Accounts and authentication
The same way as other blockchains and the crypto ecosystem overall, and account (or a wallet) in the ICON Blockchain is an instrument that allows users to store, manage and transfer assets on the ICON Network.
An account consists of a private key, a public key and an address.
- Private keys on the ICON Network, just like in most other blockchain networks are a 32 bytes integer (64 characters long hexadecimal string).
- An address is generated by applying the SHA3-256 hashing algorithm to the public key and taking the last 20 bytes (40 hexadecimal characters) and adding “hx” to the beginning.
Here is an example.
- Private key => 1111111111111111111111111111111111111111111111111111111111111111
- Public key => 4f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa385b6b1b8ead809ca67454d9683fcf2ba03456d6fe2c4abe2b07f0fbdbb2f1c1
- Wallet address => hx396031be52ec56955bd7bf15eacdfa1a1c1fe19e
To showcase in more detail how this process is executed we are going to be creating private keys and generating the respective public keys and addresses using different methods like the
After creating the private keys we will be describing how to generate a signature for an RPC call and sending the RPC JSON call to a node.
The following instructions will allow you to setup the working folders depending on which method you will use, one instruction is for the case of using the
Complete the following steps to install the
To start, let's create a folder called
icon-wallet-testinside our home folder.
$ cd ~
$ mkdir icon-wallet-test
$ cd icon-wallet-test
Initialize an NPM project:
~/icon-wallet-test$ npm init -y
Wrote to /home/user/icon-wallet-test/package.json:
"test": "echo \"Error: no test specified\" && exit 1"
Create a file called
$ touch main.js
package.jsonfile and add a command to run the script.
"test": "echo \'Error: no test specified\' && exit 1",
“start”: “node main.js”
Install the required
nodejspackages to cryptographically generate the keys.
npm install --save-dev secp256k1 js-sha3 icon-sdk-js