multiversx / mx-chain-go

⚡ The official implementation of the MultiversX blockchain protocol, written in golang.

Home Page:https://multiversx.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[BUG] The node starts with an invalid validator key despite error messages

miohtama opened this issue · comments

Because validator key generation is not documented and Elrond scripts is not something I want on my computer I am trying to generate my testnet validator key with erdpy using the following.

Note that this is the blind shot, as I have no idea should this work or not, but I am trying to something to make progress as a developer.

$ erdpy wallet derive validator.pem                       

INFO:cli.wallet:Created PEM file [validator.pem] for [erd1wfxgcxpwxmes5nsn4nxqhz4vewmhwpdhdelhkrqdqdz7x5h3j60qay6phg]

$ cat validator.pem 
-----BEGIN PRIVATE KEY for erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e-----
MjU1ZjlhYjNiNmI3YzE3MWFiNjNmNTk4MmRhMTgxOTE4MDJiODlmZTMwZDAxOThm
ZTQ3YjExNDBjMTRlZTcwYTJlMTM0ZTljNmFjNjFhZTc4ZTYxNTc0NzdjYjQ3MTgx
ZDJmOWZkYzM2ZTBhMGI2NzdjNjE4MGQ3YmIwNjdjZTI=
-----END PRIVATE KEY for erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e-----%    

When starting elrond docker image with this key I get the same error repeated multiple times cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e .

The node actual starts and I need to terminate it with CTRL+C

My questions

  • Should elrond node accept PEM files validator keys generated with erdpy

My suggestions

  • If the validator key is invalid, have a better error message

  • Exit the node if it it cannot start with a proper validator key

elrond is up-to-date
Attaching to elrond
elrond    | INFO [2021-08-21 09:13:24.749]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:24.790]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:24.831]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:26.163]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:26.187]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:26.209]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:27.436]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:27.495]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:27.552]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:28.713]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:28.738]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:28.760]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:30.256]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:30.288]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:30.309]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:32.621]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:32.643]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:32.660]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 
elrond    | INFO [2021-08-21 09:13:44.105]   starting node                            version = v1.2.11-0-g6e2bf7a70/go1.15.7/linux-amd64/f9b031042e pid = 1 
elrond    | INFO [2021-08-21 09:13:44.128]   start time                               formatted = Wed Aug 18 15:00:00 UTC 2021 seconds = 1629298800 
elrond    | ERROR[2021-08-21 09:13:44.138]   cryptoComponentsFactory create failed: encoding/hex: invalid byte: U+0072 'r' for encoded public key erd19cf5a8r2ccdw0rnp2arhedr3s8f0nlwrdc9qkemuvxqd0wcx0n3q6gjd4e 

Hello miohtama!

Thank you for your feedback.
The first problem I can see is that you generated validatorKey.pem with erdpy using : erdpy wallet... command
-> this command will generate a wallet pem, not a validator one, and because of this you get that error.
-> unfortunately, for the moment erdpy is not able to generate validator keys and we strongly recommend to use keygenerator by following the steps from here

Referring to the first 2 issues that you linked, I will come as fast as I can with an answer there.
Thank you !