diff --git a/openethereum/.env b/openethereum/.env new file mode 100644 index 0000000..23f7278 --- /dev/null +++ b/openethereum/.env @@ -0,0 +1 @@ +COMPOSE_PROJECT_NAME=parity diff --git a/openethereum/Dockerfile b/openethereum/Dockerfile new file mode 100644 index 0000000..32aeaa4 --- /dev/null +++ b/openethereum/Dockerfile @@ -0,0 +1,44 @@ +FROM rust:1.47 AS builder + +ARG VERSION + +RUN apt-get update && apt-get install -y git curl wget pwgen vim htop gcc g++ cmake + +RUN git clone https://github.com/openethereum/openethereum --branch=v${VERSION} \ + && cd openethereum \ + && cargo build --features secretstore --release \ + && cp ./target/release/openethereum /openethereum + +FROM debian:buster + +ENV USER_ID ${USER_ID:-1000} +ENV GROUP_ID ${GROUP_ID:-1000} + +# Show backtraces +ENV RUST_BACKTRACE 1 + +RUN groupadd -g ${GROUP_ID} parity \ + && useradd -u ${USER_ID} -g parity -s /bin/bash -m -d /parity parity + +RUN apt-get update && apt-get -y upgrade && apt-get install -y wget ca-certificates gpg \ + && apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +COPY --from=builder /openethereum/target/release/openethereum /usr/bin + +ENV GOSU_VERSION 1.11 +RUN set -x \ + && wget -O /usr/local/bin/gosu "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture)" \ + && wget -O /usr/local/bin/gosu.asc "https://github.com/tianon/gosu/releases/download/$GOSU_VERSION/gosu-$(dpkg --print-architecture).asc" \ + && export GNUPGHOME="$(mktemp -d)" \ + && gpg --keyserver ha.pool.sks-keyservers.net --recv-keys B42F6819007F00F88E364FD4036A9C25BF357DD4 \ + && gpg --batch --verify /usr/local/bin/gosu.asc /usr/local/bin/gosu \ + && chmod +x /usr/local/bin/gosu \ + && gosu nobody true + +VOLUME ["/parity"] +EXPOSE 5001 8080 8082 8083 8545 8546 8180 30303/tcp 30303/udp + +WORKDIR /parity + +COPY scripts/docker-entrypoint.sh /usr/local/bin/ +ENTRYPOINT ["docker-entrypoint.sh"] diff --git a/openethereum/README.md b/openethereum/README.md new file mode 100644 index 0000000..e12f4e8 --- /dev/null +++ b/openethereum/README.md @@ -0,0 +1,68 @@ +# Parity + +## Start the cryptonode + +```shell +docker-compose up -Vd *mainnet or testnet*` +``` + +## Usage +### Check synchronization +To check if the node is currently synchronizing: +```shell +curl --data '{"method":"eth_syncing","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +The response should look like the following: +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": { + "startingBlock": "0x384", // 900 + "currentBlock": "0x386", // 902 + "highestBlock": "0x454" // 1108 + } // Or `false` when not syncing +} +``` + +To simply check the number of the most recent block, run: +```shell +curl --data '{"method":"eth_blockNumber","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +The response should look like the following: +```json +{ + "id": 1, + "jsonrpc": "2.0", + "result": "0x4b7" // 1207 +} +``` +### Create a new account + +To create a new account you'd only need to come up with a `passphrase` which would be later used to access account information + +```shell +curl -H "Content-Type: application/json" -X POST --data '{"jsonrpc":"2.0","method":"personal_newAccount","params":["pretty_safe_passphrase"],"id":42}' localhost:8545 +``` + +You can check if the account is present on the node and if the passphrase you've used works: +```shell +curl --data '{"method":"parity_testPassword","params":["*account address*","*account_passphrase*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +### Account info + +To get all accounts present on the node: + +```shell +curl --data '{"method":"parity_allAccountsInfo","params":[],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +To get account balance: +```shell +curl --data '{"method":"eth_getBalance","params":["*account_address*"],"id":1,"jsonrpc":"2.0"}' -H "Content-Type: application/json" -X POST localhost:8545 +``` + +Feel free to check [Parity JSON RPC API](https://wiki.parity.io/JSONRPC) for more calls. diff --git a/openethereum/VERSION b/openethereum/VERSION new file mode 100644 index 0000000..fd2a018 --- /dev/null +++ b/openethereum/VERSION @@ -0,0 +1 @@ +3.1.0 diff --git a/openethereum/checksum.sha256 b/openethereum/checksum.sha256 new file mode 100644 index 0000000..a43cc1a --- /dev/null +++ b/openethereum/checksum.sha256 @@ -0,0 +1 @@ +b5a924c625de2f18981ec5514782c6eb4c14db82a8788f7084667a9d8bcb74f6 openethereum-3.1.0.zip diff --git a/openethereum/config/classic/parity.toml b/openethereum/config/classic/parity.toml new file mode 100644 index 0000000..1819e7a --- /dev/null +++ b/openethereum/config/classic/parity.toml @@ -0,0 +1,40 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +auto_update = "critical" +release_track = "stable" +public_node = false +no_download = false +no_consensus = false +chain = "classic" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +min_peers = 100 +max_peers = 200 +discovery = true +warp = true +allow_ips = "all" +# Parity will maintain additional 128 peers for snapshot sync. +snapshot_peers = 128 +# Parity will allow up to 512 pending connections. +max_pending_peers = 512 + +[footprint] +tracing = "off" +db_compaction = "ssd" +cache_size = 4096 + +[ui] +disable = true + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "rpc", "secretstore", "parity_pubsub"] diff --git a/openethereum/config/dev/parity.toml b/openethereum/config/dev/parity.toml new file mode 100644 index 0000000..e2dcf96 --- /dev/null +++ b/openethereum/config/dev/parity.toml @@ -0,0 +1,26 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +no_persistent_txqueue = true +chain = "dev" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +allow_ips = "all" +max_pending_peers = 512 + +[rpc] +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "secretstore", "parity_pubsub"] + +[secretstore] +disable = true # users do not run a secret store node + +[network] +port = 30303 diff --git a/openethereum/config/dev/ss1.pw b/openethereum/config/dev/ss1.pw new file mode 100644 index 0000000..07995b3 --- /dev/null +++ b/openethereum/config/dev/ss1.pw @@ -0,0 +1 @@ +ss1pw diff --git a/openethereum/config/dev/ss1.toml b/openethereum/config/dev/ss1.toml new file mode 100644 index 0000000..d3f5c36 --- /dev/null +++ b/openethereum/config/dev/ss1.toml @@ -0,0 +1,38 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +no_persistent_txqueue = true +chain = "dev" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[account] +password = ["/parity/.local/share/io.parity.ethereum/ss1.pw"] + +[secretstore] +disable = false +disable_http = false # This node will expose a Secret Store HTTP API +self_secret = "94647a791a0c207fb46a5091a88991e4a5fbcc21" +http_interface = "all" # The HTTP API is available locally only +http_port = 8010 # The Secret Store HTTP API is available at this port +acl_contract = "none" # Insecure, will be changed later on +server_set_contract = "none" +nodes = [] +interface = "local" +port = 8011 # port used to communicated with other Secret Store nodes +path = "/parity/.local/share/io.parity.ethereum/secretstore" + +[network] +port = 30303 +allow_ips = "all" +max_pending_peers = 512 + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "secretstore", "parity_pubsub"] + diff --git a/openethereum/config/dev/ss2.toml b/openethereum/config/dev/ss2.toml new file mode 100644 index 0000000..d4ea8f7 --- /dev/null +++ b/openethereum/config/dev/ss2.toml @@ -0,0 +1,39 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +no_persistent_txqueue = true +chain = "dev" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +allow_ips = "all" +max_pending_peers = 512 + +[account] +password = ["/parity/.local/share/io.parity.ethereum/ss2.pw"] + +[secretstore] +disable = false +disable_http = false # This node will expose a Secret Store HTTP API +self_secret = "8b21c74c79cd94664e8f0a1d7cae2d83278b333c" +http_interface = "all" # The HTTP API is available locally only +http_port = 8010 # The Secret Store HTTP API is available at this port +acl_contract = "none" # Insecure, will be changed later on +server_set_contract = "none" +nodes = [] +interface = "local" +port = 8011 # port used to communicated with other Secret Store nodes +path = "/parity/.local/share/io.parity.ethereum/secretstore" + + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "secretstore", "parity_pubsub"] + diff --git a/openethereum/config/dev/ss3.toml b/openethereum/config/dev/ss3.toml new file mode 100644 index 0000000..1ad5844 --- /dev/null +++ b/openethereum/config/dev/ss3.toml @@ -0,0 +1,38 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +no_persistent_txqueue = true +chain = "dev" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +allow_ips = "all" +max_pending_peers = 512 + +[account] +password = ["/parity/.local/share/io.parity.ethereum/ss3.pw"] + +[secretstore] +disable = false +disable_http = false # This node will expose a Secret Store HTTP API +self_secret = "ce68e27f7b36e6e5c80d52f68c0cda6c2bcbf31d" +http_interface = "all" # The HTTP API is available locally only +http_port = 8010 # The Secret Store HTTP API is available at this port +acl_contract = "none" # Insecure, will be changed later on +server_set_contract = "none" +nodes = [] +interface = "local" +port = 8011 # port used to communicated with other Secret Store nodes +path = "/parity/.local/share/io.parity.ethereum/secretstore" + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "secretstore", "parity_pubsub"] + diff --git a/openethereum/config/kotti/parity.toml b/openethereum/config/kotti/parity.toml new file mode 100644 index 0000000..55d2ebb --- /dev/null +++ b/openethereum/config/kotti/parity.toml @@ -0,0 +1,40 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +auto_update = "critical" +release_track = "stable" +public_node = false +no_download = false +no_consensus = false +chain = "kotti" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +min_peers = 100 +max_peers = 200 +discovery = true +warp = true +allow_ips = "all" +# Parity will maintain additional 128 peers for snapshot sync. +snapshot_peers = 128 +# Parity will allow up to 512 pending connections. +max_pending_peers = 512 + +[footprint] +tracing = "off" +db_compaction = "ssd" +cache_size = 4096 + +[ui] +disable = true + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "rpc", "secretstore", "parity_pubsub"] diff --git a/openethereum/config/kovan/openethereum.toml b/openethereum/config/kovan/openethereum.toml new file mode 100644 index 0000000..e28b9b9 --- /dev/null +++ b/openethereum/config/kovan/openethereum.toml @@ -0,0 +1,41 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +auto_update = "critical" +release_track = "stable" +public_node = false +no_download = false +no_consensus = false +chain = "kovan" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +min_peers = 100 +max_peers = 200 +discovery = true +warp = true +allow_ips = "all" +# Parity will maintain additional 128 peers for snapshot sync. +snapshot_peers = 128 +# Parity will allow up to 512 pending connections. +max_pending_peers = 512 + +[footprint] +tracing = "off" +db_compaction = "ssd" +cache_size = 4096 + +[ui] +disable = true + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "rpc", "secretstore", "parity_pubsub"] + diff --git a/openethereum/config/mainnet/openethereum.toml b/openethereum/config/mainnet/openethereum.toml new file mode 100644 index 0000000..23f1bc9 --- /dev/null +++ b/openethereum/config/mainnet/openethereum.toml @@ -0,0 +1,44 @@ +[parity] +mode = "active" +mode_timeout = 300 +mode_alarm = 3600 +auto_update = "critical" +release_track = "stable" +public_node = false +no_download = false +no_consensus = false +chain = "mainnet" +base_path = "/parity/.local/share/io.parity.ethereum" +db_path = "/parity/.local/share/io.parity.ethereum/chains" +keys_path = "/parity/.local/share/io.parity.ethereum/keys" + +[network] +port = 30303 +min_peers = 100 +max_peers = 200 +discovery = true +warp = true +allow_ips = "all" +# Parity will maintain additional 128 peers for snapshot sync. +snapshot_peers = 128 +# Parity will allow up to 512 pending connections. +max_pending_peers = 512 + +[footprint] +tracing = "off" +db_compaction = "ssd" +cache_size = 4096 + +[secretstore] +disable = true # users do not run a secret store node + +[ui] +disable = true + +[rpc] +disable = false +port = 8545 +interface = "0.0.0.0" +hosts = ["*"] +apis = ["web3", "eth", "net","parity","parity_accounts","personal", "traces", "rpc", "parity_pubsub"] + diff --git a/openethereum/docker-compose.yml b/openethereum/docker-compose.yml new file mode 100644 index 0000000..9ca37f8 --- /dev/null +++ b/openethereum/docker-compose.yml @@ -0,0 +1,97 @@ +version: '3.6' + +services: + mainnet: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum --no-persistent-txqueue + ports: + - "8545:8545" + volumes: + - ./keys/mainnet:/openethereum/.local/share/io.openethereum.ethereum/keys + - ./blocks/mainnet:/openethereum/.local/share/io.openethereum.ethereum/chains + - ./config/mainnet/openethereum.toml:/openethereum/.local/share/io.openethereum.ethereum/config.toml + + kovan: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum + ports: + - "8545:8545" + volumes: + - ./keys/kovan:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/kovan:/parity/.local/share/io.parity.ethereum/chains + - ./config/kovan/openethereum.toml:/parity/.local/share/io.parity.ethereum/config.toml + + classic: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: parity + ports: + - "8545:8545" + volumes: + - ./keys/classic:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/classic:/parity/.local/share/io.parity.ethereum/chains + - ./config/classic/parity.toml:/parity/.local/share/io.parity.ethereum/config.toml + + kotti: + image: quay.io/openware/parity:3.1.0 + restart: always + user: root + command: parity + ports: + - "8545:8545" + volumes: + - ./keys/kotti:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/kotti:/parity/.local/share/io.parity.ethereum/chains + - ./config/kotti/parity.toml:/parity/.local/share/io.parity.ethereum/config.toml + + + ss1: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum + ports: + - "8545:8545" + - "8546:8546" + volumes: + - ./keys/ss1:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/ss1:/parity/.local/share/io.parity.ethereum/chains + - ./config/dev/ss1.toml:/parity/.local/share/io.parity.ethereum/config.toml + - ./config/dev/ss1.pw:/parity/.local/share/io.parity.ethereum/ss1.pw + + ss2: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum + volumes: + - ./keys/ss2:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/ss2:/parity/.local/share/io.parity.ethereum/chains + - ./config/dev/ss2.toml:/parity/.local/share/io.parity.ethereum/config.toml + - ./config/dev/ss2.pw:/parity/.local/share/io.parity.ethereum/ss2.pw + + ss3: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum + volumes: + - ./keys/ss3:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/ss3:/parity/.local/share/io.parity.ethereum/chains + - ./config/dev/ss3.toml:/parity/.local/share/io.parity.ethereum/config.toml + - ./config/dev/ss3.pw:/parity/.local/share/io.parity.ethereum/ss3.pw + + dev: + image: quay.io/openware/openethereum:3.1.0 + restart: always + user: root + command: openethereum + volumes: + - ./keys/dev:/parity/.local/share/io.parity.ethereum/keys + - ./blocks/dev:/parity/.local/share/io.parity.ethereum/chains + - ./config/dev/parity.toml:/parity/.local/share/io.parity.ethereum/config.toml diff --git a/openethereum/scripts/docker-entrypoint.sh b/openethereum/scripts/docker-entrypoint.sh new file mode 100755 index 0000000..0a9a903 --- /dev/null +++ b/openethereum/scripts/docker-entrypoint.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e +# allow the container to be started with `--user` +if [ "$(id -u)" = '0' ]; then + chown -R parity:parity /parity + exec gosu parity "$0" "$@" +fi + +exec "$@"