diff --git a/README.md b/README.md index 60cf772..665e1f6 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,35 @@ -# PoA Launcher +# EtherCore PoA Launcher -![Kim lunch](./meme.jpg) +![Kim launch](./meme.jpg) EtherCore PoA sidechain launcher + +## Prerequisite + ++ New vitural machine with Ubuntu 18.04 installed + +Recommended spec) + +AWS `m5a.xlarge` (4 Cores 16GB Ram) for beginners + +## One-line installer + +This command will initialize the poa sidechain on your server + +## PoA launcher composition + ++ One parity node for block explorer & api service ++ Two geth PoA validator node ++ Blockscout open-source block explorer ++ eth-netstats poa network dashboard ++ eth-net-intelligence-api node stats reporting api + +## Recommendation + +If you are going to use this launcher for production, please change your wallet since the private keys are public from github! + +## TO-DO + ++ Add web wallet service ++ Add faucet service ++ Add mainnet-sidechain bridge service diff --git a/api-config/app.json b/api-config/app.json new file mode 100644 index 0000000..afa2c2e --- /dev/null +++ b/api-config/app.json @@ -0,0 +1,24 @@ +[ + { + "name" : "node-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8545", + "LISTENING_PORT" : "30303", + "INSTANCE_NAME" : "Parity PoA node", + "CONTACT_DETAILS" : "", + "WS_SERVER" : "ws://127.0.0.1:3000", + "WS_SECRET" : "poasidechain", + "VERBOSITY" : 2 + } + } +] diff --git a/api-config/app2.json b/api-config/app2.json new file mode 100644 index 0000000..85ef5c6 --- /dev/null +++ b/api-config/app2.json @@ -0,0 +1,24 @@ +[ + { + "name" : "node2-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8745", + "LISTENING_PORT" : "30503", + "INSTANCE_NAME" : "Geth PoA Validator 1", + "CONTACT_DETAILS" : "", + "WS_SERVER" : "ws://127.0.0.1:3000", + "WS_SECRET" : "poasidechain", + "VERBOSITY" : 2 + } + } +] diff --git a/api-config/app3.json b/api-config/app3.json new file mode 100644 index 0000000..108daa0 --- /dev/null +++ b/api-config/app3.json @@ -0,0 +1,24 @@ +[ + { + "name" : "node3-app", + "script" : "app.js", + "log_date_format" : "YYYY-MM-DD HH:mm Z", + "merge_logs" : false, + "watch" : false, + "max_restarts" : 10, + "exec_interpreter" : "node", + "exec_mode" : "fork_mode", + "env": + { + "NODE_ENV" : "production", + "RPC_HOST" : "localhost", + "RPC_PORT" : "8945", + "LISTENING_PORT" : "30703", + "INSTANCE_NAME" : "Geth PoA Validator 2", + "CONTACT_DETAILS" : "", + "WS_SERVER" : "ws://127.0.0.1:3000", + "WS_SECRET" : "poasidechain", + "VERBOSITY" : 2 + } + } +] diff --git a/aws.sh b/aws.sh new file mode 100644 index 0000000..cae931d --- /dev/null +++ b/aws.sh @@ -0,0 +1,2 @@ +#!/bin/sh +wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.deb && curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash - && sudo add-apt-repository -y ppa:deadsnakes/ppa && sudo apt-get install -y libpython3.7 libpython3.7-dev libpython3.7-minimal libpython3.7-stdlib python3.7 python3.7-dev python3.7-distutils python3.7-lib2to3 python3.7-minimal python3.7-venv python3.7-doc binfmt-support build-essential nodejs gcc g++ pkg-config file make cmake libgmp3-dev libtool esl-erlang elixir postgresql postgresql-contrib && curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py && sudo python3.7 get-pip.py && rm get-pip.py && sudo python3.7 -m pip install pandas pathlib web3 && sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'poasidechain';" diff --git a/dev.secret.exs b/dev.secret.exs new file mode 100644 index 0000000..d5e81cb --- /dev/null +++ b/dev.secret.exs @@ -0,0 +1,10 @@ +use Mix.Config + +# Configure your database +config :explorer, Explorer.Repo, + database: "explorer_dev", + hostname: "localhost", + username: "postgres", + password: "poasidechain", + pool_size: 20, + timeout: 80_000 diff --git a/geth.json b/geth.json new file mode 100644 index 0000000..631142f --- /dev/null +++ b/geth.json @@ -0,0 +1,32 @@ +{ + "config": { + "chainId": 2020, + "homesteadBlock": 0, + "eip150Block": 0, + "eip155Block": 0, + "eip158Block": 0, + "byzantiumBlock": 0, + "constantinopleBlock": 0, + "petersburgBlock": 0, + "istanbulBlock": 0, + "clique": { + "period": 1, + "epoch": 450000 + } + }, + "nonce": "0x0", + "timestamp": "0x5e385f2d", + "extraData": "0x000000000000000000000000000000000000000000000000000000000000000031d05c2CFd341dDc1f7FA1aebE27E21379a6120164B8d819460452f9b5c726E29720626b6D9744200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit": "0xc845880", + "difficulty": "0x1", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "coinbase": "0x0000000000000000000000000000000000000000", + "alloc": { + "0xaf6F001FdB3CD98CD38A3f6C7306706D98689dF0": { + "balance": "0x33b2e3c9fd0803ce8000000" + } + }, + "number": "0x0", + "gasUsed": "0x0", + "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000" +} diff --git a/init.sh b/init.sh new file mode 100644 index 0000000..15b4c08 --- /dev/null +++ b/init.sh @@ -0,0 +1,11 @@ +#!/bin/sh +sudo cp bin/* /usr/local/bin +sudo cp systemd/* /etc/systemd/system +geth --datadir nodes/geth init geth.json +geth --datadir nodes/geth2 init geth.json +cd eth-netstats && npm i && cd .. +cd eth-net-intelligence-api && npm i && cd .. +cp ws_secret.json eth-netstats +cp api-config/* eth-net-intelligence-api +cp dev.secret.exs blockscout/apps/explorer/config/dev.secret.exs +cd blockscout && cp apps/block_scout_web/config/dev.secret.exs.example apps/block_scout_web/config/dev.secret.exs && mix do deps.get, local.rebar --force, deps.compile, compile && mix do ecto.create, ecto.migrate && cd apps/block_scout_web/assets; npm install && node_modules/webpack/bin/webpack.js --mode production; cd - && cd apps/explorer && npm install; cd - && mix phx.digest && cd apps/block_scout_web && mix phx.gen.cert blockscout blockscout.local; cd - diff --git a/nodes/geth/geth/nodekey b/nodes/geth/geth/nodekey new file mode 100644 index 0000000..c88607d --- /dev/null +++ b/nodes/geth/geth/nodekey @@ -0,0 +1 @@ +f734ec272aef419c928fca10d971af6aa66bd916872f26a1438c6caae47d74a7 diff --git a/nodes/geth/keystore/UTC--2020-02-03T17-29-33.151872191Z--31d05c2cfd341ddc1f7fa1aebe27e21379a61201 b/nodes/geth/keystore/UTC--2020-02-03T17-29-33.151872191Z--31d05c2cfd341ddc1f7fa1aebe27e21379a61201 new file mode 100644 index 0000000..15da963 --- /dev/null +++ b/nodes/geth/keystore/UTC--2020-02-03T17-29-33.151872191Z--31d05c2cfd341ddc1f7fa1aebe27e21379a61201 @@ -0,0 +1 @@ +{"address":"31d05c2cfd341ddc1f7fa1aebe27e21379a61201","crypto":{"cipher":"aes-128-ctr","ciphertext":"7c5c0aff3d0805a7319a698a4396424d3b0dee60a28379ee7d036e6742a9c694","cipherparams":{"iv":"1debf1d326b4da6a97fcaaba102a6fa3"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"4260e27eab7a848a6496c7217ea7355ac70fdd9c62279322fff5b1bffe6c95b8"},"mac":"d301e6e76d2e0bb4b531c11353e7f02eb6870b49bfabb37cce0e92da6686a3d7"},"id":"7cff1dbe-b3b6-4fd1-905d-d4f4cbee2847","version":3} diff --git a/nodes/geth2/geth/nodekey b/nodes/geth2/geth/nodekey new file mode 100644 index 0000000..7ec5718 --- /dev/null +++ b/nodes/geth2/geth/nodekey @@ -0,0 +1 @@ +dcaffb57bcdf84d9ec9f72aaf2ceafa359dab027d451a6c69431f6879f8fd95a diff --git a/nodes/geth2/keystore/UTC--2020-02-03T17-29-42.974873457Z--64b8d819460452f9b5c726e29720626b6d974420 b/nodes/geth2/keystore/UTC--2020-02-03T17-29-42.974873457Z--64b8d819460452f9b5c726e29720626b6d974420 new file mode 100644 index 0000000..0e71119 --- /dev/null +++ b/nodes/geth2/keystore/UTC--2020-02-03T17-29-42.974873457Z--64b8d819460452f9b5c726e29720626b6d974420 @@ -0,0 +1 @@ +{"address":"64b8d819460452f9b5c726e29720626b6d974420","crypto":{"cipher":"aes-128-ctr","ciphertext":"5dd2b401e6ac540b21f3150ad9d36ec9940a6b3b8eca47d0eafbdefe4428d18b","cipherparams":{"iv":"4e0c0c080a9b5e3db3b434d7350b74fe"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"ea64e8c4ffc86fd341d2dc039343b99d0d69ce889b61832a353bf8000deeb446"},"mac":"4ac3d7541703fd68444ae5c3a4f148d3875b3d758ffedcd7f61c95ebc9653867"},"id":"b523dbb5-781b-48af-b905-91b709f65fb3","version":3} diff --git a/nodes/parity/network/key b/nodes/parity/network/key new file mode 100644 index 0000000..5607060 --- /dev/null +++ b/nodes/parity/network/key @@ -0,0 +1 @@ +9d4899cbd9686510f04507b81e4c2f9bba145df0e4fe6e4985ed7d67886e9127 diff --git a/parity.json b/parity.json new file mode 100644 index 0000000..3bbb08a --- /dev/null +++ b/parity.json @@ -0,0 +1,174 @@ +{ + "name":"PoA", + "dataDir":"poa", + "engine":{ + "clique":{ + "params":{ + "period":1, + "epoch":450000 + } + } + }, + "params":{ + "gasLimitBoundDivisor":"0x400", + "accountStartNonce":"0x0", + "maximumExtraDataSize":"0xffff", + "minGasLimit":"0x1388", + "networkID":"0x7e4", + "eip150Transition":"0x0", + "eip160Transition":"0x0", + "eip161abcTransition":"0x0", + "eip161dTransition":"0x0", + "eip155Transition":"0x0", + "maxCodeSize":"0x6000", + "maxCodeSizeTransition":"0x0", + "eip140Transition":"0x0", + "eip211Transition":"0x0", + "eip214Transition":"0x0", + "eip658Transition":"0x0", + "eip145Transition":"0x0", + "eip1014Transition":"0x0", + "eip1052Transition":"0x0", + "eip1283Transition":"0x0", + "eip1344Transition":"0x0", + "eip1706Transition":"0x0", + "eip1884Transition":"0x0", + "eip2028Transition":"0x0" + }, + "genesis":{ + "author":"0x0000000000000000000000000000000000000000", + "difficulty":"0x1", + "extraData":"0x000000000000000000000000000000000000000000000000000000000000000031d05c2CFd341dDc1f7FA1aebE27E21379a6120164B8d819460452f9b5c726E29720626b6D9744200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "gasLimit":"0xc845880", + "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", + "seal":{ + "ethereum":{ + "nonce":"0x0000000000000000", + "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000" + } + }, + "timestamp":"0x5e385f2d" + }, + "nodes":[ + "enode://d45875c480cbe72a6a17158991a1af6b1e3f643928c39302064dcd0b0d4429afd342b993064febc10b4f42a8f46bf631adedb0f353477efdffe87dc75bae013e@127.0.0.1:30303", + "enode://464101aea7a11ebc1d5013e015b459bad010c7814e98d980db375dc94f9f75096cf67eed83fc5500f1703cec292ba806978cc98e83f76007118808f5aae0b969@127.0.0.1:30503", + "enode://102ce55c5680dc2bd68a0adc6d914dc8512ac2ea2adb0b9b4f5e4200a7f67e6586d85834486e501903d22e56d21ee878a5140369b482bd459f763c5dfd4e5f9f@127.0.0.1:30703" + ], + "accounts":{ + "0x0000000000000000000000000000000000000001":{ + "builtin":{ + "name":"ecrecover", + "pricing":{ + "linear":{ + "base":3000, + "word":0 + } + } + } + }, + "0x0000000000000000000000000000000000000002":{ + "builtin":{ + "name":"sha256", + "pricing":{ + "linear":{ + "base":60, + "word":12 + } + } + } + }, + "0x0000000000000000000000000000000000000003":{ + "builtin":{ + "name":"ripemd160", + "pricing":{ + "linear":{ + "base":600, + "word":120 + } + } + } + }, + "0x0000000000000000000000000000000000000004":{ + "builtin":{ + "name":"identity", + "pricing":{ + "linear":{ + "base":15, + "word":3 + } + } + } + }, + "0x0000000000000000000000000000000000000005":{ + "builtin":{ + "name":"modexp", + "activate_at":"0x0", + "pricing":{ + "modexp":{ + "divisor":20 + } + } + } + }, + "0x0000000000000000000000000000000000000006":{ + "builtin":{ + "name":"alt_bn128_add", + "pricing":{ + "0x0":{ + "info":"EIP 1108 transition", + "price":{ + "alt_bn128_const_operations":{ + "price":150 + } + } + } + } + } + }, + "0x0000000000000000000000000000000000000007":{ + "builtin":{ + "name":"alt_bn128_mul", + "pricing":{ + "0x0":{ + "info":"EIP 1108 transition", + "price":{ + "alt_bn128_const_operations":{ + "price":6000 + } + } + } + } + } + }, + "0x0000000000000000000000000000000000000008":{ + "builtin":{ + "name":"alt_bn128_pairing", + "pricing":{ + "0x0":{ + "info":"EIP 1108 transition", + "price":{ + "alt_bn128_pairing":{ + "base":45000, + "pair":34000 + } + } + } + } + } + }, + "0x0000000000000000000000000000000000000009":{ + "builtin":{ + "name":"blake2_f", + "activate_at":"0x0", + "pricing":{ + "blake2_f":{ + "gas_per_round":1 + } + } + } + }, + "0xaf6F001FdB3CD98CD38A3f6C7306706D98689dF0":{ + "balance":"0x33b2e3c9fd0803ce8000000" + } + } +} diff --git a/password.txt b/password.txt new file mode 100644 index 0000000..db175ee --- /dev/null +++ b/password.txt @@ -0,0 +1 @@ +poasidechain diff --git a/start.sh b/start.sh new file mode 100644 index 0000000..768f312 --- /dev/null +++ b/start.sh @@ -0,0 +1,2 @@ +#!/bin/sh +sudo systemctl start parity geth geth2 netstats blockscout diff --git a/systemd/blockscout.service b/systemd/blockscout.service new file mode 100644 index 0000000..685f399 --- /dev/null +++ b/systemd/blockscout.service @@ -0,0 +1,15 @@ +[Unit] +Description=Blockscout Explorer Daemon +After=parity.target + +[Service] +Type=simple +User=ubuntu +WorkingDirectory=/home/ubuntu/poa-launcher/blockscout +ExecStart=/usr/bin/mix phx.server +KillMode=control-group +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/systemd/geth.service b/systemd/geth.service new file mode 100644 index 0000000..93e460d --- /dev/null +++ b/systemd/geth.service @@ -0,0 +1,15 @@ +[Unit] +Description=Geth Node Daemon +After=network-online.target + +[Service] +Type=simple +User=ubuntu +WorkingDirectory=/home/ubuntu +ExecStart=/usr/local/bin/geth --datadir="/home/ubuntu/poa-launcher/nodes/geth" --networkid=2020 --port=30503 --rpc --rpcport=8745 --nousb --cache=10000 --mine --miner.etherbase="0x31d05c2CFd341dDc1f7FA1aebE27E21379a61201" --miner.extradata="Geth PoA Validator 1" --txpool.pricelimit=0 --txpool.accountslots=200000 --txpool.globalslots=200000 --txpool.accountqueue=200000 --txpool.globalqueue=200000 --miner.gasprice=0 --miner.gastarget=210000000 --miner.gaslimit=210000000 --bootnodes="enode://d45875c480cbe72a6a17158991a1af6b1e3f643928c39302064dcd0b0d4429afd342b993064febc10b4f42a8f46bf631adedb0f353477efdffe87dc75bae013e@127.0.0.1:30303,enode://102ce55c5680dc2bd68a0adc6d914dc8512ac2ea2adb0b9b4f5e4200a7f67e6586d85834486e501903d22e56d21ee878a5140369b482bd459f763c5dfd4e5f9f@127.0.0.1:30703" +KillMode=process +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/systemd/geth2.service b/systemd/geth2.service new file mode 100644 index 0000000..8a83042 --- /dev/null +++ b/systemd/geth2.service @@ -0,0 +1,15 @@ +[Unit] +Description=Geth2 Node Daemon +After=network-online.target + +[Service] +Type=simple +User=ubuntu +WorkingDirectory=/home/ubuntu +ExecStart=/usr/local/bin/geth --datadir="/home/ubuntu/poa-launcher/nodes/geth2" --networkid=2020 --port=30703 --rpc --rpcport=8945 --nousb --cache=10000 --mine --miner.etherbase="0x64B8d819460452f9b5c726E29720626b6D974420" --miner.extradata="Geth PoA Validator 2" --txpool.pricelimit=0 --txpool.accountslots=200000 --txpool.globalslots=200000 --txpool.accountqueue=200000 --txpool.globalqueue=200000 --miner.gasprice=0 --miner.gastarget=210000000 --miner.gaslimit=210000000 --bootnodes="enode://d45875c480cbe72a6a17158991a1af6b1e3f643928c39302064dcd0b0d4429afd342b993064febc10b4f42a8f46bf631adedb0f353477efdffe87dc75bae013e@127.0.0.1:30303,enode://464101aea7a11ebc1d5013e015b459bad010c7814e98d980db375dc94f9f75096cf67eed83fc5500f1703cec292ba806978cc98e83f76007118808f5aae0b969@127.0.0.1:30503" +KillMode=process +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/systemd/netstats.service b/systemd/netstats.service new file mode 100644 index 0000000..780cef9 --- /dev/null +++ b/systemd/netstats.service @@ -0,0 +1,15 @@ +[Unit] +Description=Netstats +After=network-online.target + +[Service] +Type=simple +User=ubuntu +WorkingDirectory=/home/ubuntu/poa-launcher/eth-netstats +ExecStart=/usr/bin/npm start +KillMode=control-group +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/systemd/parity.service b/systemd/parity.service new file mode 100644 index 0000000..06d97ce --- /dev/null +++ b/systemd/parity.service @@ -0,0 +1,15 @@ +[Unit] +Description=Parity Node Daemon +After=network-online.target + +[Service] +Type=simple +User=ubuntu +WorkingDirectory=/home/ubuntu +ExecStart=/usr/local/bin/parity --base-path="/home/ubuntu/poa-launcher/nodes/parity" --chain="/home/ubuntu/poa-launcher/parity.json" --no-warp --tracing=on --pruning=archive --db-compaction=ssd --fat-db=on --jsonrpc-interface=all --jsonrpc-hosts=all --jsonrpc-cors=all --jsonrpc-server-threads=10 --jsonrpc-threads=10 --jsonrpc-max-payload=10000 --bootnodes="enode://464101aea7a11ebc1d5013e015b459bad010c7814e98d980db375dc94f9f75096cf67eed83fc5500f1703cec292ba806978cc98e83f76007118808f5aae0b969@127.0.0.1:30503,enode://102ce55c5680dc2bd68a0adc6d914dc8512ac2ea2adb0b9b4f5e4200a7f67e6586d85834486e501903d22e56d21ee878a5140369b482bd459f763c5dfd4e5f9f@127.0.0.1:30703" +KillMode=process +Restart=always +RestartSec=10s + +[Install] +WantedBy=multi-user.target diff --git a/ws_secret.json b/ws_secret.json new file mode 100644 index 0000000..5d57274 --- /dev/null +++ b/ws_secret.json @@ -0,0 +1 @@ +["poasidechain"]