• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

btcsuite / btcd / 9984164707 / 4
56%
master: 55%

Build:
Build:
LAST BUILD BRANCH: spellcheck
DEFAULT BRANCH: master
Ran 18 Jul 2024 01:50AM UTC
Files 189
Run time 4s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

18 Jul 2024 01:45AM UTC coverage: 53.242% (-0.2%) from 53.406%
9984164707.4

Pull #2216

github

Roasbeef
txscript: add new ScriptTemplate DSL for writing Scripts

In this commit, we add a new function, `ScriptTemplate` to make the
process of making custom Bitcoin scripts a bit less verbose.

ScriptTemplate processes a script template with parameters and returns the
corresponding script bytes. This functions allows Bitcoin scripts to be
created using a DSL-like syntax, based on Go's templating system.

An example of a simple p2pkh template would be:

   `OP_DUP OP_HASH160 0x14e8948c7 OP_EQUALVERIFY OP_CHECKSIG`

Strings that have the `0x` prefix are assumed to byte strings to be pushed
ontop of the stack. Integers can be passed as normal. If a value can't be
parsed as an integer, then it's assume that it's a byte slice without the 0x
prefix.

Normal go template operations can be used as well. The params argument
houses paramters to pass into the script, for example a local variable
storing a computed public key.
Pull Request #2216: txscript: add new ScriptTemplate DSL for writing Scripts

24332 of 45701 relevant lines covered (53.24%)

545754.12 hits per line

Source Files on job btcd - 9984164707.4
  • Tree
  • List 189
  • Changed 54
  • Source Changed 0
  • Coverage Changed 2
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 9984164707
  • 9335b4b8 on github
  • Prev Job for on script-template (#9957391466.4)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc