How to use the bigchaindb-driver.Connection function in bigchaindb-driver

To help you get started, we’ve selected a few bigchaindb-driver examples, based on popular ways it is used in public projects.

github bigchaindb / project-jannowitz / js-examples / create_transfer.js View on Github external
var BigchainDB = require('bigchaindb-driver')
var bip39 = require('bip39')

// ***************************************************************
// Simple example:
const alice = new BigchainDB.Ed25519Keypair()
const bob = new BigchainDB.Ed25519Keypair()
console.log(alice)
const API_PATH = 'http://127.0.0.1:9984/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
     app_id: '',
    app_key: ''
})


// copy to file
const enemy = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0, 32))

createAssets()

async function createAssets() {
    const enemyAsset = await createEnemy(enemy)
    // Transfer transaction
    console.log('Enemy created', enemyAsset)
    const groupAsset = await createGroup(enemy)
    console.log('Group asset created', groupAsset)
github bigchaindb / js-bigchaindb-driver / examples / src / basic-usage-async-await.js View on Github external
// Copyright BigchainDB GmbH and BigchainDB contributors
// SPDX-License-Identifier: (Apache-2.0 AND CC-BY-4.0)
// Code is Apache-2.0 and docs are CC-BY-4.0

/* eslint-disable import/no-unresolved */

const driver = require('bigchaindb-driver')
require('dotenv').config()


// ======== Preparation ======== //
const conn = new driver.Connection('https://example.com/api/v1/', {
    header1: 'header1_value',
    header2: 'header2_value'
})

const alice = new driver.Ed25519Keypair()
const bob = new driver.Ed25519Keypair()

const assetdata = {
    'bicycle': {
        'serial_number': 'abcd1234',
        'manufacturer': 'Bicycle Inc.',
    }
}

const metadata = { 'planet': 'earth' }
github bigchaindb / project-jannowitz / js-examples / transactionsPerSecond.js View on Github external
const BigchainDB = require('bigchaindb-driver')
const schedule = require('node-schedule')
const bip39 = require('bip39')
const sizeof = require('object-sizeof');

const API_PATH = 'http://localhost:9984/api/v1/'

const conn = new BigchainDB.Connection(API_PATH, {
     app_id: '',
    app_key: ''
})




const user = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0, 32))


// Execute ever x seconds: '*/15 * * * * *'
let count = 0
const numTransactions = 60


var j = schedule.scheduleJob('*/1 * * * * *', function () {
github bigchaindb / project-jannowitz / js-examples / differentPayloadSize.js View on Github external
const BigchainDB = require('bigchaindb-driver')
const schedule = require('node-schedule')
const bip39 = require('bip39')
var sizeof = require('object-sizeof');


// const API_PATH = 'https://test-earth.ipdb.io/api/v1/'
// const conn = new BigchainDB.Connection(API_PATH, {
//     'X-Secret-Access-Token': 'secret-earth'
// })


const API_PATH = 'http://localhost:9984/api/v1/'

// const API_PATH = 'http://localhost:32780/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
     app_id: '',
     app_key: ''
})



const longAsset = 'testexapme'.repeat(400)



const user = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0, 32))

const windAsset = {
    'timeStamp': JSON.stringify(new Date()),
    'example': 'simpleAsseet',
    'long': longAsset
github bigchaindb / project-jannowitz / js-examples / issue2226.js View on Github external
const BigchainDB = require('bigchaindb-driver')
const schedule = require('node-schedule')
const bip39 = require('bip39')
var sizeof = require('object-sizeof');

const API_PATH = 'http://localhost:9984/api/v1/'

const conn = new BigchainDB.Connection(API_PATH, {
     app_id: '',
    app_key: ''
})


// const API_PATH = 'https://test-venus.ipdb.io/api/v1/'
// const conn = new BigchainDB.Connection(API_PATH, {
//     'X-Secret-Access-Token': 'secret-venus'
// })




const user = new BigchainDB.Ed25519Keypair(bip39.mnemonicToSeed('seedPhrase').slice(0, 32))
github artus / FarmToFork / js / FarmToFork.js View on Github external
constructor() {
        // Initialise a new connection.
        this.connection = new driver.Connection(process.env.APP_URL, {
            app_id: process.env.APP_ID,
            app_key: process.env.APP_KEY,
        });
        //this.connection = new driver.Connection(process.env.APP_URL);

        this.currentIdentity = this.generateKeypair("ftf");
    }
github NP-compete / Alternate-Authentication / Enterprise / BlockChain / assetManager.js View on Github external
constructor(assetType) {
        this.seed = bip39.mnemonicToSeed(ID.phrase).slice(0, 32)
        this.userKeyPair = new BigchainDB.Ed25519Keypair(this.seed)

        this.conn = new BigchainDB.Connection(API_PATH, {})

        this.userDID = new DID(this.userKeyPair.publicKey)
        this.assetType = assetType;

        this.userDID.define(assetType, `https://schema.org/v1/${assetType}`)
    }
github bigchaindb / project-jannowitz / angular-boilerplate / src / app / shared / bdb.service.ts View on Github external
private async _getConnection() {
    if (!this.conn) {
      const config = this.configService.getConfiguration();
      this.conn = new driver.Connection(config.bdb.apiUrl);
    }
  }
}
github bigchaindb / js-driver-orm / src / connection.js View on Github external
constructor(path, headers = {}) {
        this.path = path
        this.headers = Object.assign({}, headers)
        this.conn = new driver.Connection(path, headers)
    }

bigchaindb-driver

Node.js driver for BigchainDB

Apache-2.0
Latest version published 8 months ago

Package Health Score

68 / 100
Full package analysis