Ethereum SHA256 return

pedrocsc21pedrocsc21 Member Posts: 5
I am a newbie to Ethereum please all bear with me: When we send something through the block chain the message or transaction is translated via SHA256. Lets say a contract is created and I want to see all and any transactions from my contract that processed through the block chain, is it possible to see all of this data without it returning in the SHA256 format? Can anyone provide feedback on how this can be accomplished?

Comments

  • CryptoFutureCryptoFuture Member Posts: 44
    Not too sure about this but you can put the contract address in at http://etherapps.info and see all the transactions if that helps.
  • SmithgiftSmithgift Member Posts: 64
    You might look into events, which be what you're looking for.

    Here's a few snippets from code I'm working on as an example:

    I define an event in Solidity like this:

    event challengeMade(uint indexed _challengeID, address indexed _from, address indexed _to, uint _energy, uint _grace, uint _winMargin);

    Then down in a function, I call it like another function this:

    challengeMade(challengeID, players[0], players[1], _energy, _grace, _winMargin);

    Now over on the javascript side, I can write something like this (efc is my contract):

    var challengeMadeEvent = efc.challengeMade({}, {fromBlock: 0, toBlock: 'latest'});

    challengeMadeEvent can now be used as a filter and you can either use .watch() or .get() to get nice javascript objects whenever the contract uses the event. challengeMadeEvent.get(), for example, gives an array of events, which looks like this.

    [{ address: '0xf025d81196b72fba60a1d4dddad12eeb8360d828', blockNumber: 0, logIndex: 0, event: 'challengeMade', transactionIndex: 0, number: 1, hash: '0x4d80156bc10d7caaaf12ad0bd02834bf5b3c9343df360bdfe52c72838c262458', args: { _challengeID: '1', _from: '0x38f388fadf4a6a35c61c3f88194ec5ae162c8944', _to: '0x1e62637375fa72c3bbf29b59fdd117d21eea861c', _energy: '50', _grace: '60', _winMargin: '3' } } ]

    There's a bunch of other things, like filtering the filter for topics (to only look for challenges against your own address, say), or using .watch() for a callback. Unfortunately, some of these things are currently broken/buggy, but it's looking to be the best way to learn what a contract is doing.
  • pedrocsc21pedrocsc21 Member Posts: 5
Sign In or Register to comment.