Skip to content

Update bitcoin_hashes to 1.0#282

Open
apoelstra wants to merge 3 commits into
ElementsProject:masterfrom
apoelstra:2026-06/hashes-1.0
Open

Update bitcoin_hashes to 1.0#282
apoelstra wants to merge 3 commits into
ElementsProject:masterfrom
apoelstra:2026-06/hashes-1.0

Conversation

@apoelstra

Copy link
Copy Markdown
Member

As part of our project to modernize this library and its dependencies, upgrade to bitcoin_hashes 1.0. This has a number of API improvements:

  • replacing all the Hash trait methods with inherent methods so you don't need to import a trait anymore
  • replacing the fallible from_slice methods with infallible from_byte_array methods
  • removing the hash method and other "compute a hash from arbitrary data" methods on wrapper types like Txid; these should only be constructed in specific prescribed ways

Also includes a followup commit to #279 to improve error typing.

In ElementsProject#279 we fixed some slicing bugs in a fairly ugly way so that we could
easily backport the bugfixes without API breakage. However, the better
solution is to close the RangeProofMessage type, add a dedicated error
for parsing from an array, and update all callers.

This changes the CT validation logic to allow rangeproofs to contain
embedded asset IDs alongside explicit assets. This differs from Elements
which only allows unblinding an output if both its value and asset
commitment are confidential. However, if the confidential asset is
explicit, it seems like the "right thing to do" to embed the asset ID
and a zero blinding factor. This matches what we do in this library in
TxIn::blind_issuances_with_bfs for example.
This is a fairly big commit but it's mostly mechanical and it didn't seem
super helpful to pull it out into multiple commits. The bulk of the
prepatory work was done in ElementsProject#278.
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.

1 participant