Documentation ¶
Index ¶
- func ErrInvalidCount(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidDifficulty(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrInvalidProof(codespace sdk.CodespaceType, msg string) sdk.Error
- func ErrNonexistentCount(codespace sdk.CodespaceType) sdk.Error
- func ErrNonexistentDifficulty(codespace sdk.CodespaceType) sdk.Error
- func ErrNonexistentReward(codespace sdk.CodespaceType) sdk.Error
- func ErrNotBelowTarget(codespace sdk.CodespaceType, msg string) sdk.Error
- func InitGenesis(ctx sdk.Context, k Keeper, genesis Genesis) error
- func RegisterWire(cdc *wire.Codec)
- type CodeType
- type Config
- type Genesis
- type Keeper
- func (k Keeper) ApplyValid(ctx sdk.Context, sender sdk.Address, newDifficulty uint64, newCount uint64) sdk.Error
- func (k Keeper) CheckValid(ctx sdk.Context, difficulty uint64, count uint64) (uint64, uint64, sdk.Error)
- func (k Keeper) GetLastCount(ctx sdk.Context) (uint64, error)
- func (k Keeper) GetLastDifficulty(ctx sdk.Context) (uint64, error)
- func (pk Keeper) Handler(ctx sdk.Context, msg sdk.Msg) sdk.Result
- func (k Keeper) SetLastCount(ctx sdk.Context, count uint64)
- func (k Keeper) SetLastDifficulty(ctx sdk.Context, diff uint64)
- type MsgMine
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ErrInvalidCount ¶
func ErrInvalidCount(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrInvalidDifficulty ¶
func ErrInvalidDifficulty(codespace sdk.CodespaceType, msg string) sdk.Error
nolint
func ErrInvalidProof ¶
func ErrInvalidProof(codespace sdk.CodespaceType, msg string) sdk.Error
func ErrNonexistentCount ¶
func ErrNonexistentCount(codespace sdk.CodespaceType) sdk.Error
func ErrNonexistentDifficulty ¶
func ErrNonexistentDifficulty(codespace sdk.CodespaceType) sdk.Error
func ErrNonexistentReward ¶
func ErrNonexistentReward(codespace sdk.CodespaceType) sdk.Error
func ErrNotBelowTarget ¶
func ErrNotBelowTarget(codespace sdk.CodespaceType, msg string) sdk.Error
func InitGenesis ¶ added in v0.16.0
InitGenesis for the POW module
func RegisterWire ¶ added in v0.16.0
Register concrete types on wire codec
Types ¶
type CodeType ¶
TODO remove, seems hacky
const ( DefaultCodespace sdk.CodespaceType = 5 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 )
POW errors reserve 200 ~ 299
type Config ¶ added in v0.16.0
module users must specify coin denomination and reward (constant) per PoW solution
type Keeper ¶
type Keeper struct {
// contains filtered or unexported fields
}
POW Keeper
func (Keeper) ApplyValid ¶
func (k Keeper) ApplyValid(ctx sdk.Context, sender sdk.Address, newDifficulty uint64, newCount uint64) sdk.Error
Add some coins for a POW well done
func (Keeper) CheckValid ¶
func (k Keeper) CheckValid(ctx sdk.Context, difficulty uint64, count uint64) (uint64, uint64, sdk.Error)
Is the keeper state valid?
func (Keeper) GetLastCount ¶
get the last count
func (Keeper) GetLastDifficulty ¶
get the last mining difficulty
func (Keeper) SetLastCount ¶
set the last count
type MsgMine ¶ added in v0.16.0
type MsgMine struct { Sender sdk.Address `json:"sender"` Difficulty uint64 `json:"difficulty"` Count uint64 `json:"count"` Nonce uint64 `json:"nonce"` Proof []byte `json:"proof"` }
MsgMine - mine some coins with PoW
func GenerateMsgMine ¶ added in v0.16.0
generate the mine message
func NewMsgMine ¶ added in v0.16.0
func NewMsgMine(sender sdk.Address, difficulty uint64, count uint64, nonce uint64, proof []byte) MsgMine
NewMsgMine - construct mine message
func (MsgMine) GetSignBytes ¶ added in v0.16.0
get the mine message sign bytes
func (MsgMine) GetSigners ¶ added in v0.16.0
func (MsgMine) ValidateBasic ¶ added in v0.16.0
validate the mine message
Click to show internal directories.
Click to hide internal directories.