I am trying to add msg.value and msg.sender into an array using web3 for every client that invokes my contract. I would like this information to be stored on the contract for as long as possible, if possible.

If a new client invokes this method, they are added to the array, and so on.

I then want to be able to retrieve those values (msg.value, msg.sender) from the array via web3 at a later point in time.

It would be great to see the contract code, and the web3 code if possible.

1 Answer 1


Set and retrieve to/from array: http://solidity.readthedocs.org/en/latest/types.html#arrays

To retrieve array values through web3, write a function in the contract that returns the values (see above example) and then call it with: https://github.com/ethereum/wiki/wiki/JavaScript-API#web3ethcall

  • Answers should be clear and useful even if all the links are broken. please include a summary of each source or a code snippet Feb 11, 2016 at 14:37

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.