provable-things / ethereum-api

Provable API for Ethereum smart contracts
https://docs.provable.xyz/#ethereum
MIT License
801 stars 427 forks source link

Not getting the __callback() #100

Open nurajc opened 4 years ago

nurajc commented 4 years ago

I have tried the code snippet provided in samples before and it worked. Also I tried my own contract with oraclized for GET and POST requests and it worked. But recently I noticed that the callback function is not being called in any of those previously worked samples. I tried increasing the gas price upto 1000 GEWI for the callback and the result was the same.

I have been trying on Ropsten test network.

Following is a code snipped that is supposed to work, but does not receive a callback. I have imported the proper oraclized solidity file from a file and copied all the content from provable things github to that file.

`pragma solidity ^0.4.22; import "./oracleService.sol";

contract ExampleContract is usingProvable {

string public ETHUSD; event LogConstructorInitiated(string nextStep); event LogPriceUpdated(string price); event LogNewProvableQuery(string description);

function ExampleContract() payable { provable_setCustomGasPrice(10000000000); LogConstructorInitiated("Constructor was initiated. Call 'updatePrice()' to send the Provable Query."); }

function __callback(bytes32 myid, string result) { if (msg.sender != provable_cbAddress()) revert(); ETHUSD = result; LogPriceUpdated(result); }

function updatePrice() payable { if (provable_getPrice("URL") > this.balance) { LogNewProvableQuery("Provable query was NOT sent, please add some ETH to cover for the query fee"); } else { LogNewProvableQuery("Provable query was sent, standing by for the answer.."); bytes32 queryId = provable_query("URL", "json(https://www.therocktrading.com/api/ticker/BTCEUR).result.0.last"); } } }`

lhoenig commented 3 years ago

I still don't get any callbacks.. Edit: fixed after interaction with Support.

tj327 commented 3 years ago

hey @lhoenig , nice to meet you. I am having same issues so would you please help me with that? how did you fix that?

lhoenig commented 3 years ago

Hi @nft1126, I asked on Gitter about the issue, and in the end it wasn't a problem with our code but something on Provable's side on Rinkeby. They fixed something interally and then everything worked. What was wrong exactly, I dont know :) Now, everything works perfectly on Rinkeby. The other testnets I didn't check.

tj327 commented 3 years ago

Oh, thank you so much. Actually, I was having tests on kovan but will switch over rinkeby.

lhoenig commented 3 years ago

No problem! :)

tj327 commented 3 years ago

hey @lhoenig , Is it possible to use encryption service with computation? https://docs.provable.xyz/#ethereum-advanced-topics-encrypted-queries

lhoenig commented 3 years ago

At the bottom of the page it says "Our encryption system also permits users to encrypt any of the supported datasource options." I have never tried it myself though.

tj327 commented 3 years ago

Ok. Thank you.

vishnu-rai commented 2 years ago

@lhoenig I am trying the same code but the call back function is not being called. Can you tell me how to fix that

oliviera9 commented 2 years ago

The same issue here. I tested on Rinkeby testnet. Perhaps, the Provable stopped support for some testnets?

Hello @legendaryphoenixicarus, you can reach us here for support https://gitter.im/provable/ethereum-api (please indicate the input transaction calling your contract).