You need address and ABI to invoke a contract. Before invoking a contract you need to deploy it. You have only got the abi definition. You need to deploy the contract by letting it be mined and get the address. Use,
var simpleStorage = StoreContract.new(your_parameters ,{from:web3.eth.accounts[0], data: compiled_code , gas: gas_amount}, call_back_function)
Once the contract is mined, it will return something like this,
Contract mined! address: contract_address
where you can find the contract address at contract_address
Refer the basic greeter example provided in the Ethereum web site for a detailed explanation on beginning with smart contracts.
UPDATE-1:
If you carefully read the blog post you referred, it's clearly given that you need to send a transaction for the contract to be deployed.(it has some nice diagrams too)
This is the code snippet from the blog post,
abiDefinition = JSON.parse(compiledCode.contracts[':Voting'].interface)
VotingContract = web3.eth.contract(abiDefinition)
byteCode = compiledCode.contracts[':Voting'].bytecode
// the following line is what you need to do get the address
deployedContract = VotingContract.new(['Rama','Nick','Jose'],{data: byteCode, from:
web3.eth.accounts[0], gas: 4700000})
deployedContract.address
contractInstance = VotingContract.at(deployedContract.address)
and from what you posted,
var Web3 = require('web3');
var web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545"));
abi = JSON.parse(....) //==> I got abi following this tutorial(https://medium.com/@mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2)
//at this point you need to send the transaction using "StoredContract.new(params,transaction details, callback[optional]);"
StoreContract = web3.eth.contract(abi);
contractInstance = VotingContract.at('CONTRACT ADDRESS');
You don't need a address to deploy a contract, you just need to send a transaction with the contract details. Once the contract is deployed(after the transaction is mined) it will output the address which you can use to call the particular instance.
UPDATE-2:
You may deploy many instance of the same contract by sending transactions and they are stored at different addresses. You can use a particular instance using the respective address (eg: to call a function like setter in your case). Refer the following answer posted here.
Just like code can be in source form, or converted/compiled to
executable form, the same thing applies to contracts.
From source code, many copies of the executable form can be generated.
In source code form, a contract in Solidity is like a class in OOP
terms: it can be instantiated many times, and can be inherited from.
Making a contract executable, usually involves 2 steps:
converting the source to Ethereum Virtual Machine (EVM) bytecode
deploying the EVM to an Ethereum blockchain The same contract source
code or EVM can be deployed to a blockchain many times. Each instance
of a deployed contract has a unique address.
contractInstance = VotingContract.at('CONTRACT ADDRESS');it should beStoreContractnotVotingContract– Achala Dissanayake Sep 15 '17 at 18:39