Skip to content

BIP174: add hash preimage fields to inputs#955

Merged
luke-jr merged 1 commit intobitcoin:masterfrom
apoelstra:2020-07-hash-preimages-to-174
Aug 20, 2020
Merged

BIP174: add hash preimage fields to inputs#955
luke-jr merged 1 commit intobitcoin:masterfrom
apoelstra:2020-07-hash-preimages-to-174

Conversation

@apoelstra
Copy link
Copy Markdown
Contributor

@apoelstra apoelstra commented Jul 29, 2020

These fields are needed to solve miniscripts, which may have hash preimage challenges.

See https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2019-March/016720.html for some earlier (very short) discussion.

@apoelstra apoelstra force-pushed the 2020-07-hash-preimages-to-174 branch from 503bfc2 to 41c987f Compare July 29, 2020 22:06
@apoelstra apoelstra force-pushed the 2020-07-hash-preimages-to-174 branch from 41c987f to 2bc2606 Compare July 31, 2020 18:30
@apoelstra apoelstra force-pushed the 2020-07-hash-preimages-to-174 branch from 2bc2606 to 277be22 Compare August 11, 2020 17:31
@achow101
Copy link
Copy Markdown
Member

ACK 277be22

Copy link
Copy Markdown
Contributor

@benthecarman benthecarman left a comment

Choose a reason for hiding this comment

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

ACK

@dgpv
Copy link
Copy Markdown
Contributor

dgpv commented Aug 26, 2020

All the per-input fields have _IN_ in their names, but these new fields do not. Why ?

@dgpv
Copy link
Copy Markdown
Contributor

dgpv commented Aug 26, 2020

I regret not having a watch turned on the bip repo, so I'm late with my comments, this is already merged.

But IMO it would be better to have one new field, PSBT_IN_UNLOCKDATA, and a byte that specifies the type of unlock, PSBT_UNLOCKDATA_PREIMAGE_SHA256, etc. Or PSBT_IN_HASH_PREIMAGE and four types of hashes.

As I understand, there's no reason to have several preimages of different type for a single input. Thus having them in different fields creates ambiguity. Should having both SHA256 and RIPEMD160 preimages be treated as error ?

@apoelstra
Copy link
Copy Markdown
Contributor Author

@dgpv you can certainly have different kinds of preimages in one input (or multiple of a single kind of preimage)

As for the names missing _IN_, I think we should fix this. Good catch. I will open another PR.

@dr-orlovsky
Copy link
Copy Markdown
Contributor

dr-orlovsky commented Sep 7, 2020

@apoelstra, what happened to the (c) part from https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2019-March/016720.html ?

(c) a map from public keys to 32-byte "tweaks" that are used in the pay-to-contract construction

I also see no PR for it being opened...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants