storage

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: MIT Imports: 24 Imported by: 0

README

◀ modules

storage

Contents

  1. Jackal Proof-of-Persistence (JPOP)
  2. Interaction Outline
  3. Client

Jackal Proof-of-Persistence (JPOP)

Jackal Storage functions by a Proof-of-Storage algorithm we call Proof-of-Persistence. The Jackal Proof-of-Persistence (JPOP) works through a series of contracts formed between the storage provider and the user. These contracts contain the Merkle Tree root hash of the file and the information required to prove ownership of the file. Miners, or as well call them, Storage Providers, are responsible for posting Merkle Proofs within a challenge window determined by the blockchain. These challenge windows require the miner to post the raw data chunk of data corresponding to the index of the challenge window alongside the required Merkle Hashes to prove the data belongs to the Merkle Root stored on the contract. These challenge indexes are chosen at random by the blockchain using a block-hash-based random number generator paired with a random data oracle.

Internal Detection Of Loss (IDOL) Protocol

If a Storage Provider successfully posts a Merkle Proof within the challenge window for the contract and the data is verified by the Validators to be valid Merkle Proofs for the challenge index, the Storage Provider is paid out. Storage Provider rewards are proportional to the file size the contract is associated with relative to every other active contract on the network. If a Storage Provider fails to provide a valid proof within the allotted timeframe, the contract is struck with a missed proof. After X missed proofs the contract is burned and the User is alerted the next time they query the contract. For every contract burned through missing proofs, the Storage Provider is struck with a penalty that remains on their record for a period of time adjustable through governance. These contracts are then moved to a new list where they are able to be claimed by other providers. This system follows our secondary protocol IDOL (Internal Detection Of Loss), where a contract is claimed by a new provider and downloaded from one of the two online providers storing the same file, thus resuming that contract's proof action, returning redundancy to 3x.

Interaction Outline

A user first sends a file to an available Storage Provider. A list of Storage Providers can be found on the blockchain and miners can deny any incoming request if they wish not to store new files. The Storage Provider, after receiving the entire file, keeps that file in memory and posts a contract to the blockchain. If the contract is not signed by the sender in X blocks (configurable by the Storage Provider), then the file is removed from memory and the contract is burned. However, if the contract is signed by the user within the given blocks, the file is committed to the Storage Provider's hard storage and the challenge windows start being created for the now active contract.

Client

Query

The query commands allow users to query storage state.

canined q storage --help
list-active-deals

The list-active-deals command allows users to view a list of currently active contracts that have already been signed.

canined q storage list-active-deals
show-active-deals

The show-active-deals command allows users to view information about a specific active deal by passing in the contract id.

canined q storage show-active-deals [cid]
list-miners

The list-miners command allows users to view a list of currently registered mining nodes.

canined q storage list-miners
show-miners

The show-miners command allows users to view information about a specific miner by passing in its jackal address.

canined q storage show-miners [address]
list-contracts

The list-contracts command allows users to see a list of currently alive contracts that are awaiting signatures.

canined q storage list-contracts
show-contracts

The show-contracts command allows users to view information about a specific contract as the identifier.

canined q storage show-contracts [cid]
find-file

The find-file command lets a user enter a file id (fid) and return every storage provider currently storing that file.

canined q storage find-file [fid]
freespace

The freespace command returns the free space in bytes of the miner.

canined q storage freespace [miner-address]
get-client-free-space

The get-client-free-space command takes an address and returns the total data they have available to use in bytes.

canined q storage get-client-free-space [address]
list-pay-blocks

The list-pay-blocks command lists all of the payblocks created by users.

canined q storage list-pay-blocks
show-pay-blocks

The show-pay-blocks command shows information about a single pay block.

canined q storage show-pay-blocks [blockid]
list-strays

The list-strays command lists all of stray contracts.

canined q storage list-strays
show-strays

The show-strays command shows information about a single stray contract from a given contract id (cid).

canined q storage show-strays [cid]
params

The params command allows users to view the params of the module.

canined q storage params
storage-payment-info

The storage-payment-info command returns the payment info of the requested address.

canined q storage storage-payment-info [address]
Transactions

The tx commands allow users to interact with the storage module.

canined tx storage --help
init-miner

The init-miner command posts a miner's interface info alongside the total storage offered by the miner.

canined tx storage init-miner [ip-address] [total-size]
set-miner-ip

The set-miner-ip command updates a miner's IP address.

canined tx storage set-miner-ip [ip]
set-miner-totalspace

The set-miner-totalspace command updates a miner's total space available.

canined tx storage set-miner-totalspace [total-space]
sign-contract

The sign-contract command signs a contract by passing in the contract id.

canined tx storage sign-contract [cid]
post-contract

The post-contract command posts a contract to the blockchain from a miner.

canined tx storage post-contract [hashes] [signee] [duration] [filesize] [file-id]
postproof

The postproof command allows storage providers to post a proof claiming they have the file available.

canined tx storage postproof [chunk_data] [proof_data]

buy-storage

The buy-storage command allows users to pay for a specific amount of storage for a specified period of time.

canined tx storage buy-storage [for-address] [duration] [bytes] [payment-denom]

Example:

canined tx storage buy-storage jkl1t3stAcc0unt 720h 6000000000 ujkl
Failed Cases:
  • buy storage while having an active plan
  • buy less than the current usage (SpaceUsed)
  • buy less than a GB
  • buy less than a month
  • pay with anything other than ujkl

cancel-contract

The cancel-contract command allows users to cancel currently active contracts removing the data usage from their account.

canined tx storage cancel-contract [cid]

upgrade-storage

The upgrade-storage command allows users to UPGRADE or DOWNGRADE for more/less storage or more/less duration.

canined tx storage upgrade-storage [for-address] [duration] [bytes] [payment-denom]

Example:

canined tx storage upgrade-storage jkl1t3stAcc0unt 720h 6000000000 ujkl
Failed Cases:
  • downgrading with refund higher than new cost (user will have to wait till current plan expired or upgrade only)
  • upgrading an expired plan
  • downgrade to less gb than the current usage

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginBlocker

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

func ExportGenesis

func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState

ExportGenesis returns the capability module's exported genesis.

func InitGenesis

func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState)

InitGenesis initializes the capability module's state from a provided genesis state.

func NewHandler

func NewHandler(k keeper.Keeper) sdk.Handler

NewHandler ...

Types

type AppModule

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

AppModule implements the AppModule interface for the capability module.

func NewAppModule

func NewAppModule(
	cdc codec.Codec,
	keeper keeper.Keeper,
	accountKeeper types.AccountKeeper,
	bankKeeper types.BankKeeper,
) AppModule

func (AppModule) BeginBlock

func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock)

BeginBlock executes all ABCI BeginBlock logic respective to the capability module.

func (AppModule) ConsensusVersion

func (AppModule) ConsensusVersion() uint64

ConsensusVersion implements ConsensusVersion.

func (AppModule) EndBlock

EndBlock executes all ABCI EndBlock logic respective to the capability module. It returns no validator updates.

func (AppModule) ExportGenesis

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

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

func (AppModule) GenerateGenesisState

func (AppModule) GenerateGenesisState(simState *module.SimulationState)

GenerateGenesisState creates a randomized GenState of the module

func (AppModule) InitGenesis

func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, gs json.RawMessage) []abci.ValidatorUpdate

InitGenesis performs the capability module's genesis initialization It returns no validator updates.

func (AppModule) LegacyQuerierHandler

func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier

LegacyQuerierHandler returns the capability module's Querier.

func (AppModule) Name

func (am AppModule) Name() string

Name returns the capability module's name.

func (AppModule) ProposalContents

ProposalContents doesn't return any content functions for governance proposals

func (AppModule) QuerierRoute

func (AppModule) QuerierRoute() string

QuerierRoute returns the capability module's query routing key.

func (AppModule) RandomizedParams

func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange

RandomizedParams creates randomized param changes for the simulator

func (AppModule) RegisterInvariants

func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry)

RegisterInvariants registers the capability module's invariants.

func (AppModule) RegisterServices

func (am AppModule) RegisterServices(cfg module.Configurator)

RegisterServices registers a GRPC query service to respond to the module-specific GRPC queries.

func (AppModule) RegisterStoreDecoder

func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry)

RegisterStoreDecoder registers a decoder

func (AppModule) Route

func (am AppModule) Route() sdk.Route

Route returns the capability module's message routing key.

func (AppModule) WeightedOperations

func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation

WeightedOperations returns the all the gov module operations with their respective weights.

type AppModuleBasic

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

AppModuleBasic implements the AppModuleBasic interface for the capability module.

func NewAppModuleBasic

func NewAppModuleBasic(cdc codec.BinaryCodec) AppModuleBasic

func (AppModuleBasic) DefaultGenesis

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

DefaultGenesis returns the capability module's default genesis state.

func (AppModuleBasic) GetQueryCmd

func (AppModuleBasic) GetQueryCmd() *cobra.Command

GetQueryCmd returns the capability module's root query command.

func (AppModuleBasic) GetTxCmd

func (a AppModuleBasic) GetTxCmd() *cobra.Command

GetTxCmd returns the capability module's root tx command.

func (AppModuleBasic) Name

func (AppModuleBasic) Name() string

Name returns the capability module's name.

func (AppModuleBasic) RegisterCodec

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

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 (a AppModuleBasic) RegisterInterfaces(reg cdctypes.InterfaceRegistry)

RegisterInterfaces registers the module's interface types

func (AppModuleBasic) RegisterLegacyAminoCodec

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

func (AppModuleBasic) RegisterRESTRoutes

func (AppModuleBasic) RegisterRESTRoutes(clientCtx client.Context, rtr *mux.Router)

RegisterRESTRoutes registers the capability module's REST service handlers.

func (AppModuleBasic) ValidateGenesis

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

ValidateGenesis performs genesis state validation for the capability module.

Directories

Path Synopsis
client
cli
legacy
v2
Package testutil is a generated GoMock package.
Package testutil is a generated GoMock package.
Package types is a reverse proxy.
Package types is a reverse proxy.

Jump to

Keyboard shortcuts

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