dash-schema v0.0.1
Dash Schema
A consensus-code library for Dash V13.0 Evolution containing:
- Consensus-data definitions using JSON Schema (extends draft-06)
- Consensus code Modules for validating objects against V13 consensus rules (ECMA-262 5.1 edition)
- Model Classes to represent, construct and manipulate schema object instances using consensus code ES6
- A development environment for creating & deploying Evolution DAPs
Build
Ensure you have the latest NodeJS installed.
Clone the repo:
git clone https://github.com/dashevo/dash-schema
Install npm packages:
cd dash-schema && npm install
Build: (lint, gen test data, run all tests)
npm run build
Build HTML docs:
# builds to... ./docs/html/index.html
npm run docs
Test
Run all tests:
npm test
Follow the Stack log:
tail -F ./__tests__/data/stack.log
Follow the Stack DB contents:
tail -F ./__tests__/data/stack-db.json
Regenerate test data:
# outputs to... ./__tests__/data/dashpay-test-data.json
npm test:gen
Run individual tests:
npm test:consensus
npm test:model
npm test:stack
npm test:dashpay
Hong Kong Dev-Workshop Demo
A basic demonstration of how a user (Alice) can create her own DAP, register it on the blockchain, and then spin through basic usecases like friending and paying friends by name.
The tests simulate the flow of the actual consensus-governed objects from a JavaScript client for each of Alice, Bob and Charlie as they call DAPI over simulated HTTP to interact with each other using data processed on L2 (DAPI/DashDrive) in conjunction with L1 (DashCore), implemented within the virtual test stack.
Run the usecase demo:
npm run test:dashpay
This will generate the test-data using this code:
./__tests__/data/__gen__/test-gendata.js
...And then run through the basic usecases, through a virtual Evo Masternode stack, using this code:
./__tests__/test/dap/dashpay/usecase-test.js
Please start code review from these 2 files to gain a full understanding of the consensus shcema objects, validation code, and the integration between the simulated DAPI, DashDrive and DashCore components running on a Dash V13 Masternode.
Please note that as L2 reference implementation is written entirely in JS from DashDrive, DAPI, to client SDK and the example DAP clients we'll release, all those components can actually reference and use this code directly, so our consensus code is modularized from the start, and we don't need to reimplement code in different L2 compoenents, and have a single library to focus security and QA on.
Also, be aware that this code is essentially Alpha stage so much validation, security is skeleton code and will be fleshed-out from here.