Is it possible to interact with a deployed contract in a private blockchain with Web3 API ?
i have alreaded deployed a contract and i saved the contract adreess, but i don't find how i cant interect with this contract ?
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.Sign up to join this community
You can interact with remix. Just change your environment to 'web3 provider' and load contract from address. Now, you'll see the methods which you can access.
Also, you can build your own html application with which you can access. While doing so, I got an error. Note that my contract is deployed in ropsten network. If you want to access your contract, use the html code and instead of
web3 = new Web3(new Web3.providers.HttpProvider("https://ropsten.infura.io/"));
give (as long as you're connecting via 8545 port)
web3 = new Web3(new Web3.providers.HttpProvider("http://localhost:8545 "));
Under geth you could create a contract instance by using
contractinstance = eth.contract(abi).at(addr)
The abi is found using -
solc --abi smartcontractname.sol
Copy the abi (no quotes into a variable in geth), the address is your 20 byte address given during the deployment.
Then the functions are executable using -