rollingseed

package
v3.0.0-...-caddde9 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 13 Imported by: 0

README

rollingseed

Abstract

This abstract outlines a module designed to enhance the security and randomness of Cosmos-SDK based blockchains by implementing an on-chain rolling seed system. The module introduces a mechanism whereby a new rolling seed is generated at the beginning of each block, utilizing the block hash as a source of entropy. By integrating this module into a Cosmos-SDK based blockchain, developers can ensure a higher level of security and prevent predictability in critical processes such as block validation, leader selection, cryptographic operations, and on-chain random number generation (RNG).

One of the significant use cases of this module is the on-chain RNG functionality it enables. Random numbers play a crucial role in various applications such as gaming, gambling, and fair distributed systems. By leveraging the on-chain rolling seed system, developers can create a secure and transparent on-chain RNG. The generation of a new rolling seed based on the block hash ensures that the RNG output is unpredictable and tamper-proof. This capability opens up opportunities for provably fair games, random selection of validators or winners, and other use cases where unbiased randomness is essential.

This module will be used in the Oracle and TSS modules in BandChain.

Documentation

Index

Constants

View Source
const ConsensusVersion uint64 = 1

ConsensusVersion defines the current x/rollingseed module consensus version.

Variables

This section is empty.

Functions

func BeginBlocker

func BeginBlocker(ctx sdk.Context, k keeper.Keeper) error

BeginBlocker re-calculates and saves the rolling seed value based on block hashes.

Types

type AppModule

type AppModule struct {
	AppModuleBasic
	// contains filtered or unexported fields
}

AppModule implements the AppModule interface that defines the inter-dependent methods that modules need to implement.

func NewAppModule

func NewAppModule(cdc codec.Codec, k keeper.Keeper) AppModule

NewAppModule creates a new AppModule object.

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx context.Context) error

BeginBlock processes ABCI begin block message for this module (SDK AppModule interface).

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion implements AppModule/ConsensusVersion.

func (AppModule) ExportGenesis

func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.RawMessage

ExportGenesis returns the module's exported genesis state as raw JSON bytes.

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage)

InitGenesis performs genesis initialization for the module.

func (AppModule) IsAppModule

func (am AppModule) IsAppModule()

IsAppModule implements the appmodule.AppModule interface.

func (AppModule) IsOnePerModuleType

func (am AppModule) IsOnePerModuleType()

IsOnePerModuleType implements the depinject.OnePerModuleType interface.

func (AppModule) Name

func (AppModule) Name() string

Name returns the module's name.

type AppModuleBasic

type AppModuleBasic struct {
	// contains filtered or unexported fields
}

AppModuleBasic defines the basic application module used by the rollingseed module.

func NewAppModuleBasic

func NewAppModuleBasic(cdc codec.Codec) AppModuleBasic

NewAppModuleBasic returns a new AppModuleBasic

func (AppModuleBasic) DefaultGenesis

func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage

DefaultGenesis is an empty object.

func (AppModuleBasic) GetTxCmd

func (AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the transaction commands for the module.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the module's name.

func (AppModuleBasic) RegisterGRPCGatewayRoutes

func (AppModuleBasic) RegisterGRPCGatewayRoutes(clientCtx client.Context, mux *runtime.ServeMux)

RegisterGRPCGatewayRoutes registers the gRPC Gateway routes for the module.

func (AppModuleBasic) RegisterInterfaces

func (AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry)

RegisterInterfaces registers the module's interface types

func (AppModuleBasic) RegisterLegacyAminoCodec

func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino)

RegisterLegacyAminoCodec registers the module's types for the given codec.

func (AppModuleBasic) ValidateGenesis

func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error

ValidateGenesis is always successful, as we ignore the value.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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