mirror of
https://github.com/bigchaindb/site.git
synced 2025-02-14 21:10:28 +01:00
add java setup example
This commit is contained in:
parent
8593358ebf
commit
7a800ffb02
@ -1,15 +1,26 @@
|
|||||||
# Setup
|
# Setup
|
||||||
|
|
||||||
Start by installing the official BigchainDB [JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver) or [Python driver](https://github.com/bigchaindb/bigchaindb-driver):
|
Start by installing the official BigchainDB [JavaScript driver](https://github.com/bigchaindb/js-bigchaindb-driver), [Python driver](https://github.com/bigchaindb/bigchaindb-driver) or [Java driver](https://github.com/bigchaindb/java-bigchaindb-driver):
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# JavaScript driver
|
||||||
npm i bigchaindb-driver
|
npm i bigchaindb-driver
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
# Python driver
|
||||||
pip install -U bigchaindb-driver
|
pip install -U bigchaindb-driver
|
||||||
```
|
```
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<!-- Java driver, in pom.xml for Maven users -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.bigchaindb</groupId>
|
||||||
|
<artifactId>bigchaindb-driver</artifactId>
|
||||||
|
<version>1.0</version>
|
||||||
|
</dependency>
|
||||||
|
```
|
||||||
|
|
||||||
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
|
||||||
@ -25,19 +36,16 @@ const conn = new BigchainDB.Connection(API_PATH, {
|
|||||||
|
|
||||||
```python
|
```python
|
||||||
from bigchaindb_driver import BigchainDB
|
from bigchaindb_driver import BigchainDB
|
||||||
from bigchaindb_driver.crypto import generate_keypair
|
|
||||||
|
|
||||||
bdb = BigchainDB(
|
conn = BigchainDB(
|
||||||
'https://test.bigchaindb.com',
|
'https://test.bigchaindb.com',
|
||||||
headers={'app_id': 'Get one from testnet.bigchaindb.com',
|
headers={'app_id': 'Get one from testnet.bigchaindb.com',
|
||||||
'app_key': 'Get one from testnet.bigchaindb.com'})
|
'app_key': 'Get one from testnet.bigchaindb.com'})
|
||||||
alice = generate_keypair()
|
```
|
||||||
tx = bdb.transactions.prepare(
|
|
||||||
operation='CREATE',
|
```java
|
||||||
signers=alice.public_key,
|
BigchainDbConfigBuilder
|
||||||
asset={'data': {'message': ''}})
|
.baseUrl("https://test.bigchaindb.com/")
|
||||||
signed_tx = bdb.transactions.fulfill(
|
.addToken("app_id", "Get one from testnet.bigchaindb.com")
|
||||||
tx,
|
.addToken("app_key","Get one from testnet.bigchaindb.com").setup();
|
||||||
private_keys=alice.private_key)
|
|
||||||
bdb.transactions.send(signed_tx)
|
|
||||||
```
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user