Socket
Socket
Sign inDemoInstall

github.com/decred/dcrd/txscript/v4

Package Overview
Dependencies
14
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/decred/dcrd/txscript/v4

Package txscript implements the Decred transaction script language. This package provides data structures and functions to parse and execute decred transaction scripts. Decred transaction scripts are written in a stack-base, FORTH-like language. The Decred script language consists of a number of opcodes which fall into several categories such pushing and popping data to and from the stack, performing basic and bitwise arithmetic, conditional branching, comparing hashes, and checking cryptographic signatures. Scripts are processed from left to right and intentionally do not provide loops. The vast majority of Decred scripts at the time of this writing are of several standard forms which consist of a spender providing a public key and a signature which proves the spender owns the associated private key. This information is used to prove the spender is authorized to perform the transaction. One benefit of using a scripting language is added flexibility in specifying what conditions must be met in order to spend decred. The errors returned by this package are of type txscript.ErrorKind wrapped by txscript.Error which has full support for the standard library errors.Is and errors.As functions. This allows the caller to programmatically determine the specific error while still providing rich error messages with contextual information. See the constants defined with ErrorKind in the package documentation for a full list.


Version published

Readme

Source

txscript

Build Status ISC License Doc

Package txscript implements the Decred 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 Decred transaction scripts.

Decred Scripts

Decred provides a stack-based, FORTH-like language for the scripts in the Decred transactions. This language is not Turing complete although it is still fairly powerful.

Installation and Updating

This package is part of the github.com/decred/dcrd/txscript/v3 module. Use the standard go tooling for working with modules to incorporate it.

Examples

  • Counting Opcodes in Scripts Demonstrates creating a script tokenizer instance and using it to count the number of opcodes a script contains.

License

Package txscript is licensed under the copyfree ISC License.

FAQs

Last updated on 08 Jun 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc