Package model provides data structures that represent anchor and database records.
- func EncodeOpReturn(a *Anchor) byte
- func XAnchorVersion(v uint8)
- type Anchor
- type AnchorRecord
- type BTCNet
const ( BTCTestnet3 = 3 BTCTestnet4 = 4 BTCMainnet = 255 )
func EncodeOpReturn ¶
EncodeOpReturn encodes the given Anchor to OP_RETURN.
Anchor contains an anchor that can be encoded to OP_RETURN.
func DecodeOpReturn ¶
DecodeOpReturn decodes the given bytes array to Anchor.
NewAnchor initializes an Anchor.
- btcnet sets target Bitcoin network. - timestamp sets time stamp. - bbc1dom sets BBc-1 Domain ID. - bbc1tx sets BBc-1 Transaction ID.
Anchor.BBc1DomainID and Anchor.BBc1TransactionID are fixed at 32 bytes. If the given byte is shorter than 32bytes, padding with 0. If the given byte is longer than 32bytes, only use the first 32 bytes.
type AnchorRecord ¶
AnchorRecord contains an Anchor and a Bitcoin transaction ID in which the Anchor is embedded. Some additional information from the Bitcoin transaction are also included. Some optional information NOT from the Bitcoin transaction can be added.
func NewAnchorRecord ¶
NewAnchorRecord initializes an AnchorRecord.
- anchor sets the Anchor - btctx sets the Bitcoin transaction ID in which anchor is embedded. - ts sets the time in Bitcoin transaction. - conf sets the number of confirmations. - bbc1domName sets the BBc-1 domain name. - note sets a string for note.
bbc1domName and note are not included in Bitcoin blockchain. They cannot be restored when the datastore is lost.