ethermint
ethermint copied to clipboard
personal_newAccount failed in "file" keyring-backend mode
System info: [Include Ethermint commit, operating system name, and other relevant details] latest main branch Steps to reproduce:
- [First Step] edit init.sh and set KEYRING="file" , instead of "test" sh init.sh
- [Second Step] call personal_newAccount json-rpc api.
- [and so on...]
Expected behavior: [What you expected to happen]
the same behavior as https://docs.evmos.org/developers/json-rpc/endpoints.html#personal-newaccount described
Actual behavior: [What actually happened]
first time , no response and tcp disconnected again, stuck in sending request
Additional info: [Include gist of relevant config, logs, etc.]
the similiar problem in personal_xxx json-rpc apis. like personal_importRawKey but it's ok in cli command like "ethermintd account add xxx" i suppose it's caused by the keyring passphrase .it seems theres no way to input keyring passphrase from JSON-RPC but the os.stdin.
see codes below
func newFileBackendKeyringConfig(name, dir string, buf io.Reader) keyring.Config {
fileDir := filepath.Join(dir, keyringFileDirName)
return keyring.Config{
AllowedBackends: []keyring.BackendType{keyring.FileBackend},
ServiceName: name,
FileDir: fileDir,
FilePasswordFunc: newRealPrompt(fileDir, buf),
}
func newRealPrompt(dir string, buf io.Reader) func(string) (string, error) {
...
pass, err := input.GetPassword("Enter keyring passphrase:", buf)
...
}
input.GetPassword in function newRealPrompt(fileDir, buf) will fail as called from RPC.