Skip to content

Commit

Permalink
Enable rpc on reth and determinsitic p2p key
Browse files Browse the repository at this point in the history
  • Loading branch information
ferranbt committed Oct 25, 2024
1 parent 6cc59a8 commit 65e5c94
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
Expand Down
17 changes: 17 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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").
Expand All @@ -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()
Expand Down

0 comments on commit 65e5c94

Please sign in to comment.