Documentation ¶
Index ¶
- Variables
- func DecodeHex(src string) (out []byte)
- func DecodeJson(data []byte, v interface{}) error
- func EncodeHex(src []byte) (out string)
- func EncodeJson(v interface{}) (data []byte, err error)
- func FormTransaction(command Command, epoch uint64, payload string, privKey *eddsa.PrivateKey) ([]byte, error)
- type Authority
- type Command
- type KatzenmintApplication
- func (app *KatzenmintApplication) ApplySnapshotChunk(req abcitypes.RequestApplySnapshotChunk) (res abcitypes.ResponseApplySnapshotChunk)
- func (app *KatzenmintApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
- func (app *KatzenmintApplication) CheckTx(req abcitypes.RequestCheckTx) abcitypes.ResponseCheckTx
- func (app *KatzenmintApplication) Commit() abcitypes.ResponseCommit
- func (app *KatzenmintApplication) DeliverTx(req abcitypes.RequestDeliverTx) abcitypes.ResponseDeliverTx
- func (app *KatzenmintApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
- func (app *KatzenmintApplication) Info(req abcitypes.RequestInfo) abcitypes.ResponseInfo
- func (app *KatzenmintApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
- func (app *KatzenmintApplication) ListSnapshots(req abcitypes.RequestListSnapshots) (res abcitypes.ResponseListSnapshots)
- func (app *KatzenmintApplication) LoadSnapshotChunk(req abcitypes.RequestLoadSnapshotChunk) (res abcitypes.ResponseLoadSnapshotChunk)
- func (app *KatzenmintApplication) OfferSnapshot(req abcitypes.RequestOfferSnapshot) (res abcitypes.ResponseOfferSnapshot)
- func (app *KatzenmintApplication) Query(rquery abcitypes.RequestQuery) (resQuery abcitypes.ResponseQuery)
- func (app *KatzenmintApplication) SetOption(req abcitypes.RequestSetOption) abcitypes.ResponseSetOption
- type KatzenmintError
- type KatzenmintState
- func (state *KatzenmintState) BeginBlock()
- func (state *KatzenmintState) Commit() ([]byte, error)
- func (state *KatzenmintState) Delete(key []byte) error
- func (state *KatzenmintState) Get(key []byte) ([]byte, error)
- func (state *KatzenmintState) GetAuthorized(addr string) (pc.PublicKey, bool)
- func (state *KatzenmintState) Set(key []byte, value []byte) error
- type Query
- type Transaction
Constants ¶
This section is empty.
Variables ¶
var ( // Transaction Common Errors ErrTxIsNotValidJSON = KatzenmintError{Code: 0x01, Msg: "transaction is not valid json string"} ErrTxWrongPublicKeySize = KatzenmintError{Code: 0x02, Msg: "wrong public key size in transaction"} ErrTxWrongSignatureSize = KatzenmintError{Code: 0x03, Msg: "wrong signature size in transaction"} ErrTxWrongSignature = KatzenmintError{Code: 0x04, Msg: "wrong signature in transaction"} // Transaction Specific Errors ErrTxDescInvalidVerifier = KatzenmintError{Code: 0x11, Msg: "cannot get descriptor verifier"} ErrTxDescFalseVerification = KatzenmintError{Code: 0x12, Msg: "cannot verify and parse descriptor"} ErrTxDescNotAuthorized = KatzenmintError{Code: 0x13, Msg: "authority is not authorized"} ErrTxDocFalseVerification = KatzenmintError{Code: 0x14, Msg: "cannot verify and parse document"} ErrTxDocEpochNotEqual = KatzenmintError{Code: 0x15, Msg: "document epoch inconsistent with transaction epoch"} ErrTxDocNotAuthorized = KatzenmintError{Code: 0x16, Msg: "document is not authorized"} ErrTxAuthorityParse = KatzenmintError{Code: 0x17, Msg: "cannot parse authority"} ErrTxAuthorityNotAuthorized = KatzenmintError{Code: 0x18, Msg: "descriptor is not authorized"} ErrTxCommandNotFound = KatzenmintError{Code: 0x19, Msg: "transaction command not found"} // Transaction Execution Errors ErrTxWrongEpoch = KatzenmintError{Code: 0x21, Msg: "expect transaction epoch within +-1 to current epoch"} ErrTxUpdateDesc = KatzenmintError{Code: 0x22, Msg: "error updating descriptor"} ErrTxUpdateDoc = KatzenmintError{Code: 0x23, Msg: "error updating document"} ErrTxUpdateAuth = KatzenmintError{Code: 0x24, Msg: "error updating authority"} // Query Errors ErrQueryInvalidFormat = KatzenmintError{Code: 0x31, Msg: "error query format"} ErrQueryUnsupported = KatzenmintError{Code: 0x32, Msg: "unsupported query"} ErrQueryEpochFailed = KatzenmintError{Code: 0x33, Msg: "cannot obtain epoch for the current height"} ErrQueryNoDocument = KatzenmintError{Code: 0x34, Msg: "requested epoch has passed and will never get a document"} ErrQueryDocumentNotReady = KatzenmintError{Code: 0x35, Msg: "document for requested epoch is not ready yet"} ErrQueryDocumentUnknown = KatzenmintError{Code: 0x36, Msg: "unknown failure for document query"} )
Functions ¶
func DecodeHex ¶
DecodeHex return byte of the given hex string return nil if the src is not valid hex string
func DecodeJson ¶
func EncodeJson ¶
func FormTransaction ¶
func FormTransaction(command Command, epoch uint64, payload string, privKey *eddsa.PrivateKey) ([]byte, error)
FormTransaction returns the crafted transaction that can be posted
Types ¶
type Authority ¶
type Authority struct { // Auth is the prefix of the authority. Auth string // PubKey is the validator's public key. PubKey []byte // KeyType is the validator's key type. KeyType string // Power is the voting power of the authority. Power int64 }
Authority represents authority in katzenmint.
func VerifyAndParseAuthority ¶
type KatzenmintApplication ¶
type KatzenmintApplication struct {
// contains filtered or unexported fields
}
func (*KatzenmintApplication) ApplySnapshotChunk ¶
func (app *KatzenmintApplication) ApplySnapshotChunk(req abcitypes.RequestApplySnapshotChunk) (res abcitypes.ResponseApplySnapshotChunk)
func (*KatzenmintApplication) BeginBlock ¶
func (app *KatzenmintApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
Track the block hash and header information
func (*KatzenmintApplication) CheckTx ¶
func (app *KatzenmintApplication) CheckTx(req abcitypes.RequestCheckTx) abcitypes.ResponseCheckTx
TODO: gas formula
func (*KatzenmintApplication) Commit ¶
func (app *KatzenmintApplication) Commit() abcitypes.ResponseCommit
TODO: should update the validators map after commit
func (*KatzenmintApplication) DeliverTx ¶
func (app *KatzenmintApplication) DeliverTx(req abcitypes.RequestDeliverTx) abcitypes.ResponseDeliverTx
func (*KatzenmintApplication) EndBlock ¶
func (app *KatzenmintApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
Update validators
func (*KatzenmintApplication) Info ¶
func (app *KatzenmintApplication) Info(req abcitypes.RequestInfo) abcitypes.ResponseInfo
func (*KatzenmintApplication) InitChain ¶
func (app *KatzenmintApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
func (*KatzenmintApplication) ListSnapshots ¶
func (app *KatzenmintApplication) ListSnapshots(req abcitypes.RequestListSnapshots) (res abcitypes.ResponseListSnapshots)
TODO: state sync connection
func (*KatzenmintApplication) LoadSnapshotChunk ¶
func (app *KatzenmintApplication) LoadSnapshotChunk(req abcitypes.RequestLoadSnapshotChunk) (res abcitypes.ResponseLoadSnapshotChunk)
func (*KatzenmintApplication) OfferSnapshot ¶
func (app *KatzenmintApplication) OfferSnapshot(req abcitypes.RequestOfferSnapshot) (res abcitypes.ResponseOfferSnapshot)
func (*KatzenmintApplication) Query ¶
func (app *KatzenmintApplication) Query(rquery abcitypes.RequestQuery) (resQuery abcitypes.ResponseQuery)
func (*KatzenmintApplication) SetOption ¶
func (app *KatzenmintApplication) SetOption(req abcitypes.RequestSetOption) abcitypes.ResponseSetOption
type KatzenmintError ¶
func (KatzenmintError) Error ¶
func (err KatzenmintError) Error() string
type KatzenmintState ¶
func NewKatzenmintState ¶
func NewKatzenmintState(kConfig *config.Config, db dbm.DB) *KatzenmintState
func (*KatzenmintState) BeginBlock ¶
func (state *KatzenmintState) BeginBlock()
func (*KatzenmintState) Commit ¶
func (state *KatzenmintState) Commit() ([]byte, error)
func (*KatzenmintState) Delete ¶
func (state *KatzenmintState) Delete(key []byte) error
func (*KatzenmintState) GetAuthorized ¶
func (state *KatzenmintState) GetAuthorized(addr string) (pc.PublicKey, bool)
type Query ¶
type Query struct { // version Version string // Epoch Epoch uint64 // command Command Command // payload Payload string }
Query represents the Query request
type Transaction ¶
type Transaction struct { // version Version string // Epoch Epoch uint64 // command Command Command // hex encoded ed25519 public key (should not be 0x prefxied) PublicKey string // hex encoded ed25519 signature (should not be 0x prefixed) Signature string // json encoded payload (eg. mix descriptor/authority) Payload string }
TODO: find a better way to represent the Transaction maybe add nonce? switch to rlp encoding? Transaction represents a transaction used to make state change, eg: publish mix descriptor or add new authority
func (*Transaction) Address ¶
func (tx *Transaction) Address() string
Address returns public address of the given transaction
func (*Transaction) IsVerified ¶
func (tx *Transaction) IsVerified() (isVerified bool)
IsVerified returns whether transaction was signed by the public key
func (*Transaction) PublicKeyByteArray ¶
func (tx *Transaction) PublicKeyByteArray() (pk [eddsa.PublicKeySize]byte)
PublicKeyByteArray returns public key bytes of the given transaction
func (*Transaction) PublicKeyBytes ¶
func (tx *Transaction) PublicKeyBytes() (pk []byte)
PublicKeyBytes returns public key bytes of the given transaction
func (*Transaction) SerializeHash ¶
func (tx *Transaction) SerializeHash() (txHash [32]byte)
SerializeHash returns the serialize hash that user signed of the given transaction
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
cmd
|
|
Package s11n implements serialization routines for the various PKI data structures.
|
Package s11n implements serialization routines for the various PKI data structures. |