Skip to content

Commit

Permalink
updates to support capella and latest prysm develop
Browse files Browse the repository at this point in the history
  • Loading branch information
rauljordan committed Sep 8, 2023
1 parent a293e5c commit 46df685
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 52 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
clean:
rm -Rf ./consensus/beacondata ./consensus/validatordata ./consensus/genesis.ssz
rm -Rf ./execution/geth
8 changes: 0 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@ This sets up a single node development network with 64 deterministically-generat

1. We initialize a go-ethereum, proof-of-work development node from a genesis config
2. We initialize a Prysm beacon chain, proof-of-stake development node from a genesis config
3. We then start mining in go-ethereum proof-of-work, and concurrently run proof-of-stake using Prysm
4. Once the mining difficulty of the go-ethereum node reaches `50`, the node switches to proof-of-stake mode by letting Prysm drive the consensus of blocks

The development net is fully functional and allows for the deployment of smart contracts and all the features that also come with the Prysm consensus client such as its rich set of APIs for retrieving data from the blockchain. This development net is a great way to understand the internals of Ethereum proof-of-stake and to mess around with the different settings that make the system possible.

Expand Down Expand Up @@ -52,10 +50,6 @@ INFO [08-19|00:44:42.733] Imported new potential chain segment blocks=1 txs=
INFO [08-19|00:44:42.747] Chain head was updated number=53 hash=ee046e..e56b0c root=815538..801014 elapsed="821.084µs"
```

Once the mining difficulty of go-ethereum reaches 50, proof-of-stake will be activated and the Prysm beacon chain will be driving consensus of blocks.

<img width="1728" alt="Screen Shot 2022-08-18 at 8 22 57 PM" src="https://user-images.githubusercontent.com/5572669/185518458-25a454a8-b70a-40a8-b3e6-d32770d16ca9.png">

# Available Features

- The network launches with a [Validator Deposit Contract](https://github.com/ethereum/consensus-specs/blob/dev/solidity_deposit_contract/deposit_contract.sol) deployed at address `0x4242424242424242424242424242424242424242`. This can be used to onboard new validators into the network by depositing 32 ETH into the contract
Expand All @@ -66,9 +60,7 @@ Once the mining difficulty of go-ethereum reaches 50, proof-of-stake will be act
- The Prysm client also exposes a gRPC API at http://beacon-chain:4000

<img width="1631" alt="5" src="https://user-images.githubusercontent.com/5572669/186052294-70909835-210f-4b13-86a3-cf1f568bb8a3.png">
<img width="810" alt="4" src="https://user-images.githubusercontent.com/5572669/186052296-03c18e6f-17f2-4d94-830d-ba7522cc09c8.png">
<img width="1693" alt="3" src="https://user-images.githubusercontent.com/5572669/186052298-54b82ff2-a901-482e-9e5a-a7c265605ad6.png">
<img width="1728" alt="2" src="https://user-images.githubusercontent.com/5572669/186052300-80d9e6d5-e2b7-4e1a-9113-1593e5a5872f.png">
<img width="1426" alt="1" src="https://user-images.githubusercontent.com/5572669/186052301-dd487b50-183a-4fa6-bbec-216f32d6f03a.png">


Expand Down
6 changes: 5 additions & 1 deletion consensus/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@ BELLATRIX_FORK_EPOCH: 0
BELLATRIX_FORK_VERSION: 0x20000091
TERMINAL_TOTAL_DIFFICULTY: 0

CAPELLA_FORK_EPOCH: 2
# Capella
CAPELLA_FORK_EPOCH: 0
CAPELLA_FORK_VERSION: 0x20000092
MAX_WITHDRAWALS_PER_PAYLOAD: 16

DENEB_FORK_VERSION: 0x20000093

# Time parameters
SECONDS_PER_SLOT: 12
Expand Down
72 changes: 38 additions & 34 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ services:
#Creates a genesis state for the beacon chain using a YAML configuration file and
# a deterministic set of 64 validators.
create-beacon-chain-genesis:
image: "gcr.io/prysmaticlabs/prysm/cmd/prysmctl:latest"
image: "gcr.io/prysmaticlabs/prysm/cmd/prysmctl:local-devnet"
command:
- testnet
- generate-genesis
- --fork=bellatrix
- --fork=capella
- --num-validators=64
- --genesis-time-delay=15
- --output-ssz=/consensus/genesis.ssz
- --chain-config-file=/consensus/config.yml
- --geth-genesis-json-in=/execution/genesis.json
Expand All @@ -28,34 +29,6 @@ services:
create-beacon-chain-genesis:
condition: service_completed_successfully

# Runs the go-ethereum execution client with the specified, unlocked account and necessary
# APIs to allow for proof-of-stake consensus via Prysm.
geth:
image: "ethereum/client-go:latest"
command:
- --http
- --http.api=eth
- --http.addr=0.0.0.0
- --authrpc.vhosts=*
- --authrpc.addr=0.0.0.0
- --authrpc.jwtsecret=/execution/jwtsecret
- --datadir=/execution
- --allow-insecure-unlock
- --unlock=0x123463a4b065722e99115d6c222f267d9cabb524
- --password=/execution/geth_password.txt
- --nodiscover
- --syncmode=full
ports:
- 8551:8551
- 8545:8545
depends_on:
geth-genesis:
condition: service_completed_successfully
volumes:
- ./execution:/execution
- ./execution/geth_password.txt:/execution/geth_password.txt
- ./jwtsecret:/execution/jwtsecret

# Runs a Prysm beacon chain from a specified genesis state created in the previous step
# and connects to go-ethereum in the same network as the execution client.
# The account used in go-ethereum is set as the suggested fee recipient for transactions
Expand All @@ -68,29 +41,60 @@ services:
- --min-sync-peers=0
- --genesis-state=/consensus/genesis.ssz
- --bootstrap-node=
- --interop-eth1data-votes
# The chain configuration file used for setting up Prysm
- --chain-config-file=/consensus/config.yml
# We specify the chain id used by our execution client
- --chain-id=${CHAIN_ID:-32382}
- --rpc-host=0.0.0.0
- --contract-deployment-block=0
- --grpc-gateway-host=0.0.0.0
- --execution-endpoint=http://geth:8551
- --accept-terms-of-use
- --jwt-secret=/execution/jwtsecret
- --suggested-fee-recipient=0x123463a4b065722e99115d6c222f267d9cabb524
depends_on:
geth:
condition: service_started
create-beacon-chain-genesis:
condition: service_completed_successfully
ports:
- 4000:4000
- 3500:3500
- 8080:8080
- 6060:6060
- 9090:9090
volumes:
- ./consensus:/consensus
- ./jwtsecret:/execution/jwtsecret
- ./execution:/execution
- ./execution/jwtsecret:/execution/jwtsecret

# Runs the go-ethereum execution client with the specified, unlocked account and necessary
# APIs to allow for proof-of-stake consensus via Prysm.
geth:
image: "ethereum/client-go:latest"
command:
- --http
- --http.api=eth
- --http.addr=0.0.0.0
- --authrpc.vhosts=*
- --authrpc.addr=0.0.0.0
- --authrpc.jwtsecret=/execution/jwtsecret
- --datadir=/execution
- --allow-insecure-unlock
- --unlock=0x123463a4b065722e99115d6c222f267d9cabb524
- --password=/execution/geth_password.txt
- --nodiscover
- --syncmode=full
ports:
- 8551:8551
- 8545:8545
depends_on:
geth-genesis:
condition: service_completed_successfully
beacon-chain:
condition: service_started
volumes:
- ./execution:/execution
- ./execution/jwtsecret:/execution/jwtsecret
- ./execution/geth_password.txt:/execution/geth_password.txt

# We run a validator client with 64, deterministically-generated keys that match
# The validator keys present in the beacon chain genesis state generated a few steps above.
Expand Down
14 changes: 6 additions & 8 deletions execution/genesis.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"homesteadBlock": 0,
"daoForkSupport": true,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
Expand All @@ -16,15 +15,12 @@
"londonBlock": 0,
"arrowGlacierBlock": 0,
"grayGlacierBlock": 0,
"shanghaiTime": 1681499865,
"shanghaiTime": 1694202041,
"terminalTotalDifficulty": 0,
"clique": {
"period": 5,
"epoch": 30000
}
"terminalTotalDifficultyPassed": true
},
"nonce": "0x0",
"timestamp": "0x6439a649",
"timestamp": "0x64fb78b9",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000123463a4b065722e99115d6c222f267d9cabb5240000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x1c9c380",
"difficulty": "0x1",
Expand Down Expand Up @@ -105,5 +101,7 @@
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": null
"baseFeePerGas": null,
"excessBlobGas": null,
"blobGasUsed": null
}
1 change: 1 addition & 0 deletions execution/jwtsecret
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0xfad2709d0bb03bf0e8ba3c99bea194575d3e98863133d1af638ed056d1d59345
1 change: 0 additions & 1 deletion jwtsecret

This file was deleted.

0 comments on commit 46df685

Please sign in to comment.