【问题标题】:web3.js encrypt and decrypt keystore v3 standardweb3.js 加密和解密 keystore v3 标准
【发布时间】:2018-05-18 08:46:32
【问题描述】:

我正在使用 web3 的 javascript 版本并想从 Web3 Secret Storage Definition 文件(旧 wiki:Passphrase protected key store spec )导入私钥。根据the docs有一个解密和加密功能:

keystoreJsonV3 = web3.eth.accounts.encrypt(privateKey, password);
privateKey = web3.eth.accounts.decrypt(keystoreJsonV3, password);

但我收到“未捕获的类型错误:web3.eth.accounts.decrypt 不是函数”。怎么了?是文档错误还是我的 web3.js 版本错误或类似的东西?如何加密/解密密钥库文件。

我从这个来源构建了我的 web3.js 文件

git clone -b develop  https://github.com/ethereum/web3.js.git

【问题讨论】:

    标签: javascript ethereum web3js


    【解决方案1】:

    这些功能还没有实现。您所涉及的功能大多在 web3 的 1.0.0 版本中描述,该版本尚未发布。

    现在,web3.eth.accounts 只是检索从您机器上运行的 testrpc/ganache-cli/geth 实例加载的可用帐户数组。

    【讨论】:

    • 尝试在您的 package.json 中添加 web3,指定您想要的版本:在 package.json 中:"web3":"^1.0.0-beta.26" 然后执行npm install 这可能会起作用
    猜你喜欢
    • 1970-01-01
    • 2019-01-02
    • 2021-08-17
    • 1970-01-01
    • 1970-01-01
    • 2016-07-19
    • 2014-03-27
    • 2019-03-04
    • 2011-09-12
    相关资源
    最近更新 更多