I am trying to use the function here https://docs.rs/ethkey/0.2.5/ethkey/ to write a keyfile for ethereum :
let key = EthAccount::load_or_generate("Users/Documents/Code/Thor/thor/parity/keys", "passwd")
.expect("should load or generate new eth key");
println!("{:?}", key.address());
unfortunately, it doesnt work and it get the following error:
thread 'main' panicked at 'should load or generate new eth key: Error(SerdeJsonError(Error("Is a directory (os error 21)", line: 0, column: 0)), State { next_error: None, backtrace: InternalBacktrace { backtrace: None } })', src/libcore/result.rs:999:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
Update
load_or_generate
works when i enter the ~
as the first argument but not the file path where i actually want my keys i.e Users/Documents/Code/Thor/thor/parity/keys
Update
I am now using the full path with a slash infront but still doenst work. i.e.
let key = EthAccount::load_or_generate("./Users/samueldare/Documents/Code/Thor/thor/parity/keys", "passwd")
.expect("should load or generate new eth key");
println!("{:?}", key.address());
I will apprciate pointers on this
(file_path: P, password: W) ` so it should be a file, instead of a directory?
– hellow Jul 25 '19 at 12:18