Skip to content
This repository has been archived by the owner. It is now read-only.
Obsoleted in favor of https://github.com/rchain-community/rchain-api. Use at your own risk.
JavaScript Other
Branch: master
Clone or download
Joshy Orndorff
Latest commit 19eacd1 Oct 23, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
interfaces
protobuf Merging in changes from dckc:live-tests Oct 22, 2018
test Switched normal tests to use 'deadbeef' hex, and simple test to use '… Oct 22, 2018
.dir-locals.el
.eslintrc.yaml
.flowconfig flow config Oct 4, 2018
.gitignore use @grpc/proto-loader at "link time" Sep 14, 2018
.travis.yml travis ci: `npm run X` Oct 4, 2018
CONTRIBUTING.md CONTRIBUTING: more explicit coding conventions Oct 19, 2018
LICENSE.txt Sketched out readme and license Jul 25, 2018
README.md
RHOCore.js
package-lock.json
package.json Fix silly typo in package.json Oct 23, 2018
rnodeAPI.js
signing.js

README.md

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)

You can’t perform that action at this time.