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 CheckPayments(version uint64, testnet bool, payments currency.Map) error
- func RecordName(record interface{}) (string, bool)
- type AssetData
- type AssetIndex
- type BitmarkIssue
- type BitmarkTransfer
- type BitmarkTransferCountersigned
- func (transfer *BitmarkTransferCountersigned) GetCountersignature() account.Signature
- func (transfer *BitmarkTransferCountersigned) GetCurrencies() currency.Map
- func (transfer *BitmarkTransferCountersigned) GetLink() merkle.Digest
- func (transfer *BitmarkTransferCountersigned) GetOwner() *account.Account
- func (transfer *BitmarkTransferCountersigned) GetPayment() *Payment
- func (transfer *BitmarkTransferCountersigned) GetSignature() account.Signature
- func (transfer *BitmarkTransferCountersigned) Pack(address *account.Account) (Packed, error)
- type BitmarkTransferUnratified
- func (transfer *BitmarkTransferUnratified) GetCountersignature() account.Signature
- func (transfer *BitmarkTransferUnratified) GetCurrencies() currency.Map
- func (transfer *BitmarkTransferUnratified) GetLink() merkle.Digest
- func (transfer *BitmarkTransferUnratified) GetOwner() *account.Account
- func (transfer *BitmarkTransferUnratified) GetPayment() *Payment
- func (transfer *BitmarkTransferUnratified) GetSignature() account.Signature
- func (transfer *BitmarkTransferUnratified) Pack(address *account.Account) (Packed, error)
- type BlockFoundation
- type BlockOwnerTransfer
- func (transfer *BlockOwnerTransfer) GetCountersignature() account.Signature
- func (transfer *BlockOwnerTransfer) GetCurrencies() currency.Map
- func (transfer *BlockOwnerTransfer) GetLink() merkle.Digest
- func (transfer *BlockOwnerTransfer) GetOwner() *account.Account
- func (transfer *BlockOwnerTransfer) GetPayment() *Payment
- func (transfer *BlockOwnerTransfer) GetSignature() account.Signature
- func (transfer *BlockOwnerTransfer) Pack(address *account.Account) (Packed, error)
- type OldBaseData
- 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 types // OBSOLETE items must still be supported to process older blocks BaseDataTag = TagType(iota) // OBSOLETE: block owner AssetDataTag = TagType(iota) // create asset BitmarkIssueTag = TagType(iota) // issue asset BitmarkTransferUnratifiedTag = TagType(iota) // OBSOLETE: transfer BitmarkTransferCountersignedTag = TagType(iota) // transfer BlockFoundationTag = TagType(iota) // block owner BlockOwnerTransferTag = TagType(iota) // block owner transfer // 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
const (
FoundationVersion = 1
)
currently supported block foundation version (used by proofer)
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 CheckPayments ¶ added in v0.7.0
check all currency addresses for correct network and validity
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 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 interface { Transaction GetLink() merkle.Digest GetPayment() *Payment GetOwner() *account.Account GetCurrencies() currency.Map 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 Escrow *Payment `json:"escrow"` // optional escrow 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) GetCurrencies ¶ added in v0.7.0
func (transfer *BitmarkTransferCountersigned) GetCurrencies() currency.Map
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) 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 Escrow *Payment `json:"escrow"` // optional escrow 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) GetCurrencies ¶ added in v0.7.0
func (transfer *BitmarkTransferUnratified) GetCurrencies() currency.Map
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) 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 BlockFoundation ¶ added in v0.7.0
type BlockFoundation struct { Version uint64 `json:"version"` // reflects combination of supported currencies Payments currency.Map `json:"payments"` // contents depend on version 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 this is first tx in every block and can only be used there
func (*BlockFoundation) Pack ¶ added in v0.7.0
func (issue *BlockFoundation) Pack(address *account.Account) (Packed, error)
pack BlockFoundation
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 BlockOwnerTransfer ¶ added in v0.7.0
type BlockOwnerTransfer struct { Link merkle.Digest `json:"link"` // previous record Escrow *Payment `json:"escrow"` // optional escrow payment address Version uint64 `json:"version"` // reflects combination of supported currencies Payments currency.Map `json:"payments"` // require length and contents depend on version Owner *account.Account `json:"owner"` // base58 Signature account.Signature `json:"signature,"` // hex Countersignature account.Signature `json:"countersignature"` // hex: corresponds to owner in this record }
the unpacked Block Owner Transfer Data structure forms a chain that links back to a foundation record which has a TxId of: SHA3-256 . concat blockDigest leBlockNumberUint64
func (*BlockOwnerTransfer) GetCountersignature ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetCountersignature() account.Signature
func (*BlockOwnerTransfer) GetCurrencies ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetCurrencies() currency.Map
func (*BlockOwnerTransfer) GetLink ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetLink() merkle.Digest
func (*BlockOwnerTransfer) GetOwner ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetOwner() *account.Account
func (*BlockOwnerTransfer) GetPayment ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetPayment() *Payment
func (*BlockOwnerTransfer) GetSignature ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) GetSignature() account.Signature
func (*BlockOwnerTransfer) Pack ¶ added in v0.7.0
func (transfer *BlockOwnerTransfer) Pack(address *account.Account) (Packed, error)
pack BlockOwnerTransfer
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 OldBaseData ¶ added in v0.7.0
type OldBaseData 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 (OBSOLETE) this is first tx in every block and can only be used there
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