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
> isStrictAddress
function(address)
> isStrictAddress(eth.accounts[0])
true