Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Inputs will fail transaction #46

Open
omnibasissupport opened this issue Oct 30, 2019 · 0 comments
Open

Multiple Inputs will fail transaction #46

omnibasissupport opened this issue Oct 30, 2019 · 0 comments

Comments

@omnibasissupport
Copy link

omnibasissupport commented Oct 30, 2019

If you try to combine assets as described in https://www.bigchaindb.com/developers/guide/tutorial-token-launch/ it will fail.

The code only update first input fullfillment. See
this.transaction.getInputs().get(0)
.setFullFillment(Base64.encodeBase64URLSafeString(fulfillment.getEncoded()));

We fixed in upcoming release of C# driver https://github.com/Omnibasis/bigchaindb-csharp-driver

Here is a solution to proper sign fulfillments.

// based on javascript signTransaction
                    foreach (Input input in this.transaction.Inputs)
                    {
                        var transactionUniqueFulfillment = "";
                        if (input.FulFills != null)
                        {
                            FulFill fulfill = input.FulFills;
                            transactionUniqueFulfillment = jsonOrdered + fulfill.TransactionId + fulfill.OutputIndex.ToString();
                        } else
                        {
                            transactionUniqueFulfillment = jsonOrdered;
                        }
                        var transactionHash = DriverUtils.getSha3HashHex(transactionUniqueFulfillment);
                        var b = Utils.StringToByteArray(transactionHash);
                        var sig = algorithm.Sign(key, b);
                        Ed25519Sha256Fulfillment ff = new Ed25519Sha256Fulfillment(this.publicKey, sig);
                        input.FulFillment = Base64UrlEncoder.Encode(ff.Encoded);
                    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant