Documentation
¶
Index ¶
- Constants
- func CheckScript(ls LockingScript, us UnlockingScript) bool
- func Checker(item interface{}, value interface{}) bool
- func GenerateFinalOblivion() (o string, err error)
- func RebuildTransactionID(forTx Transaction) (txID model.Hash, err error)
- type Contract
- type Features
- type Frequency
- type LockingScript
- type Script
- type Signatures
- type Subchain
- type Transaction
- func (tx *Transaction) CreateTransactionID() error
- func (tx Transaction) Dump()
- func (tx Transaction) DumpByte() ([]byte, error)
- func (tx Transaction) GetByteArrayValues() (values [][]byte)
- func (tx *Transaction) IsEmpty() bool
- func (tx Transaction) IsFeeding() bool
- func (tx Transaction) IsOblivion() bool
- func (tx Transaction) IsOptOut() bool
- func (tx Transaction) IsSpending() bool
- func (tx Transaction) IsStatic() bool
- func (tx *Transaction) VerifyIdentification(checker model.Ciphered, decompressedPublicKey model.Key) bool
- type Transactions
- type Type
- type UnlockingScript
Constants ¶
const ( // SCRIPT_SEPARATOR_HEX ... SCRIPT_SEPARATOR_HEX = "003b" // Unicode semi-colon character: ";" // SCRIPT_ITEM_SEPARATOR_HEX ... SCRIPT_ITEM_SEPARATOR_HEX = "002c" // Unicode comma character: "," )
Separators should be used as their binary value, ie. passed through utils.Must(utils.FromHex()).
const ( // INFINITY ... INFINITY int = -1 // Any negative value would suit but -1 is our preferred choice )
Variables ¶
This section is empty.
Functions ¶
func CheckScript ¶
func CheckScript(ls LockingScript, us UnlockingScript) bool
CheckScript should return `true` to notify that it's a valid combination of transactions
It takes the opt-in's locking script and the other transaction's unlocking script and return a boolean.
func Checker ¶
func Checker(item interface{}, value interface{}) bool
Checker is a function to be sent to concurrent.Slice.Check to compare transactions. `item` will be the original and `value` will be either the new transaction we're trying to compare or its ID as a `Hash`.
func GenerateFinalOblivion ¶ added in v1.1.0
GenerateFinalOblivion creates the Ω' string, or an error if any
func RebuildTransactionID ¶
func RebuildTransactionID(forTx Transaction) (txID model.Hash, err error)
RebuildTransactionID ...
Types ¶
type Contract ¶
type Contract struct {
TransactionType Type `json:"type"`
Channel channel.Channel `json:"channel,omitempty"`
Features Features `json:"features,omitempty"`
Signatures Signatures `json:"signatures"`
}
Contract ...
type Features ¶
type Features struct {
Start uint64 `json:"start"`
End int `json:"end"` // Possible INFINITY
MaxUse int `json:"maxUse"` // Possible INFINITY
Frequency Frequency `json:"freq,omitempty"`
Destination features.Destination `json:"dest"`
}
Features ...
func (Features) GetByteArrayValues ¶
GetByteArrayValues ...
func (Features) HasStaticFeatures ¶
HasStaticFeatures ...
type Frequency ¶
type Frequency struct {
FirstPeriodID uint64 `json:"firstPeriodId"`
CycleLength uint64 `json:"cycleLength"`
UsePerCycle int `json:"usePerCycle"` // Possible INFINITY
CurrentPeriodID uint64 `json:"currentPeriodId"`
}
Frequency ...
type LockingScript ¶
type LockingScript struct {
Version model.Bits8 `json:"version"`
BeneficiaryPublicKey crypto.PublicKey `json:"beneficiaryPublicKey"`
EmitterPublicKey crypto.PublicKey `json:"emitterPublicKey"`
Permissions permissions.Permissions `json:"permissions"`
}
LockingScript ...
func ToLockingScript ¶
func ToLockingScript(s Script) (ls LockingScript, err error)
ToLockingScript ...
type Script ¶
Script ...
func BuildLocking ¶
func BuildLocking(beneficiary crypto.PublicKey, emitter crypto.PublicKey, permissions permissions.Permissions) Script
BuildLocking creates the Script from the passed arguments.
It takes the users and the permissions as arguments and returns a Script object.
func BuildUnlocking ¶
func BuildUnlocking(op operation.Operation, signedData []model.Signature, hashedFeatures model.Hash, timestamp uint64, rand int) Script
BuildUnlocking creates the Script from the passed arguments.
It takes the operation, an array of signed data, the hashed features, the timestamp and the transaction random number for identification as arguments and returns a Script object.
type Signatures ¶
type Signatures struct {
Beneficiary model.Signature `json:"beneficiary,omitempty"`
Emitter model.Signature `json:"emitter,omitempty"`
}
Signatures ...
type Subchain ¶
type Subchain struct {
InitialTransactionID model.Hash `json:"initialTransactionId"`
LastStateTransactionID model.Hash `json:"lastStateTransactionId,omitempty"`
FinalTransactionID model.Hash `json:"finalTransactionId,omitempty"`
}
Subchain ...
type Transaction ¶
type Transaction struct {
TransactionID model.Hash `json:"transactionId"`
LastBlockID model.Hash `json:"lastBlockId"`
Subchain Subchain `json:"subchain,omitempty"`
Timestamp uint64 `json:"timestamp"`
Contract Contract `json:"contract"`
Identification ti.Identifications `json:"identification,omitempty"`
Script Script `json:"script"`
OblivionCode string `json:"oblivionCode,omitempty"` // NB: this is the encrypted oblivion code (or the final one)
}
Transaction ...
func (*Transaction) CreateTransactionID ¶
func (tx *Transaction) CreateTransactionID() error
CreateTransactionID ...
func (Transaction) GetByteArrayValues ¶
func (tx Transaction) GetByteArrayValues() (values [][]byte)
GetByteArrayValues ...
func (*Transaction) IsEmpty ¶
func (tx *Transaction) IsEmpty() bool
IsEmpty returns `true` if all its fields are empty.
func (Transaction) IsOblivion ¶ added in v1.1.0
func (tx Transaction) IsOblivion() bool
IsOblivion ...
func (*Transaction) VerifyIdentification ¶
func (tx *Transaction) VerifyIdentification(checker model.Ciphered, decompressedPublicKey model.Key) bool
VerifyIdentification helps verify that the transaction was correctly "signed". It takes the data to check as well as the stakeholder's decompressed public key and returns a boolean.
type Transactions ¶
type Transactions []Transaction
Transactions ...
func (Transactions) Len ¶
func (t Transactions) Len() int
func (Transactions) Less ¶
func (t Transactions) Less(i, j int) bool
func (Transactions) Swap ¶
func (t Transactions) Swap(i, j int)
type UnlockingScript ¶
type UnlockingScript struct {
Version model.Bits8
Operation operation.Operation
SignedData []model.Signature
HashedFeatures model.Hash
Timestamp uint64
Random int
}
UnlockingScript ...
func ToUnlockingScript ¶
func ToUnlockingScript(s Script) (us UnlockingScript, err error)
ToUnlockingScript ...