Skip to content

Instantly share code, notes, and snippets.

@jorpic
Last active December 13, 2017 12:51
Show Gist options
  • Save jorpic/0a157bfb924d2127f674c3ed9c59ff52 to your computer and use it in GitHub Desktop.
Save jorpic/0a157bfb924d2127f674c3ed9c59ff52 to your computer and use it in GitHub Desktop.
Run parity in docker
$ docker pull parity/parity:v1.8.4

Создаём директорию, в которой будут храниться аккаунты и блокчейн:

$ mkdir ~/parity-data

Создаём файлик с паролем от аккаунта, чтобы делать --unlock:

$ echo secret_password >> ~/parity-data/pwd

Создаём новый аккаунт (вводим тот пароль, который записали в ~/parity-data/pwd:

$ docker run \
    -it \
    -v ~/parity-data:/parity-data \
    parity/parity:v1.8.4 \
    -d /parity-data \
    account new
Please note that password is NOT RECOVERABLE.
Type password: 
Repeat password: 
0x092c9d02d2181ccfca3ecd2c466687e5758db9f8

Запускаем ноду с разлоченным аккаунтом и открытым JSON-RPC:

$ docker run \
    -d \
    --name parity \
    -p 1234:8545 -p 30303:30303 -p 30303:30303/udp \
    -v ~/parity-data:/parity-data \
    parity/parity:v1.8.4 \
    -d /parity-data \
    --no-ui --no-dapps --jsonrpc-interface all \
    --unlock 0x092c9d02d2181ccfca3ecd2c466687e5758db9f8 --password /parity-data/pwd

Дальше можно посмотреть что там в контейнере происходит:

$ docker logs parity
2017-12-13 12:27:52 UTC Starting Parity/v1.8.4-beta-c74c8c1-20171211/x86_64-linux-gnu/rustc1.22.1
2017-12-13 12:27:52 UTC Keys path /parity-data/keys/Foundation
2017-12-13 12:27:52 UTC DB path /parity-data/chains/ethereum/db/906a34e69aec8c0d
2017-12-13 12:27:52 UTC Path to dapps /parity-data/dapps
2017-12-13 12:27:52 UTC State DB configuration: fast
2017-12-13 12:27:52 UTC Operating mode: active
2017-12-13 12:27:52 UTC Configured for Foundation using Ethash engine
2017-12-13 12:27:52 UTC Updated conversion rate to Ξ1 = US$691.43 (172175950 wei/gas)
2017-12-13 12:27:57 UTC Public node URL: enode://ec741a69864309fab62aab295318b6863ee9f9fe62264506fa161f43f6712cf18cfb8207591c6812acb3440b0afd0c5209abbd5f10e7d1c860b6ca07ed661b4c@172.17.0.2:30303
2017-12-13 12:28:27 UTC    0/25 peers     39 KiB chain    4 MiB db  0 bytes queue 448 bytes sync  RPC:  0 conn,  0 req/s,   0 µs

Можно слать запросы через JSON-RPC:

$ curl localhost:1234 \
    -X POST -H "Content-Type: application/json" \
    --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x092c9d02d2181ccfca3ecd2c466687e5758db9f8"],"id":1}'
{"jsonrpc":"2.0","result":"0x0","id":1}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment