Documentation
¶
Overview ¶
Package app is the core menta application. It contains logic to add callbacks, implements the ABCI interface, and provides and embedded node.
Index ¶
- Constants
- Variables
- func InitTendermint(homedir string)
- func LoadConfig(homedir string) (*cfg.Config, error)
- func TrapSignal(cleanupFunc func())
- type MentaApp
- func (app *MentaApp) BeginBlock(req abci.RequestBeginBlock) (resp abci.ResponseBeginBlock)
- func (app *MentaApp) CheckTx(checkTx abci.RequestCheckTx) abci.ResponseCheckTx
- func (app *MentaApp) Commit() abci.ResponseCommit
- func (app *MentaApp) CreateNode() *node.Node
- func (app *MentaApp) DeliverTx(dtx abci.RequestDeliverTx) abci.ResponseDeliverTx
- func (app *MentaApp) EndBlock(req abci.RequestEndBlock) (resp abci.ResponseEndBlock)
- func (app *MentaApp) Info(req abci.RequestInfo) abci.ResponseInfo
- func (app *MentaApp) InitChain(req abci.RequestInitChain) (resp abci.ResponseInitChain)
- func (app *MentaApp) OnBeginBlock(fn sdk.BeginBlockHandler)
- func (app *MentaApp) OnEndBlock(fn sdk.EndBlockHandler)
- func (app *MentaApp) OnInitialStart(fn sdk.InitialStartHandler)
- func (app *MentaApp) OnQuery(routeName string, fn sdk.QueryHandler)
- func (app *MentaApp) OnTx(routeName string, fn sdk.TxHandler)
- func (app *MentaApp) OnValidateTx(fn sdk.TxHandler)
- func (app *MentaApp) Query(query abci.RequestQuery) abci.ResponseQuery
- func (app *MentaApp) Run()
- func (app *MentaApp) SetOption(req abci.RequestSetOption) abci.ResponseSetOption
Constants ¶
const ( MENTAHOME = ".menta" Home = "home" )
Variables ¶
Functions ¶
func InitTendermint ¶
func InitTendermint(homedir string)
func TrapSignal ¶
func TrapSignal(cleanupFunc func())
TrapSignal Adapted from Cosmos SDK Note: Must add a select{} after this - see above
Types ¶
type MentaApp ¶
MentaApp contains all the basics needed to build a tendermint application
func NewApp ¶
NewApp returns a new instance of MentaApp where appname is the name of your application, and homedir is the path where menta/tendermint will store all the data and configuration information
func NewMockApp ¶
func NewMockApp() *MentaApp
NewMockApp creates a menta app that can be used for local testing without a full blown node and an in memory state tree
func (*MentaApp) BeginBlock ¶
func (app *MentaApp) BeginBlock(req abci.RequestBeginBlock) (resp abci.ResponseBeginBlock)
BeginBlock signals the start of processing a batch of transaction via DeliverTx
func (*MentaApp) CheckTx ¶
func (app *MentaApp) CheckTx(checkTx abci.RequestCheckTx) abci.ResponseCheckTx
CheckTx populates the mempool. Transactions are ran through the OnValidationHandler. If the pass, they will be considered for inclusion in a block and processed via DeliverTx
func (*MentaApp) Commit ¶
func (app *MentaApp) Commit() abci.ResponseCommit
Commit to state tree, refresh caches
func (*MentaApp) CreateNode ¶
CreateNode creates an embedded tendermint node for standalone mode
func (*MentaApp) DeliverTx ¶
func (app *MentaApp) DeliverTx(dtx abci.RequestDeliverTx) abci.ResponseDeliverTx
DeliverTx is the heart of processing transactions leading to a state transistion. This is where the your application logic lives via handlers
func (*MentaApp) EndBlock ¶
func (app *MentaApp) EndBlock(req abci.RequestEndBlock) (resp abci.ResponseEndBlock)
EndBlock signals the end of a block of txs. TODO: return changes to the validator set
func (*MentaApp) Info ¶
func (app *MentaApp) Info(req abci.RequestInfo) abci.ResponseInfo
Info checks the application state on startup. If the last block height known by the application is less than what tendermint says, then the application node will sync by replaying all transactions up to the current tendermint block height.
func (*MentaApp) InitChain ¶
func (app *MentaApp) InitChain(req abci.RequestInitChain) (resp abci.ResponseInitChain)
InitChain is ran once on the very first run of the application chain.
func (*MentaApp) OnBeginBlock ¶
func (app *MentaApp) OnBeginBlock(fn sdk.BeginBlockHandler)
OnBeginBlock : Add this handler if you want to do something before a block of transactions are processed.
func (*MentaApp) OnEndBlock ¶
func (app *MentaApp) OnEndBlock(fn sdk.EndBlockHandler)
OnEndBlock : Add this handler to do something after a block of transactions are processed. This is commonly used to update network validators based on logic implemented via an OnTx handler.
func (*MentaApp) OnInitialStart ¶
func (app *MentaApp) OnInitialStart(fn sdk.InitialStartHandler)
OnInitialStart : Add this handler if you'd like to do 'something' the very first time Menta starts the new app. Usually this is used to load initial application state: accounts, etc....
func (*MentaApp) OnQuery ¶
func (app *MentaApp) OnQuery(routeName string, fn sdk.QueryHandler)
OnQuery : Add one or more handler to query application state.
func (*MentaApp) OnTx ¶
OnTx : This is the heart of the application. TxHandlers are the application business logic. The 'routeName' maps to the route field in the transaction, used to select which handler to select for which route. Transactions also have an 'action' field the can be used to further filter logic to sub functions under a single handler.
func (*MentaApp) OnValidateTx ¶
OnValidateTx : Add this handler to validate your transactions. This is NOT required as you can also validate tx in your OnTx handlers if you want. Usually this is a good place to put signature verification. There is only 1 of these per application.
func (*MentaApp) Query ¶
func (app *MentaApp) Query(query abci.RequestQuery) abci.ResponseQuery
Query *committed* state in the Tree This calls the handler where the path is the registed query path (handler) and the key is the application specific key in storage
func (*MentaApp) SetOption ¶
func (app *MentaApp) SetOption(req abci.RequestSetOption) abci.ResponseSetOption
SetOption - not used