app

package
v0.8.0 Latest Latest
Warning

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

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

Documentation

Overview

Copyright 2017-2018 OneLedger

Define aliases to hide Tendermint types and 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
View Source
var ZeroAccountKey id.AccountKey

TODO: DEBUG

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) id.AccountKey

func AddAccount added in v0.7.1

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

TODO: NodeAccount flag should not be here!!! Create a local account for this fullnode

func AddIdentity added in v0.7.1

func AddIdentity(app *Application, name string, publicKey id.PublicKeyED25519)

Broadcast an Indentity to the chain

func Balance

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

func ChainAddress added in v0.7.1

func ChainAddress(chain data.ChainType) interface{}

func CreateAccount added in v0.7.0

func CreateAccount(app Application, state *BasicState, publicKey id.PublicKeyED25519, privateKey id.PrivateKeyED25519)

func CreatePaymentRequest added in v0.7.0

func CreatePaymentRequest(app Application, quotient data.Coin, height int64) action.Transaction

func CreateRegisterRequest added in v0.7.1

func CreateRegisterRequest(identityName string, accountKey id.AccountKey) action.Transaction

TODO: Called by olfullnode, not olclient?

func CurrencyAddress added in v0.8.0

func CurrencyAddress(application Application, currency string, identityName string) []byte

func GetBool added in v0.7.1

func GetBool(boolean string) bool

TODO: Should be in common library

func GetChain added in v0.7.1

func GetChain(chainName string) data.ChainType

func GetKeys added in v0.7.1

func GetKeys(chain data.ChainType, name string, publicKey string, privateKey string) (id.PublicKeyED25519, id.PrivateKeyED25519)

TODO: The datatype for Key, depends on Chain

func GetSigners added in v0.7.0

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

func GetSourceCode added in v0.8.0

func GetSourceCode(name string) []byte

func HandleAccountKeyQuery

func HandleAccountKeyQuery(app Application, arguments map[string]string) interface{}

Get the account information for a given user

func HandleAccountPublicKeyQuery added in v0.7.0

func HandleAccountPublicKeyQuery(app Application, arguments map[string]string) interface{}

func HandleAccountQuery

func HandleAccountQuery(app Application, arguments map[string]string) interface{}

Get the account information for a given user

func HandleApplyValidatorQuery added in v0.7.1

func HandleApplyValidatorQuery(application Application, arguments map[string]string) interface{}

func HandleBalanceQuery

func HandleBalanceQuery(app Application, arguments map[string]string) interface{}

Get the account information for a given user

func HandleCreateExSendRequest added in v0.8.0

func HandleCreateExSendRequest(application Application, arguments map[string]string) interface{}

func HandleCreateMintRequest added in v0.8.0

func HandleCreateMintRequest(application Application, arguments map[string]string) interface{}

func HandleCreateSendRequest added in v0.8.0

func HandleCreateSendRequest(application Application, arguments map[string]string) interface{}

func HandleCurrencyAddressQuery added in v0.7.1

func HandleCurrencyAddressQuery(app Application, arguments map[string]string) interface{}

func HandleError

func HandleError(text string, path string, arguments map[string]string) interface{}

Return a nicely formatted error message

func HandleIdentityQuery

func HandleIdentityQuery(app Application, arguments map[string]string) interface{}

Get the account information for a given user

func HandleNodeNameQuery added in v0.6.2

func HandleNodeNameQuery(app Application, arguments map[string]string) interface{}

func HandleQuery

func HandleQuery(app Application, path string, arguments map[string]string) []byte

Top-level list of all query types

func HandleRegisterIdentity added in v0.7.1

func HandleRegisterIdentity(app Application, arguments map[string]string) interface{}

func HandleSequenceNumberQuery added in v0.7.1

func HandleSequenceNumberQuery(app Application, arguments map[string]string) interface{}

Get the account information for a given user

func HandleSet added in v0.7.1

func HandleSet(app Application, path string, arguments map[string]string) []byte

func HandleSetAccount added in v0.7.1

func HandleSetAccount(app Application, arguments map[string]string) interface{}

TODO: Pass in App pointer?

func HandleSignTransaction added in v0.7.0

func HandleSignTransaction(app Application, arguments map[string]string) interface{}

func HandleSwapRequest added in v0.8.0

func HandleSwapRequest(application Application, arguments map[string]string) interface{}

func HandleTestScript added in v0.8.0

func HandleTestScript(app Application, arguments map[string]string) interface{}

func HandleTypeError added in v0.7.1

func HandleTypeError(message string) []byte

func HandleValidatorQuery added in v0.8.0

func HandleValidatorQuery(app Application, arguments map[string]string) interface{}

Get the validator information for a given user

func HandleVersionQuery

func HandleVersionQuery(app Application, arguments map[string]string) interface{}

func IdentityInfo

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

func LoadPrivValidatorFile added in v0.7.0

func LoadPrivValidatorFile()

Load the Priv Validator file directly from the associated Tendermint node

func NewBalanceFromStates added in v0.7.1

func NewBalanceFromStates(states []State) *data.Balance

func NewSDKServer added in v0.7.0

func NewSDKServer(app *Application, addr string) (*sdk.Server, error)

func ParseData added in v0.7.1

func ParseData(message []byte) map[string]string

func RunTestScript added in v0.8.0

func RunTestScript(request *action.OLVMRequest) interface{}

Take the engine for a test spin

func RunTestScriptName added in v0.8.0

func RunTestScriptName(name string) interface{}

func SequenceNumber added in v0.7.1

func SequenceNumber(app Application, accountKey []byte) id.SequenceRecord

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

TODO: This probably doesn't work. It was replaced by the SDK direct connection Handle a SetOption ABCi reqeust

func SignTransaction added in v0.7.0

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

func StartOLVM added in v0.8.0

func StartOLVM()

func ValidatorInfo added in v0.8.0

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

func XRegisterLocally added in v0.7.1

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

Register Identities and Accounts from the user.

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)
	Balances         *data.ChainState // unspent transction output (for each type of coin)
	Identities       *id.Identities   // Keep a higher-level identity for a given user
	SmartContract    data.Datastore   //Store olvm smart contracts
	ExecutionContext data.Datastore   //Store last olvm execution

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

	SDK common.Service

	// Tendermint's last block information
	Header     types.Header   // Tendermint last header info
	Validators *id.Validators // List of validators for this block
}

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) CheckIfInitialized added in v0.8.0

func (app Application) CheckIfInitialized() bool

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) GetBalances added in v0.7.1

func (app Application) GetBalances() 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) GetExecutionContext added in v0.8.0

func (app Application) GetExecutionContext() interface{}

func (Application) GetIdentities

func (app Application) GetIdentities() interface{}

Access to the local persistent databases

func (Application) GetPassword added in v0.8.0

func (app Application) GetPassword() interface{}

func (Application) GetSequence added in v0.8.0

func (app Application) GetSequence() interface{}

func (Application) GetSmartContract added in v0.8.0

func (app Application) GetSmartContract() interface{}

func (Application) GetStatus

func (app Application) GetStatus() interface{}

Access to the local persistent databases

func (Application) GetValidators added in v0.8.0

func (app Application) GetValidators() interface{}

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)

make payment to validators

func (Application) Query

func (app Application) Query(req RequestQuery) ResponseQuery

Query comes from tendermint node, and returns data and/or a proof

func (Application) RunScript added in v0.8.0

func (app Application) RunScript(request interface{}) interface{}

func (Application) SetOption

func (app Application) SetOption(req RequestSetOption) ResponseSetOption

SetOption changes the underlying options for the ABCi app

func (*Application) SetPaymentRecord added in v0.8.0

func (app *Application) SetPaymentRecord(amount data.Coin, blockHeight int64)

func (Application) SetupState

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

Use the Genesis block to initialze the system

func (Application) StartSDK added in v0.7.1

func (app Application) StartSDK()

Start up a local server for direct connections from clients

type BasicState

type BasicState struct {
	Account string  `json:"account"`
	States  []State `json:"states"`
}

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 SDKQuery added in v0.7.1

type SDKQuery struct {
	Path      string
	Arguments map[string]string
}

type SDKServer added in v0.7.0

type SDKServer struct {
	App *Application
}

func (SDKServer) Block added in v0.7.1

func (server SDKServer) Block(ctx context.Context, request *pb.BlockRequest) (*pb.SDKReply, error)

func (SDKServer) CheckAccount added in v0.7.0

func (server 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 (server 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) Request added in v0.7.1

func (server SDKServer) Request(ctx context.Context, request *pb.SDKRequest) (*pb.SDKReply, error)

func (SDKServer) Send added in v0.7.0

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

Issue a send transacgion

func (SDKServer) Status added in v0.7.0

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

func (SDKServer) Tx added in v0.7.1

func (server SDKServer) Tx(ctx context.Context, request *pb.TxRequest) (*pb.SDKReply, error)

func (SDKServer) TxSearch added in v0.7.1

func (server SDKServer) TxSearch(ctx context.Context, request *pb.TxSearchRequest) (*pb.SDKReply, error)

type SDKSet added in v0.7.1

type SDKSet struct {
	Path      string
	Arguments map[string]string
}

type State added in v0.7.1

type State struct {
	Amount string `json:"amount"`
	Coin   string `json:"currency"` // TODO: Misnamed?
}

Jump to

Keyboard shortcuts

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