Documentation ¶
Index ¶
- Constants
- func AccountKey(addr []byte) []byte
- func ExecTx(state *State, tx Tx, isCheckTx bool, evc events.Fireable, height int64) abci.ResponseDeliverTx
- func InitKVStore(app *DMCCoinApplication)
- func LegibleBytes(data []byte) string
- func RandVal(i int) types.Validator
- func RandVals(cnt int) []types.Validator
- func SetAccount(store KVS, addr []byte, acc *Account)
- func TxID(tx Tx) []byte
- type Account
- type AccountGetter
- type AccountGetterSetter
- type AccountSetter
- type Accounts
- type AppTx
- type DMCCoinApplication
- func (app *DMCCoinApplication) CheckTx(txBytes []byte, height int64) types.ResponseCheckTx
- func (app *DMCCoinApplication) Commit() types.ResponseCommit
- func (app *DMCCoinApplication) DeliverBucketedTx(txBytes []byte, height int64, bucketID string) (res types.ResponseDeliverTx)
- func (app *DMCCoinApplication) DeliverTx(txBytes []byte, height int64) types.ResponseDeliverTx
- func (app *DMCCoinApplication) GetState() *State
- func (app *DMCCoinApplication) GetValidatorSet(height int64) (res types.ResponseGetValidatorSet)
- func (app *DMCCoinApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
- func (app *DMCCoinApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
- func (app *DMCCoinApplication) SetInitAccount(address data.Bytes, balance uint64)
- type DMCTx
- type KVCache
- func (kvc *KVCache) ClearLogLines()
- func (kvc *KVCache) Get(key []byte) (value []byte)
- func (kvc *KVCache) GetAll(key []byte, prefixSize int) (value []byteArray)
- func (kvc *KVCache) GetLogLines() []string
- func (kvc *KVCache) Reset() *KVCache
- func (kvc *KVCache) Set(key []byte, value []byte)
- func (kvc *KVCache) SetLogging()
- func (kvc *KVCache) Sync()
- type KVS
- type MemKVS
- type PrivAccount
- type State
- func (s *State) CacheSync()
- func (s *State) Commit() string
- func (s *State) Get(key []byte) (value []byte)
- func (s *State) GetAccount(addr []byte) *Account
- func (s *State) GetAll(key []byte, prefixSize int) (value []byteArray)
- func (s *State) GetAllAccounts() []Account
- func (s *State) GetAllAccountsInSegment(addr []byte, prefixSize int) []Account
- func (s *State) GetChainID() string
- func (s *State) Set(key []byte, value []byte)
- func (s *State) SetAccount(addr []byte, acc *Account)
- func (s *State) SetChainID(chainID string)
- func (s *State) SetLogger(l log.Logger)
- type Tx
- type TxInput
- type TxOutput
- type TxS
- type TxUTXO
Constants ¶
const ( // Account transactions TxTypeUTXO = byte(0x01) TxTypeApp = byte(0x02) TxTypeDMC = byte(0x03) TxNameUTXO = "utxo" TxNameApp = "app" TxNameDMC = "dmc" )
Types of Tx implementations
Variables ¶
This section is empty.
Functions ¶
func AccountKey ¶
func ExecTx ¶
func ExecTx(state *State, tx Tx, isCheckTx bool, evc events.Fireable, height int64) abci.ResponseDeliverTx
If the tx is invalid, a TMSP error will be returned.
func InitKVStore ¶
func InitKVStore(app *DMCCoinApplication)
InitKVStore initializes the kvstore app with some data, which allows tests to pass and is fine as long as you don't make any tx that modify the validator state
func LegibleBytes ¶
func RandVals ¶
RandVals returns a list of cnt validators for initializing the application. Note that the keys are deterministically derived from the index in the array, while the power is random (Change this if not desired)
func SetAccount ¶
Types ¶
type Account ¶
type Account struct { PubKey crypto.PubKey `json:"pub_key"` // May be nil, if not known. Height int `json:"height"` // Hold the account balance at height Balance uint64 `json:"DMC"` Address data.Bytes `json:"address"` }
func GetAccount ¶
func GetAllAccounts ¶
func GetAllAccountsInSegment ¶
func TopkAccounts ¶
type AccountGetter ¶
type AccountGetterSetter ¶
type AccountSetter ¶
type Accounts ¶
type Accounts []Account
*
- Slice of accounts and function to sort them
- for selecting the top k validators?
type AppTx ¶
type AppTx struct { Gas int64 `json:"gas"` // Gas Fee uint64 `json:"fee"` // Fee Name string `json:"type"` // Which plugin Input TxInput `json:"input"` // Hmmm do we want coins? Data json.RawMessage `json:"data"` }
----------------------------------------------------------------------------- For smart contracts
func (*AppTx) AssertIsTx ¶
func (_ *AppTx) AssertIsTx()
type DMCCoinApplication ¶
type DMCCoinApplication struct { types.BaseApplication ValUpdates []types.Validator // contains filtered or unexported fields }
func NewDMCCoinApplication ¶
func NewDMCCoinApplication(logger log.Logger) *DMCCoinApplication
func (*DMCCoinApplication) CheckTx ¶
func (app *DMCCoinApplication) CheckTx(txBytes []byte, height int64) types.ResponseCheckTx
func (*DMCCoinApplication) Commit ¶
func (app *DMCCoinApplication) Commit() types.ResponseCommit
func (*DMCCoinApplication) DeliverBucketedTx ¶
func (app *DMCCoinApplication) DeliverBucketedTx(txBytes []byte, height int64, bucketID string) (res types.ResponseDeliverTx)
func (*DMCCoinApplication) DeliverTx ¶
func (app *DMCCoinApplication) DeliverTx(txBytes []byte, height int64) types.ResponseDeliverTx
tx is either "key=value" or just arbitrary bytes
func (*DMCCoinApplication) GetState ¶
func (app *DMCCoinApplication) GetState() *State
func (*DMCCoinApplication) GetValidatorSet ¶
func (app *DMCCoinApplication) GetValidatorSet(height int64) (res types.ResponseGetValidatorSet)
FIXME: At the moment this call is also used to get UTXO account balances
func (*DMCCoinApplication) Info ¶
func (app *DMCCoinApplication) Info(req types.RequestInfo) (resInfo types.ResponseInfo)
func (*DMCCoinApplication) Query ¶
func (app *DMCCoinApplication) Query(reqQuery types.RequestQuery) (resQuery types.ResponseQuery)
func (*DMCCoinApplication) SetInitAccount ¶
func (app *DMCCoinApplication) SetInitAccount(address data.Bytes, balance uint64)
type DMCTx ¶
type DMCTx struct { Fee uint64 `json:"Fee"` Input TxInput `json:"Input"` Output TxOutput `json:"Output"` }
func (*DMCTx) AssertIsTx ¶
func (_ *DMCTx) AssertIsTx()
type KVCache ¶
type KVCache struct {
// contains filtered or unexported fields
}
A Cache that enforces deterministic sync order.
func NewKVCache ¶
NOTE: If store is nil, creates a new MemKVStore
func (*KVCache) ClearLogLines ¶
func (kvc *KVCache) ClearLogLines()
func (*KVCache) GetLogLines ¶
func (*KVCache) SetLogging ¶
func (kvc *KVCache) SetLogging()
type PrivAccount ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
func (*State) GetAccount ¶
func (*State) GetAllAccounts ¶
func (*State) GetAllAccountsInSegment ¶
func (*State) GetChainID ¶
func (*State) SetAccount ¶
func (*State) SetChainID ¶
type Tx ¶
type Tx interface { AssertIsTx() SignBytes() []byte }
Tx (Transaction) is an atomic operation on the ledger state.
Account Types:
- DMCTx Send coins to address
- TxUTXO Account balance update FIXME: Rename UTXO to UABC
type TxInput ¶
type TxInput struct { Address data.Bytes `json:"address"` // Hash of the PubKey Coins uint64 `json:"coins"` // Sequence int `json:"sequence"` // Must be 1 greater than the last committed TxInput Signature crypto.Signature `json:"signature"` // Depends on the PubKey type and the whole Tx PubKey crypto.PubKey `json:"pub_key"` // Is present iff Sequence == 0 }
func (TxInput) ValidateBasic ¶
type TxOutput ¶
type TxOutput struct { Address data.Bytes `json:"address"` // Hash of the PubKey Coins uint64 `json:"coins"` // }
func (TxOutput) ChainAndAddress ¶
An output destined for another chain may be formatted as `chainID/address`. ChainAndAddress returns the chainID prefix and the address. If there is no chainID prefix, the first returned value is nil.
func (TxOutput) ValidateBasic ¶
type TxS ¶
type TxS struct {
Tx `json:"unwrap"`
}
TxS add json serialization to Tx