Documentation
¶
Index ¶
- Constants
- Variables
- func ComputeMonthlyBotFees(months uint8, oneCoin types.Currency) types.Currency
- func IsERC20Address(str string) bool
- func IsERC20Hash(str string) bool
- func RegisterBlockHeightLimitedMultiSignatureCondition(blockHeight types.BlockHeight)
- func RegisterTransactionTypesForDevNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, ...)
- func RegisterTransactionTypesForStandardNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, ...)
- func RegisterTransactionTypesForTestNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, ...)
- type BotID
- type BotIdentifierSignaturePair
- type BotMonthsAndFlagsData
- type BotName
- func (bn BotName) Compare(obn BotName) int
- func (bn BotName) Equals(obn BotName) bool
- func (bn *BotName) LoadString(str string) (err error)
- func (bn BotName) MarshalJSON() ([]byte, error)
- func (bn BotName) MarshalRivine(w io.Writer) error
- func (bn BotName) MarshalSia(w io.Writer) error
- func (bn BotName) String() string
- func (bn *BotName) UnmarshalJSON(b []byte) error
- func (bn *BotName) UnmarshalRivine(r io.Reader) error
- func (bn *BotName) UnmarshalSia(r io.Reader) error
- type BotNameSortedSet
- func (bnss *BotNameSortedSet) AddName(name BotName) error
- func (bnss *BotNameSortedSet) BinaryDecode(r io.Reader, length int) error
- func (bnss BotNameSortedSet) BinaryEncode(w io.Writer) (int, error)
- func (bnss BotNameSortedSet) Difference(other BotNameSortedSet) []BotName
- func (bnss BotNameSortedSet) Intersection(other BotNameSortedSet) []BotName
- func (bnss BotNameSortedSet) Len() int
- func (bnss BotNameSortedSet) MarshalJSON() ([]byte, error)
- func (bnss BotNameSortedSet) MarshalRivine(w io.Writer) error
- func (bnss BotNameSortedSet) MarshalSia(w io.Writer) error
- func (bnss *BotNameSortedSet) RemoveName(name BotName) error
- func (bnss *BotNameSortedSet) UnmarshalJSON(data []byte) error
- func (bnss *BotNameSortedSet) UnmarshalRivine(r io.Reader) error
- func (bnss *BotNameSortedSet) UnmarshalSia(r io.Reader) error
- type BotNameTransferTransaction
- func (bnttx BotNameTransferTransaction) MarshalRivine(w io.Writer) error
- func (bnttx BotNameTransferTransaction) MarshalSia(w io.Writer) error
- func (bnttx *BotNameTransferTransaction) RequiredBotFee(oneCoin types.Currency) types.Currency
- func (bnttx *BotNameTransferTransaction) RevertReceiverBotRecordUpdate(record *BotRecord) error
- func (bnttx *BotNameTransferTransaction) RevertSenderBotRecordUpdate(record *BotRecord) error
- func (bnttx *BotNameTransferTransaction) Transaction(oneCoin types.Currency) types.Transaction
- func (bnttx *BotNameTransferTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
- func (bnttx *BotNameTransferTransaction) UnmarshalRivine(r io.Reader) error
- func (bnttx *BotNameTransferTransaction) UnmarshalSia(r io.Reader) error
- func (bnttx *BotNameTransferTransaction) UpdateReceiverBotRecord(blockTime types.Timestamp, record *BotRecord) error
- func (bnttx *BotNameTransferTransaction) UpdateSenderBotRecord(blockTime types.Timestamp, record *BotRecord) error
- type BotNameTransferTransactionController
- func (bnttc BotNameTransferTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (bnttc BotNameTransferTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (bnttc BotNameTransferTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (bnttc BotNameTransferTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
- func (bnttc BotNameTransferTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (bnttc BotNameTransferTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (bnttc BotNameTransferTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (bnttc BotNameTransferTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (bnttc BotNameTransferTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (bnttc BotNameTransferTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type BotNameTransferTransactionExtension
- type BotRecord
- func (record *BotRecord) AddNames(names ...BotName) error
- func (record *BotRecord) AddNetworkAddresses(addresses ...NetworkAddress) error
- func (record *BotRecord) ExtendExpirationDate(blockTime types.Timestamp, addedMonths uint8) error
- func (record *BotRecord) IsExpired(blockTime types.Timestamp) bool
- func (record BotRecord) MarshalRivine(w io.Writer) error
- func (record BotRecord) MarshalSia(w io.Writer) error
- func (record *BotRecord) RemoveNames(names ...BotName) error
- func (record *BotRecord) RemoveNetworkAddresses(addresses ...NetworkAddress) error
- func (record *BotRecord) ResetNames()
- func (record *BotRecord) UnmarshalRivine(r io.Reader) error
- func (record *BotRecord) UnmarshalSia(r io.Reader) error
- type BotRecordAddressUpdate
- type BotRecordNameUpdate
- type BotRecordReadRegistry
- type BotRecordUpdateTransaction
- func (brutx BotRecordUpdateTransaction) MarshalRivine(w io.Writer) error
- func (brutx BotRecordUpdateTransaction) MarshalSia(w io.Writer) error
- func (brutx *BotRecordUpdateTransaction) RequiredBotFee(oneCoin types.Currency) (fee types.Currency)
- func (brutx *BotRecordUpdateTransaction) RevertBotRecordUpdate(record *BotRecord) error
- func (brutx *BotRecordUpdateTransaction) Transaction(oneCoin types.Currency) types.Transaction
- func (brutx *BotRecordUpdateTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
- func (brutx *BotRecordUpdateTransaction) UnmarshalRivine(r io.Reader) error
- func (brutx *BotRecordUpdateTransaction) UnmarshalSia(r io.Reader) error
- func (brutx *BotRecordUpdateTransaction) UpdateBotRecord(blockTime types.Timestamp, record *BotRecord) error
- type BotRecordUpdateTransactionExtension
- type BotRegistrationTransaction
- func (brtx BotRegistrationTransaction) MarshalRivine(w io.Writer) error
- func (brtx BotRegistrationTransaction) MarshalSia(w io.Writer) error
- func (brtx *BotRegistrationTransaction) RequiredBotFee(oneCoin types.Currency) types.Currency
- func (brtx *BotRegistrationTransaction) Transaction(oneCoin types.Currency) types.Transaction
- func (brtx *BotRegistrationTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
- func (brtx *BotRegistrationTransaction) UnmarshalRivine(r io.Reader) error
- func (brtx *BotRegistrationTransaction) UnmarshalSia(r io.Reader) error
- type BotRegistrationTransactionController
- func (brtc BotRegistrationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (brtc BotRegistrationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (brtc BotRegistrationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (brtc BotRegistrationTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
- func (brtc BotRegistrationTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
- func (brtc BotRegistrationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (brtc BotRegistrationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (brtc BotRegistrationTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (brtc BotRegistrationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (brtc BotRegistrationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (brtc BotRegistrationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type BotRegistrationTransactionExtension
- type BotUpdateRecordTransactionController
- func (brutc BotUpdateRecordTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (brutc BotUpdateRecordTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (brutc BotUpdateRecordTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (brutc BotUpdateRecordTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
- func (brutc BotUpdateRecordTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (brutc BotUpdateRecordTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (brutc BotUpdateRecordTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (brutc BotUpdateRecordTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (brutc BotUpdateRecordTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (brutc BotUpdateRecordTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type CoinCreationTransaction
- type CoinCreationTransactionController
- func (cctc CoinCreationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (cctc CoinCreationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (cctc CoinCreationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (cctc CoinCreationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (cctc CoinCreationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (cctc CoinCreationTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (cctc CoinCreationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (cctc CoinCreationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (cctc CoinCreationTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (cctc CoinCreationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) (err error)
- type CoinCreationTransactionExtension
- type CompactTimestamp
- func (cts CompactTimestamp) MarshalRivine(w io.Writer) error
- func (cts CompactTimestamp) MarshalSia(w io.Writer) error
- func (cts *CompactTimestamp) SetUInt32(x uint32)
- func (cts CompactTimestamp) SiaTimestamp() types.Timestamp
- func (cts CompactTimestamp) UInt32() uint32
- func (cts *CompactTimestamp) UnmarshalJSON(b []byte) error
- func (cts *CompactTimestamp) UnmarshalRivine(r io.Reader) error
- func (cts *CompactTimestamp) UnmarshalSia(r io.Reader) error
- type DefaultTransactionController
- type ERC20Address
- type ERC20AddressRegistrationTransaction
- func (eartx ERC20AddressRegistrationTransaction) MarshalJSON() ([]byte, error)
- func (eartx ERC20AddressRegistrationTransaction) MarshalRivine(w io.Writer) error
- func (eartx ERC20AddressRegistrationTransaction) MarshalSia(w io.Writer) error
- func (eartx *ERC20AddressRegistrationTransaction) Transaction() types.Transaction
- func (eartx *ERC20AddressRegistrationTransaction) TransactionData() types.TransactionData
- func (eartx *ERC20AddressRegistrationTransaction) UnmarshalJSON(data []byte) error
- func (eartx *ERC20AddressRegistrationTransaction) UnmarshalRivine(r io.Reader) error
- func (eartx *ERC20AddressRegistrationTransaction) UnmarshalSia(r io.Reader) error
- type ERC20AddressRegistrationTransactionController
- func (eartc ERC20AddressRegistrationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (eartc ERC20AddressRegistrationTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
- func (eartc ERC20AddressRegistrationTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
- func (eartc ERC20AddressRegistrationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (eartc ERC20AddressRegistrationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (eartc ERC20AddressRegistrationTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (eartc ERC20AddressRegistrationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (eartc ERC20AddressRegistrationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (eartc ERC20AddressRegistrationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type ERC20AddressRegistrationTransactionExtension
- type ERC20AddressRegistrationTransactionJSON
- type ERC20CoinCreationTransaction
- func (etctx ERC20CoinCreationTransaction) MarshalRivine(w io.Writer) error
- func (etctx ERC20CoinCreationTransaction) MarshalSia(w io.Writer) error
- func (etctx *ERC20CoinCreationTransaction) Transaction() types.Transaction
- func (etctx *ERC20CoinCreationTransaction) TransactionData() types.TransactionData
- func (etctx *ERC20CoinCreationTransaction) UnmarshalRivine(r io.Reader) error
- func (etctx *ERC20CoinCreationTransaction) UnmarshalSia(r io.Reader) error
- type ERC20CoinCreationTransactionController
- func (etctc ERC20CoinCreationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (etctc ERC20CoinCreationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (etctc ERC20CoinCreationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (etctc ERC20CoinCreationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (etctc ERC20CoinCreationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (etctc ERC20CoinCreationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (etctc ERC20CoinCreationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (etctc ERC20CoinCreationTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (etctc ERC20CoinCreationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type ERC20CoinCreationTransactionExtension
- type ERC20ConvertTransaction
- func (etctx ERC20ConvertTransaction) MarshalRivine(w io.Writer) error
- func (etctx ERC20ConvertTransaction) MarshalSia(w io.Writer) error
- func (etctx *ERC20ConvertTransaction) Transaction() types.Transaction
- func (etctx *ERC20ConvertTransaction) TransactionData() types.TransactionData
- func (etctx *ERC20ConvertTransaction) UnmarshalRivine(r io.Reader) error
- func (etctx *ERC20ConvertTransaction) UnmarshalSia(r io.Reader) error
- type ERC20ConvertTransactionController
- func (etctc ERC20ConvertTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (etctc ERC20ConvertTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (etctc ERC20ConvertTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (etctc ERC20ConvertTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (etctc ERC20ConvertTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (etctc ERC20ConvertTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (etctc ERC20ConvertTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (etctc ERC20ConvertTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, ...) error
- func (etctc ERC20ConvertTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) error
- type ERC20ConvertTransactionExtension
- type ERC20Hash
- type ERC20Registry
- type ERC20TransactionValidator
- type LegacyTransactionController
- type MintConditionGetter
- type MinterDefinitionTransaction
- type MinterDefinitionTransactionController
- func (mdtc MinterDefinitionTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
- func (mdtc MinterDefinitionTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
- func (mdtc MinterDefinitionTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
- func (mdtc MinterDefinitionTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
- func (mdtc MinterDefinitionTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
- func (mdtc MinterDefinitionTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
- func (mdtc MinterDefinitionTransactionController) SignExtension(extension interface{}, ...) (interface{}, error)
- func (mdtc MinterDefinitionTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
- func (mdtc MinterDefinitionTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (mdtc MinterDefinitionTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, ...) (err error)
- func (mdtc MinterDefinitionTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, ...) (err error)
- type MinterDefinitionTransactionExtension
- type MultiSignatureCondition
- type NetworkAddress
- func (na NetworkAddress) Compare(ona NetworkAddress) int
- func (na NetworkAddress) Equals(ona NetworkAddress) bool
- func (na *NetworkAddress) LoadString(str string) (err error)
- func (na NetworkAddress) MarshalJSON() ([]byte, error)
- func (na NetworkAddress) MarshalRivine(w io.Writer) error
- func (na NetworkAddress) MarshalSia(w io.Writer) error
- func (na NetworkAddress) String() string
- func (na *NetworkAddress) UnmarshalJSON(b []byte) error
- func (na *NetworkAddress) UnmarshalRivine(r io.Reader) error
- func (na *NetworkAddress) UnmarshalSia(r io.Reader) error
- type NetworkAddressSortedSet
- func (nass *NetworkAddressSortedSet) AddAddress(address NetworkAddress) error
- func (nass *NetworkAddressSortedSet) BinaryDecode(r io.Reader, length int) error
- func (nass NetworkAddressSortedSet) BinaryEncode(w io.Writer) (int, error)
- func (nass NetworkAddressSortedSet) Len() int
- func (nass NetworkAddressSortedSet) MarshalJSON() ([]byte, error)
- func (nass NetworkAddressSortedSet) MarshalRivine(w io.Writer) error
- func (nass NetworkAddressSortedSet) MarshalSia(w io.Writer) error
- func (nass *NetworkAddressSortedSet) RemoveAddress(address NetworkAddress) error
- func (nass *NetworkAddressSortedSet) UnmarshalJSON(data []byte) error
- func (nass *NetworkAddressSortedSet) UnmarshalRivine(r io.Reader) error
- func (nass *NetworkAddressSortedSet) UnmarshalSia(r io.Reader) error
- type NetworkAddressType
- type NopERC20TransactionValidator
- type PublicKeySignaturePair
- type TFChainReadDB
- type TransactionNonce
Constants ¶
const ( // MaxNamesPerBot defines the maximum amount of names allowed per unique bot. MaxNamesPerBot = 5 // MaxAddressesPerBot defines the maximum amount of addresses allowed per unique bot. MaxAddressesPerBot = 10 )
const ( // BotMonth is defined as 30 days of exactly 24 hours, expressed in seconds. BotMonth = 60 * 60 * 24 * 30 // MaxBotPrepaidMonths defines the amount of months that is allowed to be maximum // paid upfront, as to keep a 3bot active. MaxBotPrepaidMonths = 24 // MaxBotPrepaidMonthsInSeconds defines the amount of time that is allowed to be maximum // paid upfront, which is the equavalent of roughly 2 years. MaxBotPrepaidMonthsInSeconds = MaxBotPrepaidMonths * BotMonth )
const ( // RegexpBotName is used to validate a (raw) 3bot name (string). RegexpBotName = `^[A-Za-z]{1}[A-Za-z\-0-9]{3,61}[A-Za-z0-9]{1}(\.[A-Za-z]{1}[A-Za-z\-0-9]{3,55}[A-Za-z0-9]{1})*$` // MaxLengthBotName defines the maximum length a 3bot name can have. MaxLengthBotName = 63 )
const ( // MinBotID defines the minimum value a botID can have, // in other words the smallest identifier value a Bot can have. MinBotID = 1 // MaxBotID defines the maximum value a Bot ID can have, // in other words the biggest identifier value a Bot can have. MaxBotID = math.MaxUint32 )
const ( // RegexpHostname is used to validate a (raw) hostname (string). RegexpHostname = `` /* 181-byte string literal not displayed */ // MaxLengthHostname defines the maximum length a hostname can have, // within the context of tfchain. MaxLengthHostname = 63 )
const ( // TransactionVersionMinterDefinition defines the Transaction version // for a MinterDefinition Transaction. // // See the `MinterDefinitionTransactionController` and `MinterDefinitionTransaction` // types for more information. TransactionVersionMinterDefinition types.TransactionVersion = iota + 128 // TransactionVersionCoinCreation defines the Transaction version // for a CoinCreation Transaction. // // See the `CoinCreationTransactionController` and `CoinCreationTransaction` // types for more information. TransactionVersionCoinCreation )
const ( // TransactionVersionBotRegistration defines the Transaction version // for a BotRegistration Transaction, used to register a new 3bot, // where new means that the used public key cannot yet exist. TransactionVersionBotRegistration types.TransactionVersion = iota + 144 // TransactionVersionBotRecordUpdate defines the Transaction version // for a Tx used to update a 3bot Record by the owner. where owner // means the 3bot that created the record to be updated initially using the BotRegistration Tx. TransactionVersionBotRecordUpdate // TransactionVersionBotNameTransfer defines the Transaction version // for a Tx used to transfer one or multiple names from the active // 3bot that up to the point of that Tx to another 3bot. TransactionVersionBotNameTransfer )
const ( BotFeePerAdditionalNameMultiplier = 50 BotFeeForNetworkAddressInfoChangeMultiplier = 20 BotRegistrationFeeMultiplier = 90 BotMonthlyFeeMultiplier = 10 )
3bot Multiplier fees that have to be multiplied with the OneCoin definition, in order to know the amount in the used chain currency (TFT).
const ( // TransactionVersionERC20Conversion defines the Transaction version // for an ERC20ConvertTransaction, used to convert TFT into ERC20 funds. TransactionVersionERC20Conversion types.TransactionVersion = iota + 208 // TransactionVersionERC20CoinCreation defines the Transaction version // for an ERC20CoinCreationTransaction, used to convert ERC20 funds into TFT. TransactionVersionERC20CoinCreation // TransactionVersionERC20AddressRegistration defines the Transaction version // for an TransactionVersionERC20AddressRegistration, used to register an ERC20 address, // linked to an TFT address. TransactionVersionERC20AddressRegistration )
const ERC20AddressLength = 20
ERC20AddressLength defines the length of the fixed-sized ERC20Address type explicitly.
const ERC20HashLength = 32
ERC20HashLength defines the length of the fixed-sized ERC20 Hash type explicitly, used for Transaction and Block hashes alike.
const ( // HardcodedERC20AddressRegistrationFeeOneCoinMultiplier defines the hardcoded multiplier // (to be multiplied with the OneCoin Currency Value of the network), that defines the constant (hardcoded) // Registration Fee to be paid for the Registration of an ERC20 Withdrawal address. HardcodedERC20AddressRegistrationFeeOneCoinMultiplier = 10 )
const TransactionNonceLength = 8
TransactionNonceLength defines the length of a TransactionNonce
Variables ¶
var ( // ErrTooManyBotNames is the error returned in case a bot which has more than 5 // names defined is attempted to be (un)marshaled, or in case an amount of names // to be added to the bot's record would overflow this limit of 5. ErrTooManyBotNames = errors.New("a 3bot can have a maximum of 5 names") // ErrBotNameNotUnique is the error returned in case a 3bot name is added // that is already registered in this 3bot. ErrBotNameNotUnique = errors.New("the name is already registerd with this 3bot") // ErrNetworkAddressNotUnique is the error returned in case a network address is added // that is already registered in this 3bot. ErrNetworkAddressNotUnique = errors.New("the network address is already registerd with this 3bot") // ErrBotNameDoesNotExist is the error returned in case a 3bot name is removed // that is not registered in this 3bot. ErrBotNameDoesNotExist = errors.New("the name is not registerd with this 3bot") // ErrNetworkAddressDoesNotExist is the error returned in case a network address is removed // that is not registered in this 3bot. ErrNetworkAddressDoesNotExist = errors.New("the network address is not registerd with this 3bot") // ErrTooManyBotAddresses is the error returned in case a bot which has more than 10 // addresses defined is attempted to be (un)marshaled, or in case an amount of addresses // to be added to the bot's record would overflow this limit of 10. ErrTooManyBotAddresses = errors.New("a 3bot can have a maximum of 10 addresses") // ErrBotExpirationExtendOverflow is returned in case a 3bot's expiration date is extended // using too many months (a max of 24 is allowed) ErrBotExpirationExtendOverflow = errors.New("a 3bot can only have up to 24 months prepaid") )
var ( // ErrNilBotName is the error returned in case a new bot name is attempted to be // created (from memory or bytes) from nil. ErrNilBotName = errors.New("nil bot name") // ErrBotNameTooLong is the error returned in case a new bot name is attempted to be // created using a too long string. ErrBotNameTooLong = errors.New("the length of a hostname can maximum be 127 bytes long") // ErrInvalidBotName is the error returned in case a to-be-created (or decoded) // botname. ErrInvalidBotName = errors.New("invalid bot name") )
var ( // ErrNilHostname is the error returned in case a new network address is attempted to be // created (from memory or bytes) from nil. ErrNilHostname = errors.New("nil hostname") // ErrHostnameTooLong is the error returned in case a new network address is attempted to be // created with a too long string. ErrHostnameTooLong = errors.New("the length of a hostname can maximum be 63 bytes long") // ErrInvalidNetworkAddress is the error returned in case a to-be-created (or decoded) // network address is invalid (meaning it is no valid hostname or IPv4/IPv6 address). ErrInvalidNetworkAddress = errors.New("invalid network address") )
var ( SpecifierMintDefinitionTransaction = types.Specifier{'m', 'i', 'n', 't', 'e', 'r', ' ', 'd', 'e', 'f', 'i', 'n', ' ', 't', 'x'} SpecifierCoinCreationTransaction = types.Specifier{'c', 'o', 'i', 'n', ' ', 'm', 'i', 'n', 't', ' ', 't', 'x'} SpecifierBotRegistrationTransaction = types.Specifier{'b', 'o', 't', ' ', 'r', 'e', 'g', 'i', 's', 't', 'e', 'r', ' ', 't', 'x'} SpecifierBotRecordUpdateTransaction = types.Specifier{'b', 'o', 't', ' ', 'r', 'e', 'c', 'u', 'p', 'd', 'a', 't', 'e', ' ', 't', 'x'} SpecifierBotNameTransferTransaction = types.Specifier{'b', 'o', 't', ' ', 'n', 'a', 'm', 'e', 't', 'r', 'a', 'n', 's', ' ', 't', 'x'} )
These Specifiers are used internally when calculating a Transaction's ID. See Rivine's Specifier for more details.
var ( ErrBotKeyAlreadyRegistered = errors.New("bot key is already registered") ErrBotNameAlreadyRegistered = errors.New("bot name is already registered") )
Bot validation errors
var ( BotSignatureSpecifierSender = [...]byte{'s', 'e', 'n', 'd', 'e', 'r'} BotSignatureSpecifierReceiver = [...]byte{'r', 'e', 'c', 'e', 'i', 'v', 'e', 'r'} )
Specifiers used to ensure the bot-signatures are unique within each Tx.
var ( ErrBotNotFound = errors.New("3bot not found") ErrBotKeyNotFound = errors.New("3bot public key not found") ErrBotNameNotFound = errors.New("3bot name not found") ErrBotNameExpired = errors.New("3bot name expired") )
public BotRecordReadRegistry errors
var ( SpecifierERC20ConvertTransaction = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'c', 'o', 'n', 'v', 'e', 'r', 't', ' ', 't', 'x'} SpecifierERC20CoinCreationTransaction = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'c', 'o', 'i', 'n', 'g', 'e', 'n', ' ', 't', 'x'} SpecifierERC20AddressRegistrationTransaction = types.Specifier{'e', 'r', 'c', '2', '0', ' ', 'a', 'd', 'd', 'r', 'r', 'e', 'g', ' ', 't', 'x'} )
These Specifiers are used internally when calculating a Transaction's ID. See Rivine's Specifier for more details.
var (
ERC20AdddressRegistrationSignatureSpecifier = [...]byte{'r', 'e', 'g', 'i', 's', 't', 'r', 'a', 't', 'i', 'o', 'n'}
)
Specifiers used to ensure the bot-signatures are unique within each Tx.
var ( // ERC20ConversionMinimumValue defines the minimum value of TFT // you can convert to ERC20 funds using the ERC20ConvertTransaction ERC20ConversionMinimumValue = config.GetCurrencyUnits().OneCoin.Mul64(1000) )
Functions ¶
func ComputeMonthlyBotFees ¶
ComputeMonthlyBotFees computes the total monthly fees required for the given months, using the given oneCoin value as the currency's unit value.
func IsERC20Address ¶
IsERC20Address returns true if the given string represents an ERC20 Address.
func IsERC20Hash ¶
IsERC20Hash returns true if the given string represents an ERC20 Hash.
func RegisterBlockHeightLimitedMultiSignatureCondition ¶
func RegisterBlockHeightLimitedMultiSignatureCondition(blockHeight types.BlockHeight)
RegisterBlockHeightLimitedMultiSignatureCondition registers the multisig condition, and thus implicitly the fulfillment as well, in a way that it is limited to a certain block height.
func RegisterTransactionTypesForDevNetwork ¶
func RegisterTransactionTypesForDevNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, oneCoin types.Currency, cfg config.DaemonNetworkConfig)
RegisterTransactionTypesForDevNetwork registers he transaction controllers for all transaction versions supported on the dev network.
func RegisterTransactionTypesForStandardNetwork ¶
func RegisterTransactionTypesForStandardNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, oneCoin types.Currency, cfg config.DaemonNetworkConfig)
RegisterTransactionTypesForStandardNetwork registers he transaction controllers for all transaction versions supported on the standard network.
func RegisterTransactionTypesForTestNetwork ¶
func RegisterTransactionTypesForTestNetwork(db TFChainReadDB, erc20TxValidator ERC20TransactionValidator, oneCoin types.Currency, cfg config.DaemonNetworkConfig)
RegisterTransactionTypesForTestNetwork registers he transaction controllers for all transaction versions supported on the test network.
Types ¶
type BotID ¶
type BotID uint32
BotID defines the identifier type for 3bots, each 3bot has a unique identifier using this type.
func (*BotID) LoadString ¶
LoadString loads a botID from a string
type BotIdentifierSignaturePair ¶
type BotIdentifierSignaturePair struct {
Identifier BotID `json:"id"`
Signature types.ByteSlice `json:"signature"`
}
BotIdentifierSignaturePair pairs a bot identifier and a signature assumed to be created by the bot linked to that ID.
type BotMonthsAndFlagsData ¶
type BotMonthsAndFlagsData struct {
NrOfMonths uint8
HasAddresses bool
HasNames bool
HasRefund bool
}
BotMonthsAndFlagsData is a utility structure that is used to encode the NrOfMonths (paid up front for a 3bot) as well as several flags in a single byte.
func (BotMonthsAndFlagsData) MarshalRivine ¶
func (maf BotMonthsAndFlagsData) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotMonthsAndFlagsData) MarshalSia ¶
func (maf BotMonthsAndFlagsData) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*BotMonthsAndFlagsData) UnmarshalRivine ¶
func (maf *BotMonthsAndFlagsData) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*BotMonthsAndFlagsData) UnmarshalSia ¶
func (maf *BotMonthsAndFlagsData) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
type BotName ¶
type BotName struct {
// contains filtered or unexported fields
}
BotName defines the name type for 3bots. Each 3bot can define up to 5 unique (DNS) names.
func NewBotName ¶
NewBotName creates a new BotName from a given (valid) string.
func (BotName) Compare ¶
Compare returns an integer comparing two bot names lexicographically (case insensitive). The result will be 0 if a==b, -1 if a < b, and +1 if a > b.
func (BotName) Equals ¶
Equals returns true if this BotName and the given BotName are equal (case insensitive).
func (*BotName) LoadString ¶
LoadString loads the BotName from a human-readable string.
func (BotName) MarshalJSON ¶
MarshalJSON marshals a byte slice as a hex string.
func (BotName) MarshalRivine ¶
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotName) MarshalSia ¶
MarshalSia implements SiaMarshaler.MarshalSia
func (*BotName) UnmarshalJSON ¶
UnmarshalJSON decodes the json (hex-encoded) string of the byte slice.
func (*BotName) UnmarshalRivine ¶
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
type BotNameSortedSet ¶
type BotNameSortedSet struct {
// contains filtered or unexported fields
}
BotNameSortedSet represents a sorted set of (unique) bot names.
A BotNameSortedSet does not expose it elements, as this is not a feature-requirement of tfchain, all it aims for is to ensure the set consists only of unique elements.
func (*BotNameSortedSet) AddName ¶
func (bnss *BotNameSortedSet) AddName(name BotName) error
AddName adds a new (unique) bot name to this sorted set of bot names, returning an error if the name already exists within this sorted set.
func (*BotNameSortedSet) BinaryDecode ¶
func (bnss *BotNameSortedSet) BinaryDecode(r io.Reader, length int) error
BinaryDecode can be used instead of UnmarshalRivine, should one need to decode the length prefix in a way other than the standard tfchain-slice approach. The decoding of the length has to happen prior to calling this method.
func (BotNameSortedSet) BinaryEncode ¶
func (bnss BotNameSortedSet) BinaryEncode(w io.Writer) (int, error)
BinaryEncode can be used instead of MarshalRivine, should one want to encode the length prefix in a way other than the standard tfchain-slice approach. The encoding of the length has to happen prior to calling this method.
func (BotNameSortedSet) Difference ¶
func (bnss BotNameSortedSet) Difference(other BotNameSortedSet) []BotName
Difference returns the difference of this and the other set, meaning it will return all bot names which are in this set but not in the other.
func (BotNameSortedSet) Intersection ¶
func (bnss BotNameSortedSet) Intersection(other BotNameSortedSet) []BotName
Intersection returns the intersection of this and the other set, meaning it will return all bot names which are in this set AND in the other.
func (BotNameSortedSet) Len ¶
func (bnss BotNameSortedSet) Len() int
Len returns the amount of network addresses in this sorted set.
func (BotNameSortedSet) MarshalJSON ¶
func (bnss BotNameSortedSet) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaler.MarshalJSON
func (BotNameSortedSet) MarshalRivine ¶
func (bnss BotNameSortedSet) MarshalRivine(w io.Writer) error
MarshalRivine implements rivbin.RivineMarshaler.MarshalRivine
func (BotNameSortedSet) MarshalSia ¶
func (bnss BotNameSortedSet) MarshalSia(w io.Writer) error
MarshalSia implements siabin.SiaMarshaler.MarshalSia
func (*BotNameSortedSet) RemoveName ¶
func (bnss *BotNameSortedSet) RemoveName(name BotName) error
RemoveName removes an existing bot name from this sorted set of bot names, returning an error if the name did not yet exist in this sorted set.
func (*BotNameSortedSet) UnmarshalJSON ¶
func (bnss *BotNameSortedSet) UnmarshalJSON(data []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.UnmarshalJSON
func (*BotNameSortedSet) UnmarshalRivine ¶
func (bnss *BotNameSortedSet) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements rivbin.RivineUnmarshaler.UnmarshalRivine
func (*BotNameSortedSet) UnmarshalSia ¶
func (bnss *BotNameSortedSet) UnmarshalSia(r io.Reader) error
UnmarshalSia implements siabin.SiaUnmarshaler.UnmarshalSia
type BotNameTransferTransaction ¶
type BotNameTransferTransaction struct {
// Sender is in this context the 3bot that owns and transfers the names
// defined in this Tx to the 3bot defined in this Tx as the Receiver.
// The Sender has to be different from the Receiver.
Sender BotIdentifierSignaturePair `json:"sender"`
// Receiver is in this context the 3bot that receives the names
// defined in this Tx from the 3bot defined in this Tx as the Sender.
// The Receiver has to be different from the Sender.
Receiver BotIdentifierSignaturePair `json:"receiver"`
// Names to be transferred from sender to receiver. Note that after each Tx,
// no more than 5 names can be linked to a single 3bot record.
Names []BotName `json:"names"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for a 3bot record update. At least one CoinInput is required.
// If this 3bot record update is only to pay for extending the 3bot activity,
// than no fees are required other than the monthly fees as defined by this bots usage.
CoinInputs []types.CoinInput `json:"coininputs"`
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
}
BotNameTransferTransaction defines the Transaction (with version 0x92) used to transfer one or multiple names from the active 3bot that up to the point of the Tx to another 3bot.
func BotNameTransferTransactionFromTransaction ¶
func BotNameTransferTransactionFromTransaction(tx types.Transaction) (BotNameTransferTransaction, error)
BotNameTransferTransactionFromTransaction creates a BotNameTransferTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `BotNameTransferTransactionFromTransactionData` constructor.
func BotNameTransferTransactionFromTransactionData ¶
func BotNameTransferTransactionFromTransactionData(txData types.TransactionData) (BotNameTransferTransaction, error)
BotNameTransferTransactionFromTransactionData creates a BotNameTransferTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (BotNameTransferTransaction) MarshalRivine ¶
func (bnttx BotNameTransferTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotNameTransferTransaction) MarshalSia ¶
func (bnttx BotNameTransferTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*BotNameTransferTransaction) RequiredBotFee ¶
func (bnttx *BotNameTransferTransaction) RequiredBotFee(oneCoin types.Currency) types.Currency
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
func (*BotNameTransferTransaction) RevertReceiverBotRecordUpdate ¶
func (bnttx *BotNameTransferTransaction) RevertReceiverBotRecordUpdate(record *BotRecord) error
RevertReceiverBotRecordUpdate reverts the given record update, within the context of the given blockTime, using the information of this BotRecordUpdateTransaction.
This method should only be called once for the given record, as it has no way of checking whether or not it already reverted the update of the given record.
NOTE: implicit updates such as time jumps in expiration time (due to an inactive bot that became active again) and names that were implicitly removed because the bot was inactive, are not reverted by this method, and have to be added manually reverted.
func (*BotNameTransferTransaction) RevertSenderBotRecordUpdate ¶
func (bnttx *BotNameTransferTransaction) RevertSenderBotRecordUpdate(record *BotRecord) error
RevertSenderBotRecordUpdate reverts the given record update, within the context of the given blockTime, using the information of this BotRecordUpdateTransaction.
This method should only be called once for the given record, as it has no way of checking whether or not it already reverted the update of the given record.
func (*BotNameTransferTransaction) Transaction ¶
func (bnttx *BotNameTransferTransaction) Transaction(oneCoin types.Currency) types.Transaction
Transaction returns this BotNameTransferTransaction as regular tfchain transaction, using TransactionVersionBotNameTransfer as the type.
func (*BotNameTransferTransaction) TransactionData ¶
func (bnttx *BotNameTransferTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
TransactionData returns this BotNameTransferTransaction as regular tfchain transaction data.
func (*BotNameTransferTransaction) UnmarshalRivine ¶
func (bnttx *BotNameTransferTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*BotNameTransferTransaction) UnmarshalSia ¶
func (bnttx *BotNameTransferTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
func (*BotNameTransferTransaction) UpdateReceiverBotRecord ¶
func (bnttx *BotNameTransferTransaction) UpdateReceiverBotRecord(blockTime types.Timestamp, record *BotRecord) error
UpdateReceiverBotRecord updates the given (receiver bot) record, within the context of the given blockTime, using the information of this BotNameTransferTransaction.
This method should only be called once for the given (receiver bot) record, as it has no way of checking whether or not it already updated the given record.
func (*BotNameTransferTransaction) UpdateSenderBotRecord ¶
func (bnttx *BotNameTransferTransaction) UpdateSenderBotRecord(blockTime types.Timestamp, record *BotRecord) error
UpdateSenderBotRecord updates the given (sender bot) record, within the context of the given blockTime, using the information of this BotNameTransferTransaction.
This method should only be called once for the given (sender bot) record, as it has no way of checking whether or not it already updated the given record.
type BotNameTransferTransactionController ¶
type BotNameTransferTransactionController struct {
Registry BotRecordReadRegistry
RegistryPoolAddress types.UnlockHash
OneCoin types.Currency
}
BotNameTransferTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0x92. It allows the transfer of names and update of the record of the two existing 3bot that participate in this transfer.
func (BotNameTransferTransactionController) DecodeTransactionData ¶
func (bnttc BotNameTransferTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (BotNameTransferTransactionController) EncodeTransactionData ¶
func (bnttc BotNameTransferTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (BotNameTransferTransactionController) EncodeTransactionIDInput ¶
func (bnttc BotNameTransferTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (BotNameTransferTransactionController) GetCustomMinerPayouts ¶
func (bnttc BotNameTransferTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
GetCustomMinerPayouts implements TransactionCustomMinerPayoutGetter.GetCustomMinerPayouts
func (BotNameTransferTransactionController) JSONDecodeTransactionData ¶
func (bnttc BotNameTransferTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (BotNameTransferTransactionController) JSONEncodeTransactionData ¶
func (bnttc BotNameTransferTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (BotNameTransferTransactionController) SignExtension ¶
func (bnttc BotNameTransferTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (BotNameTransferTransactionController) SignatureHash ¶
func (bnttc BotNameTransferTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (BotNameTransferTransactionController) ValidateBlockStakeOutputs ¶
func (bnttc BotNameTransferTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (BotNameTransferTransactionController) ValidateTransaction ¶
func (bnttc BotNameTransferTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type BotNameTransferTransactionExtension ¶
type BotNameTransferTransactionExtension struct {
Sender BotIdentifierSignaturePair
Receiver BotIdentifierSignaturePair
Names []BotName
}
BotNameTransferTransactionExtension defines the BotNameTransferTransaction Extension Data
func (*BotNameTransferTransactionExtension) RequiredBotFee ¶
func (bnttxe *BotNameTransferTransactionExtension) RequiredBotFee(oneCoin types.Currency) types.Currency
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
type BotRecord ¶
type BotRecord struct {
ID BotID `json:"id"`
Addresses NetworkAddressSortedSet `json:"addresses,omitempty"`
Names BotNameSortedSet `json:"names,omitempty"`
PublicKey types.PublicKey `json:"publickey"`
Expiration CompactTimestamp `json:"expiration"`
}
BotRecord is the record type used to store a unique 3bot in the TransactionDB. Per 3bot there is one BotRecord. Once a record is created it is never deleted, but it can be modified by the 3bot using one of the available Transaction types.
func (*BotRecord) AddNetworkAddresses ¶
func (record *BotRecord) AddNetworkAddresses(addresses ...NetworkAddress) error
AddNetworkAddresses adds one or multiple unique network addresses to this 3bot record.
func (*BotRecord) ExtendExpirationDate ¶
ExtendExpirationDate extends the expiration day of this 3bot record based on the block time and the months to add.
func (BotRecord) MarshalRivine ¶
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotRecord) MarshalSia ¶
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*BotRecord) RemoveNames ¶
RemoveNames removes one or multiple unique (DNS) names from this 3bot record.
func (*BotRecord) RemoveNetworkAddresses ¶
func (record *BotRecord) RemoveNetworkAddresses(addresses ...NetworkAddress) error
RemoveNetworkAddresses removes one or multiple unique network addresses from this 3bot record.
func (*BotRecord) ResetNames ¶
func (record *BotRecord) ResetNames()
ResetNames removes all names (if any) from the current record, reseting it to a nil set of bot names.
func (*BotRecord) UnmarshalRivine ¶
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
type BotRecordAddressUpdate ¶
type BotRecordAddressUpdate struct {
Add []NetworkAddress `json:"add,omitempty"`
Remove []NetworkAddress `json:"remove,omitempty"`
}
BotRecordAddressUpdate contains all information required for an update to the addresses of a bot's record.
type BotRecordNameUpdate ¶
type BotRecordNameUpdate struct {
Add []BotName `json:"add,omitempty"`
Remove []BotName `json:"remove,omitempty"`
}
BotRecordNameUpdate contains all information required for an update to the names of a bot's record.
type BotRecordReadRegistry ¶
type BotRecordReadRegistry interface {
// GetRecordForID returns the record mapped to the given BotID.
GetRecordForID(id BotID) (*BotRecord, error)
// GetRecordForKey returns the record mapped to the given Key.
GetRecordForKey(key types.PublicKey) (*BotRecord, error)
// GetRecordForName returns the record mapped to the given Name.
GetRecordForName(name BotName) (*BotRecord, error)
// GetBotTransactionIdentifiers returns the identifiers of all transactions
// that created and updated the given bot's record.
//
// The transaction identifiers are returned in the (stable) order as defined by the blockchain.
GetBotTransactionIdentifiers(id BotID) ([]types.TransactionID, error)
}
BotRecordReadRegistry defines the public READ API expected from a bot record Read-Only registry.
type BotRecordUpdateTransaction ¶
type BotRecordUpdateTransaction struct {
// Identifier of the 3bot, used to find the 3bot record to be updated,
// and verify that the Tx is authorized to do so.
Identifier BotID `json:"id"`
// Addresses can be used to add and/or remove network addresses
// to/from the existing 3bot record. Note that after each Tx,
// no more than 10 addresses can be linked to a single 3bot record.
Addresses BotRecordAddressUpdate `json:"addresses,omitempty"`
// Names can be used to add and/or remove names
// to/from the existing 3bot record. Note that after each Tx,
// no more than 5 names can be linked to a single 3bot record.
Names BotRecordNameUpdate `json:"names,omitempty"`
// NrOfMonths defines the optional amount of months that
// is desired to be paid upfront in this update. Note that the amount of
// months defined here defines how much additional fees are to be paid.
// The NrOfMonths has to be within this inclusive range [0,24].
NrOfMonths uint8 `json:"nrofmonths"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for a 3bot record update. At least one CoinInput is required.
// If this 3bot record update is only to pay for extending the 3bot activity,
// than no fees are required other than the monthly fees as defined by this bots usage.
CoinInputs []types.CoinInput `json:"coininputs"`
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
// Signature is used to proof the ownership of the 3bot record to be updated,
// and is verified using the public key defined in the 3bot linked
// to the given (3bot) identifier.
Signature types.ByteSlice `json:"signature"`
}
BotRecordUpdateTransaction defines the Transaction (with version 0x91) used to update a 3bot Record by the owner. where owner means the 3bot that created the record to be updated initially using the BotRegistration Tx.
func BotRecordUpdateTransactionFromTransaction ¶
func BotRecordUpdateTransactionFromTransaction(tx types.Transaction) (BotRecordUpdateTransaction, error)
BotRecordUpdateTransactionFromTransaction creates a BotRecordUpdateTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `BotRecordUpdateTransactionFromTransactionData` constructor.
func BotRecordUpdateTransactionFromTransactionData ¶
func BotRecordUpdateTransactionFromTransactionData(txData types.TransactionData) (BotRecordUpdateTransaction, error)
BotRecordUpdateTransactionFromTransactionData creates a BotRecordUpdateTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (BotRecordUpdateTransaction) MarshalRivine ¶
func (brutx BotRecordUpdateTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotRecordUpdateTransaction) MarshalSia ¶
func (brutx BotRecordUpdateTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*BotRecordUpdateTransaction) RequiredBotFee ¶
func (brutx *BotRecordUpdateTransaction) RequiredBotFee(oneCoin types.Currency) (fee types.Currency)
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
func (*BotRecordUpdateTransaction) RevertBotRecordUpdate ¶
func (brutx *BotRecordUpdateTransaction) RevertBotRecordUpdate(record *BotRecord) error
RevertBotRecordUpdate reverts the given record update, within the context of the given blockTime, using the information of this BotRecordUpdateTransaction.
This method should only be called once for the given record, as it has no way of checking whether or not it already reverted the update of the given record.
NOTE: implicit updates such as time jumps in expiration time (due to an inactive bot that became active again) and names that were implicitly removed because the bot was inactive, are not reverted by this method, and have to be added manually reverted.
func (*BotRecordUpdateTransaction) Transaction ¶
func (brutx *BotRecordUpdateTransaction) Transaction(oneCoin types.Currency) types.Transaction
Transaction returns this BotRecordUpdateTransaction as regular tfchain transaction, using TransactionVersionBotRecordUpdate as the type.
func (*BotRecordUpdateTransaction) TransactionData ¶
func (brutx *BotRecordUpdateTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
TransactionData returns this BotRecordUpdateTransaction as regular tfchain transaction data.
func (*BotRecordUpdateTransaction) UnmarshalRivine ¶
func (brutx *BotRecordUpdateTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*BotRecordUpdateTransaction) UnmarshalSia ¶
func (brutx *BotRecordUpdateTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
func (*BotRecordUpdateTransaction) UpdateBotRecord ¶
func (brutx *BotRecordUpdateTransaction) UpdateBotRecord(blockTime types.Timestamp, record *BotRecord) error
UpdateBotRecord updates the given record, within the context of the given blockTime, using the information of this BotRecordUpdateTransaction.
This method should only be called once for the given record, as it has no way of checking whether or not it already updated the given record.
type BotRecordUpdateTransactionExtension ¶
type BotRecordUpdateTransactionExtension struct {
Identifier BotID
Signature types.ByteSlice
AddressUpdate BotRecordAddressUpdate
NameUpdate BotRecordNameUpdate
NrOfMonths uint8
}
BotRecordUpdateTransactionExtension defines the BotRecordUpdateTransaction Extension Data
func (*BotRecordUpdateTransactionExtension) RequiredBotFee ¶
func (brutxe *BotRecordUpdateTransactionExtension) RequiredBotFee(oneCoin types.Currency) (fee types.Currency)
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
type BotRegistrationTransaction ¶
type BotRegistrationTransaction struct {
// Addresses contains the optional network addresses used to reach the 3bot.
// Normally at least one is given, none are required however.
// All addresses (max 10) can be of any of the following types: IPv4, IPv6, hostname
Addresses []NetworkAddress `json:"addresses,omitempty"`
// Names contains the optional names (max 5) that can be used to reach the bot,
// using a name, instead of one of its network addresses, comparable to how DNS works.
Names []BotName `json:"names,omitempty"`
// NrOfMonths defines the amount of months that
// is desired to be paid upfront. Note that the amount of
// months defined here indicates how much additional fees are to be paid.
// The NrOfMonths has to be within this inclusive range [1,24].
NrOfMonths uint8 `json:"nrofmonths"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for a 3bot registration. At least one CoinInput is required.
CoinInputs []types.CoinInput `json:"coininputs"`
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
// Identification is used to identify the 3bot and verify its identity.
// The identification is only given at registration, for all other
// 3bot Tx types it is identified by a combination of its unique ID and signature.
Identification PublicKeySignaturePair `json:"identification"`
}
BotRegistrationTransaction defines the Transaction (with version 0x90) used to register a new 3bot, where new means that the used public key (identification) cannot yet exist.
func BotRegistrationTransactionFromTransaction ¶
func BotRegistrationTransactionFromTransaction(tx types.Transaction) (BotRegistrationTransaction, error)
BotRegistrationTransactionFromTransaction creates a BotRegistrationTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `BotRegistrationTransactionFromTransactionData` constructor.
func BotRegistrationTransactionFromTransactionData ¶
func BotRegistrationTransactionFromTransactionData(txData types.TransactionData) (BotRegistrationTransaction, error)
BotRegistrationTransactionFromTransactionData creates a BotRegistrationTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (BotRegistrationTransaction) MarshalRivine ¶
func (brtx BotRegistrationTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (BotRegistrationTransaction) MarshalSia ¶
func (brtx BotRegistrationTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*BotRegistrationTransaction) RequiredBotFee ¶
func (brtx *BotRegistrationTransaction) RequiredBotFee(oneCoin types.Currency) types.Currency
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
func (*BotRegistrationTransaction) Transaction ¶
func (brtx *BotRegistrationTransaction) Transaction(oneCoin types.Currency) types.Transaction
Transaction returns this BotRegistrationTransaction as regular tfchain transaction, using TransactionVersionBotRegistration as the type.
func (*BotRegistrationTransaction) TransactionData ¶
func (brtx *BotRegistrationTransaction) TransactionData(oneCoin types.Currency) types.TransactionData
TransactionData returns this BotRegistrationTransaction as regular tfchain transaction data.
func (*BotRegistrationTransaction) UnmarshalRivine ¶
func (brtx *BotRegistrationTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*BotRegistrationTransaction) UnmarshalSia ¶
func (brtx *BotRegistrationTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
type BotRegistrationTransactionController ¶
type BotRegistrationTransactionController struct {
Registry BotRecordReadRegistry
RegistryPoolAddress types.UnlockHash
OneCoin types.Currency
}
BotRegistrationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0x90. It allows the registration of a new3bot.
func (BotRegistrationTransactionController) DecodeTransactionData ¶
func (brtc BotRegistrationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (BotRegistrationTransactionController) EncodeTransactionData ¶
func (brtc BotRegistrationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (BotRegistrationTransactionController) EncodeTransactionIDInput ¶
func (brtc BotRegistrationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (BotRegistrationTransactionController) GetCommonExtensionData ¶
func (brtc BotRegistrationTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
GetCommonExtensionData implements TransactionCommonExtensionDataGetter.GetCommonExtensionData
func (BotRegistrationTransactionController) GetCustomMinerPayouts ¶
func (brtc BotRegistrationTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
GetCustomMinerPayouts implements TransactionCustomMinerPayoutGetter.GetCustomMinerPayouts
func (BotRegistrationTransactionController) JSONDecodeTransactionData ¶
func (brtc BotRegistrationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (BotRegistrationTransactionController) JSONEncodeTransactionData ¶
func (brtc BotRegistrationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (BotRegistrationTransactionController) SignExtension ¶
func (brtc BotRegistrationTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (BotRegistrationTransactionController) SignatureHash ¶
func (brtc BotRegistrationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (BotRegistrationTransactionController) ValidateBlockStakeOutputs ¶
func (brtc BotRegistrationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (BotRegistrationTransactionController) ValidateTransaction ¶
func (brtc BotRegistrationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type BotRegistrationTransactionExtension ¶
type BotRegistrationTransactionExtension struct {
Addresses []NetworkAddress
Names []BotName
NrOfMonths uint8
Identification PublicKeySignaturePair
}
BotRegistrationTransactionExtension defines the BotRegistrationTransaction Extension Data
func (*BotRegistrationTransactionExtension) RequiredBotFee ¶
func (brtxe *BotRegistrationTransactionExtension) RequiredBotFee(oneCoin types.Currency) types.Currency
RequiredBotFee computes the required Bot Fee, that is to be applied as a required additional fee on top of the regular required (minimum) Tx fee.
type BotUpdateRecordTransactionController ¶
type BotUpdateRecordTransactionController struct {
Registry BotRecordReadRegistry
RegistryPoolAddress types.UnlockHash
OneCoin types.Currency
}
BotUpdateRecordTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0x91. It allows the update of the record of an existing 3bot.
func (BotUpdateRecordTransactionController) DecodeTransactionData ¶
func (brutc BotUpdateRecordTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (BotUpdateRecordTransactionController) EncodeTransactionData ¶
func (brutc BotUpdateRecordTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (BotUpdateRecordTransactionController) EncodeTransactionIDInput ¶
func (brutc BotUpdateRecordTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (BotUpdateRecordTransactionController) GetCustomMinerPayouts ¶
func (brutc BotUpdateRecordTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
GetCustomMinerPayouts implements TransactionCustomMinerPayoutGetter.GetCustomMinerPayouts
func (BotUpdateRecordTransactionController) JSONDecodeTransactionData ¶
func (brutc BotUpdateRecordTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (BotUpdateRecordTransactionController) JSONEncodeTransactionData ¶
func (brutc BotUpdateRecordTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (BotUpdateRecordTransactionController) SignExtension ¶
func (brutc BotUpdateRecordTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (BotUpdateRecordTransactionController) SignatureHash ¶
func (brutc BotUpdateRecordTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (BotUpdateRecordTransactionController) ValidateBlockStakeOutputs ¶
func (brutc BotUpdateRecordTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (BotUpdateRecordTransactionController) ValidateTransaction ¶
func (brutc BotUpdateRecordTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type CoinCreationTransaction ¶ added in v1.1.0
type CoinCreationTransaction struct {
// Nonce used to ensure the uniqueness of a CoinCreationTransaction's ID and signature.
Nonce TransactionNonce `json:"nonce"`
// MintFulfillment defines the fulfillment which is used in order to
// fulfill the globally defined MintCondition.
MintFulfillment types.UnlockFulfillmentProxy `json:"mintfulfillment"`
// CoinOutputs defines the coin outputs,
// which contain the freshly created coins, adding to the total pool of coins
// available in the tfchain network.
CoinOutputs []types.CoinOutput `json:"coinoutputs"`
// Minerfees, a fee paid for this coin creation transaction.
MinerFees []types.Currency `json:"minerfees"`
// ArbitraryData can be used for any purpose,
// but is mostly to be used in order to define the reason/origins
// of the coin creation.
ArbitraryData []byte `json:"arbitrarydata,omitempty"`
}
CoinCreationTransaction is to be created only by the defined Coin Minters, as a medium in order to create coins (coin outputs), without backing them (so without having to spend previously unspend coin outputs, see: coin inputs).
func CoinCreationTransactionFromTransaction ¶ added in v1.1.0
func CoinCreationTransactionFromTransaction(tx types.Transaction) (CoinCreationTransaction, error)
CoinCreationTransactionFromTransaction creates a CoinCreationTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `CoinCreationTransactionFromTransactionData` constructor.
func CoinCreationTransactionFromTransactionData ¶ added in v1.1.0
func CoinCreationTransactionFromTransactionData(txData types.TransactionData) (CoinCreationTransaction, error)
CoinCreationTransactionFromTransactionData creates a CoinCreationTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (*CoinCreationTransaction) Transaction ¶ added in v1.1.0
func (cctx *CoinCreationTransaction) Transaction() types.Transaction
Transaction returns this CoinCreationTransaction as regular tfchain transaction, using TransactionVersionCoinCreation as the type.
func (*CoinCreationTransaction) TransactionData ¶ added in v1.1.0
func (cctx *CoinCreationTransaction) TransactionData() types.TransactionData
TransactionData returns this CoinCreationTransaction as regular tfchain transaction data.
type CoinCreationTransactionController ¶ added in v1.1.0
type CoinCreationTransactionController struct {
// MintConditionGetter is used to get a mint condition at the context-defined block height.
//
// The found MintCondition defines the condition that has to be fulfilled
// in order to mint new coins into existence (in the form of non-backed coin outputs).
MintConditionGetter MintConditionGetter
}
CoinCreationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 129. It allows for the creation of Coin Outputs, without requiring coin inputs, but can only be used by the defined Coin Minters.
func (CoinCreationTransactionController) DecodeTransactionData ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (CoinCreationTransactionController) EncodeTransactionData ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (CoinCreationTransactionController) EncodeTransactionIDInput ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (CoinCreationTransactionController) JSONDecodeTransactionData ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (CoinCreationTransactionController) JSONEncodeTransactionData ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (CoinCreationTransactionController) SignExtension ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (CoinCreationTransactionController) SignatureHash ¶
func (cctc CoinCreationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (CoinCreationTransactionController) ValidateBlockStakeOutputs ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (CoinCreationTransactionController) ValidateCoinOutputs ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, coinInputs map[types.CoinOutputID]types.CoinOutput) (err error)
ValidateCoinOutputs implements CoinOutputValidator.ValidateCoinOutputs
func (CoinCreationTransactionController) ValidateTransaction ¶ added in v1.1.0
func (cctc CoinCreationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) (err error)
ValidateTransaction implements TransactionValidator.ValidateTransaction
type CoinCreationTransactionExtension ¶ added in v1.1.0
type CoinCreationTransactionExtension struct {
Nonce TransactionNonce
MintFulfillment types.UnlockFulfillmentProxy
}
CoinCreationTransactionExtension defines the CoinCreationTx Extension Data
type CompactTimestamp ¶
type CompactTimestamp uint64
CompactTimestamp binary marshals the regular Unix Epoch (seconds) Timestamp, in a custom format, such that it only requires 3 bytes in space. It does so by being only accurate up to 60 seconds, and by starting the Timestamp since `CompactTimestampNullpoint`.
const ( // CompactTimestampNullpoint defines the time at which the Timestamp starts (~Jan '18) CompactTimestampNullpoint CompactTimestamp = 1515000000 // CompactTimestampAccuracyInSeconds defines the lowest possible value that gets recorded in seconds CompactTimestampAccuracyInSeconds CompactTimestamp = 60 )
func NowAsCompactTimestamp ¶
func NowAsCompactTimestamp() CompactTimestamp
NowAsCompactTimestamp returns the current Epoch Unix seconds time as a Tfchain Compact timestamp.
func SiaTimestampAsCompactTimestamp ¶
func SiaTimestampAsCompactTimestamp(ts types.Timestamp) CompactTimestamp
SiaTimestampAsCompactTimestamp converts a Sia/Rivine Timestamp to a Tfchain Compact timestamp.
func (CompactTimestamp) MarshalRivine ¶
func (cts CompactTimestamp) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (CompactTimestamp) MarshalSia ¶
func (cts CompactTimestamp) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, Alias of MarshalRivine for backwards-compatibility.
func (*CompactTimestamp) SetUInt32 ¶
func (cts *CompactTimestamp) SetUInt32(x uint32)
SetUInt32 sets an uint32 version of this CompactTimestamp as the internal value of this compact time stmap.
func (CompactTimestamp) SiaTimestamp ¶
func (cts CompactTimestamp) SiaTimestamp() types.Timestamp
SiaTimestamp returns this CompactTimestamp as a Unix Epoch Seconds timestamp, the type wrapped by a Sia/Rivine timestamp.
func (CompactTimestamp) UInt32 ¶
func (cts CompactTimestamp) UInt32() uint32
UInt32 returns this CompactTimestamp as an uint32 number.
func (*CompactTimestamp) UnmarshalJSON ¶
func (cts *CompactTimestamp) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON
func (*CompactTimestamp) UnmarshalRivine ¶
func (cts *CompactTimestamp) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*CompactTimestamp) UnmarshalSia ¶
func (cts *CompactTimestamp) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, Alias of UnmarshalRivine for backwards-compatibility.
type DefaultTransactionController ¶
type DefaultTransactionController struct {
types.DefaultTransactionController
TransactionFeeCheckBlockHeight types.BlockHeight
}
DefaultTransactionController wraps around Rivine's DefaultTransactionController, as to ensure that we use check the MinimumTransactionFee, only since a certain block height, and otherwise just ensure it is bigger than 0.
In order to achieve this, the TransactionValidation interface is implemented on top of the regular DefaultTransactionController.
func (DefaultTransactionController) ValidateTransaction ¶
func (dtc DefaultTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type ERC20Address ¶
type ERC20Address [ERC20AddressLength]byte
ERC20Address defines an ERC20 address as a fixed-sized byte array of length 20, and is used in order to be able to convert TFT into tradeable tfchain ERC20 funds.
func ERC20AddressFromUnlockHash ¶
func ERC20AddressFromUnlockHash(uh types.UnlockHash) (addr ERC20Address)
ERC20AddressFromUnlockHash creates an ERC20Address using as input for a new blake2b hash an UnlockHash (TFT Address), and taking the last 20 bytes of that.
func (*ERC20Address) LoadString ¶
func (address *ERC20Address) LoadString(str string) error
LoadString loads this ERC20Address from a hex-encoded string of length 40.
func (ERC20Address) MarshalJSON ¶
func (address ERC20Address) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.MarshalJSON, and returns this ERC20Address as a hex-encoded JSON string.
func (ERC20Address) String ¶
func (address ERC20Address) String() string
String returns this ERC20Address as a string.
func (*ERC20Address) UnmarshalJSON ¶
func (address *ERC20Address) UnmarshalJSON(b []byte) error
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON, and decodes the given byte slice as a hex-encoded JSON string into the 20 bytes that make up this ERC20Address.
type ERC20AddressRegistrationTransaction ¶
type ERC20AddressRegistrationTransaction struct {
// The public key of which a TFT address can be derived, and thus also an ERC20 Address
PublicKey types.PublicKey
// Signature that proofs the ownership of the attached Public Key.
Signature types.ByteSlice
// RegistrationFee defines the Registration fee to be paid for the
// registration on top of the regular Transaction fee.
// TODO: integrate it into the parent block, for now it is ignored.
RegistrationFee types.Currency
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for the address registration. At least one CoinInput is required.
CoinInputs []types.CoinInput
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput
}
ERC20AddressRegistrationTransaction defines the Transaction (with version 0xD2) used to register an ERC20 address linked to a regular TFT address (derived from the given public key). This is required as to be able to convert ERC20 Funds back into TFT.
func ERC20AddressRegistrationTransactionFromTransaction ¶
func ERC20AddressRegistrationTransactionFromTransaction(tx types.Transaction) (ERC20AddressRegistrationTransaction, error)
ERC20AddressRegistrationTransactionFromTransaction creates an ERC20AddressRegistrationTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `ERC20AddressRegistrationTransactionFromTransactionData` constructor.
func ERC20AddressRegistrationTransactionFromTransactionData ¶
func ERC20AddressRegistrationTransactionFromTransactionData(txData types.TransactionData) (ERC20AddressRegistrationTransaction, error)
ERC20AddressRegistrationTransactionFromTransactionData creates an ERC20ConvertTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (ERC20AddressRegistrationTransaction) MarshalJSON ¶
func (eartx ERC20AddressRegistrationTransaction) MarshalJSON() ([]byte, error)
MarshalJSON implements json.Marshaler.MarshalRivine
func (ERC20AddressRegistrationTransaction) MarshalRivine ¶
func (eartx ERC20AddressRegistrationTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (ERC20AddressRegistrationTransaction) MarshalSia ¶
func (eartx ERC20AddressRegistrationTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*ERC20AddressRegistrationTransaction) Transaction ¶
func (eartx *ERC20AddressRegistrationTransaction) Transaction() types.Transaction
Transaction returns this ERC20AddressRegistrationTransaction as regular tfchain transaction, using TransactionVersionERC20AddressRegistration as the type.
func (*ERC20AddressRegistrationTransaction) TransactionData ¶
func (eartx *ERC20AddressRegistrationTransaction) TransactionData() types.TransactionData
TransactionData returns this ERC20AddressRegistrationTransaction as regular tfchain transaction data.
func (*ERC20AddressRegistrationTransaction) UnmarshalJSON ¶
func (eartx *ERC20AddressRegistrationTransaction) UnmarshalJSON(data []byte) error
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON
func (*ERC20AddressRegistrationTransaction) UnmarshalRivine ¶
func (eartx *ERC20AddressRegistrationTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*ERC20AddressRegistrationTransaction) UnmarshalSia ¶
func (eartx *ERC20AddressRegistrationTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
type ERC20AddressRegistrationTransactionController ¶
type ERC20AddressRegistrationTransactionController struct {
Registry ERC20Registry
OneCoin types.Currency
BridgeFeePoolAddress types.UnlockHash
}
ERC20AddressRegistrationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD2. It allows the registration of an ERC20 Address.
func (ERC20AddressRegistrationTransactionController) DecodeTransactionData ¶
func (eartc ERC20AddressRegistrationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (ERC20AddressRegistrationTransactionController) EncodeTransactionData ¶
func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (ERC20AddressRegistrationTransactionController) EncodeTransactionIDInput ¶
func (eartc ERC20AddressRegistrationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (ERC20AddressRegistrationTransactionController) GetCommonExtensionData ¶
func (eartc ERC20AddressRegistrationTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
GetCommonExtensionData implements TransactionCommonExtensionDataGetter.GetCommonExtensionData
func (ERC20AddressRegistrationTransactionController) GetCustomMinerPayouts ¶
func (eartc ERC20AddressRegistrationTransactionController) GetCustomMinerPayouts(extension interface{}) ([]types.MinerPayout, error)
GetCustomMinerPayouts implements TransactionCustomMinerPayoutGetter.GetCustomMinerPayouts
func (ERC20AddressRegistrationTransactionController) JSONDecodeTransactionData ¶
func (eartc ERC20AddressRegistrationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (ERC20AddressRegistrationTransactionController) JSONEncodeTransactionData ¶
func (eartc ERC20AddressRegistrationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (ERC20AddressRegistrationTransactionController) SignExtension ¶
func (eartc ERC20AddressRegistrationTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (ERC20AddressRegistrationTransactionController) SignatureHash ¶
func (eartc ERC20AddressRegistrationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (ERC20AddressRegistrationTransactionController) ValidateBlockStakeOutputs ¶
func (eartc ERC20AddressRegistrationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (ERC20AddressRegistrationTransactionController) ValidateTransaction ¶
func (eartc ERC20AddressRegistrationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type ERC20AddressRegistrationTransactionExtension ¶
type ERC20AddressRegistrationTransactionExtension struct {
RegistrationFee types.Currency
PublicKey types.PublicKey
Signature types.ByteSlice
}
ERC20AddressRegistrationTransactionExtension defines the ERC20AddressRegistrationTransaction Extension Data
type ERC20AddressRegistrationTransactionJSON ¶
type ERC20AddressRegistrationTransactionJSON struct {
// The public key of which a TFT address can be derived, and thus also an ERC20 Address
PublicKey types.PublicKey `json:"pubkey"`
// TFTAddresses can be derived from the PublicKey,
// if defined however it will be validated that the public key matches the given PublicKey.
// Can be omitted as well, given that the raw tx does not contain this duplicate data.
TFTAddress types.UnlockHash `json:"tftaddress,omitempty"`
// ERC20Address can be derived from the PublicKey,
// if defined however it will be validated that the public key matches the given PublicKey.
// Can be omitted as well, given that the raw tx does not contain this duplicate data.
ERC20Address ERC20Address `json:"erc20address,omitempty"`
// Signature that proofs the ownership of the attached Public Key.
Signature types.ByteSlice `json:"signature"`
// RegistrationFee defines the Registration fee to be paid for the
// registration on top of the regular Transaction fee.
RegistrationFee types.Currency `json:"regfee"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for the address registration. At least one CoinInput is required.
CoinInputs []types.CoinInput `json:"coininputs"`
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
}
ERC20AddressRegistrationTransactionJSON defines the JSON structure of an ERC20AddressRegistrationTransaction, which is an extended data structure when compared to the binary structure of an ERC20AddressRegistrationTransaction
type ERC20CoinCreationTransaction ¶
type ERC20CoinCreationTransaction struct {
// The address to send the TFT-converted tfchain ERC20 funds into.
Address types.UnlockHash `json:"address"`
// Amount of TFT to be paid towards buying ERC20 funds,
// note that the bridge will take part of this amount towards
// paying for the transaction costs, prior to sending the ERC20 funds to
// the defined target address.
Value types.Currency `json:"value"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// ERC20 BlockID (Sending ERC20 Funds to TFT) used as to identify
// the parent block of the source of this coin creation.
BlockID ERC20Hash `json:"blockid"`
// ERC20 TransactionID (Sending ERC20 Funds to TFT) used as the source of this coin creation.
TransactionID ERC20Hash `json:"txid"`
}
ERC20CoinCreationTransaction defines the Transaction (with version 0xD1) used to convert ERC20 funds into TFT (the reverse of the ERC20ConvertTransaction).
func ERC20CoinCreationTransactionFromTransaction ¶
func ERC20CoinCreationTransactionFromTransaction(tx types.Transaction) (ERC20CoinCreationTransaction, error)
ERC20CoinCreationTransactionFromTransaction creates an ERC20CoinCreationTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `ERC20CoinCreationTransactionFromTransactionData` constructor.
func ERC20CoinCreationTransactionFromTransactionData ¶
func ERC20CoinCreationTransactionFromTransactionData(txData types.TransactionData) (ERC20CoinCreationTransaction, error)
ERC20CoinCreationTransactionFromTransactionData creates an ERC20CoinCreationTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (ERC20CoinCreationTransaction) MarshalRivine ¶
func (etctx ERC20CoinCreationTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (ERC20CoinCreationTransaction) MarshalSia ¶
func (etctx ERC20CoinCreationTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*ERC20CoinCreationTransaction) Transaction ¶
func (etctx *ERC20CoinCreationTransaction) Transaction() types.Transaction
Transaction returns this ERC20CoinCreationTransaction as regular tfchain transaction, using TransactionVersionERC20CoinCreation as the type.
func (*ERC20CoinCreationTransaction) TransactionData ¶
func (etctx *ERC20CoinCreationTransaction) TransactionData() types.TransactionData
TransactionData returns this ERC20CoinCreationTransaction as regular tfchain transaction data.
func (*ERC20CoinCreationTransaction) UnmarshalRivine ¶
func (etctx *ERC20CoinCreationTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*ERC20CoinCreationTransaction) UnmarshalSia ¶
func (etctx *ERC20CoinCreationTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
type ERC20CoinCreationTransactionController ¶
type ERC20CoinCreationTransactionController struct {
Registry ERC20Registry
OneCoin types.Currency
TxValidator ERC20TransactionValidator
}
ERC20CoinCreationTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD1. It allows the conversion of ERC20-funds to TFT.
func (ERC20CoinCreationTransactionController) DecodeTransactionData ¶
func (etctc ERC20CoinCreationTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (ERC20CoinCreationTransactionController) EncodeTransactionData ¶
func (etctc ERC20CoinCreationTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (ERC20CoinCreationTransactionController) EncodeTransactionIDInput ¶
func (etctc ERC20CoinCreationTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (ERC20CoinCreationTransactionController) JSONDecodeTransactionData ¶
func (etctc ERC20CoinCreationTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (ERC20CoinCreationTransactionController) JSONEncodeTransactionData ¶
func (etctc ERC20CoinCreationTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (ERC20CoinCreationTransactionController) SignatureHash ¶
func (etctc ERC20CoinCreationTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (ERC20CoinCreationTransactionController) ValidateBlockStakeOutputs ¶
func (etctc ERC20CoinCreationTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (ERC20CoinCreationTransactionController) ValidateCoinOutputs ¶
func (etctc ERC20CoinCreationTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, coinInputs map[types.CoinOutputID]types.CoinOutput) (err error)
ValidateCoinOutputs implements CoinOutputValidator.ValidateCoinOutputs
func (ERC20CoinCreationTransactionController) ValidateTransaction ¶
func (etctc ERC20CoinCreationTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type ERC20CoinCreationTransactionExtension ¶
ERC20CoinCreationTransactionExtension defines the ERC20CoinCreationTransaction Extension Data
type ERC20ConvertTransaction ¶
type ERC20ConvertTransaction struct {
// The address to send the TFT-converted tfchain ERC20 funds into.
Address ERC20Address `json:"address"`
// Amount of TFT to be paid towards buying ERC20 funds,
// note that the bridge will take part of this amount towards
// paying for the transaction costs, prior to sending the ERC20 funds to
// the defined target address.
Value types.Currency `json:"value"`
// TransactionFee defines the regular Tx fee.
TransactionFee types.Currency `json:"txfee"`
// CoinInputs are only used for the required fees,
// which contains the regular Tx fee as well as the additional fees,
// to be paid for the address registration. At least one CoinInput is required.
CoinInputs []types.CoinInput `json:"coininputs"`
// RefundCoinOutput is an optional coin output that can be used
// to refund coins paid as inputs for the required fees.
RefundCoinOutput *types.CoinOutput `json:"refundcoinoutput,omitempty"`
}
ERC20ConvertTransaction defines the Transaction (with version 0xD1) used to convert TFT into ERC20 funds paid to the defined ERC20 address.
func ERC20ConvertTransactionFromTransaction ¶
func ERC20ConvertTransactionFromTransaction(tx types.Transaction) (ERC20ConvertTransaction, error)
ERC20ConvertTransactionFromTransaction creates an ERC20ConvertTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `ERC20ConvertTransactionFromTransactionData` constructor.
func ERC20ConvertTransactionFromTransactionData ¶
func ERC20ConvertTransactionFromTransactionData(txData types.TransactionData) (ERC20ConvertTransaction, error)
ERC20ConvertTransactionFromTransactionData creates an ERC20ConvertTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (ERC20ConvertTransaction) MarshalRivine ¶
func (etctx ERC20ConvertTransaction) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (ERC20ConvertTransaction) MarshalSia ¶
func (etctx ERC20ConvertTransaction) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia, alias of MarshalRivine for backwards-compatibility reasons.
func (*ERC20ConvertTransaction) Transaction ¶
func (etctx *ERC20ConvertTransaction) Transaction() types.Transaction
Transaction returns this ERC20ConvertTransaction as regular tfchain transaction, using TransactionVersionBotNameTransfer as the type.
func (*ERC20ConvertTransaction) TransactionData ¶
func (etctx *ERC20ConvertTransaction) TransactionData() types.TransactionData
TransactionData returns this ERC20ConvertTransaction as regular tfchain transaction data.
func (*ERC20ConvertTransaction) UnmarshalRivine ¶
func (etctx *ERC20ConvertTransaction) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*ERC20ConvertTransaction) UnmarshalSia ¶
func (etctx *ERC20ConvertTransaction) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia, alias of UnmarshalRivine for backwards-compatibility reasons.
type ERC20ConvertTransactionController ¶
type ERC20ConvertTransactionController struct{}
ERC20ConvertTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 0xD0. It allows the conversion of TFT to ERC20-funds.
func (ERC20ConvertTransactionController) DecodeTransactionData ¶
func (etctc ERC20ConvertTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (ERC20ConvertTransactionController) EncodeTransactionData ¶
func (etctc ERC20ConvertTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (ERC20ConvertTransactionController) EncodeTransactionIDInput ¶
func (etctc ERC20ConvertTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (ERC20ConvertTransactionController) JSONDecodeTransactionData ¶
func (etctc ERC20ConvertTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (ERC20ConvertTransactionController) JSONEncodeTransactionData ¶
func (etctc ERC20ConvertTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (ERC20ConvertTransactionController) SignatureHash ¶
func (etctc ERC20ConvertTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (ERC20ConvertTransactionController) ValidateBlockStakeOutputs ¶
func (etctc ERC20ConvertTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (ERC20ConvertTransactionController) ValidateCoinOutputs ¶
func (etctc ERC20ConvertTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, coinInputs map[types.CoinOutputID]types.CoinOutput) error
ValidateCoinOutputs implements CoinOutputValidator.ValidateCoinOutputs, implemented here, overwriting the default logic, as the Tx value is not registered as a coin output, instead those TFT are "burned"
func (ERC20ConvertTransactionController) ValidateTransaction ¶
func (etctc ERC20ConvertTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type ERC20ConvertTransactionExtension ¶
type ERC20ConvertTransactionExtension struct {
// The address to send the TFT-converted tfchain ERC20 funds into.
Address ERC20Address
// Amount of TFT to be paid towards buying ERC20 funds.
Value types.Currency
}
ERC20ConvertTransactionExtension defines the ERC20ConvertTransaction Extension Data
type ERC20Hash ¶
type ERC20Hash [ERC20HashLength]byte
ERC20Hash defines an ERC20 Hash as a fixed-sized byte array of length 32.
func (*ERC20Hash) LoadString ¶
LoadString loads this TransactionID from a hex-encoded string of length 64.
func (ERC20Hash) MarshalJSON ¶
MarshalJSON implements json.Marshaler.MarshalJSON, and returns this Hash as a hex-encoded JSON string.
func (*ERC20Hash) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON, and decodes the given byte slice as a hex-encoded JSON string into the 32 bytes that make up this Hash.
type ERC20Registry ¶
type ERC20Registry interface {
GetERC20AddressForTFTAddress(types.UnlockHash) (ERC20Address, bool, error)
GetTFTTransactionIDForERC20TransactionID(ERC20Hash) (types.TransactionID, bool, error)
}
ERC20Registry defines the public READ API expected from an ERC20 Read-Only registry.
type ERC20TransactionValidator ¶
type ERC20TransactionValidator interface {
ValidateWithdrawTx(blockID, txID ERC20Hash, expectedAddress ERC20Address, expecedAmount types.Currency) error
}
ERC20TransactionValidator is the validation API used by the ERC20 CoinCreation Tx Controller, in order to validate the attached ERC20 Tx. Use the NopERC20TransactionValidator if no such validation is required.
type LegacyTransactionController ¶
type LegacyTransactionController struct {
types.LegacyTransactionController
TransactionFeeCheckBlockHeight types.BlockHeight
}
LegacyTransactionController wraps around Rivine's LegacyTransactionController, as to ensure that we use check the MinimumTransactionFee, only since a certain block height, and otherwise just ensure it is bigger than 0.
In order to achieve this, the TransactionValidation interface is implemented on top of the regular LegacyTransactionController.
func (LegacyTransactionController) ValidateTransaction ¶
func (ltc LegacyTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) error
ValidateTransaction implements TransactionValidator.ValidateTransaction
type MintConditionGetter ¶ added in v1.1.0
type MintConditionGetter interface {
// GetActiveMintCondition returns the active active mint condition.
GetActiveMintCondition() (types.UnlockConditionProxy, error)
// GetMintConditionAt returns the mint condition at a given block height.
GetMintConditionAt(height types.BlockHeight) (types.UnlockConditionProxy, error)
}
MintConditionGetter allows you to get the mint condition at a given block height.
For the daemon this interface could be implemented directly by the DB object that keeps track of the mint condition state, while for a client this could come via the REST API from a tfchain daemon in a more indirect way.
type MinterDefinitionTransaction ¶ added in v1.1.0
type MinterDefinitionTransaction struct {
// Nonce used to ensure the uniqueness of a MinterDefinitionTransaction's ID and signature.
Nonce TransactionNonce `json:"nonce"`
// MintFulfillment defines the fulfillment which is used in order to
// fulfill the globally defined MintCondition.
MintFulfillment types.UnlockFulfillmentProxy `json:"mintfulfillment"`
// MintCondition defines a new condition that defines who become(s) the new minter(s),
// and thus defines who can create coins as well as update who is/are the current minter(s)
//
// UnlockHash (unlockhash type 1) and MultiSigConditions are allowed,
// as well as TimeLocked conditions which have UnlockHash- and MultiSigConditions as
// internal condition.
MintCondition types.UnlockConditionProxy `json:"mintcondition"`
// Minerfees, a fee paid for this minter definition transaction.
MinerFees []types.Currency `json:"minerfees"`
// ArbitraryData can be used for any purpose,
// but is mostly to be used in order to define the reason/origins
// of the transfer of minting power.
ArbitraryData []byte `json:"arbitrarydata,omitempty"`
}
MinterDefinitionTransaction is to be created only by the defined Coin Minters, as a medium in order to transfer minting powers.
func MinterDefinitionTransactionFromTransaction ¶ added in v1.1.0
func MinterDefinitionTransactionFromTransaction(tx types.Transaction) (MinterDefinitionTransaction, error)
MinterDefinitionTransactionFromTransaction creates a MinterDefinitionTransaction, using a regular in-memory tfchain transaction.
Past the (tx) Version validation it piggy-backs onto the `MinterDefinitionTransactionFromTransactionData` constructor.
func MinterDefinitionTransactionFromTransactionData ¶ added in v1.1.0
func MinterDefinitionTransactionFromTransactionData(txData types.TransactionData) (MinterDefinitionTransaction, error)
MinterDefinitionTransactionFromTransactionData creates a MinterDefinitionTransaction, using the TransactionData from a regular in-memory tfchain transaction.
func (*MinterDefinitionTransaction) Transaction ¶ added in v1.1.0
func (cctx *MinterDefinitionTransaction) Transaction() types.Transaction
Transaction returns this CoinCreationTransaction as regular tfchain transaction, using TransactionVersionCoinCreation as the type.
func (*MinterDefinitionTransaction) TransactionData ¶ added in v1.1.0
func (cctx *MinterDefinitionTransaction) TransactionData() types.TransactionData
TransactionData returns this CoinCreationTransaction as regular tfchain transaction data.
type MinterDefinitionTransactionController ¶ added in v1.1.0
type MinterDefinitionTransactionController struct {
// MintConditionGetter is used to get a mint condition at the context-defined block height.
//
// The found MintCondition defines the condition that has to be fulfilled
// in order to mint new coins into existence (in the form of non-backed coin outputs).
MintConditionGetter MintConditionGetter
}
MinterDefinitionTransactionController defines a tfchain-specific transaction controller, for a transaction type reserved at type 128. It allows the transfer of coin minting powers.
func (MinterDefinitionTransactionController) DecodeTransactionData ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) DecodeTransactionData(r io.Reader) (types.TransactionData, error)
DecodeTransactionData implements TransactionController.DecodeTransactionData
func (MinterDefinitionTransactionController) EncodeTransactionData ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) EncodeTransactionData(w io.Writer, txData types.TransactionData) error
EncodeTransactionData implements TransactionController.EncodeTransactionData
func (MinterDefinitionTransactionController) EncodeTransactionIDInput ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) EncodeTransactionIDInput(w io.Writer, txData types.TransactionData) error
EncodeTransactionIDInput implements TransactionIDEncoder.EncodeTransactionIDInput
func (MinterDefinitionTransactionController) GetCommonExtensionData ¶
func (mdtc MinterDefinitionTransactionController) GetCommonExtensionData(extension interface{}) (types.CommonTransactionExtensionData, error)
GetCommonExtensionData implements TransactionCommonExtensionDataGetter.GetCommonExtensionData
func (MinterDefinitionTransactionController) JSONDecodeTransactionData ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) JSONDecodeTransactionData(data []byte) (types.TransactionData, error)
JSONDecodeTransactionData implements TransactionController.JSONDecodeTransactionData
func (MinterDefinitionTransactionController) JSONEncodeTransactionData ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) JSONEncodeTransactionData(txData types.TransactionData) ([]byte, error)
JSONEncodeTransactionData implements TransactionController.JSONEncodeTransactionData
func (MinterDefinitionTransactionController) SignExtension ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) SignExtension(extension interface{}, sign func(*types.UnlockFulfillmentProxy, types.UnlockConditionProxy, ...interface{}) error) (interface{}, error)
SignExtension implements TransactionExtensionSigner.SignExtension
func (MinterDefinitionTransactionController) SignatureHash ¶
func (mdtc MinterDefinitionTransactionController) SignatureHash(t types.Transaction, extraObjects ...interface{}) (crypto.Hash, error)
SignatureHash implements TransactionSignatureHasher.SignatureHash
func (MinterDefinitionTransactionController) ValidateBlockStakeOutputs ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) ValidateBlockStakeOutputs(t types.Transaction, ctx types.FundValidationContext, blockStakeInputs map[types.BlockStakeOutputID]types.BlockStakeOutput) (err error)
ValidateBlockStakeOutputs implements BlockStakeOutputValidator.ValidateBlockStakeOutputs
func (MinterDefinitionTransactionController) ValidateCoinOutputs ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) ValidateCoinOutputs(t types.Transaction, ctx types.FundValidationContext, coinInputs map[types.CoinOutputID]types.CoinOutput) (err error)
ValidateCoinOutputs implements CoinOutputValidator.ValidateCoinOutputs
func (MinterDefinitionTransactionController) ValidateTransaction ¶ added in v1.1.0
func (mdtc MinterDefinitionTransactionController) ValidateTransaction(t types.Transaction, ctx types.ValidationContext, constants types.TransactionValidationConstants) (err error)
ValidateTransaction implements TransactionValidator.ValidateTransaction
type MinterDefinitionTransactionExtension ¶ added in v1.1.0
type MinterDefinitionTransactionExtension struct {
Nonce TransactionNonce
MintFulfillment types.UnlockFulfillmentProxy
MintCondition types.UnlockConditionProxy
}
MinterDefinitionTransactionExtension defines the MinterDefinitionTx Extension Data
type MultiSignatureCondition ¶
type MultiSignatureCondition struct {
types.MultiSignatureCondition
// contains filtered or unexported fields
}
MultiSignatureCondition wraps around the Rivine-standard MultiSignatureCondition type, as to ensure that in the standard network of tfchain, it can only be used since blockheight 42000
func (MultiSignatureCondition) Equal ¶
func (msc MultiSignatureCondition) Equal(c types.UnlockCondition) bool
Equal implements UnlockCondition.Equal, ensuring the equality works for any expected MultiSig Combination.
func (MultiSignatureCondition) IsStandardCondition ¶
func (msc MultiSignatureCondition) IsStandardCondition(ctx types.ValidationContext) error
IsStandardCondition implements UnlockCondition.IsStandardCondition, wrapping around the internal MultiSignatureCondition's IsStandardCondition check, adding a pre-check of the blockheight
type NetworkAddress ¶
type NetworkAddress struct {
// contains filtered or unexported fields
}
NetworkAddress represents a NetworkAddress, meaning an IPv4/6 address or (domain) hostname.
func NewNetworkAddress ¶
func NewNetworkAddress(addr string) (NetworkAddress, error)
NewNetworkAddress creates a new NetworkAddress from a given (valid) string.
func (NetworkAddress) Compare ¶
func (na NetworkAddress) Compare(ona NetworkAddress) int
Compare returns an integer comparing two network addresses. If the types are equal the addresses are compared lexicographically, otherwise the compare result of the network address types is returned. The final result will be 0 if a==b, -1 if a < b, and +1 if a > b.
func (NetworkAddress) Equals ¶
func (na NetworkAddress) Equals(ona NetworkAddress) bool
Equals returns true if this NetworkAddress and the given NetworkAddress are equal.
func (*NetworkAddress) LoadString ¶
func (na *NetworkAddress) LoadString(str string) (err error)
LoadString loads the NetworkAddress from a human-readable string.
func (NetworkAddress) MarshalJSON ¶
func (na NetworkAddress) MarshalJSON() ([]byte, error)
MarshalJSON marshals a byte slice as a hex string.
func (NetworkAddress) MarshalRivine ¶
func (na NetworkAddress) MarshalRivine(w io.Writer) error
MarshalRivine marshals this NetworkAddress in a compact binary format.
func (NetworkAddress) MarshalSia ¶
func (na NetworkAddress) MarshalSia(w io.Writer) error
MarshalSia marshals this NetworkAddress in a compact binary format. Alias of MarshalRivine, for backwards-compatibility
func (NetworkAddress) String ¶
func (na NetworkAddress) String() string
String returns this NetworkAddress in a (human-readable) string format.
func (*NetworkAddress) UnmarshalJSON ¶
func (na *NetworkAddress) UnmarshalJSON(b []byte) error
UnmarshalJSON decodes the json (hex-encoded) string of the byte slice.
func (*NetworkAddress) UnmarshalRivine ¶
func (na *NetworkAddress) UnmarshalRivine(r io.Reader) error
UnmarshalRivine unmarshals this NetworkAddress from a compact binary format.
func (*NetworkAddress) UnmarshalSia ¶
func (na *NetworkAddress) UnmarshalSia(r io.Reader) error
UnmarshalSia unmarshals this NetworkAddress from a semi-compact binary format. Alias of UnmarshalRivine, for backwards-compatibility
type NetworkAddressSortedSet ¶
type NetworkAddressSortedSet struct {
// contains filtered or unexported fields
}
NetworkAddressSortedSet represents a sorted set of (unique) network addresses.
A NetworkAddressSortedSet does not expose it elements, as this is not a feature-requirement of tfchain, all it aims for is to ensure the set consists only of unique elements.
func (*NetworkAddressSortedSet) AddAddress ¶
func (nass *NetworkAddressSortedSet) AddAddress(address NetworkAddress) error
AddAddress adds a new (unique) network address to this sorted set of network addresses, returning an error if the address already exists within this sorted set.
func (*NetworkAddressSortedSet) BinaryDecode ¶
func (nass *NetworkAddressSortedSet) BinaryDecode(r io.Reader, length int) error
BinaryDecode can be used instead of UnmarshalRivine, should one need to decode the length prefix in a way other than the standard tfchain-slice approach. The decoding of the length has to happen prior to calling this method.
func (NetworkAddressSortedSet) BinaryEncode ¶
func (nass NetworkAddressSortedSet) BinaryEncode(w io.Writer) (int, error)
BinaryEncode can be used instead of MarshalRivine, should one want to encode the length prefix in a way other than the standard tfchain-slice approach. The encoding of the length has to happen prior to calling this method.
func (NetworkAddressSortedSet) Len ¶
func (nass NetworkAddressSortedSet) Len() int
Len returns the amount of network addresses in this sorted set.
func (NetworkAddressSortedSet) MarshalJSON ¶
func (nass NetworkAddressSortedSet) MarshalJSON() ([]byte, error)
MarshalJSON implements encoding/json.Marshaler.MarshalJSON
func (NetworkAddressSortedSet) MarshalRivine ¶
func (nass NetworkAddressSortedSet) MarshalRivine(w io.Writer) error
MarshalRivine implements rivbin.RivineMarshaler.MarshalRivine
func (NetworkAddressSortedSet) MarshalSia ¶
func (nass NetworkAddressSortedSet) MarshalSia(w io.Writer) error
MarshalSia implements siabin.SiaMarshaler.MarshalSia
func (*NetworkAddressSortedSet) RemoveAddress ¶
func (nass *NetworkAddressSortedSet) RemoveAddress(address NetworkAddress) error
RemoveAddress removes an existing network address from this sorted set of network addresses, returning an error if the address did not yet exist in this sorted set.
func (*NetworkAddressSortedSet) UnmarshalJSON ¶
func (nass *NetworkAddressSortedSet) UnmarshalJSON(data []byte) error
UnmarshalJSON implements encoding/json.Unmarshaler.UnmarshalJSON
func (*NetworkAddressSortedSet) UnmarshalRivine ¶
func (nass *NetworkAddressSortedSet) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements rivbin.RivineUnmarshaler.UnmarshalRivine
func (*NetworkAddressSortedSet) UnmarshalSia ¶
func (nass *NetworkAddressSortedSet) UnmarshalSia(r io.Reader) error
UnmarshalSia implements siabin.SiaUnmarshaler.UnmarshalSia
type NetworkAddressType ¶
type NetworkAddressType uint8
NetworkAddressType defines the type of a network address.
const ( // NetworkAddressHostname represents a valid hostname, assumed to be a valid FQDN, // and defined as described in RFC 1178. NetworkAddressHostname NetworkAddressType = iota // NetworkAddressIPv4 represents an IPv4 address, meaning an address identified by 4 bytes, // and defined as described in RFC 791. NetworkAddressIPv4 // NetworkAddressIPv6 represents an IPv6 address, meaning an address identified by 6 bytes, // and defined as described in RFC 2460. NetworkAddressIPv6 )
type NopERC20TransactionValidator ¶
type NopERC20TransactionValidator struct{}
NopERC20TransactionValidator provides a NOP-implementation of the ERC20TransactionValidator interface, allowing you to disable any extra validation on ERC20 Transactions.
func (NopERC20TransactionValidator) ValidateWithdrawTx ¶
func (nop NopERC20TransactionValidator) ValidateWithdrawTx(ERC20Hash, ERC20Hash, ERC20Address, types.Currency) error
ValidateWithdrawTx implements ERC20TransactionValidator.ValidateWithdrawTx, returning nil for every call.
type PublicKeySignaturePair ¶
type PublicKeySignaturePair struct {
PublicKey types.PublicKey `json:"publickey"`
Signature types.ByteSlice `json:"signature"`
}
PublicKeySignaturePair pairs a public key and a signature that can be validated with it.
func (PublicKeySignaturePair) MarshalRivine ¶
func (pksp PublicKeySignaturePair) MarshalRivine(w io.Writer) error
MarshalRivine implements RivineMarshaler.MarshalRivine
func (PublicKeySignaturePair) MarshalSia ¶
func (pksp PublicKeySignaturePair) MarshalSia(w io.Writer) error
MarshalSia implements SiaMarshaler.MarshalSia
func (*PublicKeySignaturePair) UnmarshalRivine ¶
func (pksp *PublicKeySignaturePair) UnmarshalRivine(r io.Reader) error
UnmarshalRivine implements RivineUnmarshaler.UnmarshalRivine
func (*PublicKeySignaturePair) UnmarshalSia ¶
func (pksp *PublicKeySignaturePair) UnmarshalSia(r io.Reader) error
UnmarshalSia implements SiaUnmarshaler.UnmarshalSia
type TFChainReadDB ¶
type TFChainReadDB interface {
MintConditionGetter
BotRecordReadRegistry
ERC20Registry
}
TFChainReadDB is the Read-Only Database that is required in order to fetch the different transaction-related data from required by Tfchain transactions.
type TransactionNonce ¶ added in v1.1.0
type TransactionNonce [TransactionNonceLength]byte
TransactionNonce is a nonce used to ensure the uniqueness of an otherwise potentially non-unique Tx
func RandomTransactionNonce ¶ added in v1.1.0
func RandomTransactionNonce() (nonce TransactionNonce)
RandomTransactionNonce creates a random Transaction nonce
func (TransactionNonce) MarshalJSON ¶ added in v1.1.0
func (tn TransactionNonce) MarshalJSON() ([]byte, error)
MarshalJSON implements JSON.Marshaller.MarshalJSON encodes the Nonce as a base64-encoded string
func (*TransactionNonce) UnmarshalJSON ¶ added in v1.1.0
func (tn *TransactionNonce) UnmarshalJSON(in []byte) error
UnmarshalJSON implements JSON.Unmarshaller.UnmarshalJSON piggy-backing on the base64-decoding used for byte slices in the std JSON lib