# Kiln Interop: Prysm & Geth ## Setups **Geth** https://github.com/MariusVanDerWijden/go-ethereum/pull/39/ `d401077427294283d5bcfa1e70ff73fc7f6da0e8` **Prysm** https://github.com/prysmaticlabs/prysm/pull/10216 `68e75d58518cbd7bfce9a11530e42f0c30eb7ad7` **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":"0x0000000000000000000000000000000000000000000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b00000000000000000000000000000000000000000000000000000000000$ "gasLimit":"0x1C9C380", "difficulty":"0x0", "mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000", "coinbase":"0x0000000000000000000000000000000000000000", "alloc":{ "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b":{"balance":"0x6d6172697573766477000000"} }, "number":"0x0", "gasUsed":"0x0", "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000", "baseFeePerGas":"0x7" } ``` **sk.json** ``` 45a915e4d060149eb4365960e6a7a45f334393093061116b197e3240065ff2d8 ``` **To start Geth:** ``` ./build/bin/geth --http --ws -http.api "engine" --datadir "~/ethereum/taunus" init genesis.json ./build/bin/geth --http --ws -http.api "engine" --datadir "~/ethereum/taunus" account import 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 ``` **merge.yml** ``` CONFIG_NAME: "local" ALTAIR_FORK_EPOCH: 1 BELLATRIX_FORK_EPOCH: 2 DEPOSIT_CHAIN_ID: 1337702 SECONDS_PER_SLOT: 12 SLOTS_PER_EPOCH: 6 TERMINAL_TOTAL_DIFFICULTY: 9 ``` **To start Prysm:** Generate a genesis state ``` bazel run //tools/genesis-state-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` ``` bazel run //beacon-chain -- --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 --chain-id=1337702 --execution-provider=http://localhost:8545 ``` Start validator node ``` bazel run //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 / 144 seconds): ``` [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=0x4e7893c0b1b2aadec73e19855a399ce9102b97ce92c9c37d5ec9b3678294aaea status:=INVALID_BLOCK_HASH ``` Then we see following log on the geth `err="blockhash mismatch` along with return status `INVALID_BLOCK_HASH` when calling `NewPayloadV1` Note that I manually add the additinal log here: ```go= block, err := beacon.ExecutableDataToBlock(params) if err != nil { log.Error("Failed to convert payload to block", "err", err) return beacon.PayloadStatusV1{Status: beacon.INVALIDBLOCKHASH}, nil } ``` ``` ERROR[02-15|15:54:39.089] Failed to convert payload to block err="blockhash mismatch, want ad6cd74803d6b5996f06ae57849aefbedfcb4acdbecfbd940a4cb60f1ef9ceca, got 1e8ba4ee978468a8f113bcf49ee3a298b8f6cc149e9f3da10e003afce5c4b071" ``` Even though prysm passed in `0xad6cd...`, which matches the want