Code Monkey home page Code Monkey logo

ethereum-oraclize-starter's Introduction

Ethereum Oraclize starter

Front-end is generated with vue-cli version 3.2.1

Basic Ethereum Oracle example including Oraclize, Truffle, Coinbase API, Web3

Demo

Get the current ETH/USD price from the Coinbase API through an Ethereum Oracle

Project setup

Install dependencies

npm install

Install Truffle

npm install -g truffle 

Run Truffle develop (spawns a development blockchain)

truffle develop

Open a seperate terminal and run the ethereum-bridge (see package.json for what it does)

npm run bridge

Wait till it is fully loaded and you see the following message

Please add this line to your contract constructor:

OAR = OraclizeAddrResolverI(address);

Compile the contract inside the Truffle develop console

truffle(develop)> compile

Migrate the contract also inside the Truffle develop console

truffle(develop)> migrate --development --reset

Get the contract address from the ethereum-bridge terminal

Output should be something like this

    "contract_myid": "0x9fa87c542cab950bd129f3d2d13cba6199741bd1984351c04e83c54620dfee1b",
    "contract_address": "0x345ca3e014aaf5dca488057592ee47305d9b3e10"

Copy your contract address into HelloWorld.vue

let myContract = new web3.eth.Contract(
  MyContract.abi,
  //Your contract address
  "0x345ca3e014aaf5dca488057592ee47305d9b3e10"
);

Start the project

npm run serve

Enjoy!

ethereum-oraclize-starter's People

Contributors

marlowl avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.