locked
POA: Read contract data RRS feed

  • Question

  • Hi, 

    I'm running a POA ethereum blockchain and I am trying to get data from a contract. I followed this tutorial: https://docs.microsoft.com/nl-nl/azure/blockchain/templates/ethereum-poa-deployment#tutorials and I managed to write data to the contract. 

    But the tutorial does not explain how to execute the "getMsg()" function and read the message. Can anyone provide an example on how to do this?

    Thanks!

    Thursday, November 8, 2018 12:54 PM

All replies

  • Hi Lars,

    After you call the `sendRawTransaction` function, you should be able to call `getMsg()` using the following line of code:

    var response = web3.eth.contract(abi).at(contractAddress).getMsg();

    Note: You will have to wait for the transaction to be validated on the network before `getMsg()` will return what you set the message to be.


    Friday, November 9, 2018 10:22 PM
  • Like Ben mentioned, web3 will allow you to interact directly with the eth blockchain. For more information you can read more web3 doc HERE.
    Tuesday, November 13, 2018 7:43 PM