Documentation ¶
Index ¶
- func BaseDepositEquation(dataSize32 uint32, numEpochs32 uint32) (*uint256.Uint256, error)
- func MakeUTXOID(txHash []byte, idx uint32) []byte
- func NumEpochsEquation(dataSize32 uint32, depositOrig *uint256.Uint256) (uint32, error)
- func RewardDepositEquation(depositOrig *uint256.Uint256, dataSize32 uint32, epochInitial uint32, ...) (*uint256.Uint256, error)
- type ASPreImage
- func (b *ASPreImage) IsExpired(currentHeight uint32) (bool, error)
- func (b *ASPreImage) MarshalBinary() ([]byte, error)
- func (b *ASPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.ASPreImage, error)
- func (b *ASPreImage) PreHash() ([]byte, error)
- func (b *ASPreImage) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
- func (b *ASPreImage) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
- func (b *ASPreImage) UnmarshalBinary(data []byte) error
- func (b *ASPreImage) UnmarshalCapn(bc mdefs.ASPreImage) error
- func (b *ASPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *AtomicSwapSignature) error
- type AtomicSwap
- func (b *AtomicSwap) ChainID() (uint32, error)
- func (b *AtomicSwap) Exp() (uint32, error)
- func (b *AtomicSwap) GenericOwner() (*Owner, error)
- func (b *AtomicSwap) IsExpired(currentHeight uint32) (bool, error)
- func (b *AtomicSwap) IssuedAt() (uint32, error)
- func (b *AtomicSwap) MakeTxIn() (*TXIn, error)
- func (b *AtomicSwap) MarshalBinary() ([]byte, error)
- func (b *AtomicSwap) MarshalCapn(seg *capnp.Segment) (mdefs.AtomicSwap, error)
- func (b *AtomicSwap) Owner() (*AtomicSwapOwner, error)
- func (b *AtomicSwap) PreHash() ([]byte, error)
- func (b *AtomicSwap) SetTXOutIdx(idx uint32) error
- func (b *AtomicSwap) SetTxHash(txHash []byte) error
- func (b *AtomicSwap) SignAsAlternate(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error
- func (b *AtomicSwap) SignAsPrimary(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error
- func (b *AtomicSwap) TXOutIdx() (uint32, error)
- func (b *AtomicSwap) UTXOID() ([]byte, error)
- func (b *AtomicSwap) UnmarshalBinary(data []byte) error
- func (b *AtomicSwap) UnmarshalCapn(bc mdefs.AtomicSwap) error
- func (b *AtomicSwap) ValidateSignature(currentHeight uint32, txIn *TXIn) error
- func (b *AtomicSwap) Value() (*uint256.Uint256, error)
- type AtomicSwapOwner
- func (aso *AtomicSwapOwner) AlternateAccount() ([]byte, error)
- func (aso *AtomicSwapOwner) MarshalBinary() ([]byte, error)
- func (aso *AtomicSwapOwner) New(priOwnerAcct []byte, altOwnerAcct []byte, hashKey []byte) error
- func (aso *AtomicSwapOwner) NewFromOwner(priOwner *Owner, altOwner *Owner, hashKey []byte) error
- func (aso *AtomicSwapOwner) PrimaryAccount() ([]byte, error)
- func (aso *AtomicSwapOwner) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
- func (aso *AtomicSwapOwner) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
- func (aso *AtomicSwapOwner) UnmarshalBinary(o []byte) error
- func (aso *AtomicSwapOwner) Validate() error
- func (aso *AtomicSwapOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature, isExpired bool) error
- type AtomicSwapSignature
- type AtomicSwapSubOwner
- func (asso *AtomicSwapSubOwner) MarshalBinary() ([]byte, error)
- func (asso *AtomicSwapSubOwner) NewFromOwner(o *Owner) error
- func (asso *AtomicSwapSubOwner) UnmarshalBinary(o []byte) ([]byte, error)
- func (asso *AtomicSwapSubOwner) Validate() error
- func (asso *AtomicSwapSubOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature) error
- type DSLinker
- func (b *DSLinker) ChainID() (uint32, error)
- func (b *DSLinker) EpochOfExpiration() (uint32, error)
- func (b *DSLinker) Index() ([]byte, error)
- func (b *DSLinker) IssuedAt() (uint32, error)
- func (b *DSLinker) MarshalBinary() ([]byte, error)
- func (b *DSLinker) MarshalCapn(seg *capnp.Segment) (mdefs.DSLinker, error)
- func (b *DSLinker) Owner() (*DataStoreOwner, error)
- func (b *DSLinker) PreHash() ([]byte, error)
- func (b *DSLinker) RawData() ([]byte, error)
- func (b *DSLinker) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
- func (b *DSLinker) SetTXOutIdx(idx uint32) error
- func (b *DSLinker) TXOutIdx() (uint32, error)
- func (b *DSLinker) UTXOID() ([]byte, error)
- func (b *DSLinker) UnmarshalBinary(data []byte) error
- func (b *DSLinker) UnmarshalCapn(bc mdefs.DSLinker) error
- func (b *DSLinker) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error
- func (b *DSLinker) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error
- func (b *DSLinker) Value() (*uint256.Uint256, error)
- type DSPreImage
- func (b *DSPreImage) EpochOfExpiration() (uint32, error)
- func (b *DSPreImage) IsExpired(currentHeight uint32) (bool, error)
- func (b *DSPreImage) MarshalBinary() ([]byte, error)
- func (b *DSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.DSPreImage, error)
- func (b *DSPreImage) PreHash() ([]byte, error)
- func (b *DSPreImage) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
- func (b *DSPreImage) UnmarshalBinary(data []byte) error
- func (b *DSPreImage) UnmarshalCapn(bc mdefs.DSPreImage) error
- func (b *DSPreImage) ValidateDeposit() error
- func (b *DSPreImage) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error
- func (b *DSPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error
- func (b *DSPreImage) Value() (*uint256.Uint256, error)
- type DataStore
- func (b *DataStore) ChainID() (uint32, error)
- func (b *DataStore) EpochOfExpiration() (uint32, error)
- func (b *DataStore) GenericOwner() (*Owner, error)
- func (b *DataStore) Index() ([]byte, error)
- func (b *DataStore) IssuedAt() (uint32, error)
- func (b *DataStore) MakeTxIn() (*TXIn, error)
- func (b *DataStore) MarshalBinary() ([]byte, error)
- func (b *DataStore) MarshalCapn(seg *capnp.Segment) (mdefs.DataStore, error)
- func (b *DataStore) Owner() (*DataStoreOwner, error)
- func (b *DataStore) PreHash() ([]byte, error)
- func (b *DataStore) PreSign(s Signer) error
- func (b *DataStore) RawData() ([]byte, error)
- func (b *DataStore) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
- func (b *DataStore) SetTXOutIdx(idx uint32) error
- func (b *DataStore) SetTxHash(txHash []byte) error
- func (b *DataStore) Sign(txIn *TXIn, s Signer) error
- func (b *DataStore) TXOutIdx() (uint32, error)
- func (b *DataStore) TxHash() ([]byte, error)
- func (b *DataStore) UTXOID() ([]byte, error)
- func (b *DataStore) UnmarshalBinary(data []byte) error
- func (b *DataStore) UnmarshalCapn(bc mdefs.DataStore) error
- func (b *DataStore) ValidatePreSignature() error
- func (b *DataStore) ValidateSignature(currentHeight uint32, txIn *TXIn) error
- func (b *DataStore) Value() (*uint256.Uint256, error)
- type DataStoreOwner
- func (dso *DataStoreOwner) MarshalBinary() ([]byte, error)
- func (dso *DataStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)
- func (dso *DataStoreOwner) NewFromOwner(o *Owner) error
- func (dso *DataStoreOwner) Sign(msg []byte, s Signer) (*DataStoreSignature, error)
- func (dso *DataStoreOwner) UnmarshalBinary(o []byte) error
- func (dso *DataStoreOwner) Validate() error
- func (dso *DataStoreOwner) ValidateSignature(msg []byte, sig *DataStoreSignature, isExpired bool) error
- type DataStoreSignature
- type Owner
- func (onr *Owner) MarshalBinary() ([]byte, error)
- func (onr *Owner) New(acct []byte, curveSpec constants.CurveSpec) error
- func (onr *Owner) NewFromAtomicSwapOwner(aso *AtomicSwapOwner) error
- func (onr *Owner) NewFromAtomicSwapSubOwner(asso *AtomicSwapSubOwner) error
- func (onr *Owner) NewFromDataStoreOwner(dso *DataStoreOwner) error
- func (onr *Owner) NewFromValueStoreOwner(vso *ValueStoreOwner) error
- func (onr *Owner) UnmarshalBinary(o []byte) error
- func (onr *Owner) Validate() error
- type PaginationResponse
- type SVA
- type Signer
- type SignerRole
- type TXIn
- func (b *TXIn) ChainID() (uint32, error)
- func (b *TXIn) ConsumedTxHash() ([]byte, error)
- func (b *TXIn) ConsumedTxIdx() (uint32, error)
- func (b *TXIn) IsDeposit() bool
- func (b *TXIn) MarshalBinary() ([]byte, error)
- func (b *TXIn) MarshalCapn(seg *capnp.Segment) (mdefs.TXIn, error)
- func (b *TXIn) PreHash() ([]byte, error)
- func (b *TXIn) SetTxHash(txHash []byte) error
- func (b *TXIn) TxHash() ([]byte, error)
- func (b *TXIn) UTXOID() ([]byte, error)
- func (b *TXIn) UnmarshalBinary(data []byte) error
- func (b *TXIn) UnmarshalCapn(bc mdefs.TXIn) error
- type TXInLinker
- func (b *TXInLinker) ChainID() (uint32, error)
- func (b *TXInLinker) ConsumedTxHash() ([]byte, error)
- func (b *TXInLinker) ConsumedTxIdx() (uint32, error)
- func (b *TXInLinker) IsDeposit() bool
- func (b *TXInLinker) MarshalBinary() ([]byte, error)
- func (b *TXInLinker) MarshalCapn(seg *capnp.Segment) (mdefs.TXInLinker, error)
- func (b *TXInLinker) PreHash() ([]byte, error)
- func (b *TXInLinker) SetTxHash(txHash []byte) error
- func (b *TXInLinker) UTXOID() ([]byte, error)
- func (b *TXInLinker) UnmarshalBinary(data []byte) error
- func (b *TXInLinker) UnmarshalCapn(bc mdefs.TXInLinker) error
- type TXInPreImage
- func (b *TXInPreImage) IsDeposit() bool
- func (b *TXInPreImage) MarshalBinary() ([]byte, error)
- func (b *TXInPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.TXInPreImage, error)
- func (b *TXInPreImage) PreHash() ([]byte, error)
- func (b *TXInPreImage) UTXOID() ([]byte, error)
- func (b *TXInPreImage) UnmarshalBinary(data []byte) error
- func (b *TXInPreImage) UnmarshalCapn(bc mdefs.TXInPreImage) error
- type TXOut
- func (b *TXOut) Account() ([]byte, error)
- func (b *TXOut) AtomicSwap() (*AtomicSwap, error)
- func (b *TXOut) CannotBeMinedBeforeHeight() (uint32, error)
- func (b *TXOut) ChainID() (uint32, error)
- func (b *TXOut) CreateValueStore(chainID uint32, value *uint256.Uint256, acct []byte, ...) error
- func (b *TXOut) CreateValueStoreFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error
- func (b *TXOut) DataStore() (*DataStore, error)
- func (b *TXOut) GenericOwner() (*Owner, error)
- func (b *TXOut) HasAtomicSwap() bool
- func (b *TXOut) HasDataStore() bool
- func (b *TXOut) HasValueStore() bool
- func (b *TXOut) IsDeposit() bool
- func (b *TXOut) MakeTxIn() (*TXIn, error)
- func (b *TXOut) MarshalBinary() ([]byte, error)
- func (b *TXOut) MarshalCapn(seg *capnp.Segment) (mdefs.TXOut, error)
- func (b *TXOut) MustBeMinedBeforeHeight() (uint32, error)
- func (b *TXOut) NewAtomicSwap(v *AtomicSwap) error
- func (b *TXOut) NewDataStore(v *DataStore) error
- func (b *TXOut) NewValueStore(v *ValueStore) error
- func (b *TXOut) PreHash() ([]byte, error)
- func (b *TXOut) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
- func (b *TXOut) SetTXOutIdx(idx uint32) error
- func (b *TXOut) SetTxHash(txHash []byte) error
- func (b *TXOut) TXOutIdx() (uint32, error)
- func (b *TXOut) TxHash() ([]byte, error)
- func (b *TXOut) UTXOID() ([]byte, error)
- func (b *TXOut) UnmarshalBinary(data []byte) error
- func (b *TXOut) UnmarshalCapn(bc mdefs.TXOut) error
- func (b *TXOut) ValidatePreSignature() error
- func (b *TXOut) ValidateSignature(currentHeight uint32, txIn *TXIn) error
- func (b *TXOut) Value() (*uint256.Uint256, error)
- func (b *TXOut) ValueStore() (*ValueStore, error)
- type Tx
- func (b *Tx) CannotBeMinedUntil() (uint32, error)
- func (b *Tx) ConsumedIsDeposit() []bool
- func (b *Tx) ConsumedPreHash() ([][]byte, error)
- func (b *Tx) ConsumedUTXOID() ([][]byte, error)
- func (b *Tx) EpochOfExpirationForMining() (uint32, error)
- func (b *Tx) GeneratedPreHash() ([][]byte, error)
- func (b *Tx) GeneratedUTXOID() ([][]byte, error)
- func (b *Tx) MarshalBinary() ([]byte, error)
- func (b *Tx) MarshalCapn(seg *capnp.Segment) (mdefs.Tx, error)
- func (b *Tx) PostValidatePending(currentHeight uint32, consumedUTXOs Vout) error
- func (b *Tx) PreValidatePending(chainID uint32) error
- func (b *Tx) SetTxHash() error
- func (b *Tx) TxHash() ([]byte, error)
- func (b *Tx) UnmarshalBinary(data []byte) error
- func (b *Tx) UnmarshalCapn(bc mdefs.Tx) error
- func (b *Tx) Validate(set map[string]bool, currentHeight uint32, consumedUTXOs Vout) (map[string]bool, error)
- func (b *Tx) ValidateChainID(chainID uint32) error
- func (b *Tx) ValidateDataStoreIndexes(opset map[string]bool) (map[string]bool, error)
- func (b *Tx) ValidateEqualVinVout(refUTXOs Vout, currentHeight uint32) error
- func (b *Tx) ValidateIssuedAtForMining(currentHeight uint32) error
- func (b *Tx) ValidatePreSignature() error
- func (b *Tx) ValidateSignature(currentHeight uint32, refUTXOs Vout) error
- func (b *Tx) ValidateTxHash() error
- func (b *Tx) ValidateUnique(opset map[string]bool) (map[string]bool, error)
- func (b *Tx) XXXIsTx()
- type TxVec
- func (txv TxVec) ConsumedIsDeposit() []bool
- func (txv TxVec) ConsumedPreHash() ([][]byte, error)
- func (txv TxVec) ConsumedPreHashOnlyDeposits() ([][]byte, error)
- func (txv TxVec) ConsumedTxIns() (Vin, error)
- func (txv TxVec) ConsumedUTXOID() ([][]byte, error)
- func (txv TxVec) ConsumedUTXOIDNoDeposits() ([][]byte, error)
- func (txv TxVec) ConsumedUTXOIDOnlyDeposits() ([][]byte, error)
- func (txv TxVec) GeneratedPreHash() ([][]byte, error)
- func (txv TxVec) GeneratedUTXOID() ([][]byte, error)
- func (txv TxVec) GeneratedUTXOs() (Vout, error)
- func (txv TxVec) MarshalBinary() ([][]byte, error)
- func (txv TxVec) PostValidatePending(currentHeight uint32, consumedUTXOs Vout) error
- func (txv TxVec) PreValidateApplyState(chainID uint32) error
- func (txv TxVec) PreValidatePending(chainID uint32) error
- func (txv TxVec) TxHash() ([][]byte, error)
- func (txv TxVec) Validate(currentHeight uint32, consumedUTXOs Vout) error
- func (txv TxVec) ValidateChainID(chainID uint32) error
- func (txv TxVec) ValidateDataStoreIndexes(exclSet map[string]bool) (map[string]bool, error)
- func (txv TxVec) ValidateUnique(exclSet map[string]bool) (map[string]bool, error)
- type VSPreImage
- func (b *VSPreImage) MarshalBinary() ([]byte, error)
- func (b *VSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.VSPreImage, error)
- func (b *VSPreImage) PreHash() ([]byte, error)
- func (b *VSPreImage) UnmarshalBinary(data []byte) error
- func (b *VSPreImage) UnmarshalCapn(bc mdefs.VSPreImage) error
- func (b *VSPreImage) ValidateSignature(msg []byte, sig *ValueStoreSignature) error
- type ValueStore
- func (b *ValueStore) ChainID() (uint32, error)
- func (b *ValueStore) GenericOwner() (*Owner, error)
- func (b *ValueStore) IsDeposit() bool
- func (b *ValueStore) MakeTxIn() (*TXIn, error)
- func (b *ValueStore) MarshalBinary() ([]byte, error)
- func (b *ValueStore) MarshalCapn(seg *capnp.Segment) (mdefs.ValueStore, error)
- func (b *ValueStore) New(chainID uint32, value *uint256.Uint256, acct []byte, ...) error
- func (b *ValueStore) NewFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error
- func (b *ValueStore) Owner() (*ValueStoreOwner, error)
- func (b *ValueStore) PreHash() ([]byte, error)
- func (b *ValueStore) SetTXOutIdx(idx uint32) error
- func (b *ValueStore) SetTxHash(txHash []byte) error
- func (b *ValueStore) Sign(txIn *TXIn, s Signer) error
- func (b *ValueStore) TXOutIdx() (uint32, error)
- func (b *ValueStore) UTXOID() ([]byte, error)
- func (b *ValueStore) UnmarshalBinary(data []byte) error
- func (b *ValueStore) UnmarshalCapn(bc mdefs.ValueStore) error
- func (b *ValueStore) ValidateSignature(txIn *TXIn) error
- func (b *ValueStore) Value() (*uint256.Uint256, error)
- type ValueStoreOwner
- func (vso *ValueStoreOwner) MarshalBinary() ([]byte, error)
- func (vso *ValueStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)
- func (vso *ValueStoreOwner) NewFromOwner(o *Owner) error
- func (vso *ValueStoreOwner) Sign(msg []byte, s Signer) (*ValueStoreSignature, error)
- func (vso *ValueStoreOwner) UnmarshalBinary(o []byte) error
- func (vso *ValueStoreOwner) Validate() error
- func (vso *ValueStoreOwner) ValidateSignature(msg []byte, sig *ValueStoreSignature) error
- type ValueStoreSignature
- type Vin
- type Vout
- func (vout Vout) MakeTxIn() (Vin, error)
- func (vout Vout) PreHash() ([][]byte, error)
- func (vout Vout) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
- func (vout Vout) SetTxOutIdx() error
- func (vout Vout) UTXOID() ([][]byte, error)
- func (vout Vout) ValidatePreSignature() error
- func (vout Vout) ValidateSignature(currentHeight uint32, txIn []*TXIn) error
- func (vout Vout) ValidateTxOutIdx() error
- func (vout Vout) Value() (*uint256.Uint256, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BaseDepositEquation ¶
BaseDepositEquation specifies a required deposit for a certain amount of data to persist for a specified number of epochs.
The simple equation is
deposit = (dataSize + BaseDatasizeConst) * (2 + numEpochs)
We have additional checks to ensure there is no integer overflow. This will never happen for valid deposits, but we protect against it.
func MakeUTXOID ¶
MakeUTXOID will create the UTXOID for a utxo given a transaction hash and index.
func NumEpochsEquation ¶
NumEpochsEquation returns the number of epochs until expiration.
The simple equation is
numEpochs = (deposit / (dataSize + BaseDatasizeConst)) - 2
We have additional checks to ensure there is no integer overflow.
Types ¶
type ASPreImage ¶
type ASPreImage struct { ChainID uint32 Value *uint256.Uint256 TXOutIdx uint32 IssuedAt uint32 Exp uint32 Owner *AtomicSwapOwner // contains filtered or unexported fields }
ASPreImage holds the values required for an AtomicSwap object
func (*ASPreImage) IsExpired ¶
func (b *ASPreImage) IsExpired(currentHeight uint32) (bool, error)
IsExpired returns true if the current epoch is greater than exp
func (*ASPreImage) MarshalBinary ¶
func (b *ASPreImage) MarshalBinary() ([]byte, error)
MarshalBinary takes the ASPreImage object and returns the canonical byte slice
func (*ASPreImage) MarshalCapn ¶
func (b *ASPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.ASPreImage, error)
MarshalCapn marshals the object into its capnproto definition
func (*ASPreImage) PreHash ¶
func (b *ASPreImage) PreHash() ([]byte, error)
PreHash returns the PreHash of the object
func (*ASPreImage) SignAsAlternate ¶
func (b *ASPreImage) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
SignAsAlternate signs the ASPreImage as the alternate account owner
func (*ASPreImage) SignAsPrimary ¶
func (b *ASPreImage) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
SignAsPrimary signs the ASPreImage as the primary account owner
func (*ASPreImage) UnmarshalBinary ¶
func (b *ASPreImage) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding ASPreImage object
func (*ASPreImage) UnmarshalCapn ¶
func (b *ASPreImage) UnmarshalCapn(bc mdefs.ASPreImage) error
UnmarshalCapn unmarshals the capnproto definition of the object
func (*ASPreImage) ValidateSignature ¶
func (b *ASPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *AtomicSwapSignature) error
ValidateSignature validates the signature for ASPreImage
type AtomicSwap ¶
type AtomicSwap struct { ASPreImage *ASPreImage TxHash []byte // contains filtered or unexported fields }
AtomicSwap is an atomic swap object based on a time lock hash
func (*AtomicSwap) ChainID ¶
func (b *AtomicSwap) ChainID() (uint32, error)
ChainID returns the ChainID of the AtomicSwap
func (*AtomicSwap) Exp ¶
func (b *AtomicSwap) Exp() (uint32, error)
Exp returns the epoch after which the AtomicSwap will expire
func (*AtomicSwap) GenericOwner ¶
func (b *AtomicSwap) GenericOwner() (*Owner, error)
GenericOwner returns the PrimaryOwner of the AtomicSwap as an Owner object
func (*AtomicSwap) IsExpired ¶
func (b *AtomicSwap) IsExpired(currentHeight uint32) (bool, error)
IsExpired returns true if the current epoch is greater than exp
func (*AtomicSwap) IssuedAt ¶
func (b *AtomicSwap) IssuedAt() (uint32, error)
IssuedAt returns the epoch of issuance for the AtomicSwap
func (*AtomicSwap) MakeTxIn ¶
func (b *AtomicSwap) MakeTxIn() (*TXIn, error)
MakeTxIn constructs a TXIn object for the current object
func (*AtomicSwap) MarshalBinary ¶
func (b *AtomicSwap) MarshalBinary() ([]byte, error)
MarshalBinary takes the AtomicSwap object and returns the canonical byte slice
func (*AtomicSwap) MarshalCapn ¶
func (b *AtomicSwap) MarshalCapn(seg *capnp.Segment) (mdefs.AtomicSwap, error)
MarshalCapn marshals the object into its capnproto definition
func (*AtomicSwap) Owner ¶
func (b *AtomicSwap) Owner() (*AtomicSwapOwner, error)
Owner returns the AtomicSwapOwner object of the AtomicSwap
func (*AtomicSwap) PreHash ¶
func (b *AtomicSwap) PreHash() ([]byte, error)
PreHash returns the PreHash of the object
func (*AtomicSwap) SetTXOutIdx ¶
func (b *AtomicSwap) SetTXOutIdx(idx uint32) error
SetTXOutIdx sets the TXOutIdx of the object
func (*AtomicSwap) SetTxHash ¶
func (b *AtomicSwap) SetTxHash(txHash []byte) error
SetTxHash sets the TxHash of the object
func (*AtomicSwap) SignAsAlternate ¶
func (b *AtomicSwap) SignAsAlternate(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error
SignAsAlternate signs the object as the user who is exchanging in the AtomicSwap
func (*AtomicSwap) SignAsPrimary ¶
func (b *AtomicSwap) SignAsPrimary(txIn *TXIn, signer *crypto.Secp256k1Signer, hashKey []byte) error
SignAsPrimary signs the object as the user who is the original creator of the AtomicSwap
func (*AtomicSwap) TXOutIdx ¶
func (b *AtomicSwap) TXOutIdx() (uint32, error)
TXOutIdx returns the TXOutIdx of the object
func (*AtomicSwap) UTXOID ¶
func (b *AtomicSwap) UTXOID() ([]byte, error)
UTXOID returns the UTXOID of the object
func (*AtomicSwap) UnmarshalBinary ¶
func (b *AtomicSwap) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwap object
func (*AtomicSwap) UnmarshalCapn ¶
func (b *AtomicSwap) UnmarshalCapn(bc mdefs.AtomicSwap) error
UnmarshalCapn unmarshals the capnproto definition of the object
func (*AtomicSwap) ValidateSignature ¶
func (b *AtomicSwap) ValidateSignature(currentHeight uint32, txIn *TXIn) error
ValidateSignature validates the signature of the TXIn against the atomic swap
type AtomicSwapOwner ¶
type AtomicSwapOwner struct { SVA SVA HashLock []byte AlternateOwner *AtomicSwapSubOwner PrimaryOwner *AtomicSwapSubOwner }
AtomicSwapOwner describes the necessary information for AtomicSwap object
func (*AtomicSwapOwner) AlternateAccount ¶
func (aso *AtomicSwapOwner) AlternateAccount() ([]byte, error)
AlternateAccount returns the account byte slice of the AlternateOwner
func (*AtomicSwapOwner) MarshalBinary ¶
func (aso *AtomicSwapOwner) MarshalBinary() ([]byte, error)
MarshalBinary takes the AtomicSwapOwner object and returns the canonical byte slice
func (*AtomicSwapOwner) New ¶
func (aso *AtomicSwapOwner) New(priOwnerAcct []byte, altOwnerAcct []byte, hashKey []byte) error
New creates a new AtomicSwapOwner
func (*AtomicSwapOwner) NewFromOwner ¶
func (aso *AtomicSwapOwner) NewFromOwner(priOwner *Owner, altOwner *Owner, hashKey []byte) error
NewFromOwner creates a new AtomicSwapOwner from Owner objects
func (*AtomicSwapOwner) PrimaryAccount ¶
func (aso *AtomicSwapOwner) PrimaryAccount() ([]byte, error)
PrimaryAccount returns the account byte slice of the PrimaryOwner
func (*AtomicSwapOwner) SignAsAlternate ¶
func (aso *AtomicSwapOwner) SignAsAlternate(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
SignAsAlternate ...
func (*AtomicSwapOwner) SignAsPrimary ¶
func (aso *AtomicSwapOwner) SignAsPrimary(msg []byte, signer *crypto.Secp256k1Signer, hashKey []byte) (*AtomicSwapSignature, error)
SignAsPrimary ...
func (*AtomicSwapOwner) UnmarshalBinary ¶
func (aso *AtomicSwapOwner) UnmarshalBinary(o []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapOwner object
func (*AtomicSwapOwner) Validate ¶
func (aso *AtomicSwapOwner) Validate() error
Validate validates the AtomicSwapOwner
func (*AtomicSwapOwner) ValidateSignature ¶
func (aso *AtomicSwapOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature, isExpired bool) error
ValidateSignature validates the signature
type AtomicSwapSignature ¶
type AtomicSwapSignature struct { SVA SVA CurveSpec constants.CurveSpec SignerRole SignerRole HashKey []byte Signature []byte }
AtomicSwapSignature is the signs the AtomicSwap object
func (*AtomicSwapSignature) MarshalBinary ¶
func (onr *AtomicSwapSignature) MarshalBinary() ([]byte, error)
MarshalBinary takes the AtomicSwapSignature object and returns the canonical byte slice
func (*AtomicSwapSignature) UnmarshalBinary ¶
func (onr *AtomicSwapSignature) UnmarshalBinary(signature []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapSignature object
func (*AtomicSwapSignature) Validate ¶
func (onr *AtomicSwapSignature) Validate() error
Validate validates the AtomicSwapSignature
type AtomicSwapSubOwner ¶
AtomicSwapSubOwner ...
func (*AtomicSwapSubOwner) MarshalBinary ¶
func (asso *AtomicSwapSubOwner) MarshalBinary() ([]byte, error)
MarshalBinary takes the AtomicSwapSubOwner object and returns the canonical byte slice
func (*AtomicSwapSubOwner) NewFromOwner ¶
func (asso *AtomicSwapSubOwner) NewFromOwner(o *Owner) error
NewFromOwner takes an Owner object and creates the corresponding AtomicSwapSubOwner
func (*AtomicSwapSubOwner) UnmarshalBinary ¶
func (asso *AtomicSwapSubOwner) UnmarshalBinary(o []byte) ([]byte, error)
UnmarshalBinary takes a byte slice and returns the corresponding AtomicSwapSubOwner object
func (*AtomicSwapSubOwner) Validate ¶
func (asso *AtomicSwapSubOwner) Validate() error
Validate validates the AtomicSwapSubOwner object
func (*AtomicSwapSubOwner) ValidateSignature ¶
func (asso *AtomicSwapSubOwner) ValidateSignature(msg []byte, sig *AtomicSwapSignature) error
ValidateSignature validates the signature of the AtomicSwapSignature object
type DSLinker ¶
type DSLinker struct { DSPreImage *DSPreImage TxHash []byte }
DSLinker links the DSPreImage to the DataStore
func (*DSLinker) EpochOfExpiration ¶
EpochOfExpiration returns the epoch in which the datastore may be garbage collected
func (*DSLinker) MarshalBinary ¶
MarshalBinary takes the DSLinker object and returns the canonical byte slice
func (*DSLinker) MarshalCapn ¶
MarshalCapn marshals the object into its capnproto definition
func (*DSLinker) Owner ¶
func (b *DSLinker) Owner() (*DataStoreOwner, error)
Owner returns the Owner field of the sub object
func (*DSLinker) RemainingValue ¶
RemainingValue returns remaining value at the time of consumption
func (*DSLinker) SetTXOutIdx ¶
SetTXOutIdx sets the TXOutIdx of the object
func (*DSLinker) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding DSLinker object
func (*DSLinker) UnmarshalCapn ¶
UnmarshalCapn unmarshals the capnproto definition of the object
func (*DSLinker) ValidatePreSignature ¶
func (b *DSLinker) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error
ValidatePreSignature validates the signature of the datastore at the time of creation
func (*DSLinker) ValidateSignature ¶
func (b *DSLinker) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error
ValidateSignature validates the signature of the datastore at the time of consumption
type DSPreImage ¶
type DSPreImage struct { ChainID uint32 Index []byte IssuedAt uint32 Deposit *uint256.Uint256 RawData []byte TXOutIdx uint32 Owner *DataStoreOwner }
DSPreImage is a DataStore preimage
func (*DSPreImage) EpochOfExpiration ¶
func (b *DSPreImage) EpochOfExpiration() (uint32, error)
EpochOfExpiration returns the epoch in which the datastore may be garbage collected
func (*DSPreImage) IsExpired ¶
func (b *DSPreImage) IsExpired(currentHeight uint32) (bool, error)
IsExpired returns true if the datastore is free for garbage collection
func (*DSPreImage) MarshalBinary ¶
func (b *DSPreImage) MarshalBinary() ([]byte, error)
MarshalBinary takes the DSPreImage object and returns the canonical byte slice
func (*DSPreImage) MarshalCapn ¶
func (b *DSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.DSPreImage, error)
MarshalCapn marshals the object into its capnproto definition
func (*DSPreImage) PreHash ¶
func (b *DSPreImage) PreHash() ([]byte, error)
PreHash returns the PreHash of the object
func (*DSPreImage) RemainingValue ¶
func (b *DSPreImage) RemainingValue(currentHeight uint32) (*uint256.Uint256, error)
RemainingValue returns remaining value at the time of consumption
func (*DSPreImage) UnmarshalBinary ¶
func (b *DSPreImage) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding DSPreImage object
func (*DSPreImage) UnmarshalCapn ¶
func (b *DSPreImage) UnmarshalCapn(bc mdefs.DSPreImage) error
UnmarshalCapn unmarshals the capnproto definition of the object
func (*DSPreImage) ValidateDeposit ¶
func (b *DSPreImage) ValidateDeposit() error
ValidateDeposit validates the deposit
func (*DSPreImage) ValidatePreSignature ¶
func (b *DSPreImage) ValidatePreSignature(msg []byte, sig *DataStoreSignature) error
ValidatePreSignature validates the signature of the datastore at the time of creation
func (*DSPreImage) ValidateSignature ¶
func (b *DSPreImage) ValidateSignature(currentHeight uint32, msg []byte, sig *DataStoreSignature) error
ValidateSignature validates the signature of the datastore at the time of consumption
type DataStore ¶
type DataStore struct { DSLinker *DSLinker Signature *DataStoreSignature }
DataStore is a datastore UTXO
func (*DataStore) EpochOfExpiration ¶
EpochOfExpiration returns the epoch in which the datastore may be garbage collected
func (*DataStore) GenericOwner ¶
GenericOwner returns the Owner of the DataStore
func (*DataStore) MarshalBinary ¶
MarshalBinary takes the DataStore object and returns the canonical byte slice
func (*DataStore) MarshalCapn ¶
MarshalCapn marshals the object into its capnproto definition
func (*DataStore) Owner ¶
func (b *DataStore) Owner() (*DataStoreOwner, error)
Owner returns the DataStoreOwner of the DataStore
func (*DataStore) RemainingValue ¶
RemainingValue returns remaining value at the time of consumption
func (*DataStore) SetTXOutIdx ¶
SetTXOutIdx sets the TXOutIdx of the object
func (*DataStore) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding DataStore object
func (*DataStore) UnmarshalCapn ¶
UnmarshalCapn unmarshals the capnproto definition of the object
func (*DataStore) ValidatePreSignature ¶
ValidatePreSignature validates the signature of the datastore at the time of creation
func (*DataStore) ValidateSignature ¶
ValidateSignature validates the signature of the datastore at the time of consumption
type DataStoreOwner ¶
DataStoreOwner is the struct which specifies the owner of the DataStore
func (*DataStoreOwner) MarshalBinary ¶
func (dso *DataStoreOwner) MarshalBinary() ([]byte, error)
MarshalBinary takes the DataStoreOwner object and returns the canonical byte slice
func (*DataStoreOwner) New ¶
func (dso *DataStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)
New makes a new DataStoreOwner
func (*DataStoreOwner) NewFromOwner ¶
func (dso *DataStoreOwner) NewFromOwner(o *Owner) error
NewFromOwner takes an Owner object and creates the corresponding DataStoreOwner
func (*DataStoreOwner) Sign ¶
func (dso *DataStoreOwner) Sign(msg []byte, s Signer) (*DataStoreSignature, error)
Sign allows has the DataStoreOwner sign the message msg with signer s
func (*DataStoreOwner) UnmarshalBinary ¶
func (dso *DataStoreOwner) UnmarshalBinary(o []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding DataStoreOwner object
func (*DataStoreOwner) Validate ¶
func (dso *DataStoreOwner) Validate() error
Validate validates the DataStoreOwner
func (*DataStoreOwner) ValidateSignature ¶
func (dso *DataStoreOwner) ValidateSignature(msg []byte, sig *DataStoreSignature, isExpired bool) error
ValidateSignature validates the DataStoreSignature
type DataStoreSignature ¶
DataStoreSignature ...
func (*DataStoreSignature) MarshalBinary ¶
func (dss *DataStoreSignature) MarshalBinary() ([]byte, error)
MarshalBinary takes the DataStoreSignature object and returns the canonical byte slice
func (*DataStoreSignature) UnmarshalBinary ¶
func (dss *DataStoreSignature) UnmarshalBinary(signature []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding DataStoreSignature object
func (*DataStoreSignature) Validate ¶
func (dss *DataStoreSignature) Validate() error
Validate validates the DataStoreSignature object
type Owner ¶
Owner contains information related to a general owner object
func (*Owner) MarshalBinary ¶
MarshalBinary takes the Owner object and returns the canonical byte slice
func (*Owner) NewFromAtomicSwapOwner ¶
func (onr *Owner) NewFromAtomicSwapOwner(aso *AtomicSwapOwner) error
NewFromAtomicSwapOwner makes a new Owner from an AtomicSwapOwner (PrimaryOwner)
func (*Owner) NewFromAtomicSwapSubOwner ¶
func (onr *Owner) NewFromAtomicSwapSubOwner(asso *AtomicSwapSubOwner) error
NewFromAtomicSwapSubOwner makes a new Owner from an AtomicSwapSubOwner
func (*Owner) NewFromDataStoreOwner ¶
func (onr *Owner) NewFromDataStoreOwner(dso *DataStoreOwner) error
NewFromDataStoreOwner makes a new Owner from a DataStoreOwner
func (*Owner) NewFromValueStoreOwner ¶
func (onr *Owner) NewFromValueStoreOwner(vso *ValueStoreOwner) error
NewFromValueStoreOwner makes a new Owner from a ValueStoreOwner
func (*Owner) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding Owner object
type PaginationResponse ¶
type SVA ¶
type SVA uint8
SVA is the defined type utilized for designation of a Signature Verification Algorithm
const ( // ValueStoreSVA is the constant which specifies the // Signature Verification Algorithm used for ValueStore objects ValueStoreSVA SVA = iota + 1 // HashedTimelockSVA is the constant which specifies the // Signature Verification Algorithm used for AtomicSwap objects HashedTimelockSVA // DataStoreSVA is the constant which specifies the // Signature Verification Algorithm used for DataStore objects DataStoreSVA )
type SignerRole ¶
type SignerRole uint8
const ( // PrimarySignerRole is the constant which specifies the role of the // primary account owner in the AtomicSwap object PrimarySignerRole SignerRole = iota + 1 // AlternateSignerRole is the constant which specifies the role of the // alternate account owner in the AtomicSwap object AlternateSignerRole )
type TXIn ¶
type TXIn struct { TXInLinker *TXInLinker Signature []byte }
TXIn is a tx input object that acts as a reference to a UTXO
func (*TXIn) ConsumedTxHash ¶
ConsumedTxHash returns the consumed TxHash
func (*TXIn) ConsumedTxIdx ¶
ConsumedTxIdx returns the consumed TxIdx
func (*TXIn) MarshalBinary ¶
MarshalBinary takes the TXIn object and returns the canonical byte slice
func (*TXIn) MarshalCapn ¶
MarshalCapn marshals the object into its capnproto definition
func (*TXIn) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding TXIn object
type TXInLinker ¶
type TXInLinker struct { TXInPreImage *TXInPreImage TxHash []byte }
TXInLinker ...
func (*TXInLinker) ChainID ¶
func (b *TXInLinker) ChainID() (uint32, error)
ChainID returns the chain ID
func (*TXInLinker) ConsumedTxHash ¶
func (b *TXInLinker) ConsumedTxHash() ([]byte, error)
ConsumedTxHash returns the consumed TxHash
func (*TXInLinker) ConsumedTxIdx ¶
func (b *TXInLinker) ConsumedTxIdx() (uint32, error)
ConsumedTxIdx returns the consumed TxIdx
func (*TXInLinker) IsDeposit ¶
func (b *TXInLinker) IsDeposit() bool
IsDeposit returns true if TXInLinker is a deposit; otherwise, returns false.
func (*TXInLinker) MarshalBinary ¶
func (b *TXInLinker) MarshalBinary() ([]byte, error)
MarshalBinary takes the TXInLinker object and returns the canonical byte slice
func (*TXInLinker) MarshalCapn ¶
func (b *TXInLinker) MarshalCapn(seg *capnp.Segment) (mdefs.TXInLinker, error)
MarshalCapn marshals the object into its capnproto definition
func (*TXInLinker) PreHash ¶
func (b *TXInLinker) PreHash() ([]byte, error)
PreHash returns the PreHash of the object
func (*TXInLinker) SetTxHash ¶
func (b *TXInLinker) SetTxHash(txHash []byte) error
SetTxHash sets TxHash
func (*TXInLinker) UTXOID ¶
func (b *TXInLinker) UTXOID() ([]byte, error)
UTXOID returns the UTXOID of the object
func (*TXInLinker) UnmarshalBinary ¶
func (b *TXInLinker) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding TXInLinker object
func (*TXInLinker) UnmarshalCapn ¶
func (b *TXInLinker) UnmarshalCapn(bc mdefs.TXInLinker) error
UnmarshalCapn unmarshals the capnproto definition of the object
type TXInPreImage ¶
TXInPreImage is the tx input preimage
func (*TXInPreImage) IsDeposit ¶
func (b *TXInPreImage) IsDeposit() bool
IsDeposit returns true if TXInPreImage is a deposit; otherwise, returns false.
func (*TXInPreImage) MarshalBinary ¶
func (b *TXInPreImage) MarshalBinary() ([]byte, error)
MarshalBinary takes the TXInPreImage object and returns the canonical byte slice
func (*TXInPreImage) MarshalCapn ¶
func (b *TXInPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.TXInPreImage, error)
MarshalCapn marshals the object into its capnproto definition
func (*TXInPreImage) PreHash ¶
func (b *TXInPreImage) PreHash() ([]byte, error)
PreHash returns the PreHash of the object
func (*TXInPreImage) UTXOID ¶
func (b *TXInPreImage) UTXOID() ([]byte, error)
UTXOID returns the UTXOID of the object
func (*TXInPreImage) UnmarshalBinary ¶
func (b *TXInPreImage) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding TXInPreImage object
func (*TXInPreImage) UnmarshalCapn ¶
func (b *TXInPreImage) UnmarshalCapn(bc mdefs.TXInPreImage) error
UnmarshalCapn unmarshals the capnproto definition of the object
type TXOut ¶
type TXOut struct {
// contains filtered or unexported fields
}
TXOut is a UTXO object
func (*TXOut) AtomicSwap ¶
func (b *TXOut) AtomicSwap() (*AtomicSwap, error)
AtomicSwap returns the AtomicSwap of the TXOut object if it exists
func (*TXOut) CannotBeMinedBeforeHeight ¶
CannotBeMinedBeforeHeight ...
func (*TXOut) CreateValueStore ¶
func (b *TXOut) CreateValueStore(chainID uint32, value *uint256.Uint256, acct []byte, curveSpec constants.CurveSpec, txHash []byte) error
CreateValueStore makes a new ValueStore
func (*TXOut) CreateValueStoreFromDeposit ¶
func (b *TXOut) CreateValueStoreFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error
CreateValueStoreFromDeposit makes a new ValueStore from a deposit
func (*TXOut) GenericOwner ¶
GenericOwner returns the Owner from the TXOut
func (*TXOut) HasAtomicSwap ¶
HasAtomicSwap specifies if the TXOut object has an AtomicSwap
func (*TXOut) HasDataStore ¶
HasDataStore specifies if the TXOut object has a DataStore
func (*TXOut) HasValueStore ¶
HasValueStore specifies if the TXOut object has a ValueStore
func (*TXOut) IsDeposit ¶
IsDeposit returns true if it is a valid ValueStore with deposit. All other instances return false.
func (*TXOut) MarshalBinary ¶
MarshalBinary takes the TXOut object and returns the canonical byte slice
func (*TXOut) MarshalCapn ¶
MarshalCapn marshals the object into its capnproto definition
func (*TXOut) MustBeMinedBeforeHeight ¶
MustBeMinedBeforeHeight ...
func (*TXOut) NewAtomicSwap ¶
func (b *TXOut) NewAtomicSwap(v *AtomicSwap) error
NewAtomicSwap makes a TXOut object which with the specified AtomicSwap
func (*TXOut) NewDataStore ¶
NewDataStore makes a TXOut object which with the specified DataStore
func (*TXOut) NewValueStore ¶
func (b *TXOut) NewValueStore(v *ValueStore) error
NewValueStore makes a TXOut object which with the specified ValueStore
func (*TXOut) RemainingValue ¶
RemainingValue returns the remaining value after discount
func (*TXOut) SetTXOutIdx ¶
SetTXOutIdx sets the TXOutIdx of the object
func (*TXOut) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding TXOut object
func (*TXOut) UnmarshalCapn ¶
UnmarshalCapn unmarshals the capnproto definition of the object
func (*TXOut) ValidatePreSignature ¶
ValidatePreSignature validates the PreSignature of the object
func (*TXOut) ValidateSignature ¶
ValidateSignature validates the signature of the txIn against the UTXO
func (*TXOut) ValueStore ¶
func (b *TXOut) ValueStore() (*ValueStore, error)
ValueStore returns the ValueStore of the TXOut object if it exists
type Tx ¶
Tx is a transaction object
func (*Tx) CannotBeMinedUntil ¶
CannotBeMinedUntil ...
func (*Tx) ConsumedIsDeposit ¶
ConsumedIsDeposit returns the list of IsDeposit bools from Vin
func (*Tx) ConsumedPreHash ¶
ConsumedPreHash returns the list of PreHashs from Vin
func (*Tx) ConsumedUTXOID ¶
ConsumedUTXOID returns the list of UTXOIDs from Vin
func (*Tx) EpochOfExpirationForMining ¶
EpochOfExpirationForMining ...
func (*Tx) GeneratedPreHash ¶
GeneratedPreHash returns the list of PreHashs from Vout
func (*Tx) GeneratedUTXOID ¶
GeneratedUTXOID returns the list of UTXOIDs from Vout
func (*Tx) MarshalBinary ¶
MarshalBinary takes the Tx object and returns the canonical byte slice
func (*Tx) MarshalCapn ¶
MarshalCapn marshals the object into its capnproto definition
func (*Tx) PostValidatePending ¶
PostValidatePending ...
func (*Tx) PreValidatePending ¶
PreValidatePending ...
func (*Tx) UnmarshalBinary ¶
UnmarshalBinary takes a byte slice and returns the corresponding Tx object
func (*Tx) UnmarshalCapn ¶
UnmarshalCapn unmarshals the capnproto definition of the object
func (*Tx) Validate ¶
func (b *Tx) Validate(set map[string]bool, currentHeight uint32, consumedUTXOs Vout) (map[string]bool, error)
Validate ...
func (*Tx) ValidateChainID ¶
ValidateChainID validates that all elements have the correct ChainID
func (*Tx) ValidateDataStoreIndexes ¶
ValidateDataStoreIndexes ensures there are no duplicate output indices for DataStore objects
func (*Tx) ValidateEqualVinVout ¶
ValidateEqualVinVout checks the following calc sum on inputs from utxos and currentHeight sum inputs must equal sum outputs
func (*Tx) ValidateIssuedAtForMining ¶
ValidateIssuedAtForMining ...
func (*Tx) ValidatePreSignature ¶
ValidatePreSignature validates the presignatures of the objects
func (*Tx) ValidateSignature ¶
ValidateSignature validates the signatures of the objects
func (*Tx) ValidateTxHash ¶
ValidateTxHash validates the txHash is correct on all objects
func (*Tx) ValidateUnique ¶
ValidateUnique checks that all inputs and outputs are unique
type TxVec ¶
type TxVec []*Tx
TxVec is a vector of transactions Tx
func (TxVec) ConsumedIsDeposit ¶
ConsumedIsDeposit returns list of bools to specify which Txs in txv are deposits
func (TxVec) ConsumedPreHash ¶
ConsumedPreHash returns the list of consumed PreHashs from TxVec
func (TxVec) ConsumedPreHashOnlyDeposits ¶
ConsumedPreHashOnlyDeposits returns list of PreHashs from txv only for transactions which are deposits
func (TxVec) ConsumedTxIns ¶
ConsumedTxIns returns list of TxIns consumed by TxVec
func (TxVec) ConsumedUTXOID ¶
ConsumedUTXOID returns the list of consumed UTXOIDs in TxVec
func (TxVec) ConsumedUTXOIDNoDeposits ¶
ConsumedUTXOIDNoDeposits returns list of UTXOIDs from txv only for transactions which are not deposits
func (TxVec) ConsumedUTXOIDOnlyDeposits ¶
ConsumedUTXOIDOnlyDeposits returns list of UTXOIDs from txv only for transactions which are deposits
func (TxVec) GeneratedPreHash ¶
GeneratedPreHash returns list of PreHashs for Tx in txv
func (TxVec) GeneratedUTXOID ¶
GeneratedUTXOID returns list of UTXOIDs for Tx in txv
func (TxVec) GeneratedUTXOs ¶
GeneratedUTXOs returns list of TXOuts from Txs in txv
func (TxVec) MarshalBinary ¶
MarshalBinary takes the TxVec object and returns the canonical byte slice
func (TxVec) PostValidatePending ¶
PostValidatePending ...
func (TxVec) PreValidateApplyState ¶
PreValidateApplyState ...
func (TxVec) PreValidatePending ¶
PreValidatePending ...
func (TxVec) ValidateChainID ¶
ValidateChainID validates the chain ID in all transactions
func (TxVec) ValidateDataStoreIndexes ¶
type VSPreImage ¶
type VSPreImage struct { ChainID uint32 Value *uint256.Uint256 TXOutIdx uint32 Owner *ValueStoreOwner // contains filtered or unexported fields }
VSPreImage is a value store preimage
func (*VSPreImage) MarshalBinary ¶
func (b *VSPreImage) MarshalBinary() ([]byte, error)
MarshalBinary takes the VSPreImage object and returns the canonical byte slice
func (*VSPreImage) MarshalCapn ¶
func (b *VSPreImage) MarshalCapn(seg *capnp.Segment) (mdefs.VSPreImage, error)
MarshalCapn marshals the object into its capnproto definition
func (*VSPreImage) PreHash ¶
func (b *VSPreImage) PreHash() ([]byte, error)
PreHash calculates the PreHash of the object
func (*VSPreImage) UnmarshalBinary ¶
func (b *VSPreImage) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding VSPreImage object
func (*VSPreImage) UnmarshalCapn ¶
func (b *VSPreImage) UnmarshalCapn(bc mdefs.VSPreImage) error
UnmarshalCapn unmarshals the capnproto definition of the object
func (*VSPreImage) ValidateSignature ¶
func (b *VSPreImage) ValidateSignature(msg []byte, sig *ValueStoreSignature) error
ValidateSignature validates the signature for VSPreImage
type ValueStore ¶
type ValueStore struct { VSPreImage *VSPreImage TxHash []byte // contains filtered or unexported fields }
ValueStore stores value in a UTXO
func (*ValueStore) ChainID ¶
func (b *ValueStore) ChainID() (uint32, error)
ChainID returns the ChainID of the object
func (*ValueStore) GenericOwner ¶
func (b *ValueStore) GenericOwner() (*Owner, error)
GenericOwner returns the Owner of the ValueStore
func (*ValueStore) IsDeposit ¶
func (b *ValueStore) IsDeposit() bool
IsDeposit returns true if the object is a deposit
func (*ValueStore) MakeTxIn ¶
func (b *ValueStore) MakeTxIn() (*TXIn, error)
MakeTxIn constructs a TXIn object for the current object
func (*ValueStore) MarshalBinary ¶
func (b *ValueStore) MarshalBinary() ([]byte, error)
MarshalBinary takes the ValueStore object and returns the canonical byte slice
func (*ValueStore) MarshalCapn ¶
func (b *ValueStore) MarshalCapn(seg *capnp.Segment) (mdefs.ValueStore, error)
MarshalCapn marshals the object into its capnproto definition
func (*ValueStore) New ¶
func (b *ValueStore) New(chainID uint32, value *uint256.Uint256, acct []byte, curveSpec constants.CurveSpec, txHash []byte) error
New creates a new ValueStore
func (*ValueStore) NewFromDeposit ¶
func (b *ValueStore) NewFromDeposit(chainID uint32, value *uint256.Uint256, acct []byte, nonce []byte) error
NewFromDeposit creates a new ValueStore from a deposit event
func (*ValueStore) Owner ¶
func (b *ValueStore) Owner() (*ValueStoreOwner, error)
Owner returns the ValueStoreOwner of the ValueStore
func (*ValueStore) PreHash ¶
func (b *ValueStore) PreHash() ([]byte, error)
PreHash calculates the PreHash of the object
func (*ValueStore) SetTXOutIdx ¶
func (b *ValueStore) SetTXOutIdx(idx uint32) error
SetTXOutIdx sets the TXOutIdx of the object
func (*ValueStore) SetTxHash ¶
func (b *ValueStore) SetTxHash(txHash []byte) error
SetTxHash sets the TxHash of the object
func (*ValueStore) Sign ¶
func (b *ValueStore) Sign(txIn *TXIn, s Signer) error
Sign generates the signature for a ValueStore at the time of consumption
func (*ValueStore) TXOutIdx ¶
func (b *ValueStore) TXOutIdx() (uint32, error)
TXOutIdx returns the TXOutIdx of the object
func (*ValueStore) UTXOID ¶
func (b *ValueStore) UTXOID() ([]byte, error)
UTXOID calculates the UTXOID of the object
func (*ValueStore) UnmarshalBinary ¶
func (b *ValueStore) UnmarshalBinary(data []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding ValueStore object
func (*ValueStore) UnmarshalCapn ¶
func (b *ValueStore) UnmarshalCapn(bc mdefs.ValueStore) error
UnmarshalCapn unmarshals the capnproto definition of the object
func (*ValueStore) ValidateSignature ¶
func (b *ValueStore) ValidateSignature(txIn *TXIn) error
ValidateSignature validates the signature of the ValueStore at the time of consumption
type ValueStoreOwner ¶
ValueStoreOwner contains information related to the owner of the ValueStore
func (*ValueStoreOwner) MarshalBinary ¶
func (vso *ValueStoreOwner) MarshalBinary() ([]byte, error)
MarshalBinary takes the ValueStoreOwner object and returns the canonical byte slice
func (*ValueStoreOwner) New ¶
func (vso *ValueStoreOwner) New(acct []byte, curveSpec constants.CurveSpec)
New makes a new ValueStoreOwner
func (*ValueStoreOwner) NewFromOwner ¶
func (vso *ValueStoreOwner) NewFromOwner(o *Owner) error
NewFromOwner takes an Owner object and creates the corresponding ValueStoreOwner
func (*ValueStoreOwner) Sign ¶
func (vso *ValueStoreOwner) Sign(msg []byte, s Signer) (*ValueStoreSignature, error)
Sign signs message msg with signer s
func (*ValueStoreOwner) UnmarshalBinary ¶
func (vso *ValueStoreOwner) UnmarshalBinary(o []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding ValueStoreOwner object
func (*ValueStoreOwner) Validate ¶
func (vso *ValueStoreOwner) Validate() error
Validate validates the ValueStoreOwner object
func (*ValueStoreOwner) ValidateSignature ¶
func (vso *ValueStoreOwner) ValidateSignature(msg []byte, sig *ValueStoreSignature) error
ValidateSignature validates ValueStoreSignature sig for message msg
type ValueStoreSignature ¶
ValueStoreSignature is a struct which the necessary information for signing a ValueStore
func (*ValueStoreSignature) MarshalBinary ¶
func (vss *ValueStoreSignature) MarshalBinary() ([]byte, error)
MarshalBinary takes the ValueStoreSignature object and returns the canonical byte slice
func (*ValueStoreSignature) UnmarshalBinary ¶
func (vss *ValueStoreSignature) UnmarshalBinary(signature []byte) error
UnmarshalBinary takes a byte slice and returns the corresponding ValueStoreSignature object
func (*ValueStoreSignature) Validate ¶
func (vss *ValueStoreSignature) Validate() error
Validate validates the ValueStoreSignature object
type Vin ¶
type Vin []*TXIn
Vin is a vector of TxIn objects
func (Vin) IsDeposit ¶
IsDeposit returns a list of bools specifying if each TXTn in Vin is a deposit
type Vout ¶
type Vout []*TXOut
Vout is a vector of TXOut objects
func (Vout) RemainingValue ¶
RemainingValue sums the total value of the UTXOs with discount
func (Vout) SetTxOutIdx ¶
SetTxOutIdx sets the TxOutIdx of each utxo
func (Vout) ValidatePreSignature ¶
ValidatePreSignature validates the PreSignature from each TXOut in Vout
func (Vout) ValidateSignature ¶
ValidateSignature validates the Signature from each TXOut in Vout
func (Vout) ValidateTxOutIdx ¶
ValidateTxOutIdx validates the TxOutIdx of each utxo