Documentation
¶
Index ¶
- Constants
- func EncodeTx(tx *SignedTransaction) ([]byte, error)
- func PrefixedKey(service, key []byte) []byte
- type Cache
- type PrefixedKVStore
- type PrefixedSnapshot
- type Result
- type Service
- type SignedTransaction
- func (*SignedTransaction) Descriptor() ([]byte, []int)
- func (m *SignedTransaction) GetMsg() []byte
- func (m *SignedTransaction) GetMsgid() uint32
- func (m *SignedTransaction) GetNonce() []byte
- func (m *SignedTransaction) GetSender() []byte
- func (m *SignedTransaction) GetService() string
- func (m *SignedTransaction) GetSig() []byte
- func (*SignedTransaction) ProtoMessage()
- func (m *SignedTransaction) Reset()
- func (tx *SignedTransaction) Sign(sk crypto.PrivateKeyEd25519) error
- func (m *SignedTransaction) String() string
- func (tx *SignedTransaction) Verify() bool
- func (m *SignedTransaction) XXX_DiscardUnknown()
- func (m *SignedTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *SignedTransaction) XXX_Merge(src proto.Message)
- func (m *SignedTransaction) XXX_Size() int
- func (m *SignedTransaction) XXX_Unmarshal(b []byte) error
- type Snapshot
- type Tag
- type Tags
Constants ¶
View Source
const ( // OK - all is bueno with the executed Tx. Any non-zero code is an error OK uint32 = iota // HandlerNotFound - yep...we couldn't find it HandlerNotFound // BadTx - no bueno, couldn't decode it or something like that BadTx // NotFound - catch all NotFound // BadQuery - in store query BadQuery )
Variables ¶
This section is empty.
Functions ¶
func EncodeTx ¶
func EncodeTx(tx *SignedTransaction) ([]byte, error)
EncodeTx returns a []byte or error
func PrefixedKey ¶ added in v0.4.1
Types ¶
type PrefixedKVStore ¶ added in v0.4.1
type PrefixedKVStore struct {
// contains filtered or unexported fields
}
func NewPrefixedKVStore ¶ added in v0.4.1
func NewPrefixedKVStore(prefix string, store Cache) PrefixedKVStore
func (PrefixedKVStore) Get ¶ added in v0.4.1
func (ps PrefixedKVStore) Get(key []byte) ([]byte, error)
func (PrefixedKVStore) Has ¶ added in v0.4.1
func (ps PrefixedKVStore) Has(key []byte) bool
func (PrefixedKVStore) Put ¶ added in v0.4.1
func (ps PrefixedKVStore) Put(key, value []byte) error
func (PrefixedKVStore) Remove ¶ added in v0.4.1
func (ps PrefixedKVStore) Remove(key []byte)
type PrefixedSnapshot ¶ added in v0.4.1
type PrefixedSnapshot struct {
// contains filtered or unexported fields
}
func NewPrefixedSnapshot ¶ added in v0.4.1
func NewPrefixedSnapshot(prefix string, snapshot Snapshot) PrefixedSnapshot
type Result ¶
Result is it returned from a menta app TxHandler By default 'Code' will be zero which mean 'Ok' to tendermint
func ErrorNoHandler ¶
func ErrorNoHandler() Result
ErrorNoHandler is returned when menta can't find a handler for a given route
func ResultError ¶
ResultError is returned on an error with a non-zero code
type Service ¶ added in v0.3.0
type Service interface { // Name is the unique name of the service. Used to register your service in Menta Name() string // Init is called once, on the very first run of the application. // Use this to load genesis data for your service Initialize(data []byte, store Cache) // Execute is the primary business logic of your service. This is the blockchain // state transistion function Execute(sender []byte, msgid uint32, message []byte, store Cache) Result // Query provides read access to storage. Query(key []byte, store Snapshot) Result }
Service is the primary interface to implement for application services. A given MentaApp may have 1 or more of these.
type SignedTransaction ¶ added in v0.3.0
type SignedTransaction struct { Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` Sender []byte `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` Msgid uint32 `protobuf:"varint,3,opt,name=msgid,proto3" json:"msgid,omitempty"` Msg []byte `protobuf:"bytes,4,opt,name=msg,proto3" json:"msg,omitempty"` Nonce []byte `protobuf:"bytes,5,opt,name=nonce,proto3" json:"nonce,omitempty"` Sig []byte `protobuf:"bytes,6,opt,name=sig,proto3" json:"sig,omitempty"` XXX_NoUnkeyedLiteral struct{} `json:"-"` XXX_unrecognized []byte `json:"-"` XXX_sizecache int32 `json:"-"` }
Transaction model across client and node.
'msg' is a []byte of application specific content, the application is reponsible for encoding/decoding it.
func DecodeTx ¶
func DecodeTx(raw []byte) (*SignedTransaction, error)
DecodeTx returns a Tx from a []byte
func (*SignedTransaction) Descriptor ¶ added in v0.3.0
func (*SignedTransaction) Descriptor() ([]byte, []int)
func (*SignedTransaction) GetMsg ¶ added in v0.3.0
func (m *SignedTransaction) GetMsg() []byte
func (*SignedTransaction) GetMsgid ¶ added in v0.3.0
func (m *SignedTransaction) GetMsgid() uint32
func (*SignedTransaction) GetNonce ¶ added in v0.3.0
func (m *SignedTransaction) GetNonce() []byte
func (*SignedTransaction) GetSender ¶ added in v0.3.0
func (m *SignedTransaction) GetSender() []byte
func (*SignedTransaction) GetService ¶ added in v0.3.0
func (m *SignedTransaction) GetService() string
func (*SignedTransaction) GetSig ¶ added in v0.3.0
func (m *SignedTransaction) GetSig() []byte
func (*SignedTransaction) ProtoMessage ¶ added in v0.3.0
func (*SignedTransaction) ProtoMessage()
func (*SignedTransaction) Reset ¶ added in v0.3.0
func (m *SignedTransaction) Reset()
func (*SignedTransaction) Sign ¶ added in v0.3.0
func (tx *SignedTransaction) Sign(sk crypto.PrivateKeyEd25519) error
Sign a transaction
func (*SignedTransaction) String ¶ added in v0.3.0
func (m *SignedTransaction) String() string
func (*SignedTransaction) Verify ¶ added in v0.3.0
func (tx *SignedTransaction) Verify() bool
Verify a Tx against based on the sender's public key
func (*SignedTransaction) XXX_DiscardUnknown ¶ added in v0.3.0
func (m *SignedTransaction) XXX_DiscardUnknown()
func (*SignedTransaction) XXX_Marshal ¶ added in v0.3.0
func (m *SignedTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*SignedTransaction) XXX_Merge ¶ added in v0.3.0
func (m *SignedTransaction) XXX_Merge(src proto.Message)
func (*SignedTransaction) XXX_Size ¶ added in v0.3.0
func (m *SignedTransaction) XXX_Size() int
func (*SignedTransaction) XXX_Unmarshal ¶ added in v0.3.0
func (m *SignedTransaction) XXX_Unmarshal(b []byte) error
Click to show internal directories.
Click to hide internal directories.