I want to make logic following

  1. A user send token to B(transaction #1)
  2. contract check in realtime whether transaction #1 is mined or not.
  3. If it is mined, contract goes to next step.

How can I make step 2? Is it possible? Is it better to get balance of B in real time than process above?


Yes, this is possible in several ways:

  1. Token smart contract may maintain transaction log or Merkle tree in its storage (you need to modify token smart contract for this to work)
  2. Token smart contract may notify your contract about all token transactions (you need to modify token smart contract, and token smart contract needs to trust your contract)
  3. User A may tunnel transaction through your smart contract
  4. As long as smart contract may access hashes of last 256 blocks, one may prove to the smart contract that some transaction was included in certain block, though, this should be done quickly

Let me know if you need more details about either option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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