3

My friend and I are using geth and have the same private blockchain. He has deployed a contract and is able to invoke its functions after mining it.

Is it possible for me to call his contract functions without having to deploy the contract by myself?

Also what is the significance of mining for deploying a contract?

2

Mining the contract deployment transactions puts contract code and initial data in blockchain. After this is done the contract available to all Ethereum nodes.

When the deployment transaction is done, you can access the contract by its address.

Sharing the contract address and ABI definitions to your friends allows them to query and transact with the contract.

1

After the deployment, a contract goes to the blockchain. As you and your friend are sharing same network, the data inside the blockchain will also be replicated at you end. So yes, you can also access the functions of that contract.

You can access the contract functions in the same way your friend does (by creating the instance as:- var obj = web3.eth.contract(ContractAbi).at(contractAddress))

Mining is used to validate and include a transaction in the block. Once the block is confirmed, transaction will be validated and replicated by all nodes. For more on mining : http://ethdocs.org/en/latest/mining.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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