Fixed Erigon README for Authentication API and jwt.hex generates in Datadir (#3757)

* added datadir jwt

* fixed readme
This commit is contained in:
Giulio rebuffo 2022-03-24 03:10:29 +01:00 committed by GitHub
parent 904674e1a1
commit f4bf94f78a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -157,6 +157,14 @@ Once the JSON-RPC daemon is running, all you need to do is point your beacon cha
where `<ip address>` is either localhost or the IP address of the device running the JSON-RPC daemon.
Erigon has been tested with Lighthouse however all other clients that support JSON-RPC should also work.
### Authentication API
In order to establish a secure connection beetwen the Consensus Layer and the Execution Layer, a JWT secret key is automatically generated.
The JWT secret key will be present in the datadir by default under the name of `jwt.hex` and its path can be specified with the flag `--authrpc.jwtsecret`.
This piece of info needs to be specified in the Consensus Layer as well in order to establish connection successfully. More information can be found [here](https://github.com/ethereum/execution-apis/blob/main/src/engine/authentication.md)
### Multiple Instances / One Machine

View File

@ -331,8 +331,8 @@ var (
JWTSecretPath = cli.StringFlag{
Name: "authrpc.jwtsecret",
Usage: "Token to ensure safe connection between CL and EL",
Value: "jwt.hex",
Usage: "Path to the token that ensures safe connection between CL and EL",
Value: "",
}
HttpCompressionFlag = cli.BoolFlag{

View File

@ -285,6 +285,10 @@ func ApplyFlagsForNodeConfig(ctx *cli.Context, cfg *node.Config) {
}
func setEmbeddedRpcDaemon(ctx *cli.Context, cfg *node.Config) {
jwtSecretPath := ctx.GlobalString(utils.JWTSecretPath.Name)
if jwtSecretPath == "" {
jwtSecretPath = cfg.DataDir + "/jwt.hex"
}
c := &httpcfg.HttpCfg{
Enabled: ctx.GlobalBool(utils.HTTPEnabledFlag.Name),
DataDir: cfg.DataDir,
@ -298,7 +302,7 @@ func setEmbeddedRpcDaemon(ctx *cli.Context, cfg *node.Config) {
HttpPort: ctx.GlobalInt(utils.HTTPPortFlag.Name),
EngineHTTPListenAddress: ctx.GlobalString(utils.EngineAddr.Name),
EnginePort: ctx.GlobalInt(utils.EnginePort.Name),
JWTSecretPath: ctx.GlobalString(utils.JWTSecretPath.Name),
JWTSecretPath: jwtSecretPath,
HttpCORSDomain: strings.Split(ctx.GlobalString(utils.HTTPCORSDomainFlag.Name), ","),
HttpVirtualHost: strings.Split(ctx.GlobalString(utils.HTTPVirtualHostsFlag.Name), ","),
API: strings.Split(ctx.GlobalString(utils.HTTPApiFlag.Name), ","),