doc.go raw

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