changed 2 years ago
Published Linked with GitHub

Capella interop, Prysm - Nethermind

Build Nethermind

git clone --recursive -b feature/shanghai-eip-4895-withdrawals https://github.com/NethermindEth/nethermind.git
cd nethermind/src/Nethermind
dotnet build Nethermind.sln -c release
export NETHERMIND=$(pwd)/Nethermind.Runner/bin/Release/net6.0

Build prysm

git clone --recursive -b capella https://github.com/prysmaticlabs/prym.git
cd prysm
bazel build //cmd/beacon-chain
bazel build //cmd/validator
export PRYSM=$(pwd)

Prepare the beacon configuration

  • Make the devnet directory
mkdir devnet
export DEVNET=$(pwd)/devnet
  • Create the beacon config
$ cat config.yml
CONFIG_NAME: interop
PRESET_BASE: interop

# Genesis
GENESIS_FORK_VERSION: 0x20000089

# Altair
ALTAIR_FORK_EPOCH: 2
ALTAIR_FORK_VERSION: 0x20000090

# Merge
BELLATRIX_FORK_EPOCH: 4
BELLATRIX_FORK_VERSION: 0x20000091
TERMINAL_TOTAL_DIFFICULTY: 16

# Capella
CAPELLA_FORK_EPOCH: 6
CAPELLA_FORK_VERSION: 0x20000092
MAX_WITHDRAWALS_PER_PAYLOAD: 4

# Time parameters
SECONDS_PER_SLOT: 6
SLOTS_PER_EPOCH: 4
  • Create nethermind's config file
$ cat nethermind.json
{
  "name": "TheMerge_Devnet",
  "engine": {
    "clique": {
      "params": {
        "period": 5,
        "epoch": 30000
      }
    }
  },
  "params": {
    "gasLimitBoundDivisor": "0x400",
    "accountStartNonce": "0x0",
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "chainID": 32382,
    "networkID": 32382,
    "eip150Transition": "0x0",
    "eip155Transition": "0x0",
    "eip158Transition": "0x0",
    "eip160Transition": "0x0",
    "eip161abcTransition": "0x0",
    "eip161dTransition": "0x0",
    "eip140Transition": "0x0",
    "eip211Transition": "0x0",
    "eip214Transition": "0x0",
    "eip658Transition": "0x0",
    "eip145Transition": "0x0",
    "eip1014Transition": "0x0",
    "eip1052Transition": "0x0",
    "eip1283Transition": "0x0",
    "eip1283DisableTransition": "0x0",
    "eip152Transition": "0x0",
    "eip1108Transition": "0x0",
    "eip1344Transition": "0x0",
    "eip1884Transition": "0x0",
    "eip2028Transition": "0x0",
    "eip2200Transition": "0x0",
    "eip2565Transition": "0x0",
    "eip2929Transition": "0x0",
    "eip2930Transition": "0x0",
    "eip1559Transition": "0x0",
    "eip3198Transition": "0x0",
    "eip3529Transition": "0x0",
    "eip3541Transition": "0x0",
    "eip4895TransitionTimestamp": "0xTIMESTAMP",
    "terminalTotalDifficulty": "0x10"
  },
  "genesis": {
    "seal": {
      "ethereum": {
        "nonce": "0x42",
        "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x1",
    "author": "0x0000000000000000000000000000000000000000",
    "timestamp": "0x0",
    "parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
    "extradata": "0x0000000000000000000000000000000000000000000000000000000000000000123463a4B065722E99115D6c222f267d9cABb5240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "gasLimit":"0x1C9C380",
    "baseFeePerGas":"0x7"
  },
  "accounts": {
    "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":
    {
      "balance":"0x6d6172697573766477000000"
    }
  }
}
  • put this keystore in nethermind's directory
$cat $NETHERMIND/keystore/key-123463a4b065722e99115d6c222f267d9cabb524
{"address":"123463a4b065722e99115d6c222f267d9cabb524","crypto":{"cipher":"aes-128-ctr","ciphertext":"93b90389b855889b9f91c89fd15b9bd2ae95b06fe8e2314009fc88859fc6fde9","cipherparams":{"iv":"9dc2eff7967505f0e6a40264d1511742"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"c07503bb1b66083c37527cd8f06f8c7c1443d4c724767f625743bd47ae6179a4"},"mac":"6d359be5d6c432d5bbb859484009a4bf1bd71b76e89420c380bd0593ce25a817"},"id":"622df904-0bb1-4236-b254-f1b8dfdff1ec","version":3}
  • create the secrets
openssl rand -hex 32 | tr -d "\n" > "$DEVNET/jwt.hex"
touch $DEVNET/keystore_password.txt
  • Put the following scripts in your devnet directory
cat nethermind.sh
#!/bin/bash
rm -rf $NETHERMIND/nethermind_db/*

$NETHERMIND/Nethermind.Runner --Init.ChainSpecPath ./nethermind.json --JsonRpc.JwtSecretFile $DEVNET/jwt.hex --Init.IsMining true --KeyStore.PasswordFiles $DEVNET/keystore_password.txt --KeyStore.UnlockAccounts 0x123463a4b065722e99115d6c222f267d9cabb524 --KeyStore.BlockAuthorAccount 0x123463a4b065722e99115d6c222f267d9cabb524 --Network.MaxActivePeers 0 --Init.GenesisHash 0x19286b9ba93edd49b64266c1df5e8303ecb3c504528b010b56f5b237aa0896c2 -c withdrawals_test
$cat beacon.sh
#!/bin/bash

GENESIS=$(($(date +%s) + 10))
SHANGHAI=$(($GENESIS + 144))
printf -v SHANGHAI_NETHERMIND "%x" "$SHANGHAI"

sed -i 's/TIMESTAMP/'$SHANGHAI_NETHERMIND'/' $DEVNET/nethermind.json

rm -rf $DEVNET/beaconchaindata
rm $DEVNET/genesis.ssz

cd $PRYSM

bazel run //cmd/prysmctl -- testnet generate-genesis --num-validators=512 --output-ssz=$DEVNET/genesis.ssz --chain-config-file=$DEVNET/config.yml --genesis-time=$GENESIS

bazel run //cmd/beacon-chain -- --datadir=$DEVNET \
	--min-sync-peers=0 \
	--interop-genesis-state=$DEVNET/genesis.ssz \
	--interop-eth1data-votes \
	--bootstrap-node= \
	--chain-config-file=$DEVNET/config.yml \
	--chain-id=32382 \
	--accept-terms-of-use \
	--jwt-secret=$DEVNET/jwt.hex \
	--suggested-fee-recipient=0x123463a4b065722e99115d6c222f267d9cabb524 \
	--verbosity debug
cat validator.sh
#!/bin/bash
rm $DEVNET/validator.db

cd $PRYSM

bazel run //cmd/validator -- --datadir=$DEVNET \
	--accept-terms-of-use \
	--interop-num-validators=512 \
	--interop-start-index=0 \
	--chain-config-file=$DEVNET/config.yml

Run the clients

In three different terminals run these commands

$DEVNET/beacon.sh
$DEVNET/validator.sh
$DEVNET/nethermind.sh

in this order

Select a repo