Documentation; 'deposits create' can now ask for a private key

This commit is contained in:
Zahary Karadjov 2020-07-10 18:18:14 +03:00
parent d16676b294
commit 87928e0069
No known key found for this signature in database
GPG Key ID: C8936F8A3073D609
6 changed files with 42 additions and 25 deletions

View File

@ -20,6 +20,7 @@ BASE_PORT := 9000
BASE_RPC_PORT := 9190
BASE_METRICS_PORT := 8008
GOERLI_WEB3_URL := "wss://goerli.infura.io/ws/v3/6224f3c792cc443fafb64e70a98f871e"
VALIDATORS := 1
# unconditionally built by the default Make target
TOOLS := \
@ -162,8 +163,6 @@ clean-testnet0:
clean-testnet1:
rm -rf build/data/testnet1*
# - we're getting the preset from a testnet-specific .env file
# - try SCRIPT_PARAMS="--skipGoerliKey"
testnet0 testnet1: | beacon_node build deps
build/beacon_node \
--network=$@ \
@ -175,7 +174,11 @@ clean-altona:
rm -rf build/data/shared_altona*
altona-deposit: | beacon_node build deps
build/beacon_node deposits create --network=altona
build/beacon_node deposits create \
--network=altona \
--count=$(VALIDATORS) \
--ask-for-key \
--web3-url=$(GOERLI_WEB3_URL)
altona: | beacon_node build deps
build/beacon_node \

View File

@ -109,36 +109,34 @@ apt install build-essential git libpcre3-dev
### Connecting to testnets
Nimbus connects to any of the testnets published in the [eth2-clients/eth2-testnets repo](https://github.com/eth2-clients/eth2-testnets/tree/master/nimbus).
Once the [prerequisites](#prerequisites) are installed you can connect to the [Witti testnet](https://github.com/goerli/witti) with the following commands:
Once the [prerequisites](#prerequisites) are installed you can connect to the [Altona testnet](https://github.com/goerli/altona) with the following commands:
```bash
git clone https://github.com/status-im/nim-beacon-chain
cd nim-beacon-chain
make witti # This will build Nimbus and all other dependencies
# and connect you to Witti
```
Sometimes, you may want to disable the interactive prompt asking you for a Goerli key in order to become a validator:
```bash
make SCRIPT_PARAMS="--skipGoerliKey" witti # not a validator
make altona # This will build Nimbus and all other dependencies
# and connect you to Altona
```
You can also start multiple local nodes, in different terminal windows/tabs, by specifying their numeric IDs:
```bash
make SCRIPT_PARAMS="--nodeID=0" witti # the default
make SCRIPT_PARAMS="--nodeID=1" witti
make SCRIPT_PARAMS="--nodeID=2" witti
make altona NODE_ID=0 # the default
make altona NODE_ID=1
make altona NODE_ID=2
```
If you wish to make a deposit, execute the following command:
```
make altona-deposit VALIDATORS=2 # The default is just 1 deposit
```
### Getting metrics from a local testnet client
```bash
# the primitive HTTP server started to serve the metrics is considered insecure
make NIMFLAGS="-d:insecure" witti
make NIMFLAGS="-d:insecure" altona
```
You can now see the raw metrics on http://127.0.0.1:8008/metrics but they're not very useful like this, so let's feed them to a Prometheus instance:
@ -216,7 +214,7 @@ make eth2_network_simulation WAIT_GENESIS=yes
You can also separate the output from each beacon node in its own panel, using [multitail](http://www.vanheusden.com/multitail/):
```bash
make USE_MULTITAIL="yes" eth2_network_simulation
make eth2_network_simulation USE_MULTITAIL="yes"
```
You can find out more about it in the [development update](https://our.status.im/nimbus-development-update-2018-12-2/).
@ -435,4 +433,4 @@ or
* Apache License, Version 2.0, ([LICENSE-APACHEv2](LICENSE-APACHEv2) or http://www.apache.org/licenses/LICENSE-2.0)
at your option. These files may not be copied, modified, or distributed except according to those terms.
at your option. These files may not be copied, modified, or distributed except according to those terms.

View File

@ -1331,6 +1331,19 @@ programMain:
of deposits:
case config.depositsCmd
of DepositsCmd.create:
if config.askForKey and config.depositPrivateKey.len == 0:
let
depositsWord = if config.totalDeposits > 1: "deposits"
else: "deposit"
totalEthNeeded = 32 * config.totalDeposits
echo "Please enter your Goerli Eth1 private key in hex form " &
"(e.g. 0x1a2...f3c) in order to make your $1 (you'll need " &
"access to $2 GoETH)" % [depositsWord, $totalEthNeeded]
if not readPasswordFromStdin("> ", TaintedString config.depositPrivateKey):
error "Failed to read an Eth1 private key from standard input"
createDir(config.outValidatorsDir)
createDir(config.outSecretsDir)

View File

@ -308,6 +308,11 @@ type
desc: "Output folder for randomly generated keystore passphrases"
name: "out-secrets-dir" }: string
askForKey* {.
defaultValue: false
desc: "Ask for an Eth1 private key used to fund the deposits"
name: "ask-for-key" }: bool
dontSend* {.
defaultValue: false,
desc: "By default, all created deposits are also immediately sent " &

View File

@ -182,7 +182,6 @@ proc sendDeposits*(deposits: seq[Deposit],
let depositContract = web3.contractSender(DepositContract,
Address depositContractAddress)
for i, dp in deposits:
let status = await depositContract.deposit(
Bytes48(dp.data.pubKey.toRaw()),

View File

@ -9,14 +9,13 @@ cd "$(dirname "${BASH_SOURCE[0]}")/../.."
[[ -z "$1" ]] && { echo "Usage: $(basename $0) YOUR_ETH1_PRIVATE_GOERLI_KEY"; exit 1; }
# TODO: make "witti" a parameter
echo -ne "About to delete \"build/data/shared_witti_0\".\nMake a backup, if you need to, then press Enter. >"
read TMP
make clean-witti
make clean-altona
make beacon_node
for N in $(seq 6 9); do
make SCRIPT_PARAMS="--becomeValidatorOnly --privateGoerliKey=$1" witti && \
build/beacon_node deposits create --deposit-private-key=$1 --dont-send && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo rm -rf /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_witti_0/secrets" && \
ssh node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net "sudo rm -rf /docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_witti_0/validators" && \
rsync -a -zz --rsync-path="sudo rsync" build/data/shared_witti_0/{secrets,validators} node-0${N}.aws-eu-central-1a.nimbus.test.statusim.net:/docker/beacon-node-testnet2-1/data/nim-beacon-chain/build/data/shared_witti_0/ && \