Official Java driver for BigchainDB created by Authenteq.
Please note: due to non-official org.json implementation the driver is not compatible with Android
BigchainDB Server | BigchainDB Java Driver |
---|---|
1.0 |
0.1.x |
The build system now is fully gradle-based, so to build the driver run:
./gradlew install
or use maven
mvn clean install
BigchainDbConfigBuilder
.baseUrl("https://test.ipdb.io")
.addToken("app_id", "2bbaf3ff")
.addToken("app_key", "c929b708177dcc8b9d58180082029b8d").setup();
// prepare your keys
net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator();
KeyPair keyPair = edDsaKpg.generateKeyPair();
// Set up your transaction
Transaction transaction = BigchainDbTransactionBuilder.init()
.addAsset("firstname", "John")
.addAsset("lastname", "Smith")
.addMetaData("what", "My first BigchainDB transaction")
.addMetaData("this", "My 1st metadata BigchainDB transaction")
.operation(Operations.CREATE)
.buildOnly((EdDSAPublicKey) keyPair.getPublic(), (EdDSAPrivateKey) keyPair.getPrivate());
// prepare your keys
net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator();
KeyPair keyPair = edDsaKpg.generateKeyPair();
// Set up your transaction
Transaction transaction = BigchainDbTransactionBuilder.init()
.addAsset("firstname", "John")
.addAsset("lastname", "Smith")
.addMetaData("what", "My second BigchainDB transaction")
.addMetaData("this", "My 2nd metadata BigchainDB transaction")
.operation(Operations.CREATE)
.buildAndSignOnly((EdDSAPublicKey) keyPair.getPublic(), (EdDSAPrivateKey) keyPair.getPrivate());
// prepare your keys
net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator();
KeyPair keyPair = edDsaKpg.generateKeyPair();
// Set up your transaction
Transaction transaction = BigchainDbTransactionBuilder.init()
.addAsset("firstname", "John")
.addAsset("lastname", "Smith")
.addMetaData("what", "My third BigchainDB transaction")
.addMetaData("this", "My 3rd metadata BigchainDB transaction")
.buildAndSign((EdDSAPublicKey) keyPair.getPublic(), (EdDSAPrivateKey) keyPair.getPrivate())
.sendTransaction();
public class MyCustomMonitor implements MessageHandler {
@Override
public void handleMessage(String message) {
ValidTransaction validTransaction = JsonUtils.fromJson(message, ValidTransaction.class);
}
}
// config
BigchainDbConfigBuilder
.baseUrl("https://test.ipdb.io")
.addToken("app_id", "2bbaf3ff")
.addToken("app_key", "c929b708177dcc8b9d58180082029b8d")
.webSocketMonitor(new MyCustomMonitor())
.setup();
TransactionApi.sendTransaction(Transaction transaction) throws IOException
TransactionApi.sendTransaction(Transaction transaction, final GenericCallback callback)
Transaction TransactionApi.getTransactionById(String id) throws IOException
Transactions TransactionApi.getTransactionsByAssetId(String assetId, Operations operation)
Outputs getOutputs(String publicKey) throws IOException
Outputs getSpentOutputs(String publicKey) throws IOException
Assets getAssets(String searchKey) throws IOException
Assets getAssetsWithLimit(String searchKey, String limit) throws IOException
Block getBlock(String blockId) throws IOException
List<String> getBlocks(String transactionId, String status) throws IOException
Votes getVotes(String blockId) throws IOException
Status getTransactionStatus(String transactionId) throws IOException
Status getBlockStatus(String blockId) throws IOException
- HTTP API Reference
- The Transaction Model
- Inputs and Outputs
- Asset Transfer
- All BigchainDB Documentation
- The Authenteq team and others (see CONTRIBUTORS file).
Copyright 2017 Authenteq GmbH
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.