accounts

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

* This is a very basic extension to provide accounts. It provides signature verification, * but lacks true nonce support. See the handler in handlers.go

Index

Constants

This section is empty.

Variables

View Source
var (
	AccountNotFound  = sdk.ResultError(2, "Account not found")
	BadSignature     = sdk.ResultError(3, "Bad signature")
	FailedToSave     = sdk.ResultError(5, "Failed to save account")
	BadAccountPubKey = sdk.ResultError(6, "Bad account public key")
	PubKeyNoMatch    = sdk.ResultError(7, "Publickey address does not match the sender address")
)

Functions

func GenerateJSONAccounts

func GenerateJSONAccounts(num int) ([]byte, error)

GenerateJSONAccounts will create a json list of private keys

func LoadAccounts

func LoadAccounts(ctx sdk.Context, accts []Account) error

LoadAccounts can used in initChain to bulk load genesis accounts from a json file

func SetAccount

func SetAccount(ctx sdk.Context, acct Account) error

SetAccount in the state store

func VerifyAccount

func VerifyAccount(ctx sdk.Context) sdk.Result

VerifyAccount handler is commonly used in checkTx to verify the sender Note: this is a very basic implementation. It doesn't properly manage a nonce

Types

type Account

type Account struct {
	Pubkey               []byte   `protobuf:"bytes,2,opt,name=pubkey,proto3" json:"pubkey,omitempty"`
	Nonce                uint64   `protobuf:"varint,3,opt,name=nonce" json:"nonce,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

Basic account state store model

func GetAccount

func GetAccount(ctx sdk.Context, address []byte) (*Account, error)

GetAccount from state storage based on the account address

func LoadJSONAccounts

func LoadJSONAccounts(data []byte) ([]Account, error)

LoadJSONAccounts loads a json list from above into []Account

func (*Account) Descriptor

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

func (*Account) GetNonce

func (m *Account) GetNonce() uint64

func (*Account) GetPubkey

func (m *Account) GetPubkey() []byte

func (*Account) ProtoMessage

func (*Account) ProtoMessage()

func (*Account) Reset

func (m *Account) Reset()

func (*Account) String

func (m *Account) String() string

func (*Account) XXX_DiscardUnknown

func (m *Account) XXX_DiscardUnknown()

func (*Account) XXX_Marshal

func (m *Account) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Account) XXX_Merge

func (dst *Account) XXX_Merge(src proto.Message)

func (*Account) XXX_Size

func (m *Account) XXX_Size() int

func (*Account) XXX_Unmarshal

func (m *Account) XXX_Unmarshal(b []byte) error

Directories

Path Synopsis
cmds
mentacct command

Jump to

Keyboard shortcuts

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