Giter VIP home page Giter VIP logo

rchain-api's Introduction

RChain-API

An API for dApp frontends to communicate with the RChain blockchain.

The RChain Cooperative is developing a decentralized, economically sustainable public compute infrastructure. Decentralized applications or "dApps" will run their business logic as smart contracts on the blockchain. Their user interfaces will be more traditional programs that interact with the blockchain as a backend. This separation allows dApp developers to create nice abstract interfaces, and allows end users to create their own sovereign interfaces should they choose to do so.

Quickstart

Find an RChain node whose grpc endpoint you can use.

At the moment that likely means running your own RNode. We're working on a community node at rnode-test.rhobot.net

Make note of your RNode's hostname and gRPC port. If you're not sure, localhost and 40401 are good guesses.

Grab RChain-API

Clone this repository with eg git clone https://github.com/JoshOrndorff/RChain-API

And install dependencies with npm install

(Recommended) Run the integration test

Run rnodeAPI.js with host and port arguments, as in: node rnodeAPI.js rnode-test.rhobot.net 50000.

You should see something like:

stuffToSign serialized {
  "type": "Buffer",
  "data": "0a300a110a0f2a031a01784a08000000000000000012112a051a036162634a0800000000000000002a0800000000000000004a080000000000000000"
}
...
doDeploy result: { success: true, message: 'Success!' }
@@createBlock():  {
  "block": {
    "blockHash": {
      "type": "Buffer",
      "data": "3c5d97e2627432026b6d4a17c8027afb95b72e8d08a936d785b58459eff5859e"

Deploy contract to RNode

There are not yet nice truffle-style build tools, so you will probably deploy your code directly using the rnode deploy thin client or using RChain-API itself.

const myNode = RNode('localhost', 40401);
rchain.doDeploy({
  term: '@"aliceUpdates"!("Having fun traveling!")',
  timestamp: clock().valueOf(),
  // from: '0x1',
  // nonce: 0,
})

Interact with the blockchain

TODO Better docs would be great.

For now see the integration test examples in rnodeAPI.js

Examples and Related Projects

  • Nth Caller a minimal RChain-based dApp game that uses RChain-API
  • Status a moderately complex dapp that uses more RChain-API features as well as RSign
  • Coin Faucet An advanced robust dApp that use raspberry PI to airdrop tokens to devices in physical proximity
  • RChain-dbr A web-of-trust based distributed budgeting and rewards dApp
  • RSign A chrome extension for generating client-side signatures akin to metamask
  • node-client A similar but less mature RChain API written in python

RChain Protocol Buffer Dependency

License

Copyright 2018 RChain Cooperative

Apache 2.0 License (See LICENSE.txt)

Contributions welcome (See CONTRIBUTING.md)

rchain-api's People

Contributors

dckc avatar crypto-coder avatar joshorndorff avatar jimscarver avatar

Watchers

James Cloos avatar  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.