Documentation
¶
Overview ¶
Copyright 2017-2018 OneLedger
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017 - 2018 OneLedger ¶
Handle arbitrary, but lossely typed parameters to the function calls ¶
Copyright 2017-2018 OneLedger ¶
Parse the incoming transactions ¶
TODO: switch from individual wire calls, to reading/writing directly to structs
Copyright 2017 - 2018 OneLedger ¶
Easy Access to Persistent App Data, if the persistent data isn't avoid stop immediately
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, publish, ready, verification, etc.
Copyright 2017 - 2018 OneLedger ¶
Register this identity with the other nodes. As an externl identity
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017 - 2018 OneLedger ¶
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Copyright 2017-2018 OneLedger ¶
Declare basic types used by the Application ¶
If a type requires functions or a few types are intertwinded, then should be in their own file.
Copyright 2017-2018 OneLedger ¶
An incoming transaction, send, swap, ready, verification, etc.
Index ¶
- Constants
- func BroadcastTransaction(ttype Type, transaction Transaction, sync bool)
- func CheckAmounts(app interface{}, inputs []SendInput, outputs []SendOutput) bool
- func CheckBalance(app interface{}, accountKey id.AccountKey, amount data.Coin) bool
- func DelayedTransaction(ttype Type, transaction Transaction, waitTime time.Duration)
- func DeleteContract(app interface{}, contractKey []byte, nonce int64)
- func DeleteSwap(app interface{}, key id.AccountKey)
- func FindContract(app interface{}, contractKey []byte, nonce int64) []byte
- func FindEvent(app interface{}, eventKey Event) bool
- func GetAccount(app interface{}, accountKey id.AccountKey) id.Account
- func GetAccountKey(value FunctionValue) id.AccountKey
- func GetAccounts(app interface{}) *id.Accounts
- func GetAdmin(app interface{}) data.Datastore
- func GetAmount(value FunctionValue) btcutil.Amount
- func GetBool(value FunctionValue) *bool
- func GetByte32(value FunctionValue) [32]byte
- func GetBytes(value FunctionValue) []byte
- func GetChain(value FunctionValue) data.ChainType
- func GetChainAccount(app interface{}, name string, chain data.ChainType) id.Account
- func GetChainID(app interface{}) string
- func GetCoin(value FunctionValue) data.Coin
- func GetContract(value FunctionValue) common.Contract
- func GetContracts(app interface{}) data.Datastore
- func GetEvent(app interface{}) data.Datastore
- func GetHeight(app interface{}) int64
- func GetIdentities(app interface{}) *id.Identities
- func GetInt(value FunctionValue) int
- func GetInt64(value FunctionValue) int64
- func GetNodeAccount(app interface{}) id.Account
- func GetSigners(owner []byte) []id.PublicKey
- func GetStatus(app interface{}) data.Datastore
- func GetString(value FunctionValue) string
- func GetUtxo(app interface{}) *data.ChainState
- func PackRequest(request SignedTransaction) []byte
- func SaveContract(app interface{}, contractKey []byte, nonce int64, contract []byte)
- func SaveEvent(app interface{}, eventKey Event, status bool)
- func SaveSwap(app interface{}, swapKey []byte, transaction SwapInit)
- func SignAndPack(transaction Transaction) []byte
- func ValidateSignature(transaction SignedTransaction) bool
- type Base
- type BoxLocker
- type Command
- type CommandType
- type Commands
- type Commit
- func (transaction *Commit) ProcessCheck(app interface{}) status.Code
- func (transaction *Commit) ProcessDeliver(app interface{}) status.Code
- func (transaction *Commit) Resolve(app interface{}) Commands
- func (transaction *Commit) ShouldProcess(app interface{}) bool
- func (transaction *Commit) TransactionType() Type
- func (transaction *Commit) Validate() status.Code
- type Event
- type ExternalLock
- func (transaction *ExternalLock) ProcessCheck(app interface{}) status.Code
- func (transaction *ExternalLock) ProcessDeliver(app interface{}) status.Code
- func (transaction *ExternalLock) Resolve(app interface{}) Commands
- func (transaction *ExternalLock) ShouldProcess(app interface{}) bool
- func (transaction *ExternalLock) TransactionType() Type
- func (transaction *ExternalLock) Validate() status.Code
- type ExternalSend
- func (transaction *ExternalSend) ProcessCheck(app interface{}) status.Code
- func (transaction *ExternalSend) ProcessDeliver(app interface{}) status.Code
- func (transaction *ExternalSend) Resolve(app interface{}) Commands
- func (transaction *ExternalSend) ShouldProcess(app interface{}) bool
- func (transaction *ExternalSend) TransactionType() Type
- func (transaction *ExternalSend) Validate() status.Code
- type Forget
- func (transaction *Forget) ProcessCheck(app interface{}) status.Code
- func (transaction *Forget) ProcessDeliver(app interface{}) status.Code
- func (transaction *Forget) Resolve(app interface{}) Commands
- func (transaction *Forget) ShouldProcess(app interface{}) bool
- func (transaction *Forget) TransactionType() Type
- func (transaction *Forget) Validate() status.Code
- type FunctionValue
- type FunctionValues
- func AuditContract(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func AuditContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func AuditContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func AuditContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ClearEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func CreateCheckEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func CreateContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func CreateContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func CreateContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ExtractSecret(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ExtractSecretBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ExtractSecretETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ExtractSecretOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func FinalizeSwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func Initiate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func NextStage(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func Noop(app interface{}, chain data.ChainType, context FunctionValues) (bool, FunctionValues)
- func Participate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ParticipateBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ParticipateETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func ParticipateOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func Redeem(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RedeemBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RedeemETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RedeemOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func Refund(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RefundBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RefundETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func RefundOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
- func VerifySwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
- type HtlContract
- type Message
- type MultiSigBox
- type Parameter
- type Party
- type Prepare
- func (transaction *Prepare) ProcessCheck(app interface{}) status.Code
- func (transaction *Prepare) ProcessDeliver(app interface{}) status.Code
- func (transaction *Prepare) Resolve(app interface{}) Commands
- func (transaction *Prepare) ShouldProcess(app interface{}) bool
- func (transaction *Prepare) TransactionType() Type
- func (transaction *Prepare) Validate() status.Code
- type PublicKey
- type Publish
- func (publish *Publish) ProcessCheck(app interface{}) status.Code
- func (publish *Publish) ProcessDeliver(app interface{}) status.Code
- func (publish *Publish) Resolve(app interface{}) Commands
- func (publish *Publish) ShouldProcess(app interface{}) bool
- func (transaction *Publish) TransactionType() Type
- func (publish *Publish) Validate() status.Code
- type Register
- func (transaction Register) ProcessCheck(app interface{}) status.Code
- func (transaction Register) ProcessDeliver(app interface{}) status.Code
- func (transaction *Register) Resolve(app interface{}) Commands
- func (transaction Register) ShouldProcess(app interface{}) bool
- func (transaction *Register) TransactionType() Type
- func (transaction Register) Validate() status.Code
- type Role
- type Send
- func (transaction *Send) ProcessCheck(app interface{}) status.Code
- func (transaction *Send) ProcessDeliver(app interface{}) status.Code
- func (transaction *Send) Resolve(app interface{}) Commands
- func (transaction *Send) ShouldProcess(app interface{}) bool
- func (transaction *Send) TransactionType() Type
- func (transaction *Send) Validate() status.Code
- type SendInput
- type SendOutput
- type SignedTransaction
- type Swap
- func (swap *Swap) CommandExecute(app interface{}, commands Commands, c chan status.Code)
- func (transaction *Swap) ProcessCheck(app interface{}) status.Code
- func (transaction *Swap) ProcessDeliver(app interface{}) status.Code
- func (swap *Swap) Resolve(app interface{}) Commands
- func (transaction *Swap) ShouldProcess(app interface{}) bool
- func (transaction *Swap) TransactionType() Type
- func (transaction *Swap) Validate() status.Code
- type SwapExchange
- type SwapInit
- type SwapKey
- type SwapMessage
- type SwapVerify
- type Transaction
- type TransactionSignature
- type Type
- type Verify
- func (transaction Verify) ProcessCheck(app interface{}) status.Code
- func (transaction Verify) ProcessDeliver(app interface{}) status.Code
- func (transaction Verify) Resolve(app interface{}) Commands
- func (transaction Verify) ShouldProcess(app interface{}) bool
- func (transaction *Verify) TransactionType() Type
- func (transaction Verify) Validate() status.Code
Constants ¶
const ( NOSTAGE swapStageType = iota SWAP_MATCHING SWAP_MATCHED INITIATOR_INITIATE PARTICIPANT_PARTICIPATE INITIATOR_REDEEM PARTICIPANT_REDEEM WAIT_FOR_CHAIN SWAP_REFUND SWAP_FINISH )
Variables ¶
This section is empty.
Functions ¶
func BroadcastTransaction ¶
func BroadcastTransaction(ttype Type, transaction Transaction, sync bool)
Send out the transaction as an async broadcast
func CheckAmounts ¶
func CheckAmounts(app interface{}, inputs []SendInput, outputs []SendOutput) bool
func CheckBalance ¶
func CheckBalance(app interface{}, accountKey id.AccountKey, amount data.Coin) bool
func DelayedTransaction ¶
func DelayedTransaction(ttype Type, transaction Transaction, waitTime time.Duration)
Execute a transaction after a specific delay. TODO: The node delays in a separate goroutine, but this should really be handled by the consensus engine, so that the delay is in the mempool.
func DeleteContract ¶ added in v0.7.0
func DeleteSwap ¶ added in v0.7.0
func DeleteSwap(app interface{}, key id.AccountKey)
func FindContract ¶ added in v0.5.2
func GetAccount ¶
func GetAccount(app interface{}, accountKey id.AccountKey) id.Account
func GetAccountKey ¶
func GetAccountKey(value FunctionValue) id.AccountKey
func GetAccounts ¶
func GetAmount ¶
func GetAmount(value FunctionValue) btcutil.Amount
func GetBool ¶ added in v0.7.0
func GetBool(value FunctionValue) *bool
func GetByte32 ¶ added in v0.5.0
func GetByte32(value FunctionValue) [32]byte
func GetBytes ¶
func GetBytes(value FunctionValue) []byte
func GetChain ¶ added in v0.7.0
func GetChain(value FunctionValue) data.ChainType
func GetChainAccount ¶
Map the identity to a specific account on a chain
func GetChainID ¶ added in v0.5.0
func GetChainID(app interface{}) string
func GetCoin ¶
func GetCoin(value FunctionValue) data.Coin
func GetContract ¶ added in v0.5.2
func GetContract(value FunctionValue) common.Contract
func GetETHContract(value FunctionValue) *ethereum.HTLContract {
switch value.(type) {
case *ethereum.HTLContract:
return value.(*ethereum.HTLContract)
default:
log.Fatal("Bad Type Cast in Function Parameter", "value", value)
}
return nil
}
func GetBTCContract(value FunctionValue) *bitcoin.HTLContract {
switch value.(type) {
case *bitcoin.HTLContract:
return value.(*bitcoin.HTLContract)
default:
log.Fatal("Bad Type Cast in Function Parameter", "value", value)
}
return nil
}
func GetType(value FunctionValue) Type {
switch value.(type) {
case Type:
return value.(Type)
default:
log.Fatal("Bad Type Cast in FUnction Parameter", "value", value)
}
return INVALID
}
func GetContracts ¶ added in v0.7.0
func GetIdentities ¶
func GetIdentities(app interface{}) *id.Identities
func GetInt ¶
func GetInt(value FunctionValue) int
func GetInt64 ¶
func GetInt64(value FunctionValue) int64
func GetNodeAccount ¶ added in v0.5.2
func GetSigners ¶ added in v0.7.0
GetSigners will return the public keys of the signers
func GetString ¶
func GetString(value FunctionValue) string
func GetUtxo ¶
func GetUtxo(app interface{}) *data.ChainState
func PackRequest ¶
func PackRequest(request SignedTransaction) []byte
Pack a request into a transferable format (wire)
func SaveContract ¶ added in v0.5.2
func SignAndPack ¶
func SignAndPack(transaction Transaction) []byte
func ValidateSignature ¶ added in v0.7.0
func ValidateSignature(transaction SignedTransaction) bool
Types ¶
type Base ¶
type Base struct {
Type Type `json:"type"`
ChainId string `json:"chain_id"`
Owner id.AccountKey `json:"owner"`
Target id.AccountKey `json:"target"`
Signers []PublicKey `json:"signers"`
Sequence int64 `json:"sequence"`
Delay int64 `json:"delay"` // Pause the transaction in the mempool
}
Base Data for each type
type BoxLocker ¶
General BoxLocker struct to act as locker for any information exchange box of transactions, if verify valid then the lock can be release, otherwise box modified somehow
func (*BoxLocker) Sign ¶
Sign the locker with preImage and nonce for message passed, the message should be the full information of Transaction. The nonce is used to preventing the 3rd party from get the message even through he get the preImage, where nonce should only be known by the participants of the message sharing
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
A command to execute again a chain, needs to be polymorphic
func (Command) Execute ¶
func (command Command) Execute(app interface{}) (bool, FunctionValues)
type CommandType ¶
type CommandType int
const (
NOOP CommandType = iota
)
Set of possible commands that can be driven from a transaction
type Commit ¶
TODO: This needs to be filled out properly, need a model for other-chain actions...
func (*Commit) ProcessCheck ¶
func (*Commit) ProcessDeliver ¶
func (*Commit) ShouldProcess ¶
func (*Commit) TransactionType ¶ added in v0.7.0
type Event ¶ added in v0.5.2
type ExternalLock ¶
type ExternalLock struct {
Base
Gas data.Coin `json:"gas"`
Fee data.Coin `json:"fee"`
Inputs []SendInput `json:"inputs"`
Outputs []SendOutput `json:"outputs"`
}
Synchronize a swap between two users
func (*ExternalLock) ProcessCheck ¶
func (transaction *ExternalLock) ProcessCheck(app interface{}) status.Code
func (*ExternalLock) ProcessDeliver ¶
func (transaction *ExternalLock) ProcessDeliver(app interface{}) status.Code
func (*ExternalLock) Resolve ¶
func (transaction *ExternalLock) Resolve(app interface{}) Commands
func (*ExternalLock) ShouldProcess ¶
func (transaction *ExternalLock) ShouldProcess(app interface{}) bool
func (*ExternalLock) TransactionType ¶ added in v0.7.0
func (transaction *ExternalLock) TransactionType() Type
func (*ExternalLock) Validate ¶
func (transaction *ExternalLock) Validate() status.Code
type ExternalSend ¶
type ExternalSend struct {
Base
Gas data.Coin `json:"gas"`
Fee data.Coin `json:"fee"`
Inputs []SendInput `json:"inputs"`
Outputs []SendOutput `json:"outputs"`
}
Synchronize a swap between two users
func (*ExternalSend) ProcessCheck ¶
func (transaction *ExternalSend) ProcessCheck(app interface{}) status.Code
func (*ExternalSend) ProcessDeliver ¶
func (transaction *ExternalSend) ProcessDeliver(app interface{}) status.Code
func (*ExternalSend) Resolve ¶
func (transaction *ExternalSend) Resolve(app interface{}) Commands
func (*ExternalSend) ShouldProcess ¶
func (transaction *ExternalSend) ShouldProcess(app interface{}) bool
func (*ExternalSend) TransactionType ¶ added in v0.7.0
func (transaction *ExternalSend) TransactionType() Type
func (*ExternalSend) Validate ¶
func (transaction *ExternalSend) Validate() status.Code
type Forget ¶
func (*Forget) ProcessCheck ¶
func (*Forget) ProcessDeliver ¶
func (*Forget) ShouldProcess ¶
func (*Forget) TransactionType ¶ added in v0.7.0
type FunctionValue ¶
type FunctionValue interface{}
type FunctionValues ¶ added in v0.7.0
type FunctionValues map[Parameter]FunctionValue
func AuditContract ¶
func AuditContract(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func AuditContractBTC ¶ added in v0.5.0
func AuditContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func AuditContractETH ¶ added in v0.5.0
func AuditContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func AuditContractOLT ¶ added in v0.5.0
func AuditContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ClearEvent ¶ added in v0.7.0
func ClearEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func CreateCheckEvent ¶ added in v0.7.0
func CreateCheckEvent(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func CreateContractBTC ¶
func CreateContractBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func CreateContractETH ¶
func CreateContractETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func CreateContractOLT ¶
func CreateContractOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ExtractSecret ¶
func ExtractSecret(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ExtractSecretBTC ¶ added in v0.5.0
func ExtractSecretBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ExtractSecretETH ¶ added in v0.5.0
func ExtractSecretETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ExtractSecretOLT ¶ added in v0.5.0
func ExtractSecretOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func FinalizeSwap ¶ added in v0.7.0
func FinalizeSwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func Initiate ¶
func Initiate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func NextStage ¶ added in v0.7.0
func NextStage(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
get the next stage from the current stage
func Noop ¶
func Noop(app interface{}, chain data.ChainType, context FunctionValues) (bool, FunctionValues)
func Participate ¶
func Participate(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ParticipateBTC ¶ added in v0.5.0
func ParticipateBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ParticipateETH ¶
func ParticipateETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func ParticipateOLT ¶ added in v0.5.0
func ParticipateOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func Redeem ¶
func Redeem(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RedeemBTC ¶ added in v0.5.0
func RedeemBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RedeemETH ¶
func RedeemETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RedeemOLT ¶ added in v0.5.0
func RedeemOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func Refund ¶
func Refund(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RefundBTC ¶ added in v0.5.0
func RefundBTC(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RefundETH ¶
func RefundETH(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func RefundOLT ¶ added in v0.5.0
func RefundOLT(app interface{}, context FunctionValues, tx Transaction) (bool, FunctionValues)
func VerifySwap ¶ added in v0.7.0
func VerifySwap(app interface{}, chain data.ChainType, context FunctionValues, tx Transaction) (bool, FunctionValues)
type HtlContract ¶ added in v0.5.3
type HtlContract struct {
Transaction Transaction `json:"transaction"`
Secrethash [32]byte `json:"secrethash"`
LockHeight int64 `json:"lockheight"`
StartFromHeight int64 `json:"startfromheight"`
}
func CreateHtlContract ¶ added in v0.5.3
func CreateHtlContract(app interface{}, transaction Transaction, scrhash [32]byte, lock time.Duration) *HtlContract
type MultiSigBox ¶ added in v0.5.3
type MultiSigBox struct {
Lockers []BoxLocker `json:"lockers"`
M int `json:"m"`
N int `json:"n"`
// contains filtered or unexported fields
}
func NewMultiSigBox ¶ added in v0.5.3
func NewMultiSigBox(m int, n int, message Message) *MultiSigBox
func (MultiSigBox) Sign ¶ added in v0.5.3
func (msb MultiSigBox) Sign(locker *BoxLocker) error
func (MultiSigBox) Unlock ¶ added in v0.5.3
func (msb MultiSigBox) Unlock(signs []BoxLocker) *Message
type Party ¶
type Party struct {
Key id.AccountKey `json:"key"`
Accounts map[data.ChainType][]byte `json:"accounts"`
}
func GetParty ¶
func GetParty(value FunctionValue) Party
type Prepare ¶
TODO: This needs to be filled out properly, need a model for other-chain actions...
func (*Prepare) ProcessCheck ¶
func (*Prepare) ProcessDeliver ¶
func (*Prepare) ShouldProcess ¶
func (*Prepare) TransactionType ¶ added in v0.7.0
type Publish ¶ added in v0.5.0
type Publish struct {
Base
Target id.AccountKey `json:"target"`
Contract Message `json:"message"` //message converted from HTLContract
SecretHash [32]byte `json:"secrethash"`
Count int `json:"count"`
}
Synchronize a publish between two users
func (*Publish) ProcessCheck ¶ added in v0.5.0
func (*Publish) ProcessDeliver ¶ added in v0.5.0
Start the publish
func (*Publish) Resolve ¶ added in v0.5.0
Plug in data from the rest of a system into a set of commands
func (*Publish) ShouldProcess ¶ added in v0.5.0
Is this node one of the partipants in the publish
func (*Publish) TransactionType ¶ added in v0.7.0
type Register ¶
type Register struct {
Base
Identity string
NodeName string
AccountKey id.AccountKey
TendermintAddress string
TendermintPubKey string
}
Register an identity with the chain
func CreateRegisterRequest ¶ added in v0.7.0
func (Register) ProcessCheck ¶
Test to see if the identity already exists
func (Register) ProcessDeliver ¶
Add the identity into the database as external, don't overwrite a local identity
func (Register) ShouldProcess ¶
func (*Register) TransactionType ¶ added in v0.7.0
type Send ¶
type Send struct {
Base
Inputs []SendInput `json:"inputs"`
Outputs []SendOutput `json:"outputs"`
Gas data.Coin `json:"gas"`
Fee data.Coin `json:"fee"`
}
Synchronize a swap between two users
func (*Send) ProcessCheck ¶
func (*Send) ProcessDeliver ¶
func (*Send) ShouldProcess ¶
func (*Send) TransactionType ¶ added in v0.7.0
type SendInput ¶
type SendInput struct {
AccountKey id.AccountKey `json:"account_key"`
PubKey PublicKey `json:"pub_key"`
Signature id.Signature `json:"signature"`
Amount data.Coin `json:"coin"`
// TODO: Is sequence needed per input?
Sequence int `json:"sequence"`
}
inputs into a send transaction (similar to Bitcoin)
func NewSendInput ¶
func NewSendInput(accountKey id.AccountKey, amount data.Coin) SendInput
type SendOutput ¶
type SendOutput struct {
AccountKey id.AccountKey `json:"account_key"`
Amount data.Coin `json:"coin"`
}
outputs for a send transaction (similar to Bitcoin)
func NewSendOutput ¶
func NewSendOutput(accountKey id.AccountKey, amount data.Coin) SendOutput
type SignedTransaction ¶ added in v0.7.0
type SignedTransaction struct {
Transaction
Signatures []TransactionSignature
}
func Parse ¶
func Parse(message Message) (SignedTransaction, status.Code)
Parse a message into the appropriate transaction
func SignTransaction ¶
func SignTransaction(transaction Transaction) SignedTransaction
SignTransaction with the local keys
type Swap ¶
type Swap struct {
Base
SwapMessage SwapMessage `json:"swapmessage"`
Stage swapStageType `json:"stage"`
}
Synchronize a swap between two users
func (*Swap) CommandExecute ¶ added in v0.7.0
func (*Swap) ProcessCheck ¶
func (*Swap) ProcessDeliver ¶
Start the swap
func (*Swap) ShouldProcess ¶
Is this node one of the partipants in the swap
func (*Swap) TransactionType ¶ added in v0.7.0
type SwapExchange ¶ added in v0.7.0
type SwapInit ¶ added in v0.7.0
type SwapKey ¶ added in v0.7.0
type SwapKey struct {
Initiator id.AccountKey `json:"initiator"`
Participant id.AccountKey `json:"participant"`
Amount data.Coin `json:"amount"`
Exchange data.Coin `json:"exchange"`
Nonce int64 `json:"nonce"`
}
type SwapMessage ¶ added in v0.7.0
type SwapMessage interface {
// contains filtered or unexported methods
}
func GetSwapMessage ¶ added in v0.7.0
func GetSwapMessage(value FunctionValue) SwapMessage
type SwapVerify ¶ added in v0.7.0
type SwapVerify struct {
Event Event `json:"event"`
}
type Transaction ¶
type Transaction interface {
TransactionType() Type
Validate() status.Code
ProcessCheck(interface{}) status.Code
ShouldProcess(interface{}) bool
ProcessDeliver(interface{}) status.Code
Resolve(interface{}) Commands
}
Polymorphism and Serializable
type TransactionSignature ¶ added in v0.7.0
type TransactionSignature struct {
Signature []byte
}
type Type ¶
type Type int
ENUM for type
const ( INVALID Type = iota REGISTER // Register a new identity with the chain SEND // Do a normal send transaction on local chain EXTERNAL_SEND // Do send on external chain EXTERNAL_LOCK // Lock some data on external chain SWAP // Start a swap between chains VERIFY // Verify if a transaction finished PUBLISH // Exchange data on a chain READ // Read a specific transaction on a chain PREPARE // Do everything, except commit COMMIT // Commit to doing the work FORGET // Rollback and forget that this happened )
type Verify ¶
type Verify struct {
Base
Target id.AccountKey `json:"target"`
Event Event `json:"event"`
Message Message `json:"Message"`
}
instead of a model for other-chain actions, we make this available by event, when a action (external/internal) is done, a event related to other chain is stored with status(false/true, representing finished or not), this verify just check the event status.