These utilities used for generating public / private keys / blockchain address and sign / verify messages.
There are the following modules in the src folder:
bip32keys
--- library for generate public / private keys and sign / verify messagesdoGenerate
--- generate public (compressed and uncompresed), wif, private keys and QTUM address. flag show does mainnet or testnet used.privateKeyToWif
- convert private key to wif formatderiveQtumAddress
- get Qtum address from public key
bip39keys
--- library for generate public / private keys and sign / verify messagesgenerateMnemonic
--- return mnemonicgenerateKeysFromMnemonic
--- return public and private keys, QTUM address, wif
pmesUtils
--- library for generate public / private keys and sign / verify messagesfromMnemonic
--- return public and private keys from mnemonicdoSign
--- sign message with private_keydoVerify
--- verify message with signature and public_keyencryptProfile
--- encrypt profile with private key using sha256decryptProfile
--- decrypt profile with private key using sha256encryptPassword
--- is part of assymetric encryption algorithm. It encrypts sha256 of private_key (hash of the private_key)decryptPassword
--- is part of assymetric encryption algorithm. It decrypts "encrypted" string using sha256 with password. When decrypt private key encrypted withencryptPassword
user receives sha256 of private_key (hash of the private_key)decryptProfileByHash
--- decrypt profile with password hash using sha256
walletInfo
--- library for generate public / private keys and sign / verify messagesgetTxHistory
--- return transaction history by addressgetBalance
--- return QTUM balance by addressgetQrcBalance
--- return QRC tokens balance by address
walletTransactions
--- library for generate public / private keys and sign / verify messagesgenerateTx
--- generate transaction to send QTUM coins from one address to anothersendRawTx
--- send transaction to the QTUM testnetgenerateSendToContractTx
--- generate transaction to send QRC tokens from one address to anothergenerateCreateContractTx
--- generate transactions for creating contracts
index.html
import all these modules.
Details about assymetric encryption algorithm is here
encryptProfile
and decryptProfile
functions was used for few cases:
-
encrypt public and private keys before storing them to the keystore file.
Keystore file should contains encrypted public and private keys.
In this case:
private_key
- is password for encrypt data to the keystore filecontent
- is the following JSON string:
{
"pub_key": "qdjdfbfjbfh",
"priv_key": "sssfsffef"
}
-
encrypt profile before writing it to the blockchain:
private_key
- is user's private keycontent
- is profile
Open terminal and run the following commands in the js_client project folder:
sudo apt install npm
npm install
sudo npm install -g webpack webpack-cli
webpack --config webpack.config.js
For running JS client make the following actions:
- open
index.html
in the browser - click on the right button
- choose "Inspect element" item
- open "Console" tab
- expand "Object" item
Then you will see the all available commands:
decryptPassword
decryptProfile
decryptProfileByHash
deriveQtumAddress
doGenerate
doSign
doVerify
encryptPassword
encryptProfile
fromMnemonic
...