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.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 ¶
InitGenesis for the POW module
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 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 ¶
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 ¶
func GenerateMsgMine(sender sdk.AccAddress, count uint64, difficulty uint64) MsgMine
generate the mine message
func NewMsgMine ¶
func NewMsgMine(sender sdk.AccAddress, difficulty uint64, count uint64, nonce uint64, proof []byte) MsgMine
NewMsgMine - construct mine message
func (MsgMine) GetSignBytes ¶
get the mine message sign bytes
func (MsgMine) GetSigners ¶
func (msg MsgMine) GetSigners() []sdk.AccAddress
func (MsgMine) ValidateBasic ¶
validate the mine message
Click to show internal directories.
Click to hide internal directories.