btcd/chaincfg/chainhash
Olaoluwa Osuntokun e781b66e2f
txscript: implement BIP 341+342 segwit v1 taproot+tapscript
In this commit, we implement the new BIP 341+342 taproot sighash digest
computation. The digest is similar, but re-orders some fragments and
also starts to commit to the input values of all the transactions in the
SIGHASH_ALL case. A new implicit sighash flag, SIGHASH_DEFAULT has been
added that allows signatures to always be 64-bytes for the common case.

The hashcache has been updated as well to store both the v0 and v1 mid
state hashes. The v0 hashes are a double-sha of the contents, while the
v1 hash is a single sha. As a result, if a transaction spends both v0
and v1 inputs, then we 're able to re-use all the intermediate hashes.

As the sighash computation needs the input values and scripts, we create
an abstraction: the PrevOutFetcher to give the caller flexibility w.r.t
how this is done. We also create a `CannedPrevOutputFetcher` that holds
the information in a map for a single input.

A series of function options are also added to allow re-use of the same
base sig hash calculation for both BIP 341 and 342.
2022-03-15 18:22:43 -07:00
..
doc.go chainhash: Implement a new chainhash package. (#730) 2016-08-08 12:05:51 -05:00
go.mod chainhash: make module 2022-03-09 11:57:23 +01:00
hash_test.go chainhash: Implement a new chainhash package. (#730) 2016-08-08 12:05:51 -05:00
hash.go txscript: implement BIP 341+342 segwit v1 taproot+tapscript 2022-03-15 18:22:43 -07:00
hashfuncs_test.go chainhash: Implement a new chainhash package. (#730) 2016-08-08 12:05:51 -05:00
hashfuncs.go mining: drop getwork support. 2017-01-11 13:51:57 -05:00
README.md docs: update shields 2021-03-05 07:45:19 -05:00

chainhash

Build Status ISC License GoDoc

chainhash provides a generic hash type and associated functions that allows the specific hash algorithm to be abstracted.

Installation and Updating

$ go get -u github.com/btcsuite/btcd/chaincfg/chainhash

GPG Verification Key

All official release tags are signed by Conformal so users can ensure the code has not been tampered with and is coming from the btcsuite developers. To verify the signature perform the following:

  • Download the public key from the Conformal website at https://opensource.conformal.com/GIT-GPG-KEY-conformal.txt

  • Import the public key into your GPG keyring:

    gpg --import GIT-GPG-KEY-conformal.txt
    
  • Verify the release tag with the following command where TAG_NAME is a placeholder for the specific tag:

    git tag -v TAG_NAME
    

License

Package chainhash is licensed under the copyfree ISC License.