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 |
2.0 |
0.2.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();
TransactionsApi.sendTransaction(Transaction transaction) throws IOException
TransactionsApi.sendTransaction(Transaction transaction, final GenericCallback callback)
Transaction TransactionsApi.getTransactionById(String id) throws IOException
Transactions TransactionsApi.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).
java-bigchaindb-driver - Official Java driver for[BigchainDB
Copyright (C) 2017 Authenteq
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as
published by the Free Software Foundation, either version 3 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.