Find file History
wpaulino txscript: add support to re-derive output's PkScript from input
In this commit, we extend the txscript package to support re-deriving
the PkScript of an output by looking at the input's signature
script/witness attempting to spend it. As of this commit, the only
supported types are P2SH, v0 P2WSH, and v0 P2WPKH.

This will serve useful to detect when a particular script has been spent
on-chain.

A set of test vectors has also been added for the supported script types
to ensure its correctness.
Latest commit 0cec774 Dec 4, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
data txscript: update reference tests to include new segwit related cases Aug 14, 2017
README.md multi: Update markdown files for GFM changes. May 25, 2017
consensus.go txscript: Implement CheckSequenceVerify (BIP0112) Oct 19, 2016
doc.go txscript: Significantly improve errors. Jan 12, 2017
engine.go txscript: Cleanup strict signature enforcement. Aug 23, 2018
engine_test.go BIP0141+txscript: implement witness program validation Aug 14, 2017
error.go txscript: Cleanup strict signature enforcement. Aug 23, 2018
error_test.go txscript: Cleanup strict signature enforcement. Aug 23, 2018
example_test.go BIP0143+txscript: add segwit sighash, signing, and HashCache integration Aug 14, 2017
hashcache.go BIP0143+txscript: add segwit sighash, signing, and HashCache integration Aug 14, 2017
hashcache_test.go multi: correct all import paths May 23, 2018
log.go all: Remove seelog logger. Jun 19, 2017
opcode.go txscript: add verification of the post-segwit pub key type constraint Aug 14, 2017
opcode_test.go txscript: Significantly improve errors. Jan 12, 2017
pkscript.go txscript: add support to re-derive output's PkScript from input Jan 12, 2019
pkscript_test.go txscript: add support to re-derive output's PkScript from input Jan 12, 2019
reference_test.go txscript: Cleanup strict signature enforcement. Aug 23, 2018
script.go multi: update to point to roasbeef forks May 23, 2018
script_test.go multi: correct all import paths May 23, 2018
scriptbuilder.go txscript: Significantly improve errors. Jan 12, 2017
scriptbuilder_test.go txscript: Significantly improve errors. Jan 12, 2017
scriptnum.go txscript: Significantly improve errors. Jan 12, 2017
scriptnum_test.go txscript: Significantly improve errors. Jan 12, 2017
sigcache.go txscript: Drop the mutex before doing crypto Jan 31, 2017
sigcache_test.go chainhash: Abstract hash logic to new package. (#729) Aug 8, 2016
sign.go txscript: export calcSignatureHash Jan 26, 2018
sign_test.go BIP0141+txscript: implement witness program validation Aug 14, 2017
stack.go multi: Simplify code per gosimple linter. Mar 22, 2017
stack_test.go txscript: Significantly improve errors. Jan 12, 2017
standard.go Require atomic swap contracts to specify the secret size. Feb 16, 2018
standard_test.go btcd/multi: fix a number of typos in comments. Jan 26, 2018

README.md

txscript

Build Status ISC License GoDoc

Package txscript implements the bitcoin transaction script language. There is a comprehensive test suite.

This package has intentionally been designed so it can be used as a standalone package for any projects needing to use or validate bitcoin transaction scripts.

Bitcoin Scripts

Bitcoin provides a stack-based, FORTH-like language for the scripts in the bitcoin transactions. This language is not turing complete although it is still fairly powerful. A description of the language can be found at https://en.bitcoin.it/wiki/Script

Installation and Updating

$ go get -u github.com/btcsuite/btcd/txscript

Examples

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