I have a smart contract which have a function to allow/disallow user to send ether to my contract. By default all ETH address are allow to send ether to smart contract.

But, if I want to disallow some ETH address not to send ether, I have to write data on to the blockchain.

The same I want to do it from my WEB APP using web3.js

Can anyone provide me with example for the same.

Thanks In Advanced .......

  • 1
    Please do not close with "unclear what you are asking" if you didn't make an effort with user to correct the question. We are all learning, and not everyone has a perfect english.
    – Ismael
    Feb 21 '18 at 2:33

Create a mapping of the user's address and their ability to pay, make the default value True to allow them to deposit Ether, do a simple comparison of if (arrayOfUsers[UsersAddress] == True){allow deposit} else{don't allow deposit}

  • Want to do it from client side using web3 ?? Feb 20 '18 at 8:57
  • You'll call it the function via the front end but the front end itself won't actually edit the variable, if the variables are on the Ethereum network it'd make sense to edit them on the Ethereum network
    – JAG
    Feb 20 '18 at 9:00
  • Yes, but I can send the variable value as a parameter and change it on ethereum network. Am I right ???? Feb 20 '18 at 9:14
  • Yes, you can. Send it in the data field when calling the function
    – JAG
    Feb 20 '18 at 9:18
  • Please can you provide me with example how to do it .... Thanks for your support Feb 20 '18 at 9:22

enter image description here

Not sure if the question is still open, if so, maybe you can make a list ^ and monitor smart contract events with Web3. Hope it helps ;)

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.