<
 
 
 
 
×
>
hide You are viewing an archived web page, collected at the request of Ethereum Foundation using Archive-It. This page was captured on 19:28:33 Jun 19, 2021 , and is part of the Community collection. The information on this web page may be out of date. See All versions of this archived page. Loading media information

Looking for more features of my NodeJS oracle

CaptainJSCaptainJS Member Posts: 3
edited January 2019 in Smart Contracts and Dapps
Hi. There are so many Ethereum Oracles out there. But I needed a more simple and straight forward one for my projects. Thus, I created my own one. With it we can invoke JavaScript directly from Ethereum's Solidity. It's available on Ropsten and Mainnet.

https://github.com/CaptainJavaScript

I've implemented several use cases such as mathjs, JSON and jQuery so that you can invoke JavaScript quite easily:

Run(
   1, /* give the job a unique ID */
   "math:log2(16)", /* just call the mathjs-function after math: */
   "",
   "",
   1, /* it's fast: 1 slice is enough */
    DEFAULT_GAS_UNITS, /* use default gas units */ 
    DEFAULT_GAS_PRICE /* we will transfer the default gas price for return */
);    
or

Run(
    CENTIMETER_JOB,  /* give the job a unique ID */
    /* JavaScript code I want to execute: */
    "module.exports = function(CaptainJSIn) { var math = require('mathjs'); return math.eval(CaptainJSIn + ' cm to inch'); }", 
    Centimeter, /* Input parameter which will result in CaptainJSIn (see above) */
    "mathjs",  /* Nodejs libraries we need */
    3, /* we need a maximum of 3 runtime slices */
    DEFAULT_GAS_UNITS, /* use default gas units */ 
    DEFAULT_GAS_PRICE /* we will transfer the default gas price for return */
 );    
I'm now looking for more feature requests (did I miss something?) and people who are willing to test it on Ropsten
Post edited by CaptainJS on
Sign In or Register to comment.