Documentation ¶
Overview ¶
the structure of the transaction records
includes functions to pack/unpack []byte form
Index ¶
Constants ¶
const ( // null marks beginning of list - not used as a record type NullTag = TagType(iota) // valid record type BaseDataTag = TagType(iota) AssetDataTag = TagType(iota) BitmarkIssueTag = TagType(iota) BitmarkTransferTag = TagType(iota) // this item must be last InvalidTag = TagType(iota) )
enumerate the possible transaction record types this is encoded a Varint64 at start of "Packed"
const (
AssetIndexLength = 64
)
limits
Variables ¶
This section is empty.
Functions ¶
func AssetIndexFromBytes ¶
func AssetIndexFromBytes(assetIndex *AssetIndex, buffer []byte) error
convert and validate little endian binary byte slice to a assetIndex
func RecordName ¶
get the name of a transaction record as a string
Types ¶
type AssetData ¶
type AssetData struct { Name string `json:"name"` // utf-8 Fingerprint string `json:"fingerprint"` // utf-8 Metadata string `json:"metadata"` // utf-8 Registrant *account.Account `json:"registrant"` // base58 Signature account.Signature `json:"signature"` // hex }
the unpacked Asset Data structure
func (*AssetData) AssetIndex ¶
func (assetData *AssetData) AssetIndex() AssetIndex
compute an asset index
type AssetIndex ¶
type AssetIndex [AssetIndexLength]byte
the type for an asset index stored as little endian byte array represented as little endian hex text for JSON encoding convert a binary assetIndex to byte slice to get bytes value just use assetIndex[:]
func NewAssetIndex ¶
func NewAssetIndex(record []byte) AssetIndex
create an asset index from a byte slice
SHA3-512 Hash
func (AssetIndex) GoString ¶
func (assetIndex AssetIndex) GoString() string
convert a binary assetIndex to little endian hex string for use by the fmt package (for %#v)
func (AssetIndex) MarshalText ¶
func (assetIndex AssetIndex) MarshalText() ([]byte, error)
convert assetIndex to little endian hex text
func (*AssetIndex) Scan ¶
func (assetIndex *AssetIndex) Scan(state fmt.ScanState, verb rune) error
convert a little endian hex text representation to a assetIndex for use by the format package scan routines
func (AssetIndex) String ¶
func (assetIndex AssetIndex) String() string
convert a binary assetIndex to little endian hex string for use by the fmt package (for %s)
func (*AssetIndex) UnmarshalText ¶
func (assetIndex *AssetIndex) UnmarshalText(s []byte) error
convert little endian hex text into a assetIndex
type BaseData ¶
type BaseData struct { Currency currency.Currency `json:"currency"` // utf-8 → Enum PaymentAddress string `json:"paymentAddress"` // utf-8 Owner *account.Account `json:"owner"` // base58 Nonce uint64 `json:"nonce,string"` // unsigned 0..N Signature account.Signature `json:"signature,"` // hex }
the unpacked Proofer Data structure
type BitmarkIssue ¶
type BitmarkIssue struct { AssetIndex AssetIndex `json:"asset"` // link to asset record Owner *account.Account `json:"owner"` // base58: the "destination" owner Nonce uint64 `json:"nonce"` // to allow for multiple issues at the same time Signature account.Signature `json:"signature"` // hex: corresponds to owner in linked record }
the unpacked BitmarkIssue structure
type BitmarkTransfer ¶
type BitmarkTransfer struct { Link merkle.Digest `json:"link"` // previous record Payment *Payment `json:"payment"` // optional payment address Owner *account.Account `json:"owner"` // base58: the "destination" owner Signature account.Signature `json:"signature"` // hex: corresponds to owner in linked record }
the unpacked BitmarkTransfer structure
func (*BitmarkTransfer) Pack ¶
func (transfer *BitmarkTransfer) Pack(address *account.Account) (Packed, error)
local function to pack BitmarkTransfer
Pack Varint64(tag) followed by fields in order as struct above with signature last
NOTE: returns the "unsigned" message on signature failure - for
debugging/testing
type Packed ¶
type Packed []byte
packed records are just a byte slice
func (Packed) MarshalText ¶
convert a packed to its hex JSON form
type Payment ¶
type Payment struct { Currency currency.Currency `json:"currency"` // utf-8 → Enum Address string `json:"address"` // utf-8 Amount uint64 `json:"amount,string"` // number as string, in terms of smallest currency unit }
optional payment record
type PaymentAlternative ¶ added in v0.5.0
type PaymentAlternative []*Payment
a single payment possibility - for use in RPC layers up to entries:
- issue block owner payment
- last transfer block owner payment (can merge with 1 if same address)
- optional transfer payment