I have a private blockchain.
I am creating a contract and then I am calling a function that returns the main account. I have the error calling this function.
This is the contract creation code:
var browser_untitled1_sol_mytokenContract = web3.eth.contract([{"constant":false,"inputs":[],"name":"GetMain","outputs":[{"name":"resultMain","type":"address"}],"payable":false,"type":"function"},{"constant":false,"inputs":[],"name":"GetBalance","outputs":[{"name":"result","type":"uint256"}],"payable":false,"type":"function"},{"inputs":[],"payable":false,"type":"constructor"}]);
var browser_untitled1_sol_mytoken = browser_untitled1_sol_mytokenContract.new(
{
from: web3.eth.accounts[0],
data: '0x6060604052341561000f57600080fd5b5b33600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506301406f406000819055505b5b6101238061006d6000396000f30060606040526000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063266b1c72146047578063f8f8a912146099575b600080fd5b3415605157600080fd5b605760bf565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341560a357600080fd5b60a960ea565b6040518082815260200191505060405180910390f35b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690505b90565b6000805490508090505b905600a165627a7a72305820d65d41c2db3b45a3505ad0645f63c88098090cacaedf6000af2c10ba2dab8c720029',
gas: '4700000'
}, function (e, contract){
console.log(e, contract);
if (typeof contract.address !== 'undefined') {
console.log('Contract mined! address: ' + contract.address + ' transactionHash: ' + contract.transactionHash);
}
})
I call the function browser_untitled1_sol_mytoken.GetMain();
to get the main address and get the error:
Error: invalid address
at web3.js:3879:15
at web3.js:3705:20
at web3.js:4948:28
at map (<native code>)
at web3.js:4947:12
at web3.js:4973:18
at web3.js:4998:23
at web3.js:4061:16
at apply (<native code>)
at web3.js:4147:16
loadScript("Contrato4.js") null [object Object] true > null [object Object] Contract mined! address: 0x28affe3b07d6448ae6dbf232ec56f070bf91d036 transactionHash: 0x96a918c45d7292b02b9fbd50d0d5ee527ff7efa7f2c87d61aa8dd179df12f19c