1 问题出现路径
1.1 创建智能合约
pragma solidity ^0.4.17;
contract SimpleStorageContract{
uint a;
function setVal(uint b) public{
a = b;
}
function getVal() public constant returns (uint){
return a;
}
}
1.2 使用truffle部署智能合约
var SimpleStorageContract = artifacts.require("./SimpleStorageContract.sol");
module.exports = function(deployer) {
deployer.deploy(SimpleStorageContract, {gas:460000, from:"0xaaa5110d4d02b4daad52e0d1679e4e0f36c889fc"});
};
truffle migrate --reset
1.3 创建合约对象
var abi = [];
var simpleStorage = web3.eth.contract(abi).at(adress_of_contract);
simpleStorage.setVal(1);
2 问题
Error: invalid address
3 解决办法
eth.defaultAccount=eth.coinbase;