1

My target: I'm new to the blockchain concept as well as Ethereum and trying to develop a web-app which allows the user to upload some data (let's say contact numbers) and also manipulate it at a later stage. The way I approached this when writing a contract is that a user deploys a contract and with this his Ethereum address is stored in the contract. Now whenever he wants he can add contact numbers to this contract through provided functions. The functions checks if the message to manipulate is coming from the contract owner and then only allows it. Also tested it on the embark simulator(RPC).

Doubt: What I don't understand is once the user had deployed his contract and added some contact numbers. Later when he wants to add more contacts numbers to the contract how will his messages go to his and only his contract i.e how to make sure that at a later point the user is making calls to his contract and not others'. I did got something about how there's contract address which points to the contract. I'm wondering if I don't even need to bother about this stuff and just make web3js calls to the contract and it will by itself make sure the calls are made to the user's contract and not others.

I searched the web for stuff on this but came up with nothing. Can someone please help me understand this part of the puzzle or at least provide links which can help?

1 Answer 1

1

I did got something about how there's contract address which points to the contract.

Yes. This is the important part. To interact with the contract you need:

  • the contract's address;
  • the contract's ABI.

When you first deploy the contract, and it's successfully mined, you'll be returned an address. Anyone who wants to interact with the contract will need this address.

I'm wondering if I don't even need to bother about this stuff and just make web3js calls to the contract and it will by itself make sure the calls are made to the user's contract and not others.

Web3 is just a Javascript library. It doesn't know where the contract is until you tell it where to look (using the address).

This tutorial is pretty easy to follow, and describes how to use the address of the deployed contract, as well as its ABI, to interact with it:

Full Stack Hello World Voting Ethereum Dapp Tutorial

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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