etherenum|区块链轻钱包nodejs生成本地keystore

以下函数接受用户输入密码和传入keystore的存储路径,返回私钥

var fs = require("fs"); var keythereum = require("keythereum"); function CreateAccount(passwd, path){ var params = { keyBytes: 32, ivBytes: 16 }; var dk = keythereum.create(params); var options = { kdf: "pbkdf2", cipher: "aes-128-ctr", kdfparams: { c: 262144, dklen: 32, prf: "hmac-sha256" } }; var keyObject = keythereum.dump(passwd, dk.privateKey, dk.salt, dk.iv, options); keythereum.exportToFile(keyObject, path); return dk.privateKey.toString("hex");

关注问我技术公众号,加小问,拉您入技术交流群:
【etherenum|区块链轻钱包nodejs生成本地keystore】etherenum|区块链轻钱包nodejs生成本地keystore
文章图片

    推荐阅读