项目作者: DiscreetAI

项目描述 :
Blockchain infrastructure for decentralized machine learning (decentralized-ml repo).
高级语言: JavaScript
项目地址: git://github.com/DiscreetAI/decentralized-ml-infra.git
创建时间: 2019-06-07T19:05:58Z
项目社区:https://github.com/DiscreetAI/decentralized-ml-infra

开源协议:

下载


dAgora Chain

Build Status
To spin up a validator node (using lotion) run:

  1. node app.js

For a multiple remote nodes, run a validator and note its public IP address. Then run a peer client on a different node:

  1. node app.js --host <HOST>
  1. node app-peer.js --host <HOST>

(HOST defaults to localhost if not specified)

Scripts

To use a fresh chain, run npm run devMode beforehand.

The following command launches a lightweight client, sending a single value.

  1. node scripts/cli-peer.js --host=<HOST> --port=<PORT> --data={ key: 'value', ... }

API Information

Access endpoints through HTTP. These are the HTTP endpoints (when the tx-server is running):

  1. GET: http://localhost:<PORT>/state
  2. POST: http://localhost:<PORT>/txs

Can be reached via Python’s requests HTTP library:

  1. >>> import json
  2. >>> import requests
  3. # GET Example
  4. >>> r = requests.get("http://localhost:3000/state")
  5. >>> json.loads(r.text)
  6. {'MESSAGES': []}
  7. # POST Example
  8. >>> r = requests.post("http://127.0.0.1:3000/txs", json={'hello':'bye'})
  9. >>> json.loads(r.text)
  10. {'result': {'check_tx': {}, 'deliver_tx': {}, 'hash': '8FDBE289D77F3D918D7B49ED5315BA70F9FD6C95', 'height': '4556'}}

Be sure to follw the correct data format when posting. Data (transaction) format:

  1. {
  2. KEY: ... ,
  3. CONTENT: ...
  4. }

The relevant ABCI RPC endpoints are, though you shouldn’t have to use them:

  1. GET: http://<HOST>:<PORT>/abci_query
  2. POST: http://<HOST>:<PORT>/broadcast_tx_commit?tx=<RAW_TX_HEX>

TODO

  • Update to latest Lotionjs version
  • Use commander with cli-peer.js
  • Allow for multiple peers to be specified for app.js
  • Validator autogen, selection, autoadd to genesis.json
  • ✅ Additional tests for HTTP server
  • ✅ Travis CI
  • Autogen peer discovery
  • Better structure for multi-node testing
  • Use proper axios HTTP POST encoding in tx-server.js