From 65e5c94ac635a6dd689cabc910516465e65778ce Mon Sep 17 00:00:00 2001 From: Ferran Borreguero Date: Fri, 25 Oct 2024 22:46:12 +0100 Subject: [PATCH] Enable rpc on reth and determinsitic p2p key --- README.md | 6 ++++++ main.go | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 9745d90..b6e9208 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,12 @@ The playground performs the following steps: To stop the playground, press `Ctrl+C`. +The `EL` instance is deployed with this deterministic enode address: + +``` +enode://3479db4d9217fb5d7a8ed4d61ac36e120b05d36c2eefb795dc42ff2e971f251a2315f5649ea1833271e020b9adc98d5db9973c7ed92d6b2f1f2223088c3d852f@127.0.0.1:8545 +``` + Options: - `--output` (string): The directory where the chain data and artifacts are stored. It defaults to `$HOME/.playground/devnet`. diff --git a/main.go b/main.go index 6bf4fd5..9eaa7f4 100644 --- a/main.go +++ b/main.go @@ -46,6 +46,11 @@ var clConfigContent []byte var defaultJWTToken = "04592280e1778419b7aa954d43871cb2cfb2ebda754fb735e8adeb293a88f9bf" +var ( + defaultRethDiscoveryPrivKey = "a11ac89899cd86e36b6fb881ec1255b8a92a688790b7d950f8b7d8dd626671fb" + defaultRethDiscoveryPrivKeyLoc = "/tmp/tmp-reth-disc.txt" +) + var outputFlag string var continueFlag bool var useBinPathFlag bool @@ -357,6 +362,10 @@ func setupServices(svcManager *serviceManager, out *output) error { } fmt.Println("") + if err := os.WriteFile(defaultRethDiscoveryPrivKeyLoc, []byte(defaultRethDiscoveryPrivKey), 0644); err != nil { + return err + } + // start the reth el client svcManager. NewService("reth"). @@ -366,11 +375,19 @@ func setupServices(svcManager *serviceManager, out *output) error { "--chain", "{{.Dir}}/genesis.json", "--datadir", "{{.Dir}}/data_reth", "--color", "never", + // p2p config. Use a default discovery key and disable public discovery and connections + "--p2p-secret-key", defaultRethDiscoveryPrivKeyLoc, + "--addr", "127.0.0.1", + "--port", "30303", + "--disable-discovery", + // http config "--http", + "--http.api", "admin,eth,net,web3", "--http.port", "8545", "--authrpc.port", "8551", "--authrpc.jwtsecret", "{{.Dir}}/jwtsecret", ). + WithPort("rpc", 30303). WithPort("http", 8545). WithPort("authrpc", 8551). Run()