2

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 ?

2

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 "));

Ropsten network - 405 Method Not Allowed on eth_sendTransaction

2

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 -

contractinstance.functionname(..)

Not the answer you're looking for? Browse other questions tagged or ask your own question.