The best solution is use command ethkey
from XDC, the format is:
./ethkey inspect --private <KEYSTORE_FILENAME>
eg:
./ethkey inspect --private \
${HOME}/.XDC/keystore/UTC--2023-03-30T10-33-35.502212159Z--xdc292e37DF073E885EA3C173173cCE40A6A532be9f
To avoid entering a password, we can pass the password by using the --passwordfile
flag, the format is:
./ethkey inspect --private --passwordfile <PASSWORD_FILENAME> <KEYSTORE_FILENAME>
eg:
./ethkey inspect --private --passwordfile pw.txt \
${HOME}/.XDC/keystore/UTC--2023-03-30T10-33-35.502212159Z--xdc292e37DF073E885EA3C173173cCE40A6A532be9f
Here the file pw.txt
contains the password of keystore.
Discussion (2)
which program are we expected to run this command in?
If you created an account with command
XDC account new
and you need private key of this account.