nymapplication

package
v0.13.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 31, 2019 License: AGPL-3.0 Imports: 25 Imported by: 0

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

View Source
const (
	DBNAME       = "nymDB"
	DefaultDbDir = "/nymabci"

	// ProtocolVersion defines version of the protocol used.
	ProtocolVersion version.Protocol = 0x1
)

Variables

View Source
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 GenesisAccount struct {
	Address ethcommon.Address `json:"address"`
	Balance uint64            `json:"balance"`
}

type GenesisAppState

type GenesisAppState struct {
	SystemProperties    SystemProperties `json:"systemProperties"`
	Accounts            []GenesisAccount `json:"accounts"`
	Issuers             []Issuer         `json:"issuingAuthorities"`
	EthereumWatchers    []Watcher        `json:"ethereumWatchers"`
	CredentialVerifiers []Verifier       `json:"verifiers"`
	TokenRedeemers      []Redeemer       `json:"redeemers"`
}

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.

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

BeginBlock is executed at beginning of each block.

func (*NymApplication) CheckTx

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

DeliverTx delivers a tx for full processing.

func (*NymApplication) EndBlock

EndBlock is executed at the end of each block. Used to update validator set.

func (*NymApplication) Info

Info returns the application information. Required by the nodes to sync in case they crashed.

func (*NymApplication) InitChain

InitChain initialises blockchain with validators and other info from TendermintCore. It also populates genesis appstate with information from the genesis block. TODO: clean up the method

func (*NymApplication) Query

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

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 Redeemer

type Redeemer struct {
	// Public key associated with given redeemer. Used to authenticate any notifications they send to the chain.
	PublicKey []byte `json:"pub_key"`
}

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"`
	VerifierThreshold int               `json:"verifierThreshold"`
	RedeemerThreshold int               `json:"redeemerThreshold"`
	PipeAccount       ethcommon.Address `json:"pipeAccount"`
	CoconutProperties CoconutProperties `json:"coconutProperties"`
}

type Verifier

type Verifier struct {
	// Public key associated with given verifier. Used to authenticate any notifications they send to the chain.
	PublicKey []byte `json:"pub_key"`
}

type Watcher

type Watcher struct {
	// Public key associated with given watcher. Used to authenticate any notifications they send to the chain.
	PublicKey []byte `json:"pub_key"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL