Documentation
¶
Overview ¶
the structure of the transaction records
includes functions to pack/unpack []byte form
Index ¶
- Constants
- func AssetIndexFromBytes(assetIndex *AssetIndex, buffer []byte) error
- func RecordName(record interface{}) (string, bool)
- type AssetData
- type AssetIndex
- type BaseData
- type BitmarkIssue
- type BitmarkTransfer
- type BitmarkTransferCountersigned
- func (transfer *BitmarkTransferCountersigned) GetCountersignature() account.Signature
- func (transfer *BitmarkTransferCountersigned) GetLink() merkle.Digest
- func (transfer *BitmarkTransferCountersigned) GetOwner() *account.Account
- func (transfer *BitmarkTransferCountersigned) GetPayment() *Payment
- func (transfer *BitmarkTransferCountersigned) GetSignature() account.Signature
- func (*BitmarkTransferCountersigned) IsTransfer() bool
- func (transfer *BitmarkTransferCountersigned) Pack(address *account.Account) (Packed, error)
- type BitmarkTransferUnratified
- func (transfer *BitmarkTransferUnratified) GetCountersignature() account.Signature
- func (transfer *BitmarkTransferUnratified) GetLink() merkle.Digest
- func (transfer *BitmarkTransferUnratified) GetOwner() *account.Account
- func (transfer *BitmarkTransferUnratified) GetPayment() *Payment
- func (transfer *BitmarkTransferUnratified) GetSignature() account.Signature
- func (*BitmarkTransferUnratified) IsTransfer() bool
- func (transfer *BitmarkTransferUnratified) Pack(address *account.Account) (Packed, error)
- type Packed
- type Payment
- type PaymentAlternative
- type TagType
- type Transaction
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) BitmarkTransferUnratifiedTag = TagType(iota) BitmarkTransferCountersignedTag = 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
func (*AssetData) IsTransfer ¶ added in v0.6.7
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
func (*BaseData) IsTransfer ¶ added in v0.6.7
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
func (*BitmarkIssue) IsTransfer ¶ added in v0.6.7
func (*BitmarkIssue) IsTransfer() bool
type BitmarkTransfer ¶
type BitmarkTransfer interface {
Transaction
GetLink() merkle.Digest
GetPayment() *Payment
GetOwner() *account.Account
GetSignature() account.Signature
GetCountersignature() account.Signature
}
to access field of various transfer types
type BitmarkTransferCountersigned ¶ added in v0.6.7
type BitmarkTransferCountersigned 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
Countersignature account.Signature `json:"countersignature"` // hex: corresponds to owner in this record
}
the unpacked Countersigned BitmarkTransfer structure
func (*BitmarkTransferCountersigned) GetCountersignature ¶ added in v0.6.8
func (transfer *BitmarkTransferCountersigned) GetCountersignature() account.Signature
func (*BitmarkTransferCountersigned) GetLink ¶ added in v0.6.7
func (transfer *BitmarkTransferCountersigned) GetLink() merkle.Digest
func (*BitmarkTransferCountersigned) GetOwner ¶ added in v0.6.7
func (transfer *BitmarkTransferCountersigned) GetOwner() *account.Account
func (*BitmarkTransferCountersigned) GetPayment ¶ added in v0.6.7
func (transfer *BitmarkTransferCountersigned) GetPayment() *Payment
func (*BitmarkTransferCountersigned) GetSignature ¶ added in v0.6.8
func (transfer *BitmarkTransferCountersigned) GetSignature() account.Signature
func (*BitmarkTransferCountersigned) IsTransfer ¶ added in v0.6.7
func (*BitmarkTransferCountersigned) IsTransfer() bool
func (*BitmarkTransferCountersigned) Pack ¶ added in v0.6.7
func (transfer *BitmarkTransferCountersigned) Pack(address *account.Account) (Packed, error)
local function to pack BitmarkTransferCountersigned
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 BitmarkTransferUnratified ¶ added in v0.6.7
type BitmarkTransferUnratified 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 (*BitmarkTransferUnratified) GetCountersignature ¶ added in v0.6.8
func (transfer *BitmarkTransferUnratified) GetCountersignature() account.Signature
func (*BitmarkTransferUnratified) GetLink ¶ added in v0.6.7
func (transfer *BitmarkTransferUnratified) GetLink() merkle.Digest
func (*BitmarkTransferUnratified) GetOwner ¶ added in v0.6.7
func (transfer *BitmarkTransferUnratified) GetOwner() *account.Account
func (*BitmarkTransferUnratified) GetPayment ¶ added in v0.6.7
func (transfer *BitmarkTransferUnratified) GetPayment() *Payment
func (*BitmarkTransferUnratified) GetSignature ¶ added in v0.6.8
func (transfer *BitmarkTransferUnratified) GetSignature() account.Signature
func (*BitmarkTransferUnratified) IsTransfer ¶ added in v0.6.7
func (*BitmarkTransferUnratified) IsTransfer() bool
func (*BitmarkTransferUnratified) Pack ¶ added in v0.6.7
func (transfer *BitmarkTransferUnratified) 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
func (*Packed) UnmarshalText ¶ added in v0.5.7
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