nodejs使用keystore拿到privatekey私钥
更多区块链技术与应用分类:
keythereum库使用代码示例
const keythereum = require("keythereum");
const contractHolder = '0xe578252579e5f43fe124fe1d8236f0e5250c1197';// 0x60073b2544ce438ec1d9b93d976bd1f669455242
const account1 = '0xf63b266531af6dd9ce24afd21194c848a43461d2';
const account2 = '0x7f267c3d9ab9ba50d7da18b9e49e9f37d1864ccc';
var keystoreDatadir = "C:\CodeProject\lottery_project\lottery-eth";
var keyObject = keythereum.importFromFile(contractHolder, keystoreDatadir);
const contractHolderPrvkey = '0x' + keythereum.recover('mg123456', keyObject).toString('hex');
const account1prvkey = '0x' + keythereum.recover('mg123456', keyObject).toString('hex');
const account2prvkey = '0x' + keythereum.recover('mg123456', keyObject).toString('hex');