1
0
mirror of https://github.com/bigchaindb/site.git synced 2024-11-22 01:36:55 +01:00

add setup block

This commit is contained in:
Matthias Kretschmann 2017-11-20 13:19:16 +01:00
parent c22ec13358
commit 4ff6adddcc
Signed by: m
GPG Key ID: 606EEEF3C479A91F
2 changed files with 32 additions and 2 deletions

View File

@ -12,9 +12,19 @@ learn: >
- How asset metadata is updated. In BigchainDB it is possible to use `TRANSFER` transactions to change the state of an asset, in this case the mileage of a car.
---
# Connect to IPDB
# Setup
Start by installing the official [BigchainDB JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver):
```bash
npm i bigchaindb-driver
```
Then include as a module and connect to IPDB or any BigchainDB node:
```js
const BigchainDB = require('bigchaindb-driver')
const API_PATH = 'https://test.ipdb.io/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
app_id: '2db4355b',

View File

@ -13,10 +13,30 @@ learn: >
We show how divisible assets work in BigchainDB by showing how you could create your own token launch on BigchainDB. The token distribution is represented by divisible assets (tokens) linked to one specific application (company/network).
When creating a divisible asset in BigchainDB, the number of the sub-assets that you want to create should be specified.
# Setup
Start by installing the official [BigchainDB JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver):
```bash
npm i bigchaindb-driver
```
Then include as a module and connect to IPDB or any BigchainDB node:
```js
const BigchainDB = require('bigchaindb-driver')
const API_PATH = 'https://test.ipdb.io/api/v1/'
const conn = new BigchainDB.Connection(API_PATH, {
app_id: '2db4355b',
app_key: 'b106b7e24cc2306a00906da90de4a960'
})
```
# Create divisible asset
When creating a divisible asset in BigchainDB, the number of the sub-assets that you want to create should be specified.
```js
const nTokens = 10000
let tokensLeft