我已经为我的学习设置了一个最新的单节点获取。我也在我的应用程序中使用块菌高清钱包。在我的应用程序中,我在使用‘web3.eth.getCoinbase()’时没有得到正确的coinbase帐户;geth中的相同命令给出了正确的coinbase帐户。
在我的应用程序“web3.eth.getCoinbase()”中,我重拾了松露-高清钱包创建的第一个账户。
发布于 2018-06-17 16:42:14
当你使用块菌钱包提供商,它将coinbase设置为HD钱包的第一个帐户.这就是为什么你会得到不同的结果。
您可以在这里查看代码:https://github.com/trufflesuite/truffle-hdwallet-provider/blob/master/index.js
Line 5: var HookedSubprovider = require('web3-provider-engine/subproviders/hooked-wallet.js');
Line 28: this.engine.addProvider(new HookedSubprovider({
Line 29: getAccounts: function(cb) { cb(null, tmp_accounts) },
和,https://github.com/MetaMask/provider-engine/blob/master/subproviders/hooked-wallet.js
Line 92: case 'eth_coinbase':
Line 93: // process normally
Line 94: self.getAccounts(function(err, accounts){
Line 95: if (err) return end(err)
Line 96: let result = accounts[0] || null
Line 97: end(null, result)
Line 98: })
https://ethereum.stackexchange.com/questions/51423
复制相似问题