Coder Social home page Coder Social logo

kennyrowe / rchain-api Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rchain-community/rchain-api

0.0 1.0 0.0 2.47 MB

An API for rchain dapps to communicate with the blockchain

License: Other

JavaScript 99.88% Makefile 0.11% Emacs Lisp 0.01%

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

Install with npm install rchain-community/rchain-api. Then, with rnode on localhost, you can get current block info:

const grpc = require('grpc');
const { RNode, Ed25519keyPair, Hex, REV } = require('rchain-api');

const rnode = RNode(grpc, { host: 'localhost', port: 40401 });
rnode.showBlocks()
  .then((blocks) => { assert.ok(blocks[0].blockHash); });

If your node is a validator and you have a key to authorize payment, you can deploy code:

const grpc = require('grpc');
const { RNode, Ed25519keyPair, Hex, REV } = require('rchain-api');

const rnode = RNode(grpc, { host: 'localhost', port: 40401 });

const term = '@"world"!("Hello!")';
const myKey = Ed25519keyPair(Hex.decode('11'.repeat(32)));
const timestamp = new Date('2019-04-12T17:59:29.274Z').valueOf();
const info = REV.SignDeployment.sign(myKey, { timestamp, term, phloLimit: 10000, phloPrice: 1 });
rnode.doDeploy(info, true).then((message) => { assert(message.startsWith('Success')); });

API

./docs/

Getting access to an RChain node

Choices include:

RChain gRPC protobuf compatibility

protobuf: v0.9.1 bf1b2c6 Mar 28, 2019

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

License

Copyright 2018-2019 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

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.