mirror of
https://github.com/bigchaindb/site.git
synced 2024-11-22 01:36:55 +01:00
add Python examples to setup
This commit is contained in:
parent
7b92d044d0
commit
8593358ebf
@ -1,11 +1,15 @@
|
|||||||
# Setup
|
# Setup
|
||||||
|
|
||||||
Start by installing the official [BigchainDB JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver):
|
Start by installing the official BigchainDB [JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver) or [Python driver](https://github.com/bigchaindb/bigchaindb-driver):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm i bigchaindb-driver
|
npm i bigchaindb-driver
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```bash
|
||||||
|
pip install -U bigchaindb-driver
|
||||||
|
```
|
||||||
|
|
||||||
Then, include that as a module and connect to any BigchainDB node. You can create your own `app_id` and `app_key` on [BigchainDB Testnet](https://testnet.bigchaindb.com).
|
Then, include that as a module and connect to any BigchainDB node. You can create your own `app_id` and `app_key` on [BigchainDB Testnet](https://testnet.bigchaindb.com).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
@ -18,3 +22,22 @@ const conn = new BigchainDB.Connection(API_PATH, {
|
|||||||
app_key: 'Get one from testnet.bigchaindb.com'
|
app_key: 'Get one from testnet.bigchaindb.com'
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```python
|
||||||
|
from bigchaindb_driver import BigchainDB
|
||||||
|
from bigchaindb_driver.crypto import generate_keypair
|
||||||
|
|
||||||
|
bdb = BigchainDB(
|
||||||
|
'https://test.bigchaindb.com',
|
||||||
|
headers={'app_id': 'Get one from testnet.bigchaindb.com',
|
||||||
|
'app_key': 'Get one from testnet.bigchaindb.com'})
|
||||||
|
alice = generate_keypair()
|
||||||
|
tx = bdb.transactions.prepare(
|
||||||
|
operation='CREATE',
|
||||||
|
signers=alice.public_key,
|
||||||
|
asset={'data': {'message': ''}})
|
||||||
|
signed_tx = bdb.transactions.fulfill(
|
||||||
|
tx,
|
||||||
|
private_keys=alice.private_key)
|
||||||
|
bdb.transactions.send(signed_tx)
|
||||||
|
```
|
||||||
|
Loading…
Reference in New Issue
Block a user