Helper library for BigChainDB tasks. Blockchain Database now with a high level abstracted API. Blockchain, accessible to all!
$ npm install easy-bigchain --save
import bigchain from 'easy-bigchain'
const connection = bigchain.connect(CONNECTION_STRING)
// Default == https://test.bigchaindb.com/api/v1/
const user = bigchain.generateKeypair()
OR
const user = bigchain.generateKeypair(SEED_PHRASE)
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
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.
Please send a Pull Request with appropriate documentation and I would be more than happy to merge it! 😄