Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
{
app_id: '',
app_key: ''
}
);
//asd
bdbOrm.define("crabModel", "https://schema.org/v1/crab")
// define(,)
// : represents the name of model you want to store
// : any information you want to pass about the model (can be string or object)
// note: cannot be changed once set!
bdbOrm.define("classic_car_asset", "http://127.0.0.1:9984/api/v1/classic_car_asset")
// create a public and private key for Alice and Bob
const aliceKeypair = new driver.Ed25519Keypair()
// CREATE ASSET
// from the defined models in our bdbOrm we create an asset with Alice as owner
bdbOrm.models.classic_car_asset.create({
keypair: aliceKeypair,
data: { serial_code: 'n0tp01ntAt0p01ntB',
manufacturer: 'classik',
transmission: 'manual',
drivetrain: 'RWD' }
})
.then(asset => {
/*
asset is an object with all our data and functions
asset.id equals the id of the asset
asset.data is data of the last (unspent) transaction
asset.transactionHistory gives the full raw transaction history
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
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))
console.log('user', user);
console.log('conn', conn)
// Execute ever x seconds: '*/15 * * * * *'
let count = 0
const numTransactions = 20
var j = schedule.scheduleJob('*/1 * * * * *', function () {
const ua = postTransactions(numTransactions)
count++
console.log(count)
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)
// 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' }
// ======== Create Transaction Bicycle ======== //
const txCreateAliceSimple = driver.Transaction.makeCreateTransaction(
assetdata,
metadata,
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
}
sendToBigchainDB(windAsset, user)
async function sendToBigchainDB(asset, keypair) {
const txSimpleAsset = BigchainDB.Transaction.makeCreateTransaction(
asset,
{
'metadata': 'sdfs'
const Buffer = require('buffer').Buffer
const BigchainDB = require('bigchaindb-driver')
const base58 = require('bs58')
const cryptoconditions = require('crypto-conditions')
const sha3 = require('js-sha3')
const user1 = new BigchainDB.Ed25519Keypair()
const user2 = new BigchainDB.Ed25519Keypair()
const user3 = new BigchainDB.Ed25519Keypair()
const creator = new BigchainDB.Ed25519Keypair()
const receiver = new BigchainDB.Ed25519Keypair()
const API_PATH = 'http://localhost:9984/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
app_id: '',
app_key: ''
})
function sha256Hash(data) {
return sha3.sha3_256
.create()
.update(data)
export function getKeypairFromPassphrase(passphrase) {
return new driver.Ed25519Keypair(bip39.mnemonicToSeed(passphrase).slice(0, 32))
}
const Buffer = require('buffer').Buffer
const BigchainDB = require('bigchaindb-driver')
const base58 = require('bs58')
const cryptoconditions = require('crypto-conditions')
const sha3 = require('js-sha3')
const user1 = new BigchainDB.Ed25519Keypair()
const user2 = new BigchainDB.Ed25519Keypair()
const user3 = new BigchainDB.Ed25519Keypair()
const creator = new BigchainDB.Ed25519Keypair()
const receiver = new BigchainDB.Ed25519Keypair()
const API_PATH = 'http://localhost:9984/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
app_id: '',
app_key: ''
})
function sha256Hash(data) {
return sha3.sha3_256
.create()
.update(data)
.hex()
const Buffer = require('buffer').Buffer
const BigchainDB = require('bigchaindb-driver')
const base58 = require('bs58')
const cryptoconditions = require('crypto-conditions')
const sha3 = require('js-sha3')
const user1 = new BigchainDB.Ed25519Keypair()
const user2 = new BigchainDB.Ed25519Keypair()
const user3 = new BigchainDB.Ed25519Keypair()
const creator = new BigchainDB.Ed25519Keypair()
const receiver = new BigchainDB.Ed25519Keypair()
const API_PATH = 'http://localhost:9984/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
app_id: '',
app_key: ''
})
function sha256Hash(data) {
return sha3.sha3_256
.create()
.update(data)
.hex()
}