# Joining Verkle devnet using Besu WIP Currently, there is no official repository available for use. Until further notice, this branch can be utilized to access the latest updates for syncing with Verkle devnet-4: https://github.com/gfukushima/besu/tree/fork/verkle Verkle introduces a significant change in how state is stored in the execution layer, adding a new `VERKLE` option to the CLI flag `--data-storage-format`. Besu has incorporated the genesis of the testnet under the previous name of the Verkle devnets, `kaustinen`. Should there be a delay in updating to the latest version, you can manually override it using the `--genesis-file` flag. The genesis file and additional useful information/tools can be found at: https://verkle-gen-devnet-4.ethpandaops.io/ All Verkle devnets are Proof of Stake (PoS) from the genesis block, necessitating a consensus layer (CL) as well. We have successfully tested with Lodestar and Lighthouse, following these tutorials: [Lodestar](https://github.com/ChainSafe/lodestar-quickstart) / [Lighthouse](https://hackmd.io/gZP7Yti0Tna3lgZEgammhQ?view#%F0%9F%94%B5-Consensus-Client-Lighthouse). Note that the `--testnet-dir` flag in the command below points to a folder in this repository: https://github.com/ethpandaops/verkle-devnets/ which you will need to clone as well. In this example, I chose Lighthouse. After following the instructions in the link, cloning Lighthouse, and compiling, my final command to run Lighthouse looks like this: ``` ~/.cargo/bin/lighthouse beacon_node \ --datadir /Users/youruser/dbs/lighthouse/kaustinen/ \ --testnet-dir /Users/youruser/verkle-devnets/network-configs/gen-devnet-4/ \ --boot-nodes "enr:-Iq4QECFXCogKf4EQkygLrvBWuLRuTo4bOCvmw2vDCafpyLRMAP4xwCzR66Kk1k6pT7kaT518AueRV05psXor_2lNGuGAY192AD8gmlkgnY0gmlwhMPJJD6Jc2VjcDI1NmsxoQJJ3h8aUO3GJHv-bdvHtsQZ2OEisutelYfGjXO4lSg8BYN1ZHCCIyk" \ --execution-endpoint "http://localhost:8551" \ --jwt-secrets "/Users/youruser/configs/jwt.hex" ``` Once the CL is up and running, you're ready to run Besu. From the source directory, you can execute: `./gradlew installDist` This command generates the Besu binary in the `build/install/besu/bin` directory. Navigate to that directory and run: `./besu --config-file=/Users/youruser/configs/configs/kaustinen.toml` The kaustinen.toml configuration file looks like this: ***kaustinen.toml*** ``` # data data-path="/Users/youruser/dbs/kaustinen" data-storage-format="VERKLE" sync-mode="FULL" network="kaustinen" discovery-enabled=false # JWT # authentication is enabled by default when engine-jwt-disabled=false engine-jwt-disabled=true engine-jwt-secret="/Users/youruser/besu/jwt-secret.hex" engine-rpc-enabled=true engine-rpc-port=8551 engine-host-allowlist=["*"] logging="info" min-gas-price=1000 host-whitelist=["*"] # rpc rpc-http-enabled=true rpc-http-host="0.0.0.0" rpc-http-port=8545 rpc-http-api=["TRACE","ADMIN","DEBUG","NET","ETH","WEB3","TXPOOL"] rpc-http-cors-origins=["all"] # metrics metrics-enabled=true metrics-host="0.0.0.0" metrics-port=9545 ``` You should see some logs like these: ``` ...loads of start up logs plus we print the key/values of genesis we insert into the verkle tree genesis hash 0x8493ed97fd4314acb6ed519867b086dc698e25df37ebe8f2bc77313537710744 2024-03-06 14:17:53.438+10:00 | main | INFO | Runner | Starting external services ... 2024-03-06 14:17:53.438+10:00 | main | INFO | MetricsHttpService | ... loads of services start logs ... 2024-03-06 14:17:53.489+10:00 | main | INFO | NetworkRunner | Supported capabilities: [eth/62, eth/63, eth/64, eth/65, eth/66, eth/67, eth/68], [snap/1] 2024-03-06 14:17:53.489+10:00 | main | INFO | DefaultSynchronizer | Starting synchronizer. 2024-03-06 14:17:53.490+10:00 | main | INFO | TransactionPoolFactory | Enabling transaction handling following initial sync 2024-03-06 14:17:53.490+10:00 | main | INFO | DefaultSynchronizer | Stopping block propagation. 2024-03-06 14:17:53.491+10:00 | main | INFO | DefaultSynchronizer | Stopping the pruner. 2024-03-06 14:17:53.491+10:00 | main | INFO | Runner | Ethereum main loop is up. 2024-03-06 14:18:02.029+10:00 | vert.x-worker-thread-0 | INFO | BackwardSyncContext | Starting a new backward sync session ``` At this stage besu needs peers to download the block headers and blocks You can run this curl command to manually add a peer to besu: ``` curl --location 'http://127.0.0.1:8545' \ --header 'Content-Type: application/json' \ --data-raw '{ "jsonrpc": "2.0", "method": "admin_addPeer", "params": [ "enode://0f08a9f7087b7a71fd818679d7d847e68c1566f8838e1be6c6baa2203f33365cd3d0152dc97618c2de1fb05a8cae9b01fb28334c31caa48e7fa6a8c7d74df14c@195.201.36.62:30303?discport=30303" ], "id": 1 }' ``` After adding a peer you should see Backwards sync starting to download the block headers: ``` 2024-03-06 14:56:49.533+10:00 | nioEventLoopGroup-3-1 | INFO | BackwardSyncStep | Backward sync phase 1 of 2, 1.52% completed, downloaded 2034 headers of at least 133695. Peers: 1 2024-03-06 14:56:59.822+10:00 | nioEventLoopGroup-3-1 | INFO | BackwardSyncStep | Backward sync phase 1 of 2, 6.75% completed, downloaded 9059 headers of at least 134120. Peers: 1 ``` Phase 1 is only the block headers and phase 2 is where blocks are downloaded and executed. Expect to see blocks being executed and lgos like this coming up: ``` 2024-03-06 15:00:23.692+10:00 | nioEventLoopGroup-3-1 | INFO | BackwardSyncStep | Backward sync phase 1 of 2, 99.26% completed, downloaded 142179 headers of at least 143240. Peers: 1 2024-03-06 15:00:25.659+10:00 | nioEventLoopGroup-3-1 | INFO | BackwardSyncStep | Backward sync phase 1 of 2 completed, downloaded a total of 143345 headers. Peers: 1 2024-03-06 15:00:26.270+10:00 | nioEventLoopGroup-3-1 | INFO | DiffBasedWorldState | Persist world state for block Optional[BlockHeader{hash=0x7075b1f6516e064b36842610ddfe77eec27d1cb0b0c513fb43c2039c80fff796, parentHash=0x8493ed97fd4314acb6ed519867b086dc698e25df37ebe8f2bc77313537710744, ommersHash=0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347, coinbase=0xf97e180c050e5ab072211ad2c213eb5aee4df134, stateRoot=0x5492e10becd82299146790c27bf5c0e5311120f9528b9a9b4c1113d923880ef6, transactionsRoot=0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421, receiptsRoot=0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421, logsBloom=0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000, difficulty=0x0000000000000000000000000000000000000000000000000000000000000000, number=1, gasLimit=25024413, gasUsed=0, timestamp=1707215412, extraData=0xd983010c01846765746889676f312e32302e3133856c696e7578, baseFee=0x00000000000000000000000000000000000000000000000000000000342770c0, mixHashOrPrevRandao=0x8493ed97fd4314acb6ed519867b086dc698e25df37ebe8f2bc77313537710744, nonce=0, withdrawalsRoot=0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421, }] add storage 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7640 0x8493ed97fd4314acb6ed519867b086dc698e25df37ebe8f2bc77313537710744 account 0xfffffffffffffffffffffffffffffffffffffffe 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7600 add 0xfffffffffffffffffffffffffffffffffffffffe 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7600 0x0000000000000000000000000000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000000000000000000000000000 add 0xfffffffffffffffffffffffffffffffffffffffe 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7601 0x0000000000000000000000000000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000000000000000000000000000 add 0xfffffffffffffffffffffffffffffffffffffffe 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7602 0x0000000000000000000000000000000000000000000000000000000000000000 0x0000000000000000000000000000000000000000000000000000000000000000 add 0xfffffffffffffffffffffffffffffffffffffffe 0x97f2911f5efe08b74c28727d004e36d260225e73525fe2a300c8f58c7ffd7603 0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470 0x0000000000000000000000000000000000000000000000000000000000000000 2024-03-06 15:00:26.275+10:00 | nioEventLoopGroup-3-1 | INFO | VerkleWorldState | start commit 2024-03-06 15:00:26.602+10:00 | nioEventLoopGroup-3-1 | INFO | VerkleWorldState | end commit 2024-03-06 15:00:26.602+10:00 | nioEventLoopGroup-3-1 | INFO | VerkleWorldState | end commit 0x5492e10becd82299146790c27bf5c0e5311120f9528b9a9b4c1113d923880ef6 ``` The lines with `add` and `account` are all logs we've added in the trie.