Documentation ¶
Overview ¶
Package bundle provides primitives to create and validate bundles.
Index ¶
- Constants
- Variables
- func PadTag(tag Trytes) Trytes
- func TailTransactionHash(bndl Bundle) Hash
- func ValidBundle(bundle Bundle, applyMigrationChecks ...bool) error
- func ValidateBundleSignatures(bundle Bundle) (bool, error)
- type Bundle
- type BundleEntries
- type BundleEntry
- type Bundles
- type BundlesByTimestamp
- type Transfer
- type Transfers
Constants ¶
const (
// The minimum amount a migration bundle has to deposit.
MigrationBundleMinDeposit = 1_000_000
)
Variables ¶
var EmptyTransfer = Transfer{
Message: NullSignatureMessageFragmentTrytes,
Value: 0,
Tag: NullTagTrytes,
Address: NullAddressWithChecksum,
}
EmptyTransfer is a transfer with 9s initialized values.
Functions ¶
func PadTag ¶
func PadTag(tag Trytes) Trytes
PadTag pads the given trytes up to the length of a tag.
func TailTransactionHash ¶
func TailTransactionHash(bndl Bundle) Hash
TailTransactionHash returns the tail transaction's hash.
func ValidBundle ¶
ValidBundle checks if a bundle is syntactically valid. Validates signatures and overall structure.
func ValidateBundleSignatures ¶
ValidateBundleSignatures validates all signatures of the given bundle. Use ValidBundle() if you want to validate the overall structure of the bundle and the signatures.
Types ¶
type Bundle ¶
type Bundle = transaction.Transactions
Bundle represents grouped together transactions for creating a transfer.
func AddEntry ¶
func AddEntry(txs Bundle, bndlEntry BundleEntry) Bundle
AddEntry adds a new entry to the bundle. It automatically adds additional transactions if the signature message fragments don't fit into one transaction.
func AddTrytes ¶
AddTrytes adds the given fragments to the txs in the bundle starting from the specified offset.
func Finalize ¶
Finalize finalizes the bundle by calculating and setting the bundle hash. It increments ObsoleteTag until the hash does not contain an M; this serves as a work-around for the so-called M-Bug.
func FinalizeInsecure ¶
FinalizeInsecure finalizes the bundle by calculating and setting the bundle hash. The bundle finalized with this could be susceptible to the so-called M-Bug, but it is much faster than Finalize. It must only be used for non-value transactions or for value transactions where the private key has been derived in an M-Bug resistant way.
type BundleEntries ¶
type BundleEntries = []BundleEntry
BundleEntries are a slice of BundleEntry.
func TransfersToBundleEntries ¶
func TransfersToBundleEntries(timestamp uint64, transfers ...Transfer) (BundleEntries, error)
TransfersToBundleEntries translates transfers to bundle entries.
type BundleEntry ¶
type BundleEntry struct { // The amount of transactions to fulfill this entry. Length uint64 // The address used for this entry. Address Hash // The value for this entry. Value int64 // The tag for this entry. Tag Trytes // The timestamp for this entry. Timestamp uint64 // One or multiple signature message fragments. SignatureMessageFragments []Trytes }
BundleEntry is an object which gets translated into one or multiple transactions when used in conjunction with AddEntry().
type Bundles ¶
type Bundles []Bundle
Bundles are a slice of Bundle.
func GroupTransactionsIntoBundles ¶
func GroupTransactionsIntoBundles(txs transaction.Transactions) Bundles
GroupTransactionsIntoBundles groups the given transactions into groups of bundles. Note that the same bundle can exist in the return slice multiple times, though they are reattachments of the same transfer.
type BundlesByTimestamp ¶
type BundlesByTimestamp Bundles
BundlesByTimestamp are sorted bundles by attachment timestamp.