6

I want my contract to check a given range of blocks and see whether there are any transactions between a given pair of addresses. Is this possible to do in Solidity? Otherwise how would I do it?

l p
  • 95
  • 5

2 Answers2

6

No, its not possible the EVM is pretty isolated. Alternative way is to watch the blockchain with a web3.js script and notify your contract. Of course this is a potential security hole. The opcodes of the EVM do only have limited access to the current block.

Roland Kofler
  • 11,638
  • 3
  • 44
  • 83
3

If those two addresses are contracts, they could be coded to inform a "watching" contract of any interactions. Unfortunately, they would have to be specifically programmed to do this.

Matthew Schmidt
  • 7,290
  • 1
  • 24
  • 35
  • 1
    Thank you for the answer. But in my case, the two addresses are not contracts. – l p Jun 15 '16 at 14:51