github.com/mit-dci/lit@v0.0.0-20221102210550-8c3d3b49f2ce/btcutil/doc.go (about)

     1  // Copyright (c) 2013-2014 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 btcutil provides bitcoin-specific convenience functions and types.
     7  
     8  Block Overview
     9  
    10  A Block defines a bitcoin block that provides easier and more efficient
    11  manipulation of raw wire protocol blocks.  It also memoizes hashes for the
    12  block and its transactions on their first access so subsequent accesses don't
    13  have to repeat the relatively expensive hashing operations.
    14  
    15  Tx Overview
    16  
    17  A Tx defines a bitcoin transaction that provides more efficient manipulation of
    18  raw wire protocol transactions.  It memoizes the hash for the transaction on its
    19  first access so subsequent accesses don't have to repeat the relatively
    20  expensive hashing operations.
    21  
    22  Address Overview
    23  
    24  The Address interface provides an abstraction for a Bitcoin address.  While the
    25  most common type is a pay-to-pubkey-hash, Bitcoin already supports others and
    26  may well support more in the future.  This package currently provides
    27  implementations for the pay-to-pubkey, pay-to-pubkey-hash, and
    28  pay-to-script-hash address types.
    29  
    30  To decode/encode an address:
    31  
    32  	// NOTE: The default network is only used for address types which do not
    33  	// already contain that information.  At this time, that is only
    34  	// pay-to-pubkey addresses.
    35  	addrString := "04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962" +
    36  		"e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d57" +
    37  		"8a4c702b6bf11d5f"
    38  	defaultNet := &chaincfg.MainNetParams
    39  	addr, err := btcutil.DecodeAddress(addrString, defaultNet)
    40  	if err != nil {
    41  		fmt.Println(err)
    42  		return
    43  	}
    44  	fmt.Println(addr.EncodeAddress())
    45  */
    46  package btcutil