ElementsProject / ElementsProject/libwally-core

Blinding of asset issuance transaction

Open
#254 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
307
Forks
159
Avg merge
2h 56m
Merged PRs (30d)
4

Description

There's something I don't understand about the workflow to blind an asset issuance. `tx_elements_input_init` takes `issuance_amount` and `issuance_amount_rangeproof` as arguments, but how do we compute those data?

If I understand correctly, `issuance_amount` should be the value commitment to the amount of issued assets, and `issuance_amount_rangeproof` is the corresponding rangeproof.

At first I just took the value commitment and rangeproof for the newly issued asset output and put it also in the input, it didn't work and now I think I understand why, but now how should I create the right value commitment and rangeproof for the input ?

To compute a value commitment, I need the amount issued (so far so good), a value blinding factor (vbf) and a generator (I need an asset blinding factor for this one).

In a normal input, I'll take the vbf and abf from the previous transaction, but since an issuance doesn't spend a previous output, does it mean I can just take random 32 bytes for those ?

Then to compute the rangeproof, I'll need a blinding pubkey that again I'm supposed to take from the prevout, so can I just compute an ephemeral key pair and take the pubkey ?

[Here's the relevant part of my code so far](https://paste.ofcode.org/VRJJwWGdP5HVyM59PxkDNN) (I edited some parts since it's a bit long, maybe there are some inconsistencies because of that), I can produce a transaction that I can sign but I'll get a `16: bad-txns-in-ne-out` error in elements with `testmempoolaccept`, and I guess that's because my value commitments is broken but I can't see how to correct it.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.