‼️ 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 😉).
Srs, just read through index.js and see if you can make any sense of it.
The expected flow for making transactions:
- Go get yourself some keypairs! Just make a
new Keypair()(or a whole bunch of them, nobody's counting 😎). - Go get yourself a condition!
makeEd25519Condition()should do the trick ✨. - Go get a fulfillment (don't worry about the why)!
makeEd25519Fulfillment()no sweat 💪. - (Optional) You've got everyting you need, except for an asset. Maybe define one (any JSON-serializable object will do).
- Time to get on the rocket ship, baby.
makeCreateTransaction()your way to lifelong glory and fame 👏! - Ok, now you've got a transaction, but we need you to sign (
signTransaction()) it cause, you know... cryptography and¯\_(ツ)_/¯. - Alright, sick dude, you've finally got everything you need to
POSTto a server. Phew :sweat_drops:. Gofetch()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
.
- 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).
- Go make a transfer transaction, using the transaction you want to spend in
makeTransferTransaction()✌️. - Sign that transaction with
signTransaction()! POSTto the server, and watch the 💵s drop, man.
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
with some ⚡ ⚡, you can try using some of these to go as fast as a 🚤:
- 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)