Official JavaScript driver for BigchainDB to create transactions in Node.js and the browser.
Compatibility
BigchainDB Server | BigchainDB JavaScript Driver |
---|---|
0.10 |
0.1.x |
1.0.0 |
0.3.x |
1.3.x |
3.x.x |
>= 2.0.0 |
4.x.x |
Breaking changes
- Version 4.0 of BigchainDB JavaScript Driver makes the driver compatible with BigchainDB 2.0. There are new functions for sending off transactions along with other changes. Check older versions
- Version 3.2 of BigchainDB JavaScript Driver introduces a new way of creating transfer transactions. Check older versions
Table of Contents
Installation and Usage
npm install bigchaindb-driver
const driver = // or ES6+
Example: Create a transaction
const driver = // BigchainDB server instance (e.g. https://example.com/api/v1/)const API_PATH = 'http://localhost:9984/api/v1/' // Create a new keypair.const alice = // Construct a transaction payloadconst tx = driverTransaction // Sign the transaction with private keysconst txSigned = driverTransaction // Send the transaction off to BigchainDBconst conn = API_PATH conn
Browser usage
BigchainDB boilerplate <!-- Adjust version to your needs --> Hello BigchainDB Your transaction id is: processing
BigchainDB Documentation
- The Hitchhiker's Guide to BigchainDB
- HTTP API Reference
- The Transaction Model
- Inputs and Outputs
- Asset Transfer
- All BigchainDB Documentation
Speed Optimizations
This implementation plays "safe" by using JS-native (or downgradable) libraries for its crypto-related functions to keep compatibilities with the browser. If you do want some more speed, feel free to explore the following:
- chloride, or its underlying sodium library
- node-sha3 -- MAKE SURE to use steakknife's fork if the FIPS 202 upgrade hasn't been merged (otherwise, you'll run into all kinds of hashing problems)
Development
git clone git@githubcom:bigchaindb/js-bigchaindb-drivergitcd js-bigchaindb-driver/ npm inpm run dev
After updating source files in src/
, make sure to update the API documentation. The following command will scan all source files and create the Markdown output into ./API.md
:
npm run doc
Authors
- inspired by
js-bigchaindb-quickstart
of @sohkhai [thanks] - BigchainDB devs@bigchaindb.com
- BigchainDB contributors
Licenses
See LICENSE and LICENSE-docs.