Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
// 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' }
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 () {
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
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))
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");
}
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}`)
}
private async _getConnection() {
if (!this.conn) {
const config = this.configService.getConfiguration();
this.conn = new driver.Connection(config.bdb.apiUrl);
}
}
}
constructor(path, headers = {}) {
this.path = path
this.headers = Object.assign({}, headers)
this.conn = new driver.Connection(path, headers)
}