authenteq-zz / java-bigchaindb-driver

Official BigchainDB Java driver
https://www.bigchaindb.com
Apache License 2.0
32 stars 22 forks source link

Input/Fullfillment #18

Open stefanoba opened 7 years ago

stefanoba commented 7 years ago

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

alvin-reyes commented 7 years ago

According to the HTTP API Docs, the fullfilment is "". I don't see any examples on the documentation that uses public_key and type before it sends it. Can you cite an example here please?

stefanoba commented 7 years ago

Yes I agree, but I see in the example at https://docs.bigchaindb.com/projects/py-driver/en/latest/handcraft.html, which I report here: In [127]: input_ = { .....: 'fulfillment': output['condition']['details'], .....: 'fulfills': { .....: 'output_index': output_index, .....: 'transaction_id': signed_car_creation_tx['id'], .....: }, .....: 'owners_before': output['public_keys'], .....: } .....: Or perhaps is my misunderstanding. Thanks

alvin-reyes commented 7 years ago

I have to clarify this with the core devs, but if you look at the Java code at line 313, we already create the fulfillment using the public_key so that you have to pass redundant input to the builder.

image

May I know what exact issue are you encountering?

stefanoba commented 7 years ago

I'm working to extend the driver to support transfer transaction; we need 2 outputs and this is a json before fulfillmet I send to BCDB, which I suppose to be correct. The asset is a valid trid of a create, but we obtain the followind error trying to send the transfer transaction: { "message": "Invalid transaction schema: {'output_index': '0', 'transaction_id': 'eeb34f43a04cc887e00003408c8d32f07c897734983190cc585d7620e38fcac7'} is not valid under any of the given schemas", "status": 400 }

BAD REQUEST

We think the problem is NOT in the fulfillment, however:

JSON OF THE TRANSER TR YET TO BE FULLFILLED { "asset": { "id": "eeb34f43a04cc887e00003408c8d32f07c897734983190cc585d7620e38fcac7" }, "id": "f2d74d059cc3fa3a3cfb9a4e00045d127d8920b4c7ac2a71b426e6e9f8222082", "inputs": [ { "fulfillment": null, "fulfills": { "output_index": "0", "transaction_id": "eeb34f43a04cc887e00003408c8d32f07c897734983190cc585d7620e38fcac7" }, "owners_before": [ "9HxAT77wvmFT3m3GZk1uMAcHFuntFARbd3CaeyATvqkQ" ] } ], "metadata": {}, "operation": "TRANSFER", "outputs": [ { "amount": "98", "condition": { "details": { "public_key": "9HxAT77wvmFT3m3GZk1uMAcHFuntFARbd3CaeyATvqkQ", "type": "ed25519-sha-256" }, "uri": "ni:///sha-256;3V33xj1wqBZ060QSK6xXKNjmuG5ysWSxioZ_8jjpdxA?fpt=ed25519-sha-256&cost=131072" }, "public_keys": [ "9HxAT77wvmFT3m3GZk1uMAcHFuntFARbd3CaeyATvqkQ" ] }, { "amount": "2", "condition": { "details": { "public_key": "AAXhTfa6USiq9kv1mamg8TYe3RSx755thXGrVfoaynxj", "type": "ed25519-sha-256" }, "uri": "ni:///sha-256;Vt3iyNMd5hDj1Uny4iyGldSZQl-TerqZG4oq-Ve7LR4?fpt=ed25519-sha-256&cost=131072" }, "public_keys": [ "AAXhTfa6USiq9kv1mamg8TYe3RSx755thXGrVfoaynxj" ] } ], "version": "1.0" }

Thanks for your help, regards Stefano

stefanoba commented 7 years ago

Clicked wrong button...