Documentation ¶
Overview ¶
Package nymapplication defines the functionality of the blockchain application. The methods here are executed on each node. It is crucial that each result is entirely deterministic, otherwise it will break the consensus and the entire network will come to the halt.
Index ¶
- Constants
- Variables
- type CoconutProperties
- type GenesisAccount
- type GenesisAppState
- type Issuer
- type NymApplication
- func (app *NymApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
- func (app *NymApplication) CheckTx(tx []byte) types.ResponseCheckTx
- func (app *NymApplication) Commit() types.ResponseCommit
- func (app *NymApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
- func (app *NymApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
- func (app *NymApplication) Info(req types.RequestInfo) types.ResponseInfo
- func (app *NymApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
- func (app *NymApplication) Query(req types.RequestQuery) types.ResponseQuery
- func (app *NymApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
- type State
- type SystemProperties
- type Watcher
Constants ¶
const ( DBNAME = "nymDB" DefaultDbDir = "/nymabci" // ProtocolVersion defines version of the protocol used. ProtocolVersion version.Protocol = 0x1 )
Variables ¶
var ( // ErrKeyDoesNotExist represents error thrown when trying to look-up non-existent key ErrKeyDoesNotExist = errors.New("the specified key does not exist in the database") )
Functions ¶
This section is empty.
Types ¶
type CoconutProperties ¶
type CoconutProperties struct { // Defines maximum number of attributes the coconut keys of the issuers can sign. MaximumAttributes int `json:"q"` // Defines the threshold parameter of the coconut system, i.e. minimum number of issuers required to successfully // issue a credential Threshold int `json:"threshold"` }
type GenesisAccount ¶
type GenesisAppState ¶
type GenesisAppState struct { SystemProperties SystemProperties `json:"systemProperties"` Accounts []GenesisAccount `json:"accounts"` Issuers []Issuer `json:"issuingAuthorities"` EthereumWatchers []Watcher `json:"ethereumWatchers"` }
GenesisAppState defines the json structure of the the AppState in the Genesis block. This allows parsing it and applying appropriate changes to the state upon InitChain. Currently it includes list of genesis accounts and Coconut properties required for credential validation.
type Issuer ¶
type Issuer struct { // While currently Issuers do not need any additional keypair to interact with the blockchain, it might be useful // to just leave it in genesis app state would we ever need it down the line. PublicKey []byte `json:"pub_key"` // The coconut verification key of the particular issuer. VerificationKey []byte `json:"vk"` }
type NymApplication ¶
type NymApplication struct { types.BaseApplication // Version is the semantic version of the ABCI library used. Version string // AppVersion defines version of the app used. Unless explicitly required, // it is going to be the same as ProtocolVersion AppVersion uint64 // contains filtered or unexported fields }
NymApplication defines basic structure for the Nym-specific ABCI.
func NewNymApplication ¶
func NewNymApplication(dbType, dbDir string, logger log.Logger) *NymApplication
NewNymApplication initialises Nym-specific Tendermint ABCI.
func (*NymApplication) BeginBlock ¶
func (app *NymApplication) BeginBlock(req types.RequestBeginBlock) types.ResponseBeginBlock
BeginBlock is executed at beginning of each block.
func (*NymApplication) CheckTx ¶
func (app *NymApplication) CheckTx(tx []byte) types.ResponseCheckTx
CheckTx validates tx in the mempool to discard obviously invalid ones so they would not be included in the block.
func (*NymApplication) Commit ¶
func (app *NymApplication) Commit() types.ResponseCommit
Commit commits the state and returns the application Merkle root hash
func (*NymApplication) DeliverTx ¶
func (app *NymApplication) DeliverTx(tx []byte) types.ResponseDeliverTx
DeliverTx delivers a tx for full processing.
func (*NymApplication) EndBlock ¶
func (app *NymApplication) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock
EndBlock is executed at the end of each block. Used to update validator set.
func (*NymApplication) Info ¶
func (app *NymApplication) Info(req types.RequestInfo) types.ResponseInfo
Info returns the application information. Required by the nodes to sync in case they crashed.
func (*NymApplication) InitChain ¶
func (app *NymApplication) InitChain(req types.RequestInitChain) types.ResponseInitChain
InitChain initialises blockchain with validators and other info from TendermintCore. It also populates genesis appstate with information from the genesis block.
func (*NymApplication) Query ¶
func (app *NymApplication) Query(req types.RequestQuery) types.ResponseQuery
Query queries App State. It is not guaranteed to always give the freshest entries as it is not ordered like txs are.
func (*NymApplication) SetOption ¶
func (app *NymApplication) SetOption(req types.RequestSetOption) types.ResponseSetOption
SetOption sets non-consensus critical application specific options. Such as fee required for CheckTx, but not DeliverTx as that would be consensus critical.
Currently I'm not sure where it is called or how to do it.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State defines ABCI app state. Currently it is a iavl tree. Reason for the choice: it was recurring case in examples. It provides height (changes after each save -> perfect for blockchain) + fast hash which is also needed.
type SystemProperties ¶
type SystemProperties struct { WatcherThreshold int `json:"watcherThreshold"` PipeAccount ethcommon.Address `json:"pipeAccount"` CoconutProperties CoconutProperties `json:"coconutProperties"` }