Skip to content

Multiple Inputs will fail transaction #46

@omnibasissupport

Description

@omnibasissupport

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions