Documentation ¶
Index ¶
- func ErrInvalidCount(msg string) sdk.Error
- func ErrInvalidDifficulty(msg string) sdk.Error
- func ErrInvalidProof(msg string) sdk.Error
- func ErrNonexistentCount() sdk.Error
- func ErrNonexistentDifficulty() sdk.Error
- func ErrNonexistentReward() sdk.Error
- func ErrNotBelowTarget(msg string) sdk.Error
- type CodeType
- type Keeper
- func (pk Keeper) ApplyValid(ctx sdk.Context, sender sdk.Address, newDifficulty uint64, newCount uint64) sdk.Error
- func (pk Keeper) CheckValid(ctx sdk.Context, difficulty uint64, count uint64) (uint64, uint64, sdk.Error)
- func (pk Keeper) GetLastCount(ctx sdk.Context) (uint64, error)
- func (pk Keeper) GetLastDifficulty(ctx sdk.Context) (uint64, error)
- func (pk Keeper) Handler(ctx sdk.Context, msg sdk.Msg) sdk.Result
- func (pk Keeper) InitGenesis(ctx sdk.Context, genesis PowGenesis) error
- func (pk Keeper) SetLastCount(ctx sdk.Context, count uint64)
- func (pk Keeper) SetLastDifficulty(ctx sdk.Context, diff uint64)
- type MineMsg
- type PowConfig
- type PowGenesis
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidCount ¶
func ErrInvalidDifficulty ¶
func ErrInvalidProof ¶
func ErrNonexistentCount ¶
func ErrNonexistentReward ¶
func ErrNotBelowTarget ¶
Types ¶
type CodeType ¶
const ( CodeInvalidDifficulty CodeType = 201 CodeNonexistentDifficulty CodeType = 202 CodeNonexistentReward CodeType = 203 CodeNonexistentCount CodeType = 204 CodeInvalidProof CodeType = 205 CodeNotBelowTarget CodeType = 206 CodeInvalidCount CodeType = 207 CodeUnknownRequest CodeType = sdk.CodeUnknownRequest )
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
func (Keeper) ApplyValid ¶
func (Keeper) CheckValid ¶
func (Keeper) GetLastDifficulty ¶
func (Keeper) InitGenesis ¶
func (pk Keeper) InitGenesis(ctx sdk.Context, genesis PowGenesis) error
type MineMsg ¶
type MineMsg struct { Sender sdk.Address `json:"sender"` Difficulty uint64 `json:"difficulty"` Count uint64 `json:"count"` Nonce uint64 `json:"nonce"` Proof []byte `json:"proof"` }
MineMsg - mine some coins with PoW
func GenerateMineMsg ¶
func NewMineMsg ¶
func NewMineMsg(sender sdk.Address, difficulty uint64, count uint64, nonce uint64, proof []byte) MineMsg
NewMineMsg - construct mine message
func (MineMsg) GetSignBytes ¶
func (MineMsg) GetSigners ¶
func (MineMsg) ValidateBasic ¶
type PowConfig ¶
module users must specify coin denomination and reward (constant) per PoW solution
func NewPowConfig ¶
type PowGenesis ¶
genesis info must specify starting difficulty and starting count
Click to show internal directories.
Click to hide internal directories.