account

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2017 License: Apache-2.0 Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccountCodec = wire.Codec{
	Encode: AccountEncoder,
	Decode: AccountDecoder,
}

Functions

func AccountDecoder

func AccountDecoder(r io.Reader, n *int, err *error) interface{}

func AccountEncoder

func AccountEncoder(o interface{}, w io.Writer, n *int, err *error)

func EncodeAccount

func EncodeAccount(acc *Account) []byte

func GenPrivKeyBytesFromSecret

func GenPrivKeyBytesFromSecret(secret string) []byte

Generates 32 priv key bytes from secret

func SignBytes

func SignBytes(chainID string, o Signable) []byte

SignBytes is a convenience method for getting the bytes to sign of a Signable.

Types

type Account

type Account struct {
	Address     []byte        `json:"address"`
	PubKey      crypto.PubKey `json:"pub_key"`
	Sequence    int           `json:"sequence"`
	Balance     int64         `json:"balance"`
	Code        []byte        `json:"code"`         // VM code
	StorageRoot []byte        `json:"storage_root"` // VM storage merkle root.

	Permissions ptypes.AccountPermissions `json:"permissions"`
}

Account resides in the application state, and is mutated by transactions on the blockchain. Serialized by wire.[read|write]Reflect

func DecodeAccount

func DecodeAccount(accBytes []byte) *Account

func (*Account) Copy

func (acc *Account) Copy() *Account

func (*Account) String

func (acc *Account) String() string

type PrivAccount

type PrivAccount struct {
	Address []byte         `json:"address"`
	PubKey  crypto.PubKey  `json:"pub_key"`
	PrivKey crypto.PrivKey `json:"priv_key"`
}

func GenPrivAccount

func GenPrivAccount() *PrivAccount

Generates a new account with private key.

func GenPrivAccountFromPrivKeyBytes

func GenPrivAccountFromPrivKeyBytes(privKeyBytes []byte) *PrivAccount

func GenPrivAccountFromSecret

func GenPrivAccountFromSecret(secret string) *PrivAccount

Generates a new account with private key from SHA256 hash of a secret

func (*PrivAccount) Generate

func (pA *PrivAccount) Generate(index int) *PrivAccount

func (*PrivAccount) Sign

func (pA *PrivAccount) Sign(chainID string, o Signable) crypto.Signature

func (*PrivAccount) String

func (pA *PrivAccount) String() string

type Signable

type Signable interface {
	WriteSignBytes(chainID string, w io.Writer, n *int, err *error)
}

Signable is an interface for all signable things. It typically removes signatures before serializing.

Jump to

Keyboard shortcuts

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