# Prysm Devnet with EIP4844
## Setups
**Geth**
https://github.com/MariusVanDerWijden/go-ethereum/tree/merge-kiln-v2
:warning: To be changed to a commit which supports EIP4844
**Prysm**
https://github.com/prysmaticlabs/prysm/commit/80546f83e9e15e54668e69308f9c5898db667cf1
Branch: `eip4844` (Use the latest commit)
**Building geth**
```
make geth
```
**Building Prysm**
```
go build -o /tmp/beacon ./cmd/beacon-chain
go build -o /tmp/validator ./cmd/validator
go build -o /tmp/gen ./tools/genesis-state-gen
```
## Required Files
**genesis.json**
```
{
"config": {
"chainId": 1,
"homesteadBlock": 0,
"eip150Block": 0,
"eip150Hash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"eip155Block": 0,
"eip158Block": 0,
"byzantiumBlock": 0,
"constantinopleBlock": 0,
"petersburgBlock": 0,
"istanbulBlock": 0,
"muirGlacierBlock": 0,
"berlinBlock": 0,
"londonBlock": 0,
"clique": {
"period": 5,
"epoch": 30000
},
"terminalTotalDifficulty": 10
},
"nonce": "0x42",
"timestamp": "0x0",
"extraData": "0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"gasLimit": "0x1C9C380",
"difficulty": "0x0",
"mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"alloc": {
"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b": {
"balance": "0x6d6172697573766477000000"
}
},
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"baseFeePerGas": "0x7"
}
```
Save it to /tmp/genesis.json
**sk.json**
```
45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8
```
Save it to /tmp/sk.json
**To start Geth:**
```
./build/bin/geth --http --ws -http.api "engine" --datadir "~/ethereum/taunus" init /tmp/genesis.json
./build/bin/geth --http --ws -http.api "engine" --datadir "~/ethereum/taunus" account import /tmp/sk.json
./build/bin/geth --http --ws -http.api "engine,eth,net" --datadir "~/ethereum/taunus" --allow-insecure-unlock --unlock "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b" --password "" --nodiscover console --override.terminaltotaldifficulty 9 --jwt-secret=0x98ea6e4f216f2fb4b69fff9b3a44842c38686ca685f3f55dc48c5d3fb1107be4
```
**merge.yml**
```
CONFIG_NAME: "local"
ALTAIR_FORK_EPOCH: 1
BELLATRIX_FORK_EPOCH: 2
EIP4844_FORK_EPOCH: 3
SECONDS_PER_SLOT: 12
SLOTS_PER_EPOCH: 6
TERMINAL_TOTAL_DIFFICULTY: 10
```
Save it to /tmp/merge.yml
**To start Prysm:**
Generate a genesis state
```
/tmp/gen --num-validators=256 --output-ssz=/tmp/genesis.ssz --mainnet-config
```
Start beacon node
Notes:
- `http-web3provider` and `execution-provider` flags should point to geth
- `chain-config-file` flag should point to `merge.yml`
```
/tmp/beacon --datadir /tmp/chaindata --force-clear-db --interop-genesis-state /tmp/genesis.ssz --interop-eth1data-votes --min-sync-peers=0 --http-web3provider=http://localhost:8545 --deposit-contract 0x8A04d14125D0FDCDc742F4A05C051De07232EDa4 --bootstrap-node= --chain-config-file=/tmp/merge.yml --execution-provider=http://localhost:8551
```
Start validator node
```
/tmp/validator --beacon-rpc-provider localhost:4000 --interop-num-validators=256 --interop-start-index=0 --force-clear-db --chain-config-file=/tmp/merge.yml
```
## Runtime
Once you see the following log on the beacon node (~after 12 slots):
```
[2022-02-15 09:53:39] INFO rpc/validator: Received payload hash=0x0000000000000000000000000000000000000000000000000000000000000000 number=0 parentHash=0x0000000000000000000000000000000000000000000000000000000000000000 txCount=0
```
Enter `miner.start()` in geth console
Once `ttd` is reached, we should see the following logs on the beacon node:
```
[2022-02-15 15:54:39] INFO rpc/validator: Retrieved terminal block hash hash=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b3678294aaea number=[5] parentTd=[8] td=[10] ttd=+9
[2022-02-15 15:54:39] INFO rpc/validator: Successfully called forkchoiceUpdated with attribute hash:=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b3678294aaea status:=VALID
[2022-02-15 15:54:39] INFO rpc/validator: Received payload ID hash=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b3678294aaea id=0xc0052e2a68 slot=17
[2022-02-15 15:54:39] INFO rpc/validator: Received payload hash=0xad6cd74803d6b5996f06ae57849aefbedfcb4acdbecfbd940a4cb60f1ef9ceca number=6 parentHash=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b3678294aaea txCount=0
[2022-02-15 15:54:39] INFO blockchain: Successfully called newPayload hash:=0xad6cd74803d6b5996f06ae57849aefbedfcb4acdbecfbd940a4cb60f1ef9ceca parentHash=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b36
```
After epoch 3, we should see beacon blocks proposed with EIP4844 version
```
INFO validator: Submitted new block blockRoot=0x0c482023472b fork=eip4844 graffiti= numAttestations=1 numDeposits=0 pubKey=0xa5e5e5af2ef8 slot=27
```