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?

up vote 6 down vote accepted

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.

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.

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

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.