0

I have a private network with a few nodes and I have installed ethereum-bridge to deploy an Oracle.

One of my blockchain nodes is used by ethereum-bridge to deploy the oracle. The node is started with the command geth.exe --identity "7" --datadir "D:\Blockchain\1" --networkid 4999 --rpc --rpcport 47000 --rpcapi "db,eth,net,web3,shh,personal" --rpccorsdomain "*" --port 30800 --nodiscover --shh --ipcdisable console

while ethereum-bridge:

ethereum-bridge -H localhost:47000 -a 0

These are the logs on the ethereum-bridge console

[2019-02-21T09:45:14.820Z] INFO you are running ethereum-bridge - version: 0.6.1
[2019-02-21T09:45:14.821Z] INFO saving logs to: ./bridge.log
[2019-02-21T09:45:14.822Z] INFO using active mode
[2019-02-21T09:45:14.823Z] INFO Connecting to eth node http://localhost:47000
[2019-02-21T09:45:16.101Z] INFO connected to node type Geth/7/v1.8.21-stable-9dc5d1a9/windows-amd64/go1.11.4
[2019-02-21T09:45:16.588Z] WARN Using 0x8668dc605fe8d721dbb96378fd8155c621bea37d to query contracts on your blockchain, make sure it is unlocked and do not use the same address to deploy your contracts
[2019-02-21T09:45:16.711Z] INFO deploying the oraclize connector contract...
[2019-02-21T09:45:26.998Z] INFO connector deployed to: 0x251deddf98aca280a252d9e5f7b1b246bc3f66f7
[2019-02-21T09:45:27.119Z] WARN deterministic OAR disabled/not available, please update your contract with the new custom address generated
[2019-02-21T09:45:27.120Z] INFO deploying the address resolver contract...
[2019-02-21T09:45:37.534Z] INFO address resolver (OAR) deployed to: 0xb69156280a1461003a079387c2b5b827b3f0fc53
[2019-02-21T09:45:37.535Z] INFO updating connector pricing...
[2019-02-21T09:45:47.861Z] INFO successfully deployed all contracts
[2019-02-21T09:45:47.871Z] INFO instance configuration file saved to D:\GitHub\ethereum-bridge\config\instance\oracle_instance_20190221T094547.json

Please add this line to your contract constructor:

OAR = OraclizeAddrResolverI(0xB69156280a1461003a079387c2B5B827B3f0fc53);

[2019-02-21T09:45:47.996Z] INFO Listening @ 0x251deddf98aca280a252d9e5f7b1b246bc3f66f7 (Oraclize Connector)

(Ctrl+C to exit)

Then, using a different blockchain node I have deployed the following contract:

pragma solidity ^0.5.4;

import "github.com/oraclize/ethereum-api/oraclizeAPI.sol";

contract WolframAlpha is usingOraclize {

    uint256 public beginningPastQuarter;
    uint256 public beginningCurrentQuarter;
    uint256 public payoutIntervalSeconds;

    event newOraclizeQuery(string description);
    event newTimestampMeasure(uint256 timestamp);

     constructor() public {
        payoutIntervalSeconds = 120;
        beginningPastQuarter = 0;
        beginningCurrentQuarter = 0;
        OAR = OraclizeAddrResolverI(0xB69156280a1461003a079387c2B5B827B3f0fc53);
    }

    function stringToUint(string memory s) internal pure returns (uint) {
        bytes memory b = bytes(s);
        uint result = 0;
        for (uint i = 0; i < b.length; i++) { 
            if (uint8(b[i]) >= 48 && uint8(b[i]) <= 57) {
                result = result * 10 + (uint8(b[i]) - 48); 
            }
        }
        return result; 
    }

    function __callback(bytes32 myid, string memory result) public {
        if (msg.sender != oraclize_cbAddress()) revert();

        uint256 t = stringToUint(result);
        if (t-beginningCurrentQuarter >= payoutIntervalSeconds){
            beginningPastQuarter = beginningCurrentQuarter;
            beginningCurrentQuarter = t;
        }

        emit newTimestampMeasure(t);
    }

    function getUTCTimestamp(uint256 delay) public payable {
        emit newOraclizeQuery("Oraclize query was sent, standing by for the answer..");
        oraclize_query(delay,"WolframAlpha", "Timestamp now");
    }

    function pay(address receiver) public payable{
        address(uint160(receiver)).send(msg.value);
    }

    function balance(address a) public returns(uint256 r){
        return a.balance;
    }
} 

After deploying the contract, I have sent some ether to it so it can pay for the calls to the Oracle.

Now if I try to use the oracle by calling contractInstance.getUTCTimestamp(0,{from:eth.accounts[0],value:2222222,gas:5000000}); the transaction is mined but nothing happens in the ethereum-bridge console.

If I inspect the transaction and its receipts I get:

{
  blockHash: "0x1c2d77b1e07d51894fdf0e2c3423d01538149d657b89e2568b5846d049452fda",
  blockNumber: 5799,
  contractAddress: null,
  cumulativeGasUsed: 5000000,
  from: "0xed2632f90f57dbbeb8e1d27277f4ef85a42851d2",
  gasUsed: 5000000,
  logs: [],
  logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  root: "0x67de497db6efcd76b0f4aba9255cd7744430eb7aded05e86090952071c53e97a",
  to: "0x217e753369532055c55c3588774275b8a58d5cf4",
  transactionHash: "0x21fb0191b15e748f93e9884349f8066cd765c0948d8050d99ebe99d32eb9543b",
  transactionIndex: 0
}
{
  blockHash: "0x1c2d77b1e07d51894fdf0e2c3423d01538149d657b89e2568b5846d049452fda",
  blockNumber: 5799,
  from: "0xed2632f90f57dbbeb8e1d27277f4ef85a42851d2",
  gas: 5000000,
  gasPrice: 20000000000,
  hash: "0x21fb0191b15e748f93e9884349f8066cd765c0948d8050d99ebe99d32eb9543b",
  input: "0xa01569d70000000000000000000000000000000000000000000000000000000000000000",
  nonce: 1048,
  r: "0x782a4d75ca59f5f0646733653474c6a42e26001513996c86635be1394d23d1c2",
  s: "0x23a1346876b104f527e291f885bfb21fe406b17128a18ddb7167bdf8ce021555",
  to: "0x217e753369532055c55c3588774275b8a58d5cf4",
  transactionIndex: 0,
  v: "0x41",
  value: 2222222
}

It seems to me that the transaction is using all gas and that happens even if I increase the gas value. The weird thing is that if I test this contract in remix the total gas used is below 200000. What could be the problem?

4
  • What address are you deploying the Oraclize-using contract with?
    – gskapka
    Feb 21, 2019 at 12:41
  • I am using a different node so Oracle is on one address and Oraclize-using contract on another one
    – David
    Feb 21, 2019 at 13:10
  • W.r.t the address used to deploy the transaction, the node is irrelevant. What address did you deploy with?
    – gskapka
    Feb 21, 2019 at 13:22
  • The Oracle contracs used the address 0x8668dc605fe8d721dbb96378fd8155c621bea37d while the Oraclize-using ones 0xed2632f90f57dbbeb8e1d27277f4ef85a42851d2
    – David
    Feb 21, 2019 at 13:26

1 Answer 1

3

I have encountered the same problem,after 3 days and a day morning and thanks to the help from @D-Nice @gskapka , I finally solved the problem.I need to put my thoughts together to help guys who may encounter the same problem. - only support the dev geth private network I am sorry to say that the oraclize(ethereum-bridge) is only supported the devchain , which means you should start your private network using geth like

geth --networkid 15 --datadir ./data --rpc --rpcapi "admin,debug,eth,miner,net,personal,txpool,web3" --rpcport "8545" --rpccorsdomain "*"  --dev

or simply, you can start you your private network using

geth --dev --rpc console
  • if you deploy the contract using ethereum-bridge on Non-dev private network, you will get gas error like
gas required exceeds allowance or always failing transaction in private network

so, all the problem is caused by Non-devprivate network! Good luck for you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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