ikhofi

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2018 License: LGPL-3.0 Imports: 28 Imported by: 0

Documentation

Overview

Package ikhofi is a generated protocol buffer package.

It is generated from these files:

message.proto

It has these top-level messages:

Execution
Query
TxInfo
Result
TransactionPb
TransactionPbTmp

Index

Constants

View Source
const (
	RUNTIME_ENV     = "ANN_RUNTIME"
	IKHOFI_PATH     = "IKHOFI_PATH"
	DEFAULT_RUNTIME = ".ann_runtime"
	DATADIR         = "contract_data"
	DBDATADIR       = "chaindata"
	CONFIGFILE      = "ikhofi.yaml"
)
View Source
const CONFIGTPL = `` /* 179-byte string literal not displayed */

Variables

View Source
var (
	SystemContractId                  = "system"
	SystemDeployMethod                = "deploy"
	SystemUpgradeMethod               = "upgrade"
	SystemQueryContractIdExits        = "contract"
	SystemQueryEventFilterById        = "eventFilterById"
	SystemQueryEventFilterByIdAndType = "eventFilterByIdAndType"
)
View Source
var ErrInvalidSig = errors.New("invalid transaction v, r, s values")

Functions

func GetHash

func GetHash(tmp *TransactionPbTmp) (h common.Hash)

func GetIkhofiPath

func GetIkhofiPath(path string) string

func InitIkhofiConfig

func InitIkhofiConfig(root string, conf *viper.Viper) *viper.Viper

func Sender

func Sender(signer Signer, tx *Transaction) (common.Address, error)

Sender returns the address derived from the signature (V, R, S) using secp256k1 elliptic curve and an error if it failed deriving or upon an incorrect signature.

Sender may cache the address, allowing it to be used regardless of signing method. The cache is invalidated if the cached signer does not match the signer used in the current call.

Types

type DawnSigner

type DawnSigner struct {
}

HomesteadTransaction implements TransactionInterface using the homestead rules.

func (DawnSigner) Equal

func (s DawnSigner) Equal(s2 Signer) bool

func (DawnSigner) Hash

func (ds DawnSigner) Hash(tx *Transaction) common.Hash

Hash returns the hash to be sned by the sender. It does not uniquely identify the transaction.

func (DawnSigner) PublicKey

func (ds DawnSigner) PublicKey(tx *Transaction) ([]byte, error)

func (DawnSigner) WithSignature

func (ds DawnSigner) WithSignature(tx *Transaction, sig []byte) (*Transaction, error)

WithSignature returns a new transaction with the given signature. This signature needs to be in the [R || S || V] format where V is 0 or 1.

type Execution

type Execution struct {
	Version  int32    `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	Id       string   `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
	Method   string   `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
	Args     []string `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"`
	TxInfo   *TxInfo  `protobuf:"bytes,5,opt,name=txInfo" json:"txInfo,omitempty"`
	ByteCode []byte   `protobuf:"bytes,6,opt,name=byteCode,proto3" json:"byteCode,omitempty"`
}

func (*Execution) Descriptor

func (*Execution) Descriptor() ([]byte, []int)

func (*Execution) GetArgs

func (m *Execution) GetArgs() []string

func (*Execution) GetByteCode

func (m *Execution) GetByteCode() []byte

func (*Execution) GetId

func (m *Execution) GetId() string

func (*Execution) GetMethod

func (m *Execution) GetMethod() string

func (*Execution) GetTxInfo

func (m *Execution) GetTxInfo() *TxInfo

func (*Execution) GetVersion

func (m *Execution) GetVersion() int32

func (*Execution) ProtoMessage

func (*Execution) ProtoMessage()

func (*Execution) Reset

func (m *Execution) Reset()

func (*Execution) String

func (m *Execution) String() string

type IKHOFIApp

type IKHOFIApp struct {
	agtypes.BaseApplication

	civil.EventAppBase

	Config      *viper.Viper
	AngineHooks agtypes.Hooks
	// contains filtered or unexported fields
}

func NewIKHOFIApp

func NewIKHOFIApp(logger *zap.Logger, config *viper.Viper) (*IKHOFIApp, error)

func (*IKHOFIApp) CheckTx

func (app *IKHOFIApp) CheckTx(bs []byte) error

func (*IKHOFIApp) CompatibleWithAngine

func (app *IKHOFIApp) CompatibleWithAngine()

func (*IKHOFIApp) ExecuteTx

func (app *IKHOFIApp) ExecuteTx(height def.INT, block *agtypes.BlockCache, bs []byte) (validtx []byte, err error)

func (*IKHOFIApp) GetAngineHooks

func (app *IKHOFIApp) GetAngineHooks() agtypes.Hooks

func (*IKHOFIApp) HandleEvent

func (app *IKHOFIApp) HandleEvent(eventData civil.EventData, notification *civil.EventNotificationTx)

func (*IKHOFIApp) Info

func (app *IKHOFIApp) Info() (resInfo agtypes.ResultInfo)

func (*IKHOFIApp) OnCommit

func (app *IKHOFIApp) OnCommit(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*IKHOFIApp) OnExecute

func (app *IKHOFIApp) OnExecute(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*IKHOFIApp) OnNewRound

func (app *IKHOFIApp) OnNewRound(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*IKHOFIApp) OnPrevote

func (app *IKHOFIApp) OnPrevote(height, round def.INT, block *agtypes.BlockCache) (interface{}, error)

func (*IKHOFIApp) Query

func (app *IKHOFIApp) Query(query []byte) agtypes.Result

func (*IKHOFIApp) SetCore

func (app *IKHOFIApp) SetCore(c civil.Core)

func (*IKHOFIApp) Start

func (app *IKHOFIApp) Start() (err error)

func (*IKHOFIApp) Stop

func (app *IKHOFIApp) Stop()

func (*IKHOFIApp) SupportCoSiTx

func (app *IKHOFIApp) SupportCoSiTx()

type IkhofiConfig

type IkhofiConfig struct {
	Db struct {
		DbType            string `yaml:"type"`
		DbPath            string `yaml:"path"`
		CacheSize         int    `yaml:"cacheSize"`
		DestroyAfterClose bool   `yaml:"destroyAfterClose"`
	}
}

type LastBlockInfo

type LastBlockInfo struct {
	Height  def.INT
	AppHash []byte
}

type Query

type Query struct {
	Version int32    `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	Id      string   `protobuf:"bytes,2,opt,name=id" json:"id,omitempty"`
	Method  string   `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
	Args    []string `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"`
}

func (*Query) Descriptor

func (*Query) Descriptor() ([]byte, []int)

func (*Query) GetArgs

func (m *Query) GetArgs() []string

func (*Query) GetId

func (m *Query) GetId() string

func (*Query) GetMethod

func (m *Query) GetMethod() string

func (*Query) GetVersion

func (m *Query) GetVersion() int32

func (*Query) ProtoMessage

func (*Query) ProtoMessage()

func (*Query) Reset

func (m *Query) Reset()

func (*Query) String

func (m *Query) String() string

type Response

type Response struct {
	Code    int    "code"
	Value   string "value"
	Message string "message"
}

type Result

type Result struct {
	Version int32  `protobuf:"varint,1,opt,name=version" json:"version,omitempty"`
	Code    int32  `protobuf:"varint,2,opt,name=code" json:"code,omitempty"`
	Msg     string `protobuf:"bytes,3,opt,name=msg" json:"msg,omitempty"`
	Value   string `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"`
}

func (*Result) Descriptor

func (*Result) Descriptor() ([]byte, []int)

func (*Result) GetCode

func (m *Result) GetCode() int32

func (*Result) GetMsg

func (m *Result) GetMsg() string

func (*Result) GetValue

func (m *Result) GetValue() string

func (*Result) GetVersion

func (m *Result) GetVersion() int32

func (*Result) ProtoMessage

func (*Result) ProtoMessage()

func (*Result) Reset

func (m *Result) Reset()

func (*Result) String

func (m *Result) String() string

type Signer

type Signer interface {
	// Hash returns the rlp encoded hash for signatures
	Hash(tx *Transaction) common.Hash
	// PubilcKey returns the public key derived from the signature
	PublicKey(tx *Transaction) ([]byte, error)
	// WithSignature returns a copy of the transaction with the given signature.
	// The signature must be encoded in [R || S || V] format where V is 0 or 1.
	WithSignature(tx *Transaction, sig []byte) (*Transaction, error)
	// Checks for equality on the signers
	Equal(Signer) bool
}

type StartParams

type StartParams struct {
	ConfigPath   string
	StateHashHex string
}

type Transaction

type Transaction struct {
	From     common.Address
	To       string
	Method   string
	Args     []string
	ByteCode []byte
	Nonce    int64
	V        *big.Int // signature
	R, S     *big.Int // signature
	Hash     common.Hash
}

func NewTransaction

func NewTransaction(from common.Address, to, method string, args []string, bytecode []byte) *Transaction

func Pb2Transaction

func Pb2Transaction(txpb *TransactionPb) *Transaction

func (*Transaction) SigHash

func (tx *Transaction) SigHash(signer Signer) common.Hash

SigHash returns the hash to be signed by the sender. It does not uniquely identify the transaction.

func (*Transaction) Transaction2Pb

func (tx *Transaction) Transaction2Pb() *TransactionPb

func (*Transaction) Transaction2PbTmp

func (tx *Transaction) Transaction2PbTmp() *TransactionPbTmp

func (*Transaction) WithSignature

func (tx *Transaction) WithSignature(signer Signer, sig []byte) (*Transaction, error)

WithSignature returns a new transaction with the given signature. This signature needs to be formatted as described in the yellow paper (v+27).

type TransactionPb

type TransactionPb struct {
	From     []byte   `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	To       string   `protobuf:"bytes,2,opt,name=to" json:"to,omitempty"`
	Method   string   `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
	Args     []string `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"`
	Bytecode []byte   `protobuf:"bytes,5,opt,name=bytecode,proto3" json:"bytecode,omitempty"`
	Nonce    int64    `protobuf:"varint,6,opt,name=nonce" json:"nonce,omitempty"`
	V        []byte   `protobuf:"bytes,7,opt,name=v,proto3" json:"v,omitempty"`
	R        []byte   `protobuf:"bytes,8,opt,name=r,proto3" json:"r,omitempty"`
	S        []byte   `protobuf:"bytes,9,opt,name=s,proto3" json:"s,omitempty"`
	Hash     []byte   `protobuf:"bytes,10,opt,name=hash,proto3" json:"hash,omitempty"`
}

func (*TransactionPb) Descriptor

func (*TransactionPb) Descriptor() ([]byte, []int)

func (*TransactionPb) GetArgs

func (m *TransactionPb) GetArgs() []string

func (*TransactionPb) GetBytecode

func (m *TransactionPb) GetBytecode() []byte

func (*TransactionPb) GetFrom

func (m *TransactionPb) GetFrom() []byte

func (*TransactionPb) GetHash

func (m *TransactionPb) GetHash() []byte

func (*TransactionPb) GetMethod

func (m *TransactionPb) GetMethod() string

func (*TransactionPb) GetNonce

func (m *TransactionPb) GetNonce() int64

func (*TransactionPb) GetR

func (m *TransactionPb) GetR() []byte

func (*TransactionPb) GetS

func (m *TransactionPb) GetS() []byte

func (*TransactionPb) GetTo

func (m *TransactionPb) GetTo() string

func (*TransactionPb) GetV

func (m *TransactionPb) GetV() []byte

func (*TransactionPb) ProtoMessage

func (*TransactionPb) ProtoMessage()

func (*TransactionPb) Reset

func (m *TransactionPb) Reset()

func (*TransactionPb) String

func (m *TransactionPb) String() string

type TransactionPbTmp

type TransactionPbTmp struct {
	From     []byte   `protobuf:"bytes,1,opt,name=from,proto3" json:"from,omitempty"`
	To       string   `protobuf:"bytes,2,opt,name=to" json:"to,omitempty"`
	Method   string   `protobuf:"bytes,3,opt,name=method" json:"method,omitempty"`
	Args     []string `protobuf:"bytes,4,rep,name=args" json:"args,omitempty"`
	Bytecode []byte   `protobuf:"bytes,5,opt,name=bytecode,proto3" json:"bytecode,omitempty"`
	Nonce    int64    `protobuf:"varint,6,opt,name=nonce" json:"nonce,omitempty"`
}

func (*TransactionPbTmp) Descriptor

func (*TransactionPbTmp) Descriptor() ([]byte, []int)

func (*TransactionPbTmp) GetArgs

func (m *TransactionPbTmp) GetArgs() []string

func (*TransactionPbTmp) GetBytecode

func (m *TransactionPbTmp) GetBytecode() []byte

func (*TransactionPbTmp) GetFrom

func (m *TransactionPbTmp) GetFrom() []byte

func (*TransactionPbTmp) GetMethod

func (m *TransactionPbTmp) GetMethod() string

func (*TransactionPbTmp) GetNonce

func (m *TransactionPbTmp) GetNonce() int64

func (*TransactionPbTmp) GetTo

func (m *TransactionPbTmp) GetTo() string

func (*TransactionPbTmp) ProtoMessage

func (*TransactionPbTmp) ProtoMessage()

func (*TransactionPbTmp) Reset

func (m *TransactionPbTmp) Reset()

func (*TransactionPbTmp) String

func (m *TransactionPbTmp) String() string

type TxInfo

type TxInfo struct {
	BlockHeight    int64  `protobuf:"varint,1,opt,name=blockHeight" json:"blockHeight,omitempty"`
	LastCommitHash []byte `protobuf:"bytes,2,opt,name=lastCommitHash,proto3" json:"lastCommitHash,omitempty"`
	TxFrom         string `protobuf:"bytes,3,opt,name=txFrom" json:"txFrom,omitempty"`
	BlockTime      int64  `protobuf:"varint,4,opt,name=blockTime" json:"blockTime,omitempty"`
	TxHash         []byte `protobuf:"bytes,5,opt,name=txHash,proto3" json:"txHash,omitempty"`
}

func (*TxInfo) Descriptor

func (*TxInfo) Descriptor() ([]byte, []int)

func (*TxInfo) GetBlockHeight

func (m *TxInfo) GetBlockHeight() int64

func (*TxInfo) GetBlockTime

func (m *TxInfo) GetBlockTime() int64

func (*TxInfo) GetLastCommitHash

func (m *TxInfo) GetLastCommitHash() []byte

func (*TxInfo) GetTxFrom

func (m *TxInfo) GetTxFrom() string

func (*TxInfo) GetTxHash

func (m *TxInfo) GetTxHash() []byte

func (*TxInfo) ProtoMessage

func (*TxInfo) ProtoMessage()

func (*TxInfo) Reset

func (m *TxInfo) Reset()

func (*TxInfo) String

func (m *TxInfo) String() string

Jump to

Keyboard shortcuts

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