Answer the question
In order to leave comments, you need to log in
How can I get the value of a variable based on smart contract abi (Etherium VM) and web3.js?
I am using web3.js and trying to get the value of a variable from a smart contract.
My code for this is: var contract = web3.eth.contract(abi).at(address);
where abi is a json array and address is the actual normal and working address where the smart contract is located.
The abi json part of the object is here:
{
"constant": true,
"inputs": [],
"name": "weiRaised",
"outputs": [
{
"name": "",
"type": "uint256"
}
],
"payable": false ,
"type": "function"
},
console.log(contract.abi[0].abi[6].name);
console.log(contract.abi[0].abi[6].inputs);
Answer the question
In order to leave comments, you need to log in
I didn’t deal with ether in any way, but here’s what the console returns using simple examples
var inp = [];
undefined
inp[0]
undefined
var inp = [0]
undefined
inp[0]
0
var inp = [99]
undefined
inp[0]
99
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question