Skip to content

Conversation

@altafan
Copy link
Collaborator

@altafan altafan commented Feb 11, 2022

This contribs to the initial effort of @sekulicd in #184 and takes the psetv2 package to a ready-to-use version.

I made a huge refactor regarding named variables, errors messages, and, more importantly, the business logic.

In particular, the blinder role has been basically split into 2 fundamental parts:

  • psetv2.Blinder is the role in charge of adding blinding data to pset's input issuances or outputs. It makes sure that everything's correct and updates also the global scalars of the partial transaction
  • confidential.zkpGenerator and confidential.zkpValidator are the implementations of psetv2.BlindingGenerator and psetv2.BlindingValidator, in charge of handling private keys to unblind inputs and public keys to generate blinding data, ie. blinders, commitments, and proofs

The package already contains some tests showing how to use psetv2 to:

  • create a fully unblinded tx
  • create a fully unblinded issuance tx
  • create an issuance tx with unblinded issuance and blinded outs
  • create a fully blinded issuance tx
  • create a fully blinded tx
  • create a fully blinded swap tx

Please @tiero @sekulicd @louisinger review this.

This closes #167
This closes #189

sekulicd added 30 commits May 20, 2020 13:41
var script, blindingKey []byte
if len(a.Address) > 0 {
script, _ = address.ToOutputScript(a.Address)
script = []byte{txscript.OP_RETURN}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OP_RETURN can be confidential too

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed.
OutputArgs is a user-friendly type without a raw field like BlindingPubKey []byte. It instead has a Address string field that can be confidential or unconfidential, and in the first case is used to set also the partial output blinding pubkey.
If the OutputArgs has a confidential address and a 0 amount, it means it's dummy confidential output, therefore only the blinding pubkey extracted from the confidential address is passed to the partial output, while the actual script is OP_RETURN.

Copy link
Member

@tiero tiero Jun 15, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmm seems not straightforward and doing a lot of implicit things, also how to embed actual data in the OP_RETURN or what if you want to burn funds ie. amount > 0?

I would take advantage of generics type here, to pass both Script && Blinding Key OR Address, to accommodate both situations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bump @altafan

Copy link
Member

@tiero tiero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the badge in README for the CI status, to point to Github Action badge

Go

Copy link
Member

@tiero tiero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add the BIP371 Taproot fields

@tiero
Copy link
Member

tiero commented May 13, 2022

btcsuite/btcd#1847

@louisinger louisinger mentioned this pull request Jun 14, 2022
@tiero tiero merged commit 1fe2fd4 into vulpemventures:master Sep 16, 2022
@altafan altafan mentioned this pull request Jan 2, 2023
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

Successfully merging this pull request may close these issues.

Support SIGHASH_RANGEPROOF

3 participants