1.0.1 • Published 5 years ago

easy-bigchain v1.0.1

Weekly downloads
32
License
MIT
Repository
github
Last release
5 years ago

⭐️ Easy Bigchain ⭐️ HitCount

Stars Issues MIT

Helper library for BigChainDB tasks. Blockchain Database now with a high level abstracted API. Blockchain, accessible to all!


Installation 💻

$ npm install easy-bigchain --save

Usage 👨‍💻

import bigchain from 'easy-bigchain'

1. Connect to BigChainDB

const connection = bigchain.connect(CONNECTION_STRING)
// Default == https://test.bigchaindb.com/api/v1/

2. Generate KeyPairs for Users

const user = bigchain.generateKeypair()

OR

const user = bigchain.generateKeypair(SEED_PHRASE)

3. Create Asset

bigchain.createAsset(CONNECTION_OBJECT, ASSET, METADATA, USER, function(
  transaction
) {
  // execute code
})
  • CONNECTION OBJECT : Object returned from the connect() function call
  • ASSET : The main data object (immutable)
  • METADATA : Additonal Information to be stored
  • USER : Object returned from the generateKeypair() function call

4. Transfer Asset

bigchain.transferAsset(
  CONNECTION_OBJECT
  TRANSACTION,
  METADATA,
  CURRENT_OWNER,
  NEW_OWNER,
  function(transaction) {
    // execute code
  }
)
  • CONNECTION OBJECT : Object returned from the connect() function call
  • TRANSACTION - The original Transaction from where the asset is to be transferred
  • METADATA : Additonal Information to be stored
  • CURRENT OWNER and NEW OWNER are objects returned from the generateKeypair() function call

Due to some unexpected behaviour of the getTransaction() function, I have made use of the entire transaction itself. Not efficient but works till that issue is fixed.


Contributing ✨

Please send a Pull Request with appropriate documentation and I would be more than happy to merge it! 😄

1.0.1

5 years ago

1.0.0

5 years ago

0.4.0

5 years ago

0.3.0

5 years ago

0.2.0

5 years ago

0.1.0

5 years ago