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 ¶
Table-driven list of all of the possible functions associated with their transactions ¶
Need to fill in the target chain later, since for any set of instructions it changes...
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 ¶
- Variables
- func AuditContract(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func AuditContractBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func AuditContractETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func AuditContractOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func BroadcastTransaction(ttype Type, transaction Transaction)
- func CheckAmounts(app interface{}, inputs []SendInput, outputs []SendOutput) bool
- func CheckBalance(app interface{}, accountKey id.AccountKey, amount data.Coin) bool
- func CreateContractBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func CreateContractETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func CreateContractOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func DelayedTransaction(ttype Type, transaction Transaction, waitTime time.Duration)
- func Execute(app interface{}, command Command, lastResult map[Parameter]FunctionValue) (err.Code, map[Parameter]FunctionValue)
- func ExtractSecret(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ExtractSecretBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ExtractSecretETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ExtractSecretOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- 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 GetBTCContract(value FunctionValue) *bitcoin.HTLContract
- func GetByte32(value FunctionValue) [32]byte
- func GetBytes(value FunctionValue) []byte
- func GetChainAccount(app interface{}, name string, chain data.ChainType) id.Account
- func GetChainID(app interface{}) string
- func GetCoin(value FunctionValue) data.Coin
- func GetETHContract(value FunctionValue) *ethereum.HTLContract
- func GetIdentities(app interface{}) *id.Identities
- func GetInt(value FunctionValue) int
- func GetInt64(value FunctionValue) int64
- func GetPubKeyHash(address string) *btcutil.AddressPubKeyHash
- func GetStatus(app interface{}) *data.Datastore
- func GetString(value FunctionValue) string
- func GetUtxo(app interface{}) *data.ChainState
- func Initiate(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func MatchSwap(left *Swap, right *Swap) bool
- func Noop(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func PackRequest(ttype Type, request Transaction) []byte
- func Participate(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ParticipateBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ParticipateETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func ParticipateOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func PrepareTransaction(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func Redeem(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RedeemBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RedeemETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RedeemOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func Refund(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RefundBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RefundETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func RefundOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func SaveSwap(status *data.Datastore, accountKey id.AccountKey, transaction *Swap)
- func SignAndPack(ttype Type, transaction Transaction) []byte
- func SubmitTransaction(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- func SubmitTransactionOLT(context map[Parameter]FunctionValue, chain data.ChainType) (bool, map[Parameter]FunctionValue)
- func UnpackMessage(message Message) (Type, Message)
- func WaitForChain(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
- type Base
- type BoxLocker
- type Command
- type CommandType
- type Commands
- type Commit
- func (transaction *Commit) Expand(app interface{}) Commands
- func (transaction *Commit) ProcessCheck(app interface{}) err.Code
- func (transaction *Commit) ProcessDeliver(app interface{}) err.Code
- func (transaction *Commit) Resolve(app interface{}, commands Commands)
- func (transaction *Commit) ShouldProcess(app interface{}) bool
- func (transaction *Commit) Validate() err.Code
- type ExternalLock
- func (transaction *ExternalLock) Expand(app interface{}) Commands
- func (transaction *ExternalLock) ProcessCheck(app interface{}) err.Code
- func (transaction *ExternalLock) ProcessDeliver(app interface{}) err.Code
- func (transaction *ExternalLock) Resolve(app interface{}, commands Commands)
- func (transaction *ExternalLock) ShouldProcess(app interface{}) bool
- func (transaction *ExternalLock) Validate() err.Code
- type ExternalSend
- func (transaction *ExternalSend) Expand(app interface{}) Commands
- func (transaction *ExternalSend) ProcessCheck(app interface{}) err.Code
- func (transaction *ExternalSend) ProcessDeliver(app interface{}) err.Code
- func (transaction *ExternalSend) Resolve(app interface{}, commands Commands)
- func (transaction *ExternalSend) ShouldProcess(app interface{}) bool
- func (transaction *ExternalSend) Validate() err.Code
- type Forget
- func (transaction *Forget) Expand(app interface{}) Commands
- func (transaction *Forget) ProcessCheck(app interface{}) err.Code
- func (transaction *Forget) ProcessDeliver(app interface{}) err.Code
- func (transaction *Forget) Resolve(app interface{}, commands Commands)
- func (transaction *Forget) ShouldProcess(app interface{}) bool
- func (transaction *Forget) Validate() err.Code
- type FunctionValue
- type Message
- type Object
- type Parameter
- type Party
- type Prepare
- func (transaction *Prepare) Expand(app interface{}) Commands
- func (transaction *Prepare) ProcessCheck(app interface{}) err.Code
- func (transaction *Prepare) ProcessDeliver(app interface{}) err.Code
- func (transaction *Prepare) Resolve(app interface{}, commands Commands)
- func (transaction *Prepare) ShouldProcess(app interface{}) bool
- func (transaction *Prepare) Validate() err.Code
- type PublicKey
- type Publish
- func (transaction *Publish) Expand(app interface{}) Commands
- func (transaction *Publish) FindSwap(app interface{}) *Swap
- func (transaction *Publish) GetNodeAccount(app interface{}) id.Account
- func (transaction *Publish) ProcessCheck(app interface{}) err.Code
- func (transaction *Publish) ProcessDeliver(app interface{}) err.Code
- func (publish *Publish) Resolve(app interface{}, commands Commands)
- func (transaction *Publish) ShouldProcess(app interface{}) bool
- func (transaction *Publish) Validate() err.Code
- type Register
- func (transaction Register) Expand(app interface{}) Commands
- func (transaction Register) ProcessCheck(app interface{}) err.Code
- func (transaction Register) ProcessDeliver(app interface{}) err.Code
- func (transaction Register) Resolve(app interface{}, commands Commands)
- func (transaction Register) ShouldProcess(app interface{}) bool
- func (transaction Register) Validate() err.Code
- type Role
- type Send
- func (transaction *Send) Expand(app interface{}) Commands
- func (transaction *Send) ProcessCheck(app interface{}) err.Code
- func (transaction *Send) ProcessDeliver(app interface{}) err.Code
- func (transaction *Send) Resolve(app interface{}, commands Commands)
- func (transaction *Send) ShouldProcess(app interface{}) bool
- func (transaction *Send) Validate() err.Code
- type SendInput
- type SendOutput
- type Swap
- func (transaction *Swap) Expand(app interface{}) Commands
- func (transaction *Swap) GetNodeAccount(app interface{}) id.Account
- func (transaction *Swap) IsParty(account id.Account) *bool
- func (transaction *Swap) ProcessCheck(app interface{}) err.Code
- func (transaction *Swap) ProcessDeliver(app interface{}) err.Code
- func (swap *Swap) Resolve(app interface{}, commands Commands)
- func (transaction *Swap) ShouldProcess(app interface{}) bool
- func (transaction *Swap) Validate() err.Code
- type Transaction
- type Type
- type Verify
- func (transaction Verify) Expand(app interface{}) Commands
- func (transaction Verify) ProcessCheck(app interface{}) err.Code
- func (transaction Verify) ProcessDeliver(app interface{}) err.Code
- func (transaction Verify) Resolve(app interface{}, commands Commands)
- func (transaction Verify) ShouldProcess(app interface{}) bool
- func (transaction Verify) Validate() err.Code
Constants ¶
This section is empty.
Variables ¶
var FunctionMapping = [][]Object{ []Object{ SWAP, INITIATOR, Command{ Function: INITIATE, Order: 0, }, Command{ Function: SUBMIT_TRANSACTION, Order: 0, }, }, []Object{ SWAP, PARTICIPANT, Command{ Function: NOOP, }, }, []Object{ PUBLISH, INITIATOR, Command{ Function: AUDITCONTRACT, Order: 1, }, Command{ Function: REDEEM, Order: 1, }, Command{ Function: SUBMIT_TRANSACTION, Order: 1, }, }, []Object{ PUBLISH, PARTICIPANT, Command{ Function: AUDITCONTRACT, Order: 0, }, Command{ Function: PARTICIPATE, Order: 1, }, Command{ Function: SUBMIT_TRANSACTION, Order: 1, }, }, []Object{ PUBLISH, ALL, Command{ Function: EXTRACTSECRET, Order: 1, }, Command{ Function: REDEEM, Order: 0, }, }, []Object{ SEND, ALL, Command{ Function: PREPARE_TRANSACTION, }, }, }
Table-Driven Mapping between transactions and the specific actions to be performed on a set of chains
Functions ¶
func AuditContract ¶
func AuditContract(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func AuditContractBTC ¶ added in v0.5.0
func AuditContractBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func AuditContractETH ¶ added in v0.5.0
func AuditContractETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func AuditContractOLT ¶ added in v0.5.0
func AuditContractOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func BroadcastTransaction ¶
func BroadcastTransaction(ttype Type, transaction Transaction)
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 CreateContractBTC ¶
func CreateContractBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func CreateContractETH ¶
func CreateContractETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func CreateContractOLT ¶
func CreateContractOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
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 Execute ¶
func Execute(app interface{}, command Command, lastResult map[Parameter]FunctionValue) (err.Code, map[Parameter]FunctionValue)
Execute the function
func ExtractSecret ¶
func ExtractSecret(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ExtractSecretBTC ¶ added in v0.5.0
func ExtractSecretBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ExtractSecretETH ¶ added in v0.5.0
func ExtractSecretETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ExtractSecretOLT ¶ added in v0.5.0
func ExtractSecretOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
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 GetBTCContract ¶ added in v0.5.0
func GetBTCContract(value FunctionValue) *bitcoin.HTLContract
func GetByte32 ¶ added in v0.5.0
func GetByte32(value FunctionValue) [32]byte
func GetBytes ¶
func GetBytes(value FunctionValue) []byte
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 GetETHContract ¶
func GetETHContract(value FunctionValue) *ethereum.HTLContract
func GetIdentities ¶
func GetIdentities(app interface{}) *id.Identities
func GetInt ¶
func GetInt(value FunctionValue) int
func GetInt64 ¶
func GetInt64(value FunctionValue) int64
func GetPubKeyHash ¶
func GetPubKeyHash(address string) *btcutil.AddressPubKeyHash
func GetString ¶
func GetString(value FunctionValue) string
func GetUtxo ¶
func GetUtxo(app interface{}) *data.ChainState
func Initiate ¶
func Initiate(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func Noop ¶
func Noop(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func PackRequest ¶
func PackRequest(ttype Type, request Transaction) []byte
Pack a request into a transferable format (wire)
func Participate ¶
func Participate(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ParticipateBTC ¶ added in v0.5.0
func ParticipateBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ParticipateETH ¶
func ParticipateETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func ParticipateOLT ¶ added in v0.5.0
func ParticipateOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func PrepareTransaction ¶ added in v0.5.0
func PrepareTransaction(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func Redeem ¶
func Redeem(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RedeemBTC ¶ added in v0.5.0
func RedeemBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RedeemETH ¶
func RedeemETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RedeemOLT ¶ added in v0.5.0
func RedeemOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func Refund ¶
func Refund(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RefundBTC ¶ added in v0.5.0
func RefundBTC(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RefundETH ¶
func RefundETH(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func RefundOLT ¶ added in v0.5.0
func RefundOLT(context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func SignAndPack ¶
func SignAndPack(ttype Type, transaction Transaction) []byte
func SubmitTransaction ¶
func SubmitTransaction(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
func SubmitTransactionOLT ¶ added in v0.5.0
func SubmitTransactionOLT(context map[Parameter]FunctionValue, chain data.ChainType) (bool, map[Parameter]FunctionValue)
func UnpackMessage ¶
Pull out the type, so that the message can be deserialized
func WaitForChain ¶
func WaitForChain(chain data.ChainType, context map[Parameter]FunctionValue) (bool, map[Parameter]FunctionValue)
Types ¶
type Base ¶
type Base struct {
Type Type `json:"type"`
ChainId string `json:"chain_id"`
Owner id.AccountKey `json:"owner"`
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 {
Function CommandType
Chain data.ChainType
Data map[Parameter]FunctionValue
Order int
}
A command to execute again a chain, needs to be polymorphic
type CommandType ¶
type CommandType int
const ( NOOP CommandType = iota PREPARE_TRANSACTION SUBMIT_TRANSACTION INITIATE PARTICIPATE REDEEM REFUND EXTRACTSECRET AUDITCONTRACT WAIT_FOR_CHAIN )
Set of possible commands that can be driven from a transaction
type Commands ¶
type Commands []Command
func GetCommands ¶
Given an action and a chain, return a list of commands
type Commit ¶
TODO: This needs to be filled out properly, need a model for other-chain actions...
func (*Commit) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Commit) ProcessCheck ¶
func (*Commit) ProcessDeliver ¶
func (*Commit) ShouldProcess ¶
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) Expand ¶
func (transaction *ExternalLock) Expand(app interface{}) Commands
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*ExternalLock) ProcessCheck ¶
func (transaction *ExternalLock) ProcessCheck(app interface{}) err.Code
func (*ExternalLock) ProcessDeliver ¶
func (transaction *ExternalLock) ProcessDeliver(app interface{}) err.Code
func (*ExternalLock) Resolve ¶
func (transaction *ExternalLock) Resolve(app interface{}, commands Commands)
func (*ExternalLock) ShouldProcess ¶
func (transaction *ExternalLock) ShouldProcess(app interface{}) bool
func (*ExternalLock) Validate ¶
func (transaction *ExternalLock) Validate() err.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) Expand ¶
func (transaction *ExternalSend) Expand(app interface{}) Commands
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*ExternalSend) ProcessCheck ¶
func (transaction *ExternalSend) ProcessCheck(app interface{}) err.Code
func (*ExternalSend) ProcessDeliver ¶
func (transaction *ExternalSend) ProcessDeliver(app interface{}) err.Code
func (*ExternalSend) Resolve ¶
func (transaction *ExternalSend) Resolve(app interface{}, commands Commands)
func (*ExternalSend) ShouldProcess ¶
func (transaction *ExternalSend) ShouldProcess(app interface{}) bool
func (*ExternalSend) Validate ¶
func (transaction *ExternalSend) Validate() err.Code
type Forget ¶
func (*Forget) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Forget) ProcessCheck ¶
func (*Forget) ProcessDeliver ¶
func (*Forget) ShouldProcess ¶
type FunctionValue ¶
type FunctionValue interface{}
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) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Prepare) ProcessCheck ¶
func (*Prepare) ProcessDeliver ¶
func (*Prepare) ShouldProcess ¶
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"`
Sequence int `json:"sequence"`
}
Synchronize a publish between two users
func ParsePublish ¶ added in v0.5.0
func (*Publish) Expand ¶ added in v0.5.0
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Publish) GetNodeAccount ¶ added in v0.5.0
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
type Register ¶
type Register struct {
Base
Identity string
NodeName string
AccountKey id.AccountKey
}
Register an identity with the chain
func (Register) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
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 ¶
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) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Send) ProcessCheck ¶
func (*Send) ProcessDeliver ¶
func (*Send) ShouldProcess ¶
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 Swap ¶
type Swap struct {
Base
Party Party `json:"party"`
CounterParty Party `json:"counter_party"`
Amount data.Coin `json:"amount"`
Exchange data.Coin `json:"exchange"`
Fee data.Coin `json:"fee"`
Gas data.Coin `json:"fee"`
Nonce int64 `json:"nonce"`
Preimage []byte `json:"preimage"`
}
Synchronize a swap between two users
func FindMatchingSwap ¶
func FindMatchingSwap(status *data.Datastore, accountKey id.AccountKey, transaction *Swap, isParty bool) (matched *Swap)
TODO: Change to return Role as INITIATOR or PARTICIPANT
func ProcessSwap ¶
func (*Swap) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.
func (*Swap) GetNodeAccount ¶
func (*Swap) ProcessCheck ¶
func (*Swap) ProcessDeliver ¶
Start the swap
func (*Swap) ShouldProcess ¶
Is this node one of the partipants in the swap
type Transaction ¶
type Transaction interface {
Validate() err.Code
ProcessCheck(interface{}) err.Code
ShouldProcess(interface{}) bool
ProcessDeliver(interface{}) err.Code
Expand(interface{}) Commands
Resolve(interface{}, Commands)
}
Polymorphism and Serializable
func FindSwap ¶
func FindSwap(status *data.Datastore, key id.AccountKey) Transaction
func Parse ¶
func Parse(message Message) (Transaction, err.Code)
TODO: Need a better way to handle the polymorphism... Parse a message into the appropriate transaction
func SignTransaction ¶
func SignTransaction(transaction Transaction) Transaction
SignTransaction with the local keys
type Type ¶
type Type byte
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 that a lockbox is correct 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 CHECKFORERROR //todo: check something happened(with a delay transaction), otherwise it's an error )
type Verify ¶
type Verify struct {
Base
Target id.AccountKey `json:"target"`
}
TODO: This needs to be filled out properly, need a model for other-chain actions...
func (Verify) Expand ¶
Given a transaction, expand it into a list of Commands to execute against various chains.