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 RegisterCodec(cdc *codec.Codec)
- type CodeType
- type Config
- type Genesis
- type Keeper
- func (k Keeper) ApplyValid(ctx sdk.Context, sender sdk.AccAddress, 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 RegisterCodec ¶ added in v0.25.0
Register concrete types on codec 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.AccAddress, 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.AccAddress `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
func GenerateMsgMine(sender sdk.AccAddress, count uint64, difficulty uint64) MsgMine
generate the mine message
func NewMsgMine ¶ added in v0.16.0
func NewMsgMine(sender sdk.AccAddress, 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 (msg MsgMine) GetSigners() []sdk.AccAddress
func (MsgMine) ValidateBasic ¶ added in v0.16.0
validate the mine message
Click to show internal directories.
Click to hide internal directories.