|
| 1 | +# Parity |
| 2 | + |
| 3 | +## Start the cryptonode |
| 4 | + |
| 5 | +```shell |
| 6 | +docker-compose up -Vd *mainnet or testnet*` |
| 7 | +``` |
| 8 | + |
| 9 | +## Usage |
| 10 | +### Check synchronization |
| 11 | +To check if the node is currently synchronizing: |
| 12 | +```shell |
| 13 | +curl --data '{"method":"eth_syncing","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 |
| 14 | +``` |
| 15 | + |
| 16 | +The response should look like the following: |
| 17 | +```json |
| 18 | +{ |
| 19 | + "id": 1, |
| 20 | + "jsonrpc": "2.0", |
| 21 | + "result": { |
| 22 | + "startingBlock": "0x384", // 900 |
| 23 | + "currentBlock": "0x386", // 902 |
| 24 | + "highestBlock": "0x454" // 1108 |
| 25 | + } // Or `false` when not syncing |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +To simply check the number of the most recent block, run: |
| 30 | +```shell |
| 31 | +curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 |
| 32 | +``` |
| 33 | + |
| 34 | +The response should look like the following: |
| 35 | +```json |
| 36 | +{ |
| 37 | + "id": 1, |
| 38 | + "jsonrpc": "2.0", |
| 39 | + "result": "0x4b7" // 1207 |
| 40 | +} |
| 41 | +``` |
| 42 | +### Create a new account |
| 43 | + |
| 44 | +To create a new account you'd only need to come up with a `passphrase` which would be later used to access account information |
| 45 | +
|
| 46 | +```shell |
| 47 | +curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["pretty_safe_passphrase"],"id":42}' localhost:8545 |
| 48 | +``` |
| 49 | +
|
| 50 | +You can check if the account is present on the node and if the passphrase you've used works: |
| 51 | +```shell |
| 52 | +curl --data '{"method":"parity_testPassword","params":["*account address*","*account_passphrase*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 |
| 53 | +``` |
| 54 | + |
| 55 | +### Account info |
| 56 | + |
| 57 | +To get all accounts present on the node: |
| 58 | + |
| 59 | +```shell |
| 60 | +curl --data '{"method":"parity_allAccountsInfo","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 |
| 61 | +``` |
| 62 | + |
| 63 | +To get account balance: |
| 64 | +```shell |
| 65 | +curl --data '{"method":"eth_getBalance","params":["*account_address*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 |
| 66 | +``` |
| 67 | + |
| 68 | +Feel free to check [Parity JSON RPC API](https://wiki.parity.io/JSONRPC) for more calls. |
0 commit comments