Versions in this module Expand all Collapse all v1 v1.0.4 May 2, 2022 v1.0.3 May 2, 2022 v1.0.2 May 2, 2022 Changes in this version + const FAUCETSC_PFX + const FaucetSmartContractAddress + const GET_BALANCE + const GET_BLOCK_INFO + const GET_CHAIN_STATS + const GET_CLIENT + const GET_FAUCETSC_CONFIG + const GET_INTERESTPOOLSC_CONFIG + const GET_LATEST_FINALIZED + const GET_LATEST_FINALIZED_MAGIC_BLOCK + const GET_LOCKED_TOKENS + const GET_LOCK_CONFIG + const GET_MAGIC_BLOCK_INFO + const GET_MINERSC_CONFIG + const GET_MINERSC_EVENTS + const GET_MINERSC_GLOBALS + const GET_MINERSC_MINERS + const GET_MINERSC_NODE + const GET_MINERSC_POOL + const GET_MINERSC_SHARDERS + const GET_MINERSC_USER + const GET_VESTING_CLIENT_POOLS + const GET_VESTING_CONFIG + const GET_VESTING_POOL_INFO + const INTERESTPOOLSC_PFX + const InterestPoolSmartContractAddress + const MINERSC_PFX + const MinerSmartContractAddress + const MultiSigRegisterFuncName + const MultiSigSmartContractAddress + const MultiSigVoteFuncName + const NETWORK_ENDPOINT + const OpGetLockedTokens + const OpGetTokenLockConfig + const OpGetUserPoolDetail + const OpGetUserPools + const OpStorageSCGetAllocation + const OpStorageSCGetAllocations + const OpStorageSCGetBlobber + const OpStorageSCGetBlobbers + const OpStorageSCGetChallengePoolInfo + const OpStorageSCGetConfig + const OpStorageSCGetReadPoolInfo + const OpStorageSCGetStakePoolInfo + const OpStorageSCGetWritePoolInfo + const PUT_TRANSACTION + const REGISTER_CLIENT + const STORAGESC_GET_ALLOCATION + const STORAGESC_GET_ALLOCATIONS + const STORAGESC_GET_BLOBBER + const STORAGESC_GET_BLOBBERS + const STORAGESC_GET_CHALLENGE_POOL_INFO + const STORAGESC_GET_READ_POOL_INFO + const STORAGESC_GET_SC_CONFIG + const STORAGESC_GET_STAKE_POOL_INFO + const STORAGESC_GET_STAKE_POOL_USER_INFO + const STORAGESC_GET_WRITE_POOL_INFO + const STORAGESC_PFX + const StatusAuthError + const StatusAuthTimeout + const StatusAuthVerifyFailed + const StatusError + const StatusInvalidSignature + const StatusNetworkError + const StatusRejectedByUser + const StatusSuccess + const StatusUnknown + const StorageSmartContractAddress + const TOKEN_UNIT + const TXN_VERIFY_URL + const VESTINGSC_PFX + const VestingSmartContractAddress + var Logger logger.Logger + func CheckConfig() error + func CloseLog() + func ConvertTokenToUSD(token float64) (float64, error) + func ConvertUSDToToken(usd float64) (float64, error) + func Decrypt(key, text string) (string, error) + func Encrypt(key, text string) (string, error) + func GetAllocation(allocID string, cb GetInfoCallback) (err error) + func GetAllocations(clientID string, cb GetInfoCallback) (err error) + func GetBalanceFromSharders(clientID string) (int64, string, error) + func GetBalanceWallet(walletStr string, cb models.GetBalanceCallback) error + func GetBlobber(blobberID string, cb GetInfoCallback) (err error) + func GetBlobbers(cb GetInfoCallback) (err error) + func GetBlockByRound(ctx context.Context, numSharders int, round int64) (b *block.Block, err error) + func GetChainStats(ctx context.Context) (b *block.ChainStats, err error) + func GetChallengePoolInfo(allocID string, cb GetInfoCallback) (err error) + func GetConfig() localConfig + func GetEvents(cb GetInfoCallback, filters map[string]string) (err error) + func GetFaucetSCConfig(cb GetInfoCallback) (err error) + func GetIdForUrl(url string) string + func GetInterestPoolSCConfig(cb GetInfoCallback) (err error) + func GetLatestFinalized(ctx context.Context, numSharders int) (b *block.Header, err error) + func GetLatestFinalizedMagicBlock(ctx context.Context, numSharders int) (m *block.MagicBlock, err error) + func GetLockConfig(cb GetInfoCallback) error + func GetLockedTokens(cb GetInfoCallback) error + func GetLogger() *logger.Logger + func GetMagicBlockByNumber(ctx context.Context, numSharders int, number int64) (m *block.MagicBlock, err error) + func GetMinShardersVerify() int + func GetMinerSCConfig(cb GetInfoCallback) (err error) + func GetMinerSCGlobals(cb GetInfoCallback) (err error) + func GetMinerSCNodeInfo(id string, cb GetInfoCallback) (err error) + func GetMinerSCNodePool(id, poolID string, cb GetInfoCallback) (err error) + func GetMinerSCUserInfo(clientID string, cb GetInfoCallback) (err error) + func GetMiners(cb GetInfoCallback) (err error) + func GetNetworkJSON() string + func GetReadPoolInfo(clientID string, cb GetInfoCallback) (err error) + func GetSharders(cb GetInfoCallback) (err error) + func GetStakePoolInfo(blobberID string, cb GetInfoCallback) (err error) + func GetStakePoolUserInfo(clientID string, cb GetInfoCallback) (err error) + func GetStorageSCConfig(cb GetInfoCallback) (err error) + func GetTokenRateByCurrency(currency string) (float64, error) + func GetVestingClientList(clientID string, cb GetInfoCallback) (err error) + func GetVestingPoolInfo(poolID string, cb GetInfoCallback) (err error) + func GetVestingSCConfig(cb GetInfoCallback) (err error) + func GetWallet(walletStr string) (*zcncrypto.Wallet, error) + func GetWalletClientID(walletStr string) (string, error) + func GetWritePoolInfo(clientID string, cb GetInfoCallback) (err error) + func GetZcnUSDInfo(cb GetUSDInfoCallback) error + func Init(chainConfigJSON string) error + func InitZCNSDK(blockWorker string, signscheme string, configs ...func(*ChainConfig) error) error + func RegisterToMiners(wallet *zcncrypto.Wallet, statusCb models.WalletCallback) error + func SetAuthUrl(url string) error + func SetLogFile(logFile string, verbose bool) + func SetNetwork(miners []string, sharders []string) + func SetupAuth(authHost, clientID, clientKey, publicKey, privateKey, localPublicKey string, ...) error + func SplitKeys(privateKey string, numSplits int) (string, error) + func UpdateNetworkDetails() error + func UpdateNetworkDetailsWorker(ctx context.Context) + func UpdateRequired(networkDetails *Network) bool + func VerifyContentHash(metaTxnDataJSON string) (bool, error) + func WithChainID(id string) func(c *ChainConfig) error + func WithConfirmationChainLength(m int) func(c *ChainConfig) error + func WithEthereumNode(uri string) func(c *ChainConfig) error + func WithMinConfirmation(m int) func(c *ChainConfig) error + func WithMinSubmit(m int) func(c *ChainConfig) error + type AuthCallback interface + OnSetupComplete func(status int, err string) + type Blobber struct + BaseURL string + Capacity common.Size + ID common.Key + LastHealthCheck common.Timestamp + StakePoolSettings StakePoolSettings + Terms Terms + Used common.Size + type ChainConfig struct + BlockWorker string + ChainID string + ConfirmationChainLength int + EthNode string + MinConfirmation int + MinSubmit int + Miners []string + Sharders []string + SignatureScheme string + type ConfirmationStatus int + const ChargeableError + const Success + const Undefined + type CreateAllocationRequest struct + DataShards int + Expiration common.Timestamp + MaxChallengeCompletionTime time.Duration + Owner string + OwnerPublicKey string + ParityShards int + PreferredBlobbers []string + ReadPriceRange PriceRange + Size common.Size + WritePriceRange PriceRange + type GetClientResponse struct + CreationDate int + ID string + PublicKey string + Version string + func GetClientDetails(clientID string) (*GetClientResponse, error) + type GetInfoCallback interface + OnInfoAvailable func(op int, status int, info string, err string) + type GetUSDInfoCallback interface + OnUSDInfoAvailable func(status int, info string, err string) + type InputMap struct + Fields map[string]string + type Miner struct + BuildTag string + DelegateWallet string + Host string + ID string + MaxStake int64 + MinStake int64 + N2NHost string + NumberOfDelegates int + Port int + PublicKey string + ServiceCharge float64 + ShortName string + Stat interface{} + TotalStake int + type MinerSCDelegatePool struct + type MinerSCDelegatePoolInfo struct + Balance common.Balance + High common.Balance + ID common.Key + InterestPaid common.Balance + Low common.Balance + RewardPaid common.Balance + Status string + type MinerSCLock struct + ID string + type MinerSCMinerInfo struct + Active map[string]MinerSCDelegatePool + Deleting map[string]MinerSCDelegatePool + Pending map[string]MinerSCDelegatePool + type MinerSCMinerStat struct + BlockReward common.Balance + BlockShardersFee common.Balance + ServiceCharge common.Balance + SharderRewards common.Balance + UsersFee common.Balance + type MinerSCNodes struct + Nodes []Node + type MinerSCPool struct + Balance common.Balance + ID string + type MinerSCPoolStats struct + DelegateID string + High common.Balance + InterestRate float64 + Low common.Balance + NumRounds int64 + TotalPaid common.Balance + type MinerSCUnlock struct + ID string + PoolID string + type MinerSCUserPoolsInfo struct + Pools map[string]map[string][]*MinerSCDelegatePoolInfo + type Network struct + Miners []string + Sharders []string + func GetNetwork() *Network + func GetNetworkDetails() (*Network, error) + type Node struct + Miner Miner + type Params map[string]string + func (p Params) Query() string + type PriceRange struct + Max common.Balance + Min common.Balance + type SendTxnData struct + Note string + type SimpleMinerSCMinerInfo struct + BaseURL string + DelegateWallet string + ID string + MaxStake common.Balance + MinStake common.Balance + NumberOfDelegates int + ServiceCharge float64 + Stat MinerSCMinerStat + type StakePoolSettings struct + DelegateWallet string + MaxStake common.Balance + MinStake common.Balance + NumDelegates int + type Terms struct + ChallengeCompletionTime time.Duration + MaxOfferDuration time.Duration + MinLockDemand float64 + ReadPrice common.Balance + WritePrice common.Balance + type Transaction struct + func NewMSTransaction(walletstr string, cb TransactionCallback) (*Transaction, error) + func (t *Transaction) CancelAllocation(allocID string, fee int64) (err error) + func (t *Transaction) CreateAllocation(car *CreateAllocationRequest, lock, fee int64) (err error) + func (t *Transaction) CreateReadPool(fee int64) (err error) + func (t *Transaction) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error + func (t *Transaction) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error + func (t *Transaction) FaucetUpdateConfig(ip *InputMap) (err error) + func (t *Transaction) FinalizeAllocation(allocID string, fee int64) (err error) + func (t *Transaction) GetTransactionError() string + func (t *Transaction) GetTransactionHash() string + func (t *Transaction) GetVerifyConfirmationStatus() ConfirmationStatus + func (t *Transaction) GetVerifyError() string + func (t *Transaction) GetVerifyOutput() string + func (t *Transaction) InterestPoolUpdateConfig(ip *InputMap) (err error) + func (t *Transaction) LockTokens(val int64, durationHr int64, durationMin int) error + func (t *Transaction) MienrSCUnlock(nodeID, poolID string) (err error) + func (t *Transaction) MinerSCDeleteMiner(info *MinerSCMinerInfo) (err error) + func (t *Transaction) MinerSCDeleteSharder(info *MinerSCMinerInfo) (err error) + func (t *Transaction) MinerSCLock(nodeID string, lock int64) (err error) + func (t *Transaction) MinerSCMinerSettings(info *MinerSCMinerInfo) (err error) + func (t *Transaction) MinerSCSharderSettings(info *MinerSCMinerInfo) (err error) + func (t *Transaction) MinerScUpdateConfig(ip *InputMap) (err error) + func (t *Transaction) MinerScUpdateGlobals(ip *InputMap) (err error) + func (t *Transaction) Output() []byte + func (t *Transaction) ReadPoolLock(allocID, blobberID string, duration int64, lock, fee int64) (err error) + func (t *Transaction) ReadPoolUnlock(poolID string, fee int64) (err error) + func (t *Transaction) RegisterMultiSig(walletstr string, mswallet string) error + func (t *Transaction) RegisterVote(signerwalletstr string, msvstr string) error + func (t *Transaction) Send(toClientID string, val int64, desc string) error + func (t *Transaction) SendWithSignatureHash(toClientID string, val int64, desc string, sig string, CreationDate int64, ...) error + func (t *Transaction) SetTransactionCallback(cb TransactionCallback) error + func (t *Transaction) SetTransactionFee(txnFee int64) error + func (t *Transaction) SetTransactionHash(hash string) error + func (t *Transaction) StakePoolLock(blobberID string, lock, fee int64) (err error) + func (t *Transaction) StakePoolUnlock(blobberID, poolID string, fee int64) (err error) + func (t *Transaction) StorageScUpdateConfig(ip *InputMap) (err error) + func (t *Transaction) StoreData(data string) error + func (t *Transaction) UnlockTokens(poolID string) error + func (t *Transaction) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock, fee int64) (err error) + func (t *Transaction) UpdateBlobberSettings(b *Blobber, fee int64) (err error) + func (t *Transaction) Verify() error + func (t *Transaction) VestingAdd(ar *VestingAddRequest, value int64) (err error) + func (t *Transaction) VestingDelete(poolID string) (err error) + func (t *Transaction) VestingStop(sr *VestingStopRequest) (err error) + func (t *Transaction) VestingTrigger(poolID string) (err error) + func (t *Transaction) VestingUnlock(poolID string) (err error) + func (t *Transaction) VestingUpdateConfig(vscc *InputMap) (err error) + func (t *Transaction) WritePoolLock(allocID, blobberID string, duration int64, lock, fee int64) (err error) + func (t *Transaction) WritePoolUnlock(poolID string, fee int64) (err error) + type TransactionCallback interface + OnAuthComplete func(t *Transaction, status int) + OnTransactionComplete func(t *Transaction, status int) + OnVerifyComplete func(t *Transaction, status int) + type TransactionScheme interface + CancelAllocation func(allocID string, fee int64) error + CreateAllocation func(car *CreateAllocationRequest, lock, fee int64) error + CreateReadPool func(fee int64) error + ExecuteFaucetSCWallet func(walletStr string, methodName string, input []byte) error + ExecuteSmartContract func(address, methodName, jsoninput string, val int64) error + FaucetUpdateConfig func(*InputMap) error + FinalizeAllocation func(allocID string, fee int64) error + GetTransactionError func() string + GetTransactionHash func() string + GetVerifyConfirmationStatus func() ConfirmationStatus + GetVerifyError func() string + GetVerifyOutput func() string + InterestPoolUpdateConfig func(*InputMap) error + LockTokens func(val int64, durationHr int64, durationMin int) error + MienrSCUnlock func(minerID, poolID string) error + MinerSCDeleteMiner func(*MinerSCMinerInfo) error + MinerSCDeleteSharder func(*MinerSCMinerInfo) error + MinerSCLock func(minerID string, lock int64) error + MinerSCMinerSettings func(*MinerSCMinerInfo) error + MinerSCSharderSettings func(*MinerSCMinerInfo) error + MinerScUpdateConfig func(*InputMap) error + MinerScUpdateGlobals func(*InputMap) error + Output func() []byte + ReadPoolLock func(allocID string, blobberID string, duration int64, lock, fee int64) error + ReadPoolUnlock func(poolID string, fee int64) error + RegisterMultiSig func(walletstr, mswallet string) error + Send func(toClientID string, val int64, desc string) error + SetTransactionCallback func(cb TransactionCallback) error + SetTransactionFee func(txnFee int64) error + SetTransactionHash func(hash string) error + StakePoolLock func(blobberID string, lock, fee int64) error + StakePoolUnlock func(blobberID string, poolID string, fee int64) error + StorageScUpdateConfig func(*InputMap) error + StoreData func(data string) error + UnlockTokens func(poolID string) error + UpdateAllocation func(allocID string, sizeDiff int64, expirationDiff int64, lock, fee int64) error + UpdateBlobberSettings func(blobber *Blobber, fee int64) error + Verify func() error + VestingAdd func(ar *VestingAddRequest, value int64) error + VestingDelete func(poolID string) error + VestingStop func(sr *VestingStopRequest) error + VestingTrigger func(poolID string) error + VestingUnlock func(poolID string) error + VestingUpdateConfig func(*InputMap) error + WritePoolLock func(allocID string, blobberID string, duration int64, lock, fee int64) error + WritePoolUnlock func(poolID string, fee int64) error + func NewTransaction(cb TransactionCallback, txnFee int64) (TransactionScheme, error) + type TransactionWithAuth struct + func (ta *TransactionWithAuth) CancelAllocation(allocID string, fee int64) (err error) + func (ta *TransactionWithAuth) CreateAllocation(car *CreateAllocationRequest, lock, fee int64) (err error) + func (ta *TransactionWithAuth) CreateReadPool(fee int64) (err error) + func (ta *TransactionWithAuth) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error + func (ta *TransactionWithAuth) ExecuteSmartContract(address, methodName, jsoninput string, val int64) error + func (ta *TransactionWithAuth) FaucetUpdateConfig(ip *InputMap) (err error) + func (ta *TransactionWithAuth) FinalizeAllocation(allocID string, fee int64) (err error) + func (ta *TransactionWithAuth) GetTransactionError() string + func (ta *TransactionWithAuth) GetTransactionHash() string + func (ta *TransactionWithAuth) GetVerifyConfirmationStatus() ConfirmationStatus + func (ta *TransactionWithAuth) GetVerifyError() string + func (ta *TransactionWithAuth) GetVerifyOutput() string + func (ta *TransactionWithAuth) InterestPoolUpdateConfig(ip *InputMap) (err error) + func (ta *TransactionWithAuth) LockTokens(val int64, durationHr int64, durationMin int) error + func (ta *TransactionWithAuth) MienrSCUnlock(nodeID, poolID string) (err error) + func (ta *TransactionWithAuth) MinerSCDeleteMiner(info *MinerSCMinerInfo) (err error) + func (ta *TransactionWithAuth) MinerSCDeleteSharder(info *MinerSCMinerInfo) (err error) + func (ta *TransactionWithAuth) MinerSCLock(minerID string, lock int64) (err error) + func (ta *TransactionWithAuth) MinerSCMinerSettings(info *MinerSCMinerInfo) (err error) + func (ta *TransactionWithAuth) MinerSCSharderSettings(info *MinerSCMinerInfo) (err error) + func (ta *TransactionWithAuth) MinerScUpdateConfig(ip *InputMap) (err error) + func (ta *TransactionWithAuth) MinerScUpdateGlobals(ip *InputMap) (err error) + func (ta *TransactionWithAuth) Output() []byte + func (ta *TransactionWithAuth) ReadPoolLock(allocID, blobberID string, duration int64, lock, fee int64) (err error) + func (ta *TransactionWithAuth) ReadPoolUnlock(poolID string, fee int64) (err error) + func (ta *TransactionWithAuth) RegisterMultiSig(walletstr string, mswallet string) error + func (ta *TransactionWithAuth) Send(toClientID string, val int64, desc string) error + func (ta *TransactionWithAuth) SetTransactionCallback(cb TransactionCallback) error + func (ta *TransactionWithAuth) SetTransactionFee(txnFee int64) error + func (ta *TransactionWithAuth) SetTransactionHash(hash string) error + func (ta *TransactionWithAuth) StakePoolLock(blobberID string, lock, fee int64) (err error) + func (ta *TransactionWithAuth) StakePoolUnlock(blobberID, poolID string, fee int64) (err error) + func (ta *TransactionWithAuth) StorageScUpdateConfig(ip *InputMap) (err error) + func (ta *TransactionWithAuth) StoreData(data string) error + func (ta *TransactionWithAuth) UnlockTokens(poolID string) error + func (ta *TransactionWithAuth) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock, fee int64) (err error) + func (ta *TransactionWithAuth) UpdateBlobberSettings(blob *Blobber, fee int64) (err error) + func (ta *TransactionWithAuth) Verify() error + func (ta *TransactionWithAuth) VestingAdd(ar *VestingAddRequest, value int64) (err error) + func (ta *TransactionWithAuth) VestingDelete(poolID string) (err error) + func (ta *TransactionWithAuth) VestingStop(sr *VestingStopRequest) (err error) + func (ta *TransactionWithAuth) VestingTrigger(poolID string) (err error) + func (ta *TransactionWithAuth) VestingUnlock(poolID string) (err error) + func (ta *TransactionWithAuth) VestingUpdateConfig(ip *InputMap) (err error) + func (ta *TransactionWithAuth) WritePoolLock(allocID, blobberID string, duration int64, lock, fee int64) (err error) + func (ta *TransactionWithAuth) WritePoolUnlock(poolID string, fee int64) (err error) + type VestingAddRequest struct + Description string + Destinations []*VestingDest + Duration time.Duration + StartTime common.Timestamp + type VestingClientList struct + Pools []common.Key + type VestingDest struct + Amount common.Balance + ID common.Key + type VestingDestInfo struct + Earned common.Balance + ID common.Key + Last common.Timestamp + Vested common.Balance + Wanted common.Balance + type VestingPoolInfo struct + Balance common.Balance + ClientID common.Key + Description string + Destinations []*VestingDestInfo + ExpireAt common.Timestamp + ID common.Key + Left common.Balance + StartTime common.Timestamp + type VestingSCConfig struct + MaxDescriptionLength int + MaxDestinations int + MaxDuration time.Duration + MinDuration time.Duration + MinLock common.Balance + type VestingStopRequest struct + Destination common.Key + PoolID common.Key