Skip to content

sohkai/js-bigchaindb-quickstart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JavaScript quickstart for BigchainDB

‼️ High chance of 🔥 and 😡 ahead if you expect this to be production-ready

Some naive helpers to get you on your way to making some transactions 💥, if you'd like to use JS with BigchainDB.

Aimed to support usage in browsers or node, but like every piece of 💩, it might not. Use at your own risk 🚀. At least I can tell you it's ES6, so you'll probably need a babel here and a bundler there, of which I expect you'll know quite well (otherwise, go check out js-reactor 😉).

Getting started

Srs, just read through index.js and see if you can make any sense of it.

The expected flow for making transactions:

  1. Go get yourself some keypairs! Just make a new Keypair() (or a whole bunch of them, nobody's counting 😎).
  2. Go get yourself a condition! makeEd25519Condition() should do the trick ✨.
  3. Go get a fulfillment (don't worry about the why)! makeEd25519Fulfillment() no sweat 💪.
  4. (Optional) You've got everyting you need, except for an asset. Maybe define one (any JSON-serializable object will do).
  5. Time to get on the rocket ship, baby. makeCreateTransaction() your way to lifelong glory and fame 👏!
  6. Ok, now you've got a transaction, but we need you to sign (signTransaction()) it cause, you know... cryptography and ¯\_(ツ)_/¯.
  7. Alright, sick dude, you've finally got everything you need to POST to a server. Phew :sweat_drops:. Go fetch() your way to business, start:point_up:life4evar!

...

Alright, alright, so you've made a couple transactions. Now what? Do I hear you saying "Transfer them??" No problem, brotha, I gotcha covered :neckbeard:.

  1. Go get some more conditions and fulfillments, making sure you create fulfillments to fulfill a previous transaction's condition (maybe you wanna go check out this and this and this if you're as confused as I think you are).
  2. Go make a transfer transaction, using the transaction you want to spend in makeTransferTransaction() ✌️.
  3. Sign that transaction with signTransaction()!
  4. POST to the server, and watch the 💵s drop, man.

Needs for speeds

This implementation plays "safe" by using JS-native (or downgradable) libraries for its crypto-related functions to keep compatabilities with the browser. If that makes you 😒 and you'd rather go :godmode: with some ⚡ ⚡, you can try using some of these to go as fast as a 🚤:

About

[deprecated] So you wanna use BigchainDB with JavaScript eh?

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •