Provides bitcoin-specific convenience functions and types
Find a file
Olaoluwa Osuntokun 23db973afa
bech32: add new EncodeM and DecodeGeneric functions for bech32
In this commit, we add two new package level functions: `EncodeM`, and
`DecodeGeneric`. The new encode method is intended to allow callers to
specify that they want to use the new bech32m checksum. This should be
used when encoding segwit addresses with version 1 and beyond. The new
`DecodeGeneric` function allows a caller to decode a bech32 and bech32m
string with a single function. A new return value is added which is the
version of the returned bech32 string, which allows callers to perform
additional segwit addr validation (v1+ should use bech32m etc).

We opted to add new functions rather than modifying the existing
functions to not cause a breaking API change, as most uses in the wild
can just use the existing functions, and only taproot related logic/code
needs to worry about the new methods.

A series of tests have been added to ensure that `DecodeGeneric`
extracts the proper bech version, and we've also adopted the bech32m
tests from BIP 350.
2021-09-21 17:11:48 -07:00
.github/workflows build: replace travis with github ci 2020-10-26 09:48:59 -04:00
base58 base58: allocate less in Encode 2020-12-08 09:37:02 -05:00
bech32 bech32: add new EncodeM and DecodeGeneric functions for bech32 2021-09-21 17:11:48 -07:00
bloom Fix typo 2020-07-06 10:08:39 -04:00
coinset multi: Update markdown files for GFM changes. 2017-05-25 13:01:10 -05:00
gcs gcs/gcs: use sort.Slice instead of sort.Sort, remove uint64Slice 2019-04-25 16:57:16 -07:00
hdkeychain hdkeychain: correct BIP-32 derivation issue 2020-10-21 13:21:55 +02:00
psbt mod: update go.sum for golang 1.16.x 2021-05-27 10:06:01 +02:00
txsort multi: Update markdown files for GFM changes. 2017-05-25 13:01:10 -05:00
.gitignore Initial commit. 2013-05-28 17:20:28 -05:00
address.go address: fix stack overflow bug when printing error 2021-05-27 10:08:03 +02:00
address_test.go address: fix stack overflow bug when printing error 2021-05-27 10:08:03 +02:00
amount.go Update docs for NewAmount 2015-08-12 07:01:50 +00:00
amount_test.go Fix tiny typo 2015-07-20 11:20:46 +00:00
appdata.go build: Add gosimple linter to goclean.sh 2017-01-11 15:38:44 -05:00
appdata_test.go Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
block.go Update block.go 2020-07-13 09:48:38 -04:00
block_test.go Fix OutOfRangeError checks in block_test.go 2020-07-13 09:48:38 -04:00
certgen.go build: replace travis with github ci 2020-10-26 09:48:59 -04:00
certgen_test.go Add Common Name to certificate. 2015-06-15 16:14:08 -04:00
const.go Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
cov_report.sh Initial implementation. 2013-05-28 18:21:26 -05:00
doc.go Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
example_test.go Add testable example for UnitConversions 2015-07-22 21:20:10 +00:00
go.mod go.mod: bump to go 1.14, latest supported version 2020-10-26 09:48:59 -04:00
go.sum mod: update go.sum for golang 1.16.x 2021-05-27 10:06:01 +02:00
goclean.sh build: replace travis with github ci 2020-10-26 09:48:59 -04:00
hash160.go Switch to upstream golang.org/x/crypto 2017-05-08 23:05:27 -05:00
internal_test.go build: replace travis with github ci 2020-10-26 09:48:59 -04:00
LICENSE gcs: add package for building and using Golomb-coded set filters 2018-05-15 19:14:18 -07:00
net.go Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
net_noop.go Relicense to the btcsuite developers. 2015-05-01 12:41:58 -05:00
README.md build: replace travis with github ci 2020-10-26 09:48:59 -04:00
test_coverage.txt Add PEM encode error checking 2014-12-13 10:29:36 -05:00
tx.go Fix nil pointer dereference when WitnessHash is called before HasWitness 2020-05-05 09:28:57 +05:30
tx_test.go Fix nil pointer dereference when WitnessHash is called before HasWitness 2020-05-05 09:28:57 +05:30
wif.go Update for recent chainhash-related API changes. (#78) 2016-08-08 12:38:16 -05:00
wif_test.go Improve test coverage of WIF decoder/encoder 2020-07-06 10:32:46 -04:00

btcutil

Build Status ISC License GoDoc

Package btcutil provides bitcoin-specific convenience functions and types. A comprehensive suite of tests is provided to ensure proper functionality. See test_coverage.txt for the gocov coverage report. Alternatively, if you are running a POSIX OS, you can run the cov_report.sh script for a real-time report.

This package was developed for btcd, an alternative full-node implementation of bitcoin which is under active development by Conformal. Although it was primarily written for btcd, this package has intentionally been designed so it can be used as a standalone package for any projects needing the functionality provided.

Installation and Updating

$ go get -u github.com/btcsuite/btcutil

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 btcutil is licensed under the copyfree ISC License.