btcd/txscript
Olaoluwa Osuntokun cc020acce9 txscript: recognize P2A witness program during script execution
In this commit, we modify the execution logic, such that the P2A witness
program doesn't appear as a unknown witness program version. For
execution, we just make sure the script passes.
2026-05-11 18:42:58 -07:00
..
data txscript: update tx_invalid.json from Bitcoin Core 2026-04-28 22:44:05 -07:00
bench_test.go multi: fix ioutil deprecated function 2024-03-08 17:41:41 -08:00
consensus.go txscript: Implement CheckSequenceVerify (BIP0112) 2016-10-19 12:06:44 -04:00
doc.go fix some typos and make OP_DATA_20 explicit in comment (#2080) 2024-04-10 10:08:30 -04:00
engine.go txscript: recognize P2A witness program during script execution 2026-05-11 18:42:58 -07:00
engine_debug_test.go fix typos (#2100) 2024-03-25 09:44:25 -04:00
engine_p2a_test.go txscript: recognize P2A witness program during script execution 2026-05-11 18:42:58 -07:00
engine_test.go txscript: reject OP_CODESEPARATOR in unexecuted branches for non-segwit 2026-04-28 22:44:05 -07:00
error.go Merge pull request #2178 from ProofOfKeags/standardness-cleanup 2024-05-21 15:44:24 -07:00
error_test.go txscript: make OP_CODESEPARATOR non-standard in non-segwit scripts 2024-05-21 12:30:16 -07:00
example_test.go txscript: implement BIP 341+342 segwit v1 taproot+tapscript 2022-03-15 18:22:43 -07:00
hashcache.go refactor: use maps.Copy for cleaner map handling 2025-03-25 01:53:15 +08:00
hashcache_test.go txscript: implement BIP 341+342 segwit v1 taproot+tapscript 2022-03-15 18:22:43 -07:00
log.go all: Remove seelog logger. 2017-06-19 16:46:50 -04:00
opcode.go txscript: align empty CHECKSIG pubkey validation with Core 2026-04-28 22:44:05 -07:00
opcode_test.go txscript: implement OP_CHECKSIGADD 2022-03-15 18:23:26 -07:00
p2a_test.go txscript: add tests for new P2A awareness 2026-05-11 18:42:58 -07:00
pkscript.go txscript: recognize P2A scripts in ParsePkScript 2026-05-11 18:42:58 -07:00
pkscript_test.go txscript: add taproot script type 2022-03-15 18:22:25 -07:00
README.md txscript: Introduce zero-alloc script tokenizer. 2021-11-16 18:45:22 -08:00
reference_test.go txscript: support latest Core tx_invalid semantics 2026-04-28 22:44:05 -07:00
script.go txscript: use finalOpcodeData for nested P2SH redeem script extraction 2026-04-28 22:44:05 -07:00
script_test.go txscript: make OP_CODESEPARATOR non-standard in non-segwit scripts 2024-05-21 12:30:16 -07:00
scriptbuilder.go txscript: allow script builder capacity to be specified 2023-02-27 12:38:13 +01:00
scriptbuilder_test.go txscript: allow script builder capacity to be specified 2023-02-27 12:38:13 +01:00
scriptnum.go multi: remove repetitive the 2023-06-26 15:40:51 +08:00
scriptnum_test.go Export MakeScritpNum, AsSmallInt, and IsSmallInt 2023-03-03 15:05:14 -05:00
sigcache.go txscript: update SigCache to cache both ECDSA and Schnorr signatures 2022-03-15 18:22:45 -07:00
sigcache_test.go txscript: implement BIP 341+342 segwit v1 taproot+tapscript 2022-03-15 18:22:43 -07:00
sighash.go txscript: use a single shared scratch buffer in segwit sighash calc 2023-12-19 15:02:05 -08:00
sign.go txscript: support trivial signing for P2A 2026-05-11 18:42:58 -07:00
sign_test.go txscript: add tests for RawTxInTaprootSignature and RawTxInTapscriptSignature 2023-01-24 18:43:55 -08:00
sigvalidate.go Merge pull request #2178 from ProofOfKeags/standardness-cleanup 2024-05-21 15:44:24 -07:00
stack.go Export MakeScritpNum, AsSmallInt, and IsSmallInt 2023-03-03 15:05:14 -05:00
stack_test.go txscript: Significantly improve errors. 2017-01-12 13:12:39 -06:00
standard.go txscript: add initial awareness of new P2A output script 2026-05-11 18:42:58 -07:00
standard_test.go fix typos (#2100) 2024-03-25 09:44:25 -04:00
taproot.go txscript: add more detail to invalid tapscript merkle proof error 2025-06-18 18:11:24 -07:00
taproot_test.go txscript: add more detail to invalid tapscript merkle proof error 2025-06-18 18:11:24 -07:00
template.go txscript: switch template engine from html/template to text/template 2026-03-10 10:38:49 -03:00
template_test.go txscript: add new ScriptTemplate DSL for writing Scripts 2025-07-11 12:20:05 -07:00
tokenizer.go txscript: add new OpcodePosition method to tokenizer to save code sep position 2022-03-15 18:23:21 -07:00
tokenizer_test.go txscript: Introduce zero-alloc script tokenizer. 2021-11-16 18:45:22 -08:00

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.