Documentation ¶
Index ¶
- Constants
- func Base58Encode(b []byte) string
- func DecodeBIP276(text string) (prefix string, version int, network int, data []byte, err error)
- func DecodeParts(b []byte) ([][]byte, error)
- func DecodeStringParts(s string) ([][]byte, error)
- func DecodeVarInt(b []byte) (result uint64, size int)
- func DifficultyFromBits(bits string) (float64, error)
- func EncodeBIP276(prefix string, network int, version int, data []byte) string
- func EncodeParts(parts [][]byte) ([]byte, error)
- func Equals(b1 []byte, b2 []byte) bool
- func GetLittleEndianBytes(v uint32, l uint32) []byte
- func HumanHash(val float64) string
- func ReverseBytes(a []byte) []byte
- func ReverseHexString(hex string) string
- func Sha256d(b []byte) []byte
- func SortByteArrays(src [][]byte) [][]byte
- func VarInt(i uint64) []byte
Constants ¶
const ( Op0 = 0x00 // 0 OpZERO = 0x00 // 0 OpFALSE = 0x00 // 0 - AKA Op0 OpDATA1 = 0x01 // 1 OpDATA2 = 0x02 // 2 OpDATA3 = 0x03 // 3 OpDATA4 = 0x04 // 4 OpDATA5 = 0x05 // 5 OpDATA6 = 0x06 // 6 OpDATA7 = 0x07 // 7 OpDATA8 = 0x08 // 8 OpDATA9 = 0x09 // 9 OpDATA10 = 0x0a // 10 OpDATA11 = 0x0b // 11 OpDATA12 = 0x0c // 12 OpDATA13 = 0x0d // 13 OpDATA14 = 0x0e // 14 OpDATA15 = 0x0f // 15 OpDATA16 = 0x10 // 16 OpDATA17 = 0x11 // 17 OpDATA18 = 0x12 // 18 OpDATA19 = 0x13 // 19 OpDATA20 = 0x14 // 20 OpDATA21 = 0x15 // 21 OpDATA22 = 0x16 // 22 OpDATA23 = 0x17 // 23 OpDATA24 = 0x18 // 24 OpDATA25 = 0x19 // 25 OpDATA26 = 0x1a // 26 OpDATA27 = 0x1b // 27 OpDATA28 = 0x1c // 28 OpDATA29 = 0x1d // 29 OpDATA30 = 0x1e // 30 OpDATA31 = 0x1f // 31 OpDATA32 = 0x20 // 32 OpDATA33 = 0x21 // 33 OpDATA34 = 0x22 // 34 OpDATA35 = 0x23 // 35 OpDATA36 = 0x24 // 36 OpDATA37 = 0x25 // 37 OpDATA38 = 0x26 // 38 OpDATA39 = 0x27 // 39 OpDATA40 = 0x28 // 40 OpDATA41 = 0x29 // 41 OpDATA42 = 0x2a // 42 OpDATA43 = 0x2b // 43 OpDATA44 = 0x2c // 44 OpDATA45 = 0x2d // 45 OpDATA46 = 0x2e // 46 OpDATA47 = 0x2f // 47 OpDATA48 = 0x30 // 48 OpDATA49 = 0x31 // 49 OpDATA50 = 0x32 // 50 OpDATA51 = 0x33 // 51 OpDATA52 = 0x34 // 52 OpDATA53 = 0x35 // 53 OpDATA54 = 0x36 // 54 OpDATA55 = 0x37 // 55 OpDATA56 = 0x38 // 56 OpDATA57 = 0x39 // 57 OpDATA58 = 0x3a // 58 OpDATA59 = 0x3b // 59 OpDATA60 = 0x3c // 60 OpDATA61 = 0x3d // 61 OpDATA62 = 0x3e // 62 OpDATA63 = 0x3f // 63 OpDATA64 = 0x40 // 64 OpDATA65 = 0x41 // 65 OpDATA66 = 0x42 // 66 OpDATA67 = 0x43 // 67 OpDATA68 = 0x44 // 68 OpDATA69 = 0x45 // 69 OpDATA70 = 0x46 // 70 OpDATA71 = 0x47 // 71 OpDATA72 = 0x48 // 72 OpDATA73 = 0x49 // 73 OpDATA74 = 0x4a // 74 OpDATA75 = 0x4b // 75 OpPUSHDATA1 = 0x4c // 76 OpPUSHDATA2 = 0x4d // 77 OpPUSHDATA4 = 0x4e // 78 Op1NEGATE = 0x4f // 79 OpRESERVED = 0x50 // 80 OpBASE = 0x50 // 80 Op1 = 0x51 // 81 - AKA OpTRUE OpONE = 0x51 // 81 OpTRUE = 0x51 // 81 Op2 = 0x52 // 82 Op3 = 0x53 // 83 Op4 = 0x54 // 84 Op5 = 0x55 // 85 Op6 = 0x56 // 86 Op7 = 0x57 // 87 Op8 = 0x58 // 88 Op9 = 0x59 // 89 Op10 = 0x5a // 90 Op11 = 0x5b // 91 Op12 = 0x5c // 92 Op13 = 0x5d // 93 Op14 = 0x5e // 94 Op15 = 0x5f // 95 Op16 = 0x60 // 96 OpSIXTEEN = 0x60 // 96 OpNOP = 0x61 // 97 OpVER = 0x62 // 98 OpIF = 0x63 // 99 OpNOTIF = 0x64 // 100 OpVERIF = 0x65 // 101 OpVERNOTIF = 0x66 // 102 OpELSE = 0x67 // 103 OpENDIF = 0x68 // 104 OpVERIFY = 0x69 // 105 OpRETURN = 0x6a // 106 OpTOALTSTACK = 0x6b // 107 OpFROMALTSTACK = 0x6c // 108 Op2DROP = 0x6d // 109 Op2DUP = 0x6e // 110 Op3DUP = 0x6f // 111 Op2OVER = 0x70 // 112 Op2ROT = 0x71 // 113 Op2SWAP = 0x72 // 114 OpIFDUP = 0x73 // 115 OpDEPTH = 0x74 // 116 OpDROP = 0x75 // 117 OpDUP = 0x76 // 118 - Duplicate the top item in the stack OpNIP = 0x77 // 119 OpOVER = 0x78 // 120 OpPICK = 0x79 // 121 OpROLL = 0x7a // 122 OpROT = 0x7b // 123 OpSWAP = 0x7c // 124 OpTUCK = 0x7d // 125 OpCAT = 0x7e // 126 OpSPLIT = 0x7f // 127 OpNUM2BIN = 0x80 // 128 OpBIN2NUM = 0x81 // 129 OpSIZE = 0x82 // 130 OpINVERT = 0x83 // 131 OpAND = 0x84 // 132 OpOR = 0x85 // 133 OpXOR = 0x86 // 134 OpEQUAL = 0x87 // 135 - Returns 1 if the inputs are exactly equal, 0 otherwise OpEQUALVERIFY = 0x88 // 136 - Same as OP_EQUAL, but run OP_VERIFY after to halt if not TRUE OpRESERVED1 = 0x89 // 137 OpRESERVED2 = 0x8a // 138 Op1ADD = 0x8b // 139 Op1SUB = 0x8c // 140 Op2MUL = 0x8d // 141 Op2DIV = 0x8e // 142 OpNEGATE = 0x8f // 143 OpABS = 0x90 // 144 OpNOT = 0x91 // 145 Op0NOTEQUAL = 0x92 // 146 OpADD = 0x93 // 147 OpSUB = 0x94 // 148 OpMUL = 0x95 // 149 OpDIV = 0x96 // 150 OpMOD = 0x97 // 151 OpLSHIFT = 0x98 // 152 OpRSHIFT = 0x99 // 153 OpBOOLAND = 0x9a // 154 OpBOOLOR = 0x9b // 155 OpNUMEQUAL = 0x9c // 156 OpNUMEQUALVERIFY = 0x9d // 157 OpNUMNOTEQUAL = 0x9e // 158 OpLESSTHAN = 0x9f // 159 OpGREATERTHAN = 0xa0 // 160 OpLESSTHANOREQUAL = 0xa1 // 161 OpGREATERTHANOREQUAL = 0xa2 // 162 OpMIN = 0xa3 // 163 OpMAX = 0xa4 // 164 OpWITHIN = 0xa5 // 165 OpRIPEMD160 = 0xa6 // 166 OpSHA1 = 0xa7 // 167 OpSHA256 = 0xa8 // 168 OpHASH160 = 0xa9 // 169 - Return RIPEMD160(SHA256(x)) hash of top item OpHASH256 = 0xaa // 170 OpCODESEPARATOR = 0xab // 171 OpCHECKSIG = 0xac // 172 - Pop a public key and signature and validate the signature for the transaction's hashed data, return TRUE if matching OpCHECKSIGVERIFY = 0xad // 173 OpCHECKMULTISIG = 0xae // 174 OpCHECKMULTISIGVERIFY = 0xaf // 175 OpNOP1 = 0xb0 // 176 OpNOP2 = 0xb1 // 177 OpCHECKLOCKTIMEVERIFY = 0xb1 // 177 - AKA OpNOP2 OpNOP3 = 0xb2 // 178 OpCHECKSEQUENCEVERIFY = 0xb2 // 178 - AKA OpNOP3 OpNOP4 = 0xb3 // 179 OpNOP5 = 0xb4 // 180 OpNOP6 = 0xb5 // 181 OpNOP7 = 0xb6 // 182 OpNOP8 = 0xb7 // 183 OpNOP9 = 0xb8 // 184 OpNOP10 = 0xb9 // 185 OpUNKNOWN186 = 0xba // 186 OpUNKNOWN187 = 0xbb // 187 OpUNKNOWN188 = 0xbc // 188 OpUNKNOWN189 = 0xbd // 189 OpUNKNOWN190 = 0xbe // 190 OpUNKNOWN191 = 0xbf // 191 OpUNKNOWN192 = 0xc0 // 192 OpUNKNOWN193 = 0xc1 // 193 OpUNKNOWN194 = 0xc2 // 194 OpUNKNOWN195 = 0xc3 // 195 OpUNKNOWN196 = 0xc4 // 196 OpUNKNOWN197 = 0xc5 // 197 OpUNKNOWN198 = 0xc6 // 198 OpUNKNOWN199 = 0xc7 // 199 OpUNKNOWN200 = 0xc8 // 200 OpUNKNOWN201 = 0xc9 // 201 OpUNKNOWN202 = 0xca // 202 OpUNKNOWN203 = 0xcb // 203 OpUNKNOWN204 = 0xcc // 204 OpUNKNOWN205 = 0xcd // 205 OpUNKNOWN206 = 0xce // 206 OpUNKNOWN207 = 0xcf // 207 OpUNKNOWN208 = 0xd0 // 208 OpUNKNOWN209 = 0xd1 // 209 OpUNKNOWN210 = 0xd2 // 210 OpUNKNOWN211 = 0xd3 // 211 OpUNKNOWN212 = 0xd4 // 212 OpUNKNOWN213 = 0xd5 // 213 OpUNKNOWN214 = 0xd6 // 214 OpUNKNOWN215 = 0xd7 // 215 OpUNKNOWN216 = 0xd8 // 216 OpUNKNOWN217 = 0xd9 // 217 OpUNKNOWN218 = 0xda // 218 OpUNKNOWN219 = 0xdb // 219 OpUNKNOWN220 = 0xdc // 220 OpUNKNOWN221 = 0xdd // 221 OpUNKNOWN222 = 0xde // 222 OpUNKNOWN223 = 0xdf // 223 OpUNKNOWN224 = 0xe0 // 224 OpUNKNOWN225 = 0xe1 // 225 OpUNKNOWN226 = 0xe2 // 226 OpUNKNOWN227 = 0xe3 // 227 OpUNKNOWN228 = 0xe4 // 228 OpUNKNOWN229 = 0xe5 // 229 OpUNKNOWN230 = 0xe6 // 230 OpUNKNOWN231 = 0xe7 // 231 OpUNKNOWN232 = 0xe8 // 232 OpUNKNOWN233 = 0xe9 // 233 OpUNKNOWN234 = 0xea // 234 OpUNKNOWN235 = 0xeb // 235 OpUNKNOWN236 = 0xec // 236 OpUNKNOWN237 = 0xed // 237 OpUNKNOWN238 = 0xee // 238 OpUNKNOWN239 = 0xef // 239 OpUNKNOWN240 = 0xf0 // 240 OpUNKNOWN241 = 0xf1 // 241 OpUNKNOWN242 = 0xf2 // 242 OpUNKNOWN243 = 0xf3 // 243 OpUNKNOWN244 = 0xf4 // 244 OpUNKNOWN245 = 0xf5 // 245 OpUNKNOWN246 = 0xf6 // 246 OpUNKNOWN247 = 0xf7 // 247 OpUNKNOWN248 = 0xf8 // 248 OpUNKNOWN249 = 0xf9 // 249 OpSMALLINTEGER = 0xfa // 250 - bitcoin core internal OpPUBKEYS = 0xfb // 251 - bitcoin core internal OpUNKNOWN252 = 0xfc // 252 OpPUBKEYHASH = 0xfd // 253 - bitcoin core internal OpPUBKEY = 0xfe // 254 - bitcoin core internal OpINVALIDOPCODE = 0xff // 255 - bitcoin core internal )
Bitcoin Script constants
const CurrentVersion = 1
const NetworkMainnet = 1
const PrefixScript = "bitcoin-script"
Variables ¶
This section is empty.
Functions ¶
func Base58Encode ¶
Base58Encode encodes a byte slice to a modified base58 string.
func DecodeBIP276 ¶
DecodeBIP276 is used to decode BIP276 formatted data into specific (non-standard) scripts. See https://github.com/moneybutton/bips/blob/master/bip-0276.mediawiki
func DecodeParts ¶
DecodeParts returns an array of strings...
func DecodeStringParts ¶
DecodeStringParts calls DecodeParts.
func DecodeVarInt ¶
DecodeVarInt takes a byte array in VarInt format and returns the decoded unsiged integer value and it's size in bytes. See http://learnmeabitcoin.com/glossary/varint
func DifficultyFromBits ¶
DifficultyFromBits returns the mining difficulty from the nBits field in the block header.
func EncodeBIP276 ¶
EncodeBIP276 is used to encode specific (non-standard) scripts in BIP276 format. See https://github.com/moneybutton/bips/blob/master/bip-0276.mediawiki
func EncodeParts ¶
EncodeParts takes a slice of slices and returns a single slice with the appropriate OP_PUSH commands embedded.
func GetLittleEndianBytes ¶
GetLittleEndianBytes returns a byte array in little endian from an unsigned integer of 32 bytes.
func ReverseBytes ¶
ReverseBytes reverses the bytes (little endian/big endian). This is used when computing merkle trees in Bitcoin, for example.
func ReverseHexString ¶
ReverseHexString reverses the hex string (little endian/big endian). This is used when computing merkle trees in Bitcoin, for example.
func VarInt ¶
VarInt takes an unsiged integer and returns a byte array in VarInt format. See http://learnmeabitcoin.com/glossary/varint
Types ¶
This section is empty.