chain

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	State_Sminer      = "Sminer"
	State_SegmentBook = "SegmentBook"
	State_FileMap     = "FileMap"
	State_FileBank    = "FileBank"
)

Pallert

View Source
const (
	Sminer_MinerItems          = "MinerItems"
	Sminer_MinerDetails        = "MinerDetails"
	SegmentBook_MinerHoldSlice = "MinerHoldSlice"
	SegmentBook_ChallengeMap   = "ChallengeMap"
	FileMap_SchedulerPuk       = "SchedulerPuk"
	FileBank_FillerMap         = "FillerMap"
	FileMap_SchedulerInfo      = "SchedulerMap"
	FileBank_InvalidFile       = "InvalidFile"
	Sminer_MinerLockIn         = "MinerLockIn"
)

Chain state

View Source
const (
	ChainTx_Sminer_Register          = "Sminer.regnstk"
	ChainTx_SegmentBook_IntentSubmit = "SegmentBook.intent_submit"
	ChainTx_Sminer_ExitMining        = "Sminer.exit_miner"
	ChainTx_Sminer_Withdraw          = "Sminer.withdraw"
	ChainTx_Sminer_UpdateIp          = "Sminer.update_ip"
	ChainTx_Sminer_UpdateBeneficiary = "Sminer.update_beneficiary"
	ChainTx_Sminer_Increase          = "Sminer.increase_collateral"
	SegmentBook_SubmitProve          = "SegmentBook.submit_challenge_prove"
	FileBank_ClearInvalidFile        = "FileBank.clear_invalid_file"
	FileBank_ClearFiller             = "FileBank.clear_all_filler"
)

Extrinsics

View Source
const (
	ERR_Failed  = "Failed"
	ERR_Timeout = "Timeout"
	ERR_Empty   = "Empty"
)

Variables

This section is empty.

Functions

func ClearFiller

func ClearFiller(api *gsrpc.SubstrateAPI, signaturePrk string) (int, error)

Clear all filler files

func ClearInvalidFiles

func ClearInvalidFiles(fid FileHash) (string, error)

Clear invalid files

func ExitMining

func ExitMining(api *gsrpc.SubstrateAPI, identifyAccountPhrase, TransactionName string) (string, error)

Storage miner exits the mining function

func Free

func Free()

func GetAccountInfo

func GetAccountInfo(puk []byte) (types.AccountInfo, error)

func GetBlockHeight

func GetBlockHeight(api *gsrpc.SubstrateAPI) (types.U32, error)

Get the current block height

func GetBlockHeightExited

func GetBlockHeightExited(api *gsrpc.SubstrateAPI) (types.U32, error)

Get the block height when the miner exits

func GetGenesisHash

func GetGenesisHash(api *gsrpc.SubstrateAPI) (types.Hash, error)

func GetKeyEvents

func GetKeyEvents() (types.StorageKey, error)

func GetKeyring

func GetKeyring(prk string) (signature.KeyringPair, error)

func GetMetadata

func GetMetadata(api *gsrpc.SubstrateAPI) (*types.Metadata, error)

func GetRpcClient_Safe

func GetRpcClient_Safe(rpcaddr string) (*gsrpc.SubstrateAPI, error)

func GetRuntimeVersion

func GetRuntimeVersion(api *gsrpc.SubstrateAPI) (*types.RuntimeVersion, error)

func GetSelfPublicKey

func GetSelfPublicKey(privatekey string) ([]byte, error)

func Increase

func Increase(api *gsrpc.SubstrateAPI, identifyAccountPhrase, TransactionName string, tokens *big.Int) (string, error)

Storage miners increase deposit function

func NewRpcClient

func NewRpcClient(rpcaddr string) (*gsrpc.SubstrateAPI, error)

func Register

func Register(api *gsrpc.SubstrateAPI, incomeAcc, ip string, port uint16, pledgeTokens uint64) (string, error)

Storage Miner Registration Function

func SubmitProofs

func SubmitProofs(data []ProveInfo) (string, error)

Bulk submission proof

func UpdateAddress

func UpdateAddress(transactionPrK, ip, port string) (string, error)

func UpdateIncome

func UpdateIncome(transactionPrK string, acc types.AccountID) (string, error)

func Withdraw

func Withdraw(api *gsrpc.SubstrateAPI, identifyAccountPhrase, TransactionName string) (string, error)

Storage miner redemption deposit function

Types

type Chain_SchedulerPuk

type Chain_SchedulerPuk struct {
	Spk           [128]types.U8
	Shared_params types.Bytes
	Shared_g      [128]types.U8
}

Scheduling node public key information structure

func GetSchedulerPublicKey

func GetSchedulerPublicKey() (Chain_SchedulerPuk, error)

get public key

type ChallengesInfo

type ChallengesInfo struct {
	File_size  types.U64
	File_type  types.U8
	Block_list types.Bytes
	File_id    FileHash
	Shard_id   FileBlockId
	Random     []types.Bytes
}

Challenge information structure

func GetChallenges

func GetChallenges() ([]ChallengesInfo, error)

Get all challenges

type Event_AlreadyFrozen

type Event_AlreadyFrozen struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_Balances_Withdraw

type Event_Balances_Withdraw struct {
	Phase  types.Phase
	Who    types.AccountID
	Amount types.U128
	Topics []types.Hash
}

type Event_BuyFile

type Event_BuyFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Money  types.U128
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_BuyPackage

type Event_BuyPackage struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Fee    types.U128
	Topics []types.Hash
}

type Event_BuySpace

type Event_BuySpace struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Fee    types.U128
	Topics []types.Hash
}

type Event_ChallengeProof

type Event_ChallengeProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_Claimed

type Event_Claimed struct {
	Phase   types.Phase
	Acc     types.AccountID
	Deposit types.U128
	Topics  []types.Hash
}

type Event_ClearInvalidFile

type Event_ClearInvalidFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_DeleteFile

type Event_DeleteFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid FileHash
	Topics []types.Hash
}

------------------------FileBank-------------------------------

type Event_Deposit

type Event_Deposit struct {
	Phase   types.Phase
	Balance types.U128
	Topics  []types.Hash
}

type Event_DrawFaucetMoney

type Event_DrawFaucetMoney struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_EndOfBufferPeriod

type Event_EndOfBufferPeriod struct {
	Phase  types.Phase
	When   types.U32
	Topics []types.Hash
}

type Event_FaucetTopUpMoney

type Event_FaucetTopUpMoney struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_FileChangeState

type Event_FileChangeState struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_FileUpdate

type Event_FileUpdate struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_FileUpload

type Event_FileUpload struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_FillerUpload

type Event_FillerUpload struct {
	Phase    types.Phase
	Acc      types.AccountID
	Filesize types.U64
	Topics   []types.Hash
}

type Event_IncreaseCollateral

type Event_IncreaseCollateral struct {
	Phase   types.Phase
	Acc     types.AccountID
	Balance types.U128
	Topics  []types.Hash
}

type Event_InsertFileSlice

type Event_InsertFileSlice struct {
	Phase  types.Phase
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_LeaseExpireIn24Hours

type Event_LeaseExpireIn24Hours struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type Event_LeaseExpired

type Event_LeaseExpired struct {
	Phase  types.Phase
	Acc    types.AccountID
	Size   types.U128
	Topics []types.Hash
}

type Event_LessThan24Hours

type Event_LessThan24Hours struct {
	Phase  types.Phase
	Last   types.U32
	Now    types.U32
	Topics []types.Hash
}

type Event_MinerClaim

type Event_MinerClaim struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_MinerExit

type Event_MinerExit struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_OutstandingChallenges

type Event_OutstandingChallenges struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_PPBNoOnTimeSubmit

type Event_PPBNoOnTimeSubmit struct {
	Phase     types.Phase
	Acc       types.AccountID
	SegmentId types.U64
	Topics    []types.Hash
}

------------------------SegmentBook----------------------------

type Event_PPDNoOnTimeSubmit

type Event_PPDNoOnTimeSubmit struct {
	Phase     types.Phase
	Acc       types.AccountID
	SegmentId types.U64
	Topics    []types.Hash
}

type Event_PackageRenewal

type Event_PackageRenewal struct {
	Phase        types.Phase
	Acc          types.AccountID
	Package_type types.U8
	Topics       []types.Hash
}

type Event_PackageUpgrade

type Event_PackageUpgrade struct {
	Phase    types.Phase
	Acc      types.AccountID
	Old_type types.U8
	New_type types.U8
	Topics   []types.Hash
}

type Event_Purchased

type Event_Purchased struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_ReceiveSpace

type Event_ReceiveSpace struct {
	Phase  types.Phase
	Acc    types.AccountID
	Topics []types.Hash
}

type Event_RecoverFile

type Event_RecoverFile struct {
	Phase  types.Phase
	Acc    types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type Event_Redeemed

type Event_Redeemed struct {
	Phase   types.Phase
	Acc     types.AccountID
	Deposit types.U128
	Topics  []types.Hash
}

type Event_Registered

type Event_Registered struct {
	Phase      types.Phase
	Acc        types.AccountID
	StakingVal types.U128
	Topics     []types.Hash
}

------------------------Sminer---------------------------------

type Event_RegistrationScheduler

type Event_RegistrationScheduler struct {
	Phase  types.Phase
	Acc    types.AccountID
	Ip     types.Bytes
	Topics []types.Hash
}

------------------------FileMap--------------------------------

type Event_SignedPhaseStarted

type Event_SignedPhaseStarted struct {
	Phase  types.Phase
	Round  types.U32
	Topics []types.Hash
}

type Event_SolutionStored

type Event_SolutionStored struct {
	Phase            types.Phase
	Election_compute types.ElectionCompute
	Prev_ejected     types.Bool
	Topics           []types.Hash
}

type Event_StartOfBufferPeriod

type Event_StartOfBufferPeriod struct {
	Phase  types.Phase
	When   types.U32
	Topics []types.Hash
}

type Event_TimedTask

type Event_TimedTask struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_TimingStorageSpace

type Event_TimingStorageSpace struct {
	Phase  types.Phase
	Topics []types.Hash
}

type Event_UnsignedPhaseStarted

type Event_UnsignedPhaseStarted struct {
	Phase  types.Phase
	Round  types.U32
	Topics []types.Hash
}

------------------------other system---------------------------

type Event_UpdataBeneficiary

type Event_UpdataBeneficiary struct {
	Phase  types.Phase
	Acc    types.AccountID
	New    types.AccountID
	Topics []types.Hash
}

type Event_UpdataIp

type Event_UpdataIp struct {
	Phase  types.Phase
	Acc    types.AccountID
	Old    Ipv4Type
	New    Ipv4Type
	Topics []types.Hash
}

type Event_UpdateScheduler

type Event_UpdateScheduler struct {
	Phase    types.Phase
	Acc      types.AccountID
	Endpoint types.Bytes
	Topics   []types.Hash
}

type Event_UploadDeclaration

type Event_UploadDeclaration struct {
	Phase     types.Phase
	Acc       types.AccountID
	File_hash types.Bytes
	File_name types.Bytes
	Topics    []types.Hash
}

type Event_VerifyProof

type Event_VerifyProof struct {
	Phase  types.Phase
	Miner  types.AccountID
	Fileid types.Bytes
	Topics []types.Hash
}

type FileBlockId

type FileBlockId [68]types.U8

type FileHash

type FileHash [64]types.U8

func GetInvalidFiles

func GetInvalidFiles() ([]FileHash, error)

Get all invalid files

type IpAddress

type IpAddress struct {
	IPv4 Ipv4Type
	IPv6 Ipv6Type
}

type Ipv4Type

type Ipv4Type struct {
	Index types.U8
	Value [4]types.U8
	Port  types.U16
}

type Ipv4Type_Query

type Ipv4Type_Query struct {
	Placeholder types.U8 //
	Index       types.U8
	Value       [4]types.U8
	Port        types.U16
}

type Ipv6Type

type Ipv6Type struct {
	Index types.U8
	Value [8]types.U16
	Port  types.U16
}

type MinerInfo

type MinerInfo struct {
	PeerId      types.U64
	IncomeAcc   types.AccountID
	Ip          Ipv4Type
	Collaterals types.U128
	State       types.Bytes
	Power       types.U128
	Space       types.U128
	RewardInfo  RewardInfo
}

Storage Miner Information Structure

func GetMinerInfo

func GetMinerInfo(api *gsrpc.SubstrateAPI) (MinerInfo, error)

Get storage miner information

type MyEventRecords

type MyEventRecords struct {
	//system
	types.EventRecords
	//SegmentBook
	SegmentBook_PPBNoOnTimeSubmit     []Event_PPBNoOnTimeSubmit
	SegmentBook_PPDNoOnTimeSubmit     []Event_PPDNoOnTimeSubmit
	SegmentBook_ChallengeProof        []Event_ChallengeProof
	SegmentBook_VerifyProof           []Event_VerifyProof
	SegmentBook_OutstandingChallenges []Event_OutstandingChallenges
	//Sminer
	Sminer_Registered          []Event_Registered
	Sminer_TimedTask           []Event_TimedTask
	Sminer_DrawFaucetMoney     []Event_DrawFaucetMoney
	Sminer_FaucetTopUpMoney    []Event_FaucetTopUpMoney
	Sminer_LessThan24Hours     []Event_LessThan24Hours
	Sminer_AlreadyFrozen       []Event_AlreadyFrozen
	Sminer_MinerExit           []Event_MinerExit
	Sminer_MinerClaim          []Event_MinerClaim
	Sminer_IncreaseCollateral  []Event_IncreaseCollateral
	Sminer_Deposit             []Event_Deposit
	Sminer_Redeemed            []Event_Redeemed
	Sminer_Claimed             []Event_Claimed
	Sminer_TimingStorageSpace  []Event_TimingStorageSpace
	Sminer_UpdataBeneficiary   []Event_UpdataBeneficiary
	Sminer_UpdataIp            []Event_UpdataIp
	Sminer_StartOfBufferPeriod []Event_StartOfBufferPeriod
	Sminer_EndOfBufferPeriod   []Event_EndOfBufferPeriod
	//FileBank
	FileBank_DeleteFile           []Event_DeleteFile
	FileBank_BuySpace             []Event_BuySpace
	FileBank_FileUpload           []Event_FileUpload
	FileBank_FileUpdate           []Event_FileUpdate
	FileBank_LeaseExpireIn24Hours []Event_LeaseExpireIn24Hours
	FileBank_FileChangeState      []Event_FileChangeState
	FileBank_BuyFile              []Event_BuyFile
	FileBank_Purchased            []Event_Purchased
	FileBank_InsertFileSlice      []Event_InsertFileSlice
	FileBank_LeaseExpired         []Event_LeaseExpired
	FileBank_FillerUpload         []Event_FillerUpload
	FileBank_ClearInvalidFile     []Event_ClearInvalidFile
	FileBank_RecoverFile          []Event_RecoverFile
	FileBank_ReceiveSpace         []Event_ReceiveSpace
	FileBank_UploadDeclaration    []Event_UploadDeclaration
	FileBank_BuyPackage           []Event_BuyPackage
	FileBank_PackageUpgrade       []Event_PackageUpgrade
	FileBank_PackageRenewal       []Event_PackageRenewal
	//FileMap
	FileMap_RegistrationScheduler []Event_RegistrationScheduler
	FileMap_UpdateScheduler       []Event_UpdateScheduler
	//other system
	ElectionProviderMultiPhase_UnsignedPhaseStarted []Event_UnsignedPhaseStarted
	ElectionProviderMultiPhase_SignedPhaseStarted   []Event_SignedPhaseStarted
	ElectionProviderMultiPhase_SolutionStored       []Event_SolutionStored
	Balances_Withdraw                               []Event_Balances_Withdraw
}

All event types

type ProveInfo

type ProveInfo struct {
	FileId   FileHash
	MinerAcc types.AccountID
	Cinfo    ChallengesInfo
	Mu       []types.Bytes
	Sigma    types.Bytes
	Name     types.Bytes
	U        []types.Bytes
}

Proof information structure

type RewardInfo

type RewardInfo struct {
	Total       types.U128
	Received    types.U128
	NotReceived types.U128
}

type SchedulerInfo

type SchedulerInfo struct {
	Ip              Ipv4Type
	Stash_user      types.AccountID
	Controller_user types.AccountID
}

Scheduling Node Information Structure

func GetSchedulingNodes

func GetSchedulingNodes() ([]SchedulerInfo, error)

Get all scheduling nodes

Jump to

Keyboard shortcuts

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