Giter Club home page Giter Club logo

java-bigchaindb-driver's People

Contributors

agwego avatar avanaur avatar bodia avatar bohdanbezp avatar kremalicious avatar nf-postquantum avatar nickfitton avatar rokko11 avatar tzclucian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

java-bigchaindb-driver's Issues

Input/Fullfillment

Hello,
perhaps in the class Input the property fullFillment should be a class instead of String; this because before fullFilment it is of the form { 'public_key': 'key', 'type':'type'} and after fullfilment it is the signature "fulfillment": "signature",

thanks,
Stefano

Data for an asset can be any valid json object, not necessarily a Map<String,String> currently.

Reading the BigchainDB specs data for an asset can be any valid JSON object. To that end BlockApiTest and AssetsApiTest are failing because of data elements like the following:
'''
"data": {
"CV": {
"FirstName": "John",
"LastName": "Doe"
}
},
"id": "dd67b1fb2ca4ef6649e174b602e5d92a3844b07d3f4027683a60a6efe73cbfe5"
'''
See "Asset" from the BigchainDB docs: https://docs.bigchaindb.com/projects/server/en/latest/schema/transaction.html#asset

I may try and tackle this.

There's a memory/thread leak in BigchainDbConfigBuilder.Builder.setup

When initialising the httpClient there needs to be a check that the BigChainDBGlobals.getHttpClient() is also null, otherwise every time you initialise and a new builder a new httpClient thread group is created.

I've fixed this in my local code, but waiting for my pull request to be accepted before I submit another one.

After sending ~ 4000 transactions I get an exception

java.net.SocketException: Bad file descriptor (Write failed)
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:111)
at java.net.SocketOutputStream.write(SocketOutputStream.java:155)
at okio.Okio$1.write(Okio.java:79)
at okio.AsyncTimeout$1.write(AsyncTimeout.java:180)
at okio.RealBufferedSink.flush(RealBufferedSink.java:216)
at okhttp3.internal.http1.Http1Codec.finishRequest(Http1Codec.java:164)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:84)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at com.authenteq.builders.BigchainDbConfigBuilder$Builder$1.intercept(BigchainDbConfigBuilder.java:129)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at com.authenteq.util.NetworkUtils.sendPostRequest(NetworkUtils.java:75)
at com.authenteq.api.TransactionsApi.sendTransaction(TransactionsApi.java:42)
at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.sendTransaction(BigchainDbTransactionBuilder.java:343)
at com.authenteq.api.TransactionApiTest.testPostTransactionOfObjectUsingBuilder(TransactionApiTest.java:96)
at com.authenteq.api.TransactionApiTest.testMultiple(TransactionApiTest.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Multiple BigChainDB Connection Support

The current code only supports a single connection in a runtime environment. We need a code solution to allow multiple connections that can be injected to the Apis easily.

Complex Builder and JSON Performance. POJOs and Generics.

Same notes as @Bodia added. I saw some minor tweaks (e.g. the timeout configs could be moved to Globals or given as parameters) but considering this is WIP we will get there eventually.

On a side note I was thinking that the builders got a little too complicated maybe?
Also it seems to me that we're digging through JSONs a little bit too much and we should rely more on POJOs and maybe generics in the future?

AssetsApi.getAssets returns assets but no IDs

hey guys,

we are about to use the java-bigchaindb-driver in our production system.

i think i just found that the asset API returns the requested asset-data as intended, but not the corresponding tx-ids. the regular REST API does return the tx-ids. is that a bug maybe?

thanks in advance!

cheers,
sascha

Driver build failure

Hi,
I tried to build the driver using the ./gradlew build command from the command line as indicated in the documentation.
The build failed with the output listed below.
What am I doing wrong?
Thanks,
Alex Donnini

:compileJava
warning: [options] bootstrap class path not set in conjunction with -source 1.7
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:6: error: package javax.websocket does not exist
import javax.websocket.ClientEndpoint;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:7: error: package javax.websocket does not exist
import javax.websocket.CloseReason;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:8: error: package javax.websocket does not exist
import javax.websocket.ContainerProvider;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:9: error: package javax.websocket does not exist
import javax.websocket.OnClose;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:10: error: package javax.websocket does not exist
import javax.websocket.OnMessage;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:11: error: package javax.websocket does not exist
import javax.websocket.OnOpen;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:12: error: package javax.websocket does not exist
import javax.websocket.Session;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:13: error: package javax.websocket does not exist
import javax.websocket.WebSocketContainer;
^
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:20: error: cannot find symbol
@ClientEndpoint
^
symbol: class ClientEndpoint
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:26: error: cannot find symbol
Session userSession = null;
^
symbol: class Session
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:57: error: cannot find symbol
public void onOpen(Session userSession) {
^
symbol: class Session
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:71: error: cannot find symbol
public void onClose(Session userSession, CloseReason reason) {
^
symbol: class Session
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:71: error: cannot find symbol
public void onClose(Session userSession, CloseReason reason) {
^
symbol: class CloseReason
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:56: error: cannot find symbol
@onopen
^
symbol: class OnOpen
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:70: error: cannot find symbol
@onclose
^
symbol: class OnClose
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:83: error: cannot find symbol
@OnMessage
^
symbol: class OnMessage
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:40: error: cannot find symbol
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
^
symbol: class WebSocketContainer
location: class BigchainDbWSSessionManager
/home/adonnini1/Development/BigchainDB/java-bigchaindb-driver/src/main/java/com/authenteq/ws/BigchainDbWSSessionManager.java:40: error: cannot find symbol
WebSocketContainer container = ContainerProvider.getWebSocketContainer();
^
symbol: variable ContainerProvider
location: class BigchainDbWSSessionManager
18 errors
1 warning
:compileJava FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':compileJava'.

Compilation failed; see the compiler error output for details.

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.788 secs

mvn could not resolve java-crypto-conditions dependencies

upon mvn install

[WARNING] The POM for org.interledger:java-crypto-conditions:jar:2.0.0-SNAPSHOT is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.227 s
[INFO] Finished at: 2017-09-12T17:40:09+02:00
[INFO] Final Memory: 10M/303M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project java-bigchaindb-driver: Could not resolve dependencies for project com.authenteq:java-bigchaindb-driver:jar:0.1: Could not find artifact org.interledger:java-crypto-conditions:jar:2.0.0-SNAPSHOT -> [Help 1]

mvn -v

Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_131, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-openjdk-amd64/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.8.0-59-generic", arch: "amd64", family: "unix"

Problem with examples

Hi,

If I am not mistaken, the code in the examples, e.g.

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());

does not work any longer as BigchainDbTransactionBuilder does not have an addAsset method any longer.

I also think that the information in test.properties needs to be updated.

Could you please provide update examples and updated test.properties?

Thanks,

Alex Donnini

Experiencing SSL Timeouts, appears to be on the Server side

Java Stack Trace (JDK 1.8_144)

Compression Methods:  { 0 }
Extension elliptic_curves, curve names: {secp256r1, secp384r1, secp521r1, sect283k1, sect283r1, sect409k1, sect409r1, sect571k1, sect571r1, secp256k1}
Extension ec_point_formats, formats: [uncompressed]
Extension signature_algorithms, signature_algorithms: SHA512withECDSA, SHA512withRSA, SHA384withECDSA, SHA384withRSA, SHA256withECDSA, SHA256withRSA, SHA256withDSA, SHA1withECDSA, SHA1withRSA, SHA1withDSA
Extension renegotiation_info, renegotiated_connection: <empty>
***
main, WRITE: TLSv1.2 Handshake, length = 134
main, received EOFException: error
main, handling exception: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
main, SEND TLSv1.2 ALERT:  fatal, description = handshake_failure
main, WRITE: TLSv1.2 Alert, length = 2
main, called closeSocket()
main, called close()
main, called closeInternal(true)
Exception in thread "main" javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1002)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1385)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1413)
	at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1397)
	at okhttp3.internal.connection.RealConnection.connectTls(RealConnection.java:299)
	at okhttp3.internal.connection.RealConnection.establishProtocol(RealConnection.java:268)
	at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:160)
	at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:256)
	at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:134)
	at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:113)
	at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at com.authenteq.builders.BigchainDbConfigBuilder$Builder$1.intercept(BigchainDbConfigBuilder.java:129)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
	at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
	at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
	at okhttp3.RealCall.execute(RealCall.java:77)
	at com.authenteq.util.NetworkUtils.sendPostRequest(NetworkUtils.java:65)
	at com.authenteq.api.TransactionsApi.sendTransaction(TransactionsApi.java:42)
	at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.sendTransaction(BigchainDbTransactionBuilder.java:343)
	at side.bdb.server.SideBdbServer.testBigChainDb(SideBdbServer.java:70)
	at side.bdb.server.SideBdbServer.main(SideBdbServer.java:46)
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at sun.security.ssl.InputRecord.read(InputRecord.java:505)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:983)
	... 30 more

BigchainDB Server log, debug is on but it is of little use.

[2017-11-13 22:27:30] [CRITICAL] (gunicorn.error) WORKER TIMEOUT (pid:12173) (webapi     - pid: 12151)
[2017-11-13 22:27:30] [INFO] (gunicorn.error) Worker exiting (pid: 12173) (webapi     - pid: 12173)
[2017-11-13 22:27:30] [INFO] (gunicorn.error) Booting worker with pid: 12273 (webapi     - pid: 12273)

I've tested the python driver with sample code and the test passes.

Getting Error when Trying Send Transaction

I'm trying to run a few basic tests on creating a transaction but I kept on running to this issue.

Any clue as to why this is happening?
Thanks

{
  "asset": {
    "id": null,
    "data": {
      "firstname": "alvin"
    }
  },
  "id": "a913974543a18bf8f7e87317a701bca533aacc2688c960ce86ee2c4408d45849",
  "inputs": [
    {
      "fulfillment": "pGSAIPMHO-u2dl1aprcNK4BrrsDH0bcGpfYaFwJa2okBA_0RgUBsLat3v6ZDEU-EJSZh-Wtwd1REwQ6pP_qkPKngdmBrUSWOM3PZA4oOB_CT62Go3k07ghHM_NgASx5LZPGG6LwJ",
      "fulfills": null,
      "owners_before": [
        "HMgUAhVDWLMxQMUkPagifnaMCTY7UhqfkbsZX6LWNx5v"
      ]
    }
  ],
  "metadata": {
    "what": "bigchaintrans"
  },
  "operation": "CREATE",
  "outputs": [
    {
      "amount": "1",
      "condition": {
        "details": {
          "public_key": "HMgUAhVDWLMxQMUkPagifnaMCTY7UhqfkbsZX6LWNx5v",
          "type": "ed25519-sha-256"
        },
        "uri": "ni:///sha-256;2wpNvVFTeq5fWWvt8xlICgqOmHHigSYvr0s5n60FZEw?fpt\u003ded25519-sha-256\u0026cost\u003d131072"
      },
      "public_keys": [
        "HMgUAhVDWLMxQMUkPagifnaMCTY7UhqfkbsZX6LWNx5v"
      ]
    }
  ],
  "version": "1.0"
}

Result

https://test.ipdb.io/api/v1/transactions > 400
{
  "message": "Invalid transaction schema: None is not of type 'string'", 
  "status": 400
}


Sending a transaction without meta-data generates a bad request.

When sending a transaction without a meta-data value it is being serialized as an empty dictionary {} BigchainDB is expecting null.

You can use a GSON TypeAdapter like this one: http://chrisjenx.com/gson-empty-json-to-null/

Client JDK 1.8_144 on Windows 7
Server running on Ubuntu 16.04.3 LTS
BigchainDB 1.0.1

The error:

{
  "message": "Invalid transaction schema: {} is not valid under any of the given schemas", 
  "status": 400
}

Code Snippet to reproduce

net.i2p.crypto.eddsa.KeyPairGenerator edDsaKpg = new net.i2p.crypto.eddsa.KeyPairGenerator();
KeyPair alice = edDsaKpg.generateKeyPair();
		
Car carClassic = new Car( "n0tp01ntAt0p01ntB", "classik", "manual", "RWD" );
		
Transaction transaction = BigchainDbTransactionBuilder.init()
		                               .addAssets( carClassic.AsAsset() )
		                               .buildAndSign( (EdDSAPublicKey) alice.getPublic(), (EdDSAPrivateKey) alice.getPrivate() )
		                               .sendTransaction();

BAD REQUEST

{
  "asset": {
    "data": {
      "drivetrain": "RWD",
      "manufacturer": "classik",
      "serial_code": "n0tp01ntAt0p01ntB",
      "transmission": "manual"
    }
  },
  "id": "adbde0c80ed8edb1dd0b71e8ed3aeb6209a08f8aa8bf49df68c019e5d9f08447",
  "inputs": [
    {
      "fulfillment": "pGSAIGc_c7TkewjLZdStcdcmbqBb5zE9rzA2wh1BsqDxWnyqgUCzXuFyIorrQNWzR3EGiw6F0g-j2tqgRT05UlvC35e9-GH9zoBXdX1jER4hnnFwK7vjW3vprVAcB57b5tfGoEIF",
      "fulfills": null,
      "owners_before": [
        "7x37PSyjmDfL9m9orFDWYrvBj2e7h7AuJN5qtPJFzecZ"
      ]
    }
  ],
  "metadata": {},
  "operation": "CREATE",
  "outputs": [
    {
      "amount": "1",
      "condition": {
        "details": {
          "public_key": "7x37PSyjmDfL9m9orFDWYrvBj2e7h7AuJN5qtPJFzecZ",
          "type": "ed25519-sha-256"
        },
        "uri": "ni:///sha-256;QxMQHdFMoZXrVhfn5HmbzURbWeySolBMmZyBDw7b-pA?fpt=ed25519-sha-256&cost=131072"
      },
      "public_keys": [
        "7x37PSyjmDfL9m9orFDWYrvBj2e7h7AuJN5qtPJFzecZ"
      ]
    }
  ],
  "version": "1.0"
}

A good request from the Python:

{
	"operation": "CREATE",
	"inputs": [{
		"owners_before": ["4WG1Yi1kcjHPVKs5ijc4LxczBHr9KZUdXpJ2sze6FKuy"],
		"fulfills": null,
		"fulfillment": {
			"public_key": "4WG1Yi1kcjHPVKs5ijc4LxczBHr9KZUdXpJ2sze6FKuy",
			"type": "ed25519-sha-256"
		}
	}],
	"id": "40c3a05b57f1fafb78e4bdec453a7f46131a8f45b4092b541e10f5ff36120ce1",
	"asset": {
		"data": {
			"car": {
				"manufacturer": "classik",
				"serial_code": "n0tp01ntAt0p01ntB",
				"transmission": "manual",
				"drivetrain": "RWD"
			}
		}
	},
	"version": "1.0",
	"outputs": [{
		"public_keys": ["4WG1Yi1kcjHPVKs5ijc4LxczBHr9KZUdXpJ2sze6FKuy"],
		"condition": {
			"uri": "ni:///sha-256;7c-tWpMLQhJOCNnEMIC0MBhc-03_RZ2C9yt5W3I0GXQ?fpt=ed25519-sha-256&cost=131072",
			"details": {
				"public_key": "4WG1Yi1kcjHPVKs5ijc4LxczBHr9KZUdXpJ2sze6FKuy",
				"type": "ed25519-sha-256"
			}
		},
		"amount": "1"
	}],
	"metadata": null
}

WARNING: A connection to ... was leaked. Did you forget to close a response body?

okhttp3 throws this warning.
I have a number of transactions I am trying to send.
After a while sending transactions starts to fail I see on bigchaindb side messages like
[CRITICAL] (gunicorn.error) WORKER TIMEOUT (pid:1509) (webapi - pid: 181)
I keep retrying and after a minute or so I get okhttp3 warning When transactions start flowing again

Installed .jar is missing some classes

Steps.

  1. I've checked out this repo.
  2. I've done a ./gradlew install
  3. I can see the installed dependency:
    .m2/repository/com/authenteq/java-crypto-conditions/0.1/java-crypto-conditions-0.1.jar

Shouldn't this be called java-bigchaindb-driver? I saw this.

I import the dependency in a maven project:

        <dependency>
            <groupId>com.authenteq</groupId>
            <artifactId>java-crypto-conditions</artifactId>
            <version>0.1</version>
        </dependency>

I'm not able to create a transaction, I get the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: org/interledger/cryptoconditions/types/Ed25519Sha256Condition
	at com.authenteq.BigchaindbTransaction.buildTransactionJson(BigchaindbTransaction.java:83)
	at com.authenteq.BigchaindbTransaction.<init>(BigchaindbTransaction.java:59)
	at com.rezzonade.persistence.bigchaindb.Example.main(Example.java:52)
Caused by: java.lang.ClassNotFoundException: org.interledger.cryptoconditions.types.Ed25519Sha256Condition
	at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	... 3 more

I can solve this by manually installing java-crypto-conditions-2.0.0-SNAPSHOT.jar by using:

mvn install:install-file -Dfile=yourClonedRepo/libs/java-crypto-conditions-2.0.0-SNAPSHOT.jar -DgroupId=org.interledger -DartifactId=java-crypto-conditions -Dversion=2.0.0-SNAPSHOT -Dpackaging=jar

Am I missing something or are these actual bugs?

failure to build driver

Hi,
I just tried to compile the bigchaindb java driver working in Eclipse-Oxygen using the Buildship 2.2 add-on.

Here is a link to the zipped tests report folder
tests.zip

Below, you will find the gradle log.

Perhaps, I did something wrong. Please let me know.

Thanks,

Alex Donnini

Working Directory: /home/adonnini1/Development/workspaceLunaAndMore/java-bigchaindb-driver
Gradle User Home: /home/adonnini1/.gradle
Gradle Distribution: Gradle wrapper from target build
Gradle Version: 2.14
Java Home: /usr/lib/jvm/java-8-openjdk-amd64
JVM Arguments: None
Program Arguments: None
Build Scans Enabled: false
Offline Mode Enabled: false
Gradle Tasks: :build

:compileJavawarning: [options] bootstrap class path not set in conjunction with -source 1.7
1 warning

:processResources UP-TO-DATE
:classes
:jar
:assemble
:compileTestJavawarning: [options] bootstrap class path not set in conjunction with -source 1.7
Note: /home/adonnini1/Development/workspaceLunaAndMore/java-bigchaindb-driver/src/test/java/com/authenteq/BigchaindbTransactionTest.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
1 warning

:processTestResources
:testClasses
:test

com.authenteq.api.VotesApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

com.authenteq.api.AssetsApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

com.authenteq.api.BlocksApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

com.authenteq.api.TransactionApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

com.authenteq.api.OutputsApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

com.authenteq.api.StatusesApiTest > classMethod FAILED
com.google.gson.JsonSyntaxException
Caused by: java.lang.IllegalStateException

17 tests completed, 6 failed
:test FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':test'.

There were failing tests. See the report at: file:///home/adonnini1/Development/workspaceLunaAndMore/java-bigchaindb-driver/build/reports/tests/index.html

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 2.239 secs

Driver incompatibility problems with spring-boot

I've got a spring-boot:1.5.3.RELEASE project.

I was using spring-boot-starter-test.
It has the following dependencies:

[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:compile
[INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:compile
[INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:compile
[INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:compile
[INFO] |  |        \- org.ow2.asm:asm:jar:5.0.3:compile
[INFO] |  +- junit:junit:jar:4.12:compile
[INFO] |  +- org.assertj:assertj-core:jar:2.6.0:compile
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:compile
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:runtime
[INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:compile
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:compile
[INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:compile
[INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:compile

Unfortunately the org.json.JSONObject from com.vaadin.external.google:android-json dependency (see screenshot below) conflicts with org.json.JSONObjectfrom org.json:json

screenshot 2017-10-22 20 29 06

This conflict is causing the following exception initially:

java.lang.NoSuchFieldException: map
	at java.lang.Class.getDeclaredField(Class.java:2070)
	at com.authenteq.util.DriverUtils.makeSelfSorting(DriverUtils.java:79)
	at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.sign(BigchainDbTransactionBuilder.java:304)
	at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.buildAndSign(BigchainDbTransactionBuilder.java:323)

and later on

java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
	at java.util.ArrayList.rangeCheck(ArrayList.java:653) ~[na:1.8.0_101]
	at java.util.ArrayList.get(ArrayList.java:429) ~[na:1.8.0_101]
	at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.sign(BigchainDbTransactionBuilder.java:310) ~[java-bigchaindb-driver-0.1.jar:na]
	at com.authenteq.builders.BigchainDbTransactionBuilder$Builder.buildAndSign(BigchainDbTransactionBuilder.java:323) ~[java-bigchaindb-driver-0.1.jar:na]

We should consider addressing this.
What do you think?

One of the possible workarounds/solutions for this would be to modify the pom.xml to exclude that dependency (not very nice).

            <exclusions>
                <exclusion>
                    <groupId>org.skyscreamer</groupId>
                    <artifactId>jsonassert</artifactId>
                </exclusion>
            </exclusions>

Latest git pull is failing in mvn.

Failing in TransactionApiTest

'''
ACCEPTED
Tests run: 5, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 8.689 sec <<< FAILURE!
testTransactionByAssetIdTransfer(com.authenteq.api.TransactionApiTest) Time elapsed: 0.648 sec <<< FAILURE!
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at com.authenteq.api.TransactionApiTest.testTransactionByAssetIdTransfer(TransactionApiTest.java:151)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

testTransactionByAssetIdCreate(com.authenteq.api.TransactionApiTest) Time elapsed: 0.849 sec <<< FAILURE!
java.lang.AssertionError
at org.junit.Assert.fail(Assert.java:86)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.junit.Assert.assertTrue(Assert.java:52)
at com.authenteq.api.TransactionApiTest.testTransactionByAssetIdCreate(TransactionApiTest.java:135)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:252)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:141)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

'''

Cannot create transaction from JSON

First of all I have to mention this is my first day playing with this.

I've started by running the tests, I get the following error:

java.lang.NullPointerException
	at com.authenteq.BigchaindbTransaction.buildTransactionJson(BigchaindbTransaction.java:124)
	at com.authenteq.BigchaindbTransaction.<init>(BigchaindbTransaction.java:59)
	at com.authenteq.BigchaindbTransactionTest.transactionGenerationTest(BigchaindbTransactionTest.java:141)

Same happens when I try to create a transaction:

        byte[] publicKey = Base58.decode("where-do-i-get-this-public-key-from?");
        EdDSAParameterSpec keySpecs = EdDSANamedCurveTable.getByName("Ed25519");
        EdDSAPublicKeySpec spec = new EdDSAPublicKeySpec(publicKey, keySpecs);
        EdDSAPublicKey edDSAPublicKey = new EdDSAPublicKey(spec);

        JSONObject data = new JSONObject(aDummyHashMap);
        JSONObject metaData = new JSONObject(anotherDummyHashMap);

        BigchaindbTransaction tx = new BigchaindbTransaction(data, metadata, edDSAPublicKey);

        bigchaindbConnection.send(tx, new TransactionCallbackImpl());

I get the same error:

Exception in thread "main" java.lang.NullPointerException
	at com.authenteq.BigchaindbTransaction.buildTransactionJson(BigchaindbTransaction.java:124)
	at com.authenteq.BigchaindbTransaction.<init>(BigchaindbTransaction.java:59)

Any ideas on what's happening?

CI Build failure due to missing crypto-condition dependencies

Travis CI is failing due to this missing dependency. Need to use the latest and greatest crypto condition library

[ERROR] Failed to execute goal on project java-bigchaindb-driver: Could not resolve dependencies for project com.authenteq:java-bigchaindb-driver:jar:0.0.1-SNAPSHOT: Could not find artifact org.interledger:java-crypto-conditions:jar:2.0.0-SNAPSHOT in sonatype-snapshots (https://oss.sonatype.org/content/repositories/snapshots/)

https://travis-ci.org/authenteq/java-bigchaindb-driver

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.