Documentation
¶
Overview ¶
Package b is a library for working with B transactions (Bitcoin OP_RETURN protocol) in Go
If you have any suggestions or comments, please feel free to open an issue on this GitHub repository!
By BitcoinSchema Organization (https://bitcoinschema.org)
Index ¶
Examples ¶
Constants ¶
const Prefix = "19HxigV4QyBv3tHpQVcUEQyq1pzZVdoAut"
Prefix is the Bitcom prefix used by B
Variables ¶
This section is empty.
Functions ¶
func BitFsURL ¶
BitFsURL is a helper to create a bitfs url to fetch the content over HTTP
Example ¶
ExampleBitFsURL example using BitFsURL()
bitURL := BitFsURL(exampleTxKong, 0, 3)
fmt.Printf("url: %s", bitURL)
Output: url: https://x.bitfs.network/6ce94f75b88a6c24815d480437f4f06ae895afdab8039ddec10748660c29f910.out.0.3
Types ¶
type B ¶
B is B protocol
func NewFromTape ¶ added in v0.0.5
NewFromTape will create a new AIP object from a bob.Tape Using the FromTape() alone will prevent validation (data is needed via SetData to enable)
func NewFromTapes ¶ added in v0.0.5
NewFromTapes will create a new B object from a []bob.Tape Using the FromTapes() alone will prevent validation (data is needed via SetData to enable)
func (*B) DataURI ¶
DataURI returns a b64 encoded image that can be set directly. Ex: <img src="b64data" />
Example ¶
ExampleB_DataURI example using DataURI()
// Convert from string
bobData, _ := bob.NewFromString(exampleBobTx)
bData, _ := NewFromTape(bobData.Out[0].Tape[1])
// NOTE: The above data does not contain the actual B information from the tx it has been stripped out
fmt.Printf("data URI: %s", bData.DataURI())
Output: data URI: data:binary;base64,
func (*B) MarshalJSON ¶ added in v0.2.2
MarshalJSON custom json marshaler
func (*B) UnmarshalJSON ¶ added in v0.2.2
UnmarshalJSON custom json unmarshaler
type EncodingType ¶ added in v0.0.5
type EncodingType string
EncodingType is an enum for the possible types of data encoding
const ( EncodingBinary EncodingType = "binary" EncodingGzip EncodingType = "gzip" EncodingUtf8 EncodingType = "utf8" EncodingUtf8Alt EncodingType = "utf-8" )
Various encoding types

