github.com/palcoin-project/palcd@v1.0.0/txscript/doc.go (about)

     1  // Copyright (c) 2013-2017 The btcsuite developers
     2  // Use of this source code is governed by an ISC
     3  // license that can be found in the LICENSE file.
     4  
     5  /*
     6  Package txscript implements the bitcoin transaction script language.
     7  
     8  A complete description of the script language used by bitcoin can be found at
     9  https://en.bitcoin.it/wiki/Script.  The following only serves as a quick
    10  overview to provide information on how to use the package.
    11  
    12  This package provides data structures and functions to parse and execute
    13  bitcoin transaction scripts.
    14  
    15  Script Overview
    16  
    17  Bitcoin transaction scripts are written in a stack-base, FORTH-like language.
    18  
    19  The bitcoin script language consists of a number of opcodes which fall into
    20  several categories such pushing and popping data to and from the stack,
    21  performing basic and bitwise arithmetic, conditional branching, comparing
    22  hashes, and checking cryptographic signatures.  Scripts are processed from left
    23  to right and intentionally do not provide loops.
    24  
    25  The vast majority of Bitcoin scripts at the time of this writing are of several
    26  standard forms which consist of a spender providing a public key and a signature
    27  which proves the spender owns the associated private key.  This information
    28  is used to prove the the spender is authorized to perform the transaction.
    29  
    30  One benefit of using a scripting language is added flexibility in specifying
    31  what conditions must be met in order to spend bitcoins.
    32  
    33  Errors
    34  
    35  Errors returned by this package are of type txscript.Error.  This allows the
    36  caller to programmatically determine the specific error by examining the
    37  ErrorCode field of the type asserted txscript.Error while still providing rich
    38  error messages with contextual information.  A convenience function named
    39  IsErrorCode is also provided to allow callers to easily check for a specific
    40  error code.  See ErrorCode in the package documentation for a full list.
    41  */
    42  package txscript