can a contract parse the blockchain?

I would like to have a contract that when it is triggered it parses the blockchain and checks for the existence of a certain transaction.

Is that feasible ? I browsed contract examples on the ethereum github but none seemed to fit this scenario. Expressions and functions like block.number and block.parenthash etc. seem static, referring to just the block that is current.

Any help would be greatly appreciated.

Best Answer

Answers

  • bastardcoinbastardcoin Member Posts: 2
    thank you for the response. Following what you say, if I want a contract to be aware of a certain transaction then a suitable transaction may be sent to the contract first and then the contract can create another transaction to implement what the original transaction was meant to be doing. In this way, the contract can make a log of the transactions that are of interest in its local state and have a (partial) awareness of the transactions that have occurred.

    This is not exactly what I had in mind (as the contract may not become aware of transactions originating from entities that are not aware of the contract), however I will try to see if it can work for the application I have in mind.
  • oomooomo Member Posts: 31
    We also ended up creating our logging in the contract itself, where we track critical actions in the contract storage itself. Don't like the current approach, where the log is in the contract itself and we are working on improvement, where we will create a "Logging" contract, which will keep track of all log activities. It could very well be a general purpose contract, similar to Log4J in Java.
Sign In or Register to comment.