0

I've got one Ethereum smart contract which calls functions of the other one. How could I track these calls using web3js or some other tool if it is possible at all? I need it because I want to execute some JavaScript (or other non-solidity language) code after receiving such call and then call other function of first smart contract so the sequence of calls should be following:

  1. Smart contract N1 calls N2 smart contract function.
  2. JavaScript (or other non-solidity language) code catches this call and execute some code.
  3. Smart contract N2 calls back N1 using data from previous step.

Could anybody help with it?

0

What you are trying to archive is contrary to the design principles of Solidity and the blockchain. The answer to the question Why can't contracts make API calls? will pretty much explain why.

In short words: If you would open up Solidity to call arbritrary non Solidity code it would become non-deterministic as that non Solidity code would not exist outside of the blockchain and could be modified independently.

  • I understand it, but solution like oraclize.it exists and is successful. I need something like this. – Dmitriy Vinokurov May 27 '18 at 7:14
  • An oracle and what you are asking for isn't exactly the same. Basically, what an Oracle does it to send certain data from the outside world onto the blockchain, while making an API call would be just the other way round. Notice the difference? Maybe you have to re-think what you are trying to achieve or at least explain a bit more details. – TorstenS May 27 '18 at 10:11
  • Also possibly check the code samples at docs.oraclize.it/#ethereum-quick-start. Or you should ask a different question probably which would be: How to write my own oracle on the blockchain? – TorstenS May 27 '18 at 10:13

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.