app

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Overview

Copyright 2017-2018 OneLedger

Define aliases to enhance readability of the code

AN ABCi application node to process transactions from Tendermint Consensus

Implement all of the query mechanics for the node and the chain

Handle setting any options for the node.

Grab data from tendermint node

Index

Constants

This section is empty.

Variables

View Source
var ChainId string

Functions

func AccountInfo

func AccountInfo(app Application, name string) interface{}

AccountInfo returns the information for a given account

func AccountKey

func AccountKey(app Application, name string) interface{}

func Balance

func Balance(app Application, accountKey []byte) interface{}

func CreateAccount added in v0.7.0

func CreateAccount(app Application, stateAccount string, stateAmount string, publicKey id.PublicKeyED25519, privateKey id.PrivateKeyED25519)

func CreatePaymentRequest added in v0.7.0

func CreatePaymentRequest(app Application, identities []id.Identity, quotient data.Coin) []byte

func GetBalance

func GetBalance(app Application, account id.Account) string

Get the balancd for an account

func GetSigners added in v0.7.0

func GetSigners(owner []byte, applicaiton Application) []id.PublicKey

func HandleAccountKeyQuery

func HandleAccountKeyQuery(app Application, message []byte) interface{}

Get the account information for a given user

func HandleAccountPublicKeyQuery added in v0.7.0

func HandleAccountPublicKeyQuery(app Application, message []byte) interface{}

func HandleAccountQuery

func HandleAccountQuery(app Application, message []byte) interface{}

Get the account information for a given user

func HandleBalanceQuery

func HandleBalanceQuery(app Application, message []byte) interface{}

Get the account information for a given user

func HandleError

func HandleError(text string, path string, message []byte) interface{}

Return a nicely formatted error message

func HandleIdentityQuery

func HandleIdentityQuery(app Application, message []byte) interface{}

Get the account information for a given user

func HandleNodeNameQuery added in v0.6.2

func HandleNodeNameQuery(app Application, message []byte) interface{}

func HandleQuery

func HandleQuery(app Application, path string, message []byte) (buffer []byte)

Top-level list of all query types

func HandleSignTransaction added in v0.7.0

func HandleSignTransaction(app Application, message []byte) interface{}

func HandleSwapAddressQuery added in v0.5.0

func HandleSwapAddressQuery(app Application, message []byte) interface{}

func HandleUtxoQuery

func HandleUtxoQuery(app Application, message []byte) interface{}

func HandleVersionQuery

func HandleVersionQuery(app Application, message []byte) interface{}

func IdentityInfo

func IdentityInfo(app Application, name string) interface{}

func IsByzantine added in v0.7.0

func IsByzantine(validator types.Validator, badValidators []types.Evidence) (result bool)

func LoadPrivValidatorFile added in v0.7.0

func LoadPrivValidatorFile()

func NewBalanceFromString added in v0.6.2

func NewBalanceFromString(amount string, currency string) data.Balance

func NewSDKServer added in v0.7.0

func NewSDKServer(app *Application, port int) (*sdk.Server, error)

func RegisterLocally

func RegisterLocally(app *Application, name string, scope string, chain data.ChainType,
	publicKey id.PublicKeyED25519, privateKey id.PrivateKeyED25519) bool

Register Identities and Accounts from the user.

func SetNodeName added in v0.7.0

func SetNodeName(app interface{})

The args write Node name directly to the context, but we can check to see if that is persistent, or matches the last entry

func SetOption

func SetOption(app *Application, key string, value string) bool

func SignTransaction added in v0.7.0

func SignTransaction(transaction action.Transaction, applicaiton Application) action.SignedTransaction

func SwapAddress added in v0.6.0

func SwapAddress(chain data.ChainType) interface{}

func UtxoInfo

func UtxoInfo(app Application, name string) interface{}

Types

type AdminParameters added in v0.6.2

type AdminParameters struct {
	NodeAccountName string
	NodeName        string
}

type Application

type Application struct {
	types.BaseApplication

	// Global Chain state (data is identical on all nodes in the chain)
	Utxo       *data.ChainState // unspent transction output (for each type of coin)
	SDK        common.Service
	Identities *id.Identities // Keep a higher-level identity for a given user

	// Local Node state (data is different for each node)
	Admin    data.Datastore // any administrative parameters
	Status   data.Datastore // current state of any composite transactions (pending, verified, etc.)
	Accounts *id.Accounts   // Keep all of the user accounts locally for their node (identity management)
	Event    data.Datastore // Event for any action that need to be tracked
	Contract data.Datastore // contract for reuse.

	// Tendermint's last block information
	LastHeader types.Header // Tendermint last header info
}

ApplicationContext keeps all of the upper level global values.

func NewApplication

func NewApplication() *Application

NewApplicationContext initializes a new application, reconnects to the databases.

func (Application) BeginBlock

func (app Application) BeginBlock(req RequestBeginBlock) ResponseBeginBlock

BeginBlock is called when a new block is started

func (Application) CheckTx

func (app Application) CheckTx(tx []byte) ResponseCheckTx

CheckTx tests to see if a transaction is valid

func (Application) Close added in v0.7.0

func (app Application) Close()

Close closes every datastore in app

func (Application) Commit

func (app Application) Commit() ResponseCommit

Commit tells the app to make everything persistent

func (Application) DeliverTx

func (app Application) DeliverTx(tx []byte) ResponseDeliverTx

DeliverTx accepts a transaction and updates all relevant data

func (Application) EndBlock

func (app Application) EndBlock(req RequestEndBlock) ResponseEndBlock

EndBlock is called at the end of all of the transactions

func (Application) GetAccounts

func (app Application) GetAccounts() interface{}

Access to the local persistent databases

func (Application) GetAdmin

func (app Application) GetAdmin() interface{}

Access to the local persistent databases

func (Application) GetChainID added in v0.5.0

func (app Application) GetChainID() interface{}

func (Application) GetContract added in v0.5.2

func (app Application) GetContract() interface{}

func (Application) GetEvent added in v0.5.2

func (app Application) GetEvent() interface{}

func (Application) GetIdentities

func (app Application) GetIdentities() interface{}

Access to the local persistent databases

func (Application) GetStatus

func (app Application) GetStatus() interface{}

Access to the local persistent databases

func (Application) GetUtxo

func (app Application) GetUtxo() interface{}

Access to the local persistent databases

func (Application) Info

func (app Application) Info(req RequestInfo) ResponseInfo

Info returns the current block information

func (Application) InitChain

func (app Application) InitChain(req RequestInitChain) ResponseInitChain

InitChain is called when a new chain is getting created

func (Application) Initialize

func (app Application) Initialize()

Initial the state of the application from persistent data

func (Application) MakePayment added in v0.7.0

func (app Application) MakePayment(req RequestBeginBlock)

EndBlock is called at the end of all of the transactions

func (Application) Query

func (app Application) Query(req RequestQuery) ResponseQuery

Query returns a transaction or a proof

func (Application) SetOption

func (app Application) SetOption(req RequestSetOption) ResponseSetOption

SetOption changes the underlying options for the ABCi app

func (Application) SetupState

func (app Application) SetupState(stateBytes []byte)

Use the Genesis block to initialze the system

type BasicState

type BasicState struct {
	Account string `json:"account"`
	Amount  string `json:"coins"` // TODO: Should be corrected as Amount, not coins
}

type PrivValidator added in v0.7.0

type PrivValidator struct {
	Address       string    `json:"address"`
	PubKey        TypeValue `json:"pub_key"`
	LastHeight    int64     `json:"last_height"`
	LastRound     int64     `json:"last_round"`
	LastStep      int64     `json:"last_step"`
	LastSignature string    `json:"last_signature"`
	LastSignBytes string    `json:"last_signbytes"`
	PrivKey       TypeValue `json:"priv_key"`
}

type RegisterArguments

type RegisterArguments struct {
	Identity   string
	Chain      string
	PublicKey  string
	PrivateKey string
}

Arguments for registration

type RequestBeginBlock

type RequestBeginBlock = types.RequestBeginBlock

type RequestCheckTx

type RequestCheckTx = types.RequestCheckTx

type RequestDeliverTx

type RequestDeliverTx = types.RequestDeliverTx

type RequestEndBlock

type RequestEndBlock = types.RequestEndBlock

type RequestInfo

type RequestInfo = types.RequestInfo

type RequestInitChain

type RequestInitChain = types.RequestInitChain

type RequestQuery

type RequestQuery = types.RequestQuery

type RequestSetOption

type RequestSetOption = types.RequestSetOption

type ResponseBeginBlock

type ResponseBeginBlock = types.ResponseBeginBlock

type ResponseCheckTx

type ResponseCheckTx = types.ResponseCheckTx

type ResponseCommit

type ResponseCommit = types.ResponseCommit

type ResponseDeliverTx

type ResponseDeliverTx = types.ResponseDeliverTx

type ResponseEndBlock

type ResponseEndBlock = types.ResponseEndBlock

type ResponseInfo

type ResponseInfo = types.ResponseInfo

type ResponseInitChain

type ResponseInitChain = types.ResponseInitChain

type ResponseQuery

type ResponseQuery = types.ResponseQuery

type ResponseSetOption

type ResponseSetOption = types.ResponseSetOption

type SDKServer added in v0.7.0

type SDKServer struct {
	App *Application
}

func (SDKServer) CheckAccount added in v0.7.0

func (s SDKServer) CheckAccount(ctx context.Context, request *pb.CheckAccountRequest) (*pb.CheckAccountReply, error)

CheckAccount returns the balance of a given account ID

func (SDKServer) Register added in v0.7.0

func (s SDKServer) Register(ctx context.Context, request *pb.RegisterRequest) (*pb.RegisterReply, error)

Given the name of the identity and the chain type, generate new keys and broadcast this new identity

func (SDKServer) Send added in v0.7.0

func (s SDKServer) Send(ctx context.Context, request *pb.SendRequest) (*pb.SendReply, error)

func (SDKServer) Status added in v0.7.0

func (s SDKServer) Status(ctx context.Context, request *pb.StatusRequest) (*pb.StatusReply, error)

type TypeValue added in v0.7.0

type TypeValue struct {
	Type  string `json:"type"`
	Value string `json:"value"`
}

Jump to

Keyboard shortcuts

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