Ethereum 带web3的以太坊geth:未定义privateToAccount

Ethereum 带web3的以太坊geth:未定义privateToAccount,ethereum,Ethereum,根据web3的文档: 我可以使用: web3.eth.accounts.privateToAccount("0x78..."); 我有一个错误: TypeError: 'privateToAccount' is not a function at <anonymous>:1:1 我的问题:为什么没有定义函数“privateToAccount” 另外,web3.eth.accounts的结果是私钥还是公钥?好的,我刚刚遇到了同样的问题,并且能够重现这个问题 经过一番挖掘之后

根据web3的文档: 我可以使用:

web3.eth.accounts.privateToAccount("0x78...");
我有一个错误:

TypeError: 'privateToAccount' is not a function
    at <anonymous>:1:1
我的问题:为什么没有定义函数“privateToAccount”


另外,web3.eth.accounts的结果是私钥还是公钥?

好的,我刚刚遇到了同样的问题,并且能够重现这个问题

经过一番挖掘之后,我注意到链接的文档是针对
1.0版的,这是一个未发布的未来版本,并且

检查您的
web3.version

> web3.version
{ api: '0.18.4',
  node: [Getter],
  getNode: { [Function: get] request: [Function: bound ] },
  network: [Getter],
  getNetwork: { [Function: get] request: [Function: bound ] },
  ethereum: [Getter],
  getEthereum: { [Function: get] request: [Function: bound ] },
  whisper: [Getter],
  getWhisper: { [Function: get] request: [Function: bound ] } }
您可能会得到不支持任何
eth.accounts
子功能的
0.18.x

> web3.eth.accounts
web3.eth.accounts 
> web3.eth.accounts
web3.eth.accounts