kendricktan / ethoracle-barebones

Barebones Oracle example for Ethereum
https://kndrck.co/posts/ethereum_oracles_a_simple_guide/
19 stars 9 forks source link

Does't run 'oracle.js' and 'client.js', gets errors. #3

Open FedorSabeshkin opened 5 years ago

FedorSabeshkin commented 5 years ago

Hello!

  1. I cloned this project
  2. Installed required libraries (instead 'testrpc' npm advised 'ganache-cli')
  3. When i run 'truffle compile && truffle migrate' i gets errors, because needed to change into contracts a) 'pragma solidity' from ^0.4.17 to ^0.5.0 b) 'function CMCOracle() public' to 'constructor() public' 'function Migrations() public' to 'constructor() public' c) 'function getBTCCap() constant public returns (uint)' from 'constant' to 'view' 'function getBTCCap() view public returns (uint)' d) added 'emit'
     function updateBTCCap() public {
          // Calls the callback function
          CallbackGetBTCCap();
       }
       function updateBTCCap() public {
          // Calls the callback function
         emit CallbackGetBTCCap();
       }

    All these changes advised npm.

After i can run 'ganache-cli &' and 'truffle compile && truffle migrate' into another console, but i run 'node client.js' or 'node oracle.js' i get message into console: ''' $ node client.js (node:6432) UnhandledPromiseRejectionWarning: Error: Node error: {"message":"Met hod [object Object] not supported.","code":-32000,"data":{"stack":"Error: Method [object Object] not supported.\n at u.handleRequest (C:\Users\Wizard\AppD ata\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52 :515802)\n at t (C:\Users\Wizard\AppData\Roaming\npm\node_modules\gana che-cli\build\ganache-core.node.cli.js:52:379433)\n at a.handleRequest (C:\ \Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache -core.node.cli.js:52:514789)\n at t (C:\Users\Wizard\AppData\Roaming\npm \node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at s.f.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganac he-cli\build\ganache-core.node.cli.js:52:507919)\n at s.handleRequest (C:\ Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache- core.node.cli.js:52:505745)\n at t (C:\Users\Wizard\AppData\Roaming\npm\ \node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at c .handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache- cli\build\ganache-core.node.cli.js:52:513803)\n at t (C:\Users\Wizard\Ap pData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js: 52:379433)\n at a.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\no de_modules\ganache-cli\build\ganache-core.node.cli.js:52:513250)\n at t (C :\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganac he-core.node.cli.js:52:379433)\n at d._handleAsync (C:\Users\Wizard\AppDat a\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:3 79469)\n at Timeout._onTimeout (C:\Users\Wizard\AppData\Roaming\npm\nod e_modules\ganache-cli\build\ganache-core.node.cli.js:52:378894)\n at ontim eout (timers.js:436:11)\n at tryOnTimeout (timers.js:300:5)\n at listOnTim eout (timers.js:263:5)\n at Timer.processTimers (timers.js:223:10)","name":"E rror"}} at Function.validate (E:\ethoracle-barebones\node_modules\web3-providers\dis t\web3-providers.cjs.js:114:18) at HttpProvider._callee$ (E:\ethoracle-barebones\node_modules\web3-providers \dist\web3-providers.cjs.js:710:61) at tryCatch (E:\ethoracle-barebones\node_modules\regenerator-runtime\runtime .js:45:40) at Generator.invoke [as _invoke] (E:\ethoracle-barebones\node_modules\regene rator-runtime\runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (E:\ethoracle-barebone s\node_modules\regenerator-runtime\runtime.js:97:21) at asyncGeneratorStep (E:\ethoracle-barebones\node_modules\@babel\runtime\he lpers\asyncToGenerator.js:3:24) at _next (E:\ethoracle-barebones\node_modules\@babel\runtime\helpers\asyncTo Generator.js:25:9) at process._tickCallback (internal/process/next_tick.js:68:7) (node:6432) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1) (node:6432) [DEP0018] DeprecationWarning: Unhandled promise rejections are depre cated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ''' and ''' $ node oracle.js (node:4688) UnhandledPromiseRejectionWarning: Error: Node error: {"message":"Method [object Object] not supported.","code":-32000,"data":{"stack":"Error: Method [object Object] not supported.\n at u.handleRe quest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:515802)\n at t (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\gana che-core.node.cli.js:52:379433)\n at a.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:514789)\n at t (C:\Users\Wizard\AppData\Ro aming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at s.f.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js: 52:507919)\n at s.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:505745)\n at t (C:\Users\Wizard\AppData\Roaming\npm\node_modu les\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at c.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:513803)\n at t (C :\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at a.handleRequest (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build \ganache-core.node.cli.js:52:513250)\n at t (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379433)\n at d._handleAsync (C:\Users\Wizard\AppDat a\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.cli.js:52:379469)\n at Timeout._onTimeout (C:\Users\Wizard\AppData\Roaming\npm\node_modules\ganache-cli\build\ganache-core.node.c li.js:52:378894)\n at ontimeout (timers.js:436:11)\n at tryOnTimeout (timers.js:300:5)\n at listOnTimeout (timers.js:263:5)\n at Timer.processTimers (timers.js:223:10)","name":"Error"}} at Function.validate (E:\ethoracle-barebones\node_modules\web3-providers\dist\web3-providers.cjs.js:114:18) at HttpProvider._callee$ (E:\ethoracle-barebones\node_modules\web3-providers\dist\web3-providers.cjs.js:710:61) at tryCatch (E:\ethoracle-barebones\node_modules\regenerator-runtime\runtime.js:45:40) at Generator.invoke [as _invoke] (E:\ethoracle-barebones\node_modules\regenerator-runtime\runtime.js:271:22) at Generator.prototype.(anonymous function) [as next] (E:\ethoracle-barebones\node_modules\regenerator-runtime\runtime.js:97:21) at asyncGeneratorStep (E:\ethoracle-barebones\node_modules\@babel\runtime\helpers\asyncToGenerator.js:3:24) at _next (E:\ethoracle-barebones\node_modules\@babel\runtime\helpers\asyncToGenerator.js:25:9) at process._tickCallback (internal/process/next_tick.js:68:7) (node:4688) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not han dled with .catch(). (rejection id: 1) (node:4688) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code. ''' I self does't understand how solve it error... How i can fix it?

adityak74 commented 2 years ago

I have a modified version that works. I will be updating it to the latest solidity and maintaining this project further. Great tutorial @kendricktan. Here is the link: https://github.com/adityak74/blockchain-eth-simple-oracle