add java setup example

This commit is contained in:
Matthias Kretschmann 2018-08-29 12:52:10 +02:00
parent 8593358ebf
commit 7a800ffb02
Signed by: m
GPG Key ID: 606EEEF3C479A91F
1 changed files with 20 additions and 12 deletions

View File

@ -1,15 +1,26 @@
# 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
# JavaScript driver
npm i bigchaindb-driver
```
```bash
# Python 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).
```js
@ -25,19 +36,16 @@ const conn = new BigchainDB.Connection(API_PATH, {
```python
from bigchaindb_driver import BigchainDB
from bigchaindb_driver.crypto import generate_keypair
bdb = BigchainDB(
conn = 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)
```
```java
BigchainDbConfigBuilder
.baseUrl("https://test.bigchaindb.com/")
.addToken("app_id", "Get one from testnet.bigchaindb.com")
.addToken("app_key","Get one from testnet.bigchaindb.com").setup();
```