打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
go ethereum

I worked the Token tutorial. At one stage, newly minted tokens can be supplied to a target address. However, when I provide the address from a test account on a private net (eth.account[1]), I get an error:

> eth.accounts["0xf134f55797c344c5894d009d2784c0f32fd74199", "0x922d2931678e0641dc7d13cb38a2f0897252b0de"]> token2.mintToken(eth.accounts[1], 1000000)invalid address    at web3.js:3887:15    at web3.js:3713:20    at web3.js:4939:28    at web3.js:4938:12    at web3.js:4964:18    at web3.js:4989:23    at web3.js:4055:16    at web3.js:4141:16    at <anonymous>:1:1

I got the same error, when truncating the address by the prefix 0x, as I read about somewhere else.

How else do I need to format an address to provide to a contract?

Address is valid:

> var isStrictAddress = function (address) {....     return /^0x[0-9a-f]{40}$/i.test(address);.... };undefined> isStrictAddressfunction(address)> isStrictAddress(eth.accounts[0])true
 ////////////////////////////////////////////////////////////////////////////////////////////////

Try to set the default account and then execute!!!:

web3.eth.defaultAccount = web3.eth.accounts[0]

Hope this helps...!

answered Dec 8 '17 at 6:05
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
web3.js 中文文档 Web3
使用Ganache,web3js和remix在个人区块链上部署并调用合约
一老外2005年底的PKM构思(zcl转)
ubuntu修改网卡名称
无锡-web前端好入门吗?
Web前端开发的这些框架你都会吗?
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服