Documentation ¶
Overview ¶
Contains sub-packages and modules for managing users' wallets and issuing transactions.
Index ¶
- Constants
- Variables
- func CallZauthDelete(serverAddr, token, clientID string) error
- func CallZauthRevoke(serverAddr, token, clientID, publicKey string) error
- func CallZauthSetup(serverAddr string, token string, splitWallet SplitWallet) error
- func CallZvaultDeletePrimaryKey(serverAddr, token, clientID string) error
- func CallZvaultNewWalletString(serverAddr, token, clientID string) (string, error)
- func CallZvaultRetrieveKeys(serverAddr, token, clientID string) (string, error)
- func CallZvaultRetrieveSharedWallets(serverAddr, token string) (string, error)
- func CallZvaultRetrieveWallets(serverAddr, token string) (string, error)
- func CallZvaultRevokeKey(serverAddr, token, clientID, publicKey string) error
- func CallZvaultStoreKeyString(serverAddr, token, privateKey string) (string, error)
- func CheckConfig() error
- func CheckEthHashStatus(hash string) int
- func CloseLog()
- func ConvertToToken(token int64) float64
- func ConvertToValue(token float64) uint64
- func ConvertTokenToUSD(token float64) (float64, error)
- func ConvertUSDToToken(usd float64) (float64, error)
- func ConvertZcnTokenToETH(f float64) (float64, error)
- func CreateMSVote(proposal, grpClientID, signerWalletstr, toClientID string, token uint64) (string, error)
- func CreateMSWallet(t, n int) (string, string, []string, error)
- func CreateWalletFromEthMnemonic(mnemonic, password string, statusCb WalletCallback) error
- func CreateWalletOffline() (string, error)
- func CryptoJsDecrypt(passphrase, encryptedMessage string) (string, error)
- func CryptoJsEncrypt(passphrase, message string) (string, error)
- func Decrypt(key, text string) (string, error)
- func Encrypt(key, text string) (string, error)
- func EthToTokens(tokens float64) int64
- func GEthToTokens(gwei float64) int64
- func GTokensToEth(tokens int64) float64
- func GetAllocation(allocID string, cb GetInfoCallback) (err error)
- func GetAllocations(clientID string, cb GetInfoCallback) (err error)
- func GetAuthorizer(authorizerID string, cb GetInfoCallback) (err error)
- func GetAuthorizerSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetBalance(cb GetBalanceCallback) error
- func GetBalanceWallet(walletStr string, cb GetBalanceCallback) error
- func GetBlobber(blobberID string, cb GetInfoCallback) (err error)
- func GetBlobberSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetBlobbers(cb GetInfoCallback, limit, offset int, active bool)
- 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 GetClientID(pkey string) string
- func GetClientWalletID() string
- func GetClientWalletKey() string
- func GetEthBalance(ethAddr string, cb GetBalanceCallback) error
- func GetEthClient() (*ethclient.Client, error)
- func GetEvents(cb GetInfoCallback, filters map[string]string) (err error)
- func GetFaucetSCConfig(cb GetInfoCallback) (err error)
- func GetFeeStats(ctx context.Context) (b *block.FeeStats, err error)
- func GetHardForkRound(hardFork string) (int64, error)
- func GetIdForUrl(url string) string
- func GetInfoFromAnyMiner(urlSuffix string, op int, cb getInfoCallback)
- func GetInfoFromAnySharder(urlSuffix string, op int, cb GetInfoCallback)
- func GetInfoFromSharders(urlSuffix string, op int, cb GetInfoCallback)
- 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 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 string, cb GetInfoCallback) (err error)
- func GetMinerSCUserInfo(clientID string, cb GetInfoCallback) (err error)
- func GetMinerSharder(id string, cb GetInfoCallback) (err error)
- func GetMinerSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetMiners(cb GetInfoCallback, limit, offset int, active bool, stakable bool)
- func GetMintNonce(cb GetInfoCallback) error
- func GetMultisigPayload(mswstr string) (interface{}, error)
- func GetMultisigVotePayload(msvstr string) (interface{}, error)
- func GetNetworkJSON() string
- func GetNonce(cb GetNonceCallback) error
- func GetNotProcessedZCNBurnTickets(ethereumAddress, startNonce string, cb GetInfoCallback) error
- func GetPublicEncryptionKey(mnemonic string) (string, error)
- func GetReadPoolInfo(clientID string, cb GetInfoCallback) (err error)
- func GetRoundFromSharders() (int64, error)
- func GetSharderSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetSharders(cb GetInfoCallback, limit, offset int, active, stakable bool)
- func GetSnapshots(round int64, limit int64, cb GetInfoCallback) (err error)
- func GetStableMiners() []string
- func GetStakableBlobbers(cb GetInfoCallback, limit, offset int, active bool)
- func GetStakePoolInfo(blobberID string, cb GetInfoCallback) (err error)
- func GetStakePoolUserInfo(clientID string, offset, limit int, cb GetInfoCallback) (err error)
- func GetStorageSCConfig(cb GetInfoCallback) (err error)
- func GetTransactions(toClient, fromClient, block_hash, sort string, limit, offset int, ...) (err error)
- func GetUserLockedTotal(clientID string) (int64, error)
- func GetUserSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetValidator(validatorID string, cb GetInfoCallback) (err error)
- func GetValidatorSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
- func GetVersion() string
- 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 GetWalletAddrFromEthMnemonic(mnemonic string) (string, error)
- func GetWalletBalance(clientId string) (common.Balance, int64, error)
- func GetWalletClientID(walletStr string) (string, error)
- func GetWalletNonce(clientID string) (int64, error)
- func GetWalletRaw() zcncrypto.Wallet
- func GetZcnUSDInfo() (float64, error)
- func Init(chainConfigJSON string) error
- func InitSignatureScheme(scheme string)
- func InitZCNSDK(blockWorker string, signscheme string, configs ...func(*ChainConfig) error) error
- func IsEthTransactionVerified(txHash string) (bool, error)
- func IsMnemonicValid(mnemonic string) bool
- func IsSplitWallet() bool
- func IsValidEthAddress(ethAddr string) (bool, error)
- func RecoverOfflineWallet(mnemonic string) (string, error)
- func RecoverWallet(mnemonic string, statusCb WalletCallback) error
- func ResetStableMiners()
- func SetAuthUrl(url string) error
- func SetLogFile(logFile string, verbose bool)
- func SetLogLevel(lvl int)
- func SetNetwork(miners []string, sharders []string)
- func SetWallet(w zcncrypto.Wallet, splitKeyWallet bool) error
- func SetWalletInfo(jsonWallet string, splitKeyWallet bool) error
- func SetupAuth(authHost, clientID, clientKey, publicKey, privateKey, localPublicKey string, ...) error
- func Sign(hash string) (string, error)
- func SignWith0Wallet(hash string, w *zcncrypto.Wallet) (string, error)
- func SignWithKey(privateKey, hash string) (string, error)
- func SplitKeys(privateKey string, numSplits int) (string, error)
- func SplitKeysWallet(privateKey string, numSplits int) (*zcncrypto.Wallet, error)
- func SuggestEthGasPrice() (int64, error)
- func TokensToEth(tokens int64) float64
- func TransferEthTokens(fromPrivKey string, amountTokens, gasPrice int64) (string, error)
- func UpdateNetworkDetails() error
- func UpdateRequired(networkDetails *Network) bool
- func VerifyContentHash(metaTxnDataJSON string) (bool, error)
- func VerifyWithKey(pubKey, signature, hash 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 WithIsSplitWallet(v bool) func(c *ChainConfig) error
- func WithMinConfirmation(m int) func(c *ChainConfig) error
- func WithMinSubmit(m int) func(c *ChainConfig) error
- func WithParams(uri string, params Params) string
- func WithSharderConsensous(m int) func(c *ChainConfig) error
- func ZauthAuthCommon(serverAddr string) sys.AuthorizeFunc
- func ZauthSignMsg(serverAddr string) sys.SignFunc
- func ZauthSignTxn(serverAddr string) sys.AuthorizeFunc
- type AddAuthorizerPayload
- type AuthCallback
- type AuthMessage
- type AuthResponse
- type AuthorizerConfig
- type AuthorizerHealthCheckPayload
- type AuthorizerNode
- type AuthorizerStakePoolSettings
- type Blobber
- type BurnTicket
- type ChainConfig
- type CommitMetaData
- type CommitMetaResponse
- type ConfirmationStatus
- type ConsolidatedFileMeta
- type CreateAllocationRequest
- type DelegatePool
- type DeleteAuthorizerPayload
- type FeeOption
- type GetBalanceCallback
- type GetClientResponse
- type GetInfoCallback
- type GetNonceCallback
- type GetNonceCallbackStub
- type InputMap
- type MSTransfer
- type MSVote
- type MSVoteCallback
- type MSWallet
- type Miner
- type MinerSCDelegatePool
- type MinerSCDelegatePoolInfo
- type MinerSCLock
- type MinerSCMinerInfo
- type MinerSCNodes
- type MinerSCUnlock
- type MinerSCUserPoolsInfo
- type MultisigSCWallet
- type Network
- type Node
- type NonceCache
- type Params
- type PriceRange
- type Provider
- type QueryResult
- type QueryResultHandle
- type SendTxnData
- type SimpleMiner
- type SplitWallet
- type StakePool
- type StakePoolSettings
- type Terms
- type Transaction
- func (t *Transaction) AddHardfork(ip *InputMap) (err error)
- func (t *Transaction) CancelAllocation(allocID string) (err error)
- func (t *Transaction) CreateAllocation(car *CreateAllocationRequest, lock uint64) (err error)
- func (t *Transaction) CreateReadPool() (err error)
- func (t *Transaction) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
- func (t *Transaction) ExecuteSmartContract(address, methodName string, input interface{}, val uint64, opts ...FeeOption) (*transaction.Transaction, error)
- func (t *Transaction) FaucetUpdateConfig(ip *InputMap) (err error)
- func (t *Transaction) FinalizeAllocation(allocID string) (err error)
- func (t *Transaction) GetTransactionError() string
- func (t *Transaction) GetTransactionHash() string
- func (t *Transaction) GetTransactionNonce() int64
- func (t *Transaction) GetVerifyConfirmationStatus() ConfirmationStatus
- func (t *Transaction) GetVerifyError() string
- func (t *Transaction) GetVerifyOutput() string
- func (t *Transaction) Hash() string
- func (t *Transaction) MinerSCCollectReward(providerId string, providerType Provider) error
- func (t *Transaction) MinerSCDeleteMiner(info *MinerSCMinerInfo) (err error)
- func (t *Transaction) MinerSCDeleteSharder(info *MinerSCMinerInfo) (err error)
- func (t *Transaction) MinerSCKill(providerId string, providerType Provider) error
- func (t *Transaction) MinerSCLock(providerId string, providerType Provider, lock uint64) error
- func (t *Transaction) MinerSCMinerSettings(info *MinerSCMinerInfo) (err error)
- func (t *Transaction) MinerSCSharderSettings(info *MinerSCMinerInfo) (err error)
- func (t *Transaction) MinerSCUnlock(providerId string, providerType Provider) 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 uint64) (err error)
- func (t *Transaction) ReadPoolUnlock() (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 uint64, desc string) error
- func (t *Transaction) SendWithSignatureHash(toClientID string, val uint64, desc string, sig string, CreationDate int64, ...) error
- func (t *Transaction) SetTransactionCallback(cb TransactionCallback) error
- func (t *Transaction) SetTransactionHash(hash string) error
- func (t *Transaction) SetTransactionNonce(txnNonce int64) error
- func (t *Transaction) StakePoolLock(providerId string, providerType Provider, lock uint64) error
- func (t *Transaction) StakePoolUnlock(providerId string, providerType Provider) error
- func (t *Transaction) StorageSCCollectReward(providerId string, providerType Provider) error
- func (t *Transaction) StorageScUpdateConfig(ip *InputMap) (err error)
- func (t *Transaction) StoreData(data string) error
- func (t *Transaction) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock uint64) (err error)
- func (t *Transaction) UpdateBlobberSettings(b *Blobber) (err error)
- func (t *Transaction) UpdateValidatorSettings(v *Validator) (err error)
- func (t *Transaction) Verify() error
- func (t *Transaction) VestingAdd(ar *VestingAddRequest, value uint64) (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 uint64) (err error)
- func (t *Transaction) WritePoolUnlock(allocID string) (err error)
- func (t *Transaction) ZCNSCAddAuthorizer(ip *AddAuthorizerPayload) (err error)
- func (t *Transaction) ZCNSCAuthorizerHealthCheck(ip *AuthorizerHealthCheckPayload) (err error)
- func (t *Transaction) ZCNSCCollectReward(providerId string, providerType Provider) error
- func (t *Transaction) ZCNSCDeleteAuthorizer(ip *DeleteAuthorizerPayload) (err error)
- func (t *Transaction) ZCNSCUpdateAuthorizerConfig(ip *AuthorizerNode) (err error)
- func (t *Transaction) ZCNSCUpdateGlobalConfig(ip *InputMap) (err error)
- type TransactionCallback
- type TransactionCommon
- type TransactionQuery
- func (tq *TransactionQuery) FromAll(ctx context.Context, query string, handle QueryResultHandle) error
- func (tq *TransactionQuery) FromAny(ctx context.Context, query string, provider Provider) (QueryResult, error)
- func (tq *TransactionQuery) GetInfo(ctx context.Context, query string) (*QueryResult, error)
- func (tq *TransactionQuery) Reset()
- type TransactionScheme
- type TransactionVelocity
- type TransactionWithAuth
- func (t *TransactionWithAuth) AddHardfork(ip *InputMap) (err error)
- func (ta *TransactionWithAuth) CancelAllocation(allocID string) (err error)
- func (ta *TransactionWithAuth) CreateAllocation(car *CreateAllocationRequest, lock uint64) (err error)
- func (ta *TransactionWithAuth) CreateReadPool() (err error)
- func (ta *TransactionWithAuth) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
- func (ta *TransactionWithAuth) ExecuteSmartContract(address, methodName string, input interface{}, val uint64, ...) (*transaction.Transaction, error)
- func (ta *TransactionWithAuth) FaucetUpdateConfig(ip *InputMap) (err error)
- func (ta *TransactionWithAuth) FinalizeAllocation(allocID string) (err error)
- func (ta *TransactionWithAuth) GetTransactionError() string
- func (ta *TransactionWithAuth) GetTransactionHash() string
- func (ta *TransactionWithAuth) GetTransactionNonce() int64
- func (ta *TransactionWithAuth) GetVerifyConfirmationStatus() ConfirmationStatus
- func (ta *TransactionWithAuth) GetVerifyError() string
- func (ta *TransactionWithAuth) GetVerifyOutput() string
- func (ta *TransactionWithAuth) Hash() string
- func (ta *TransactionWithAuth) MinerSCCollectReward(providerId string, providerType Provider) error
- func (ta *TransactionWithAuth) MinerSCDeleteMiner(info *MinerSCMinerInfo) (err error)
- func (ta *TransactionWithAuth) MinerSCDeleteSharder(info *MinerSCMinerInfo) (err error)
- func (ta *TransactionWithAuth) MinerSCKill(providerId string, providerType Provider) error
- func (ta *TransactionWithAuth) MinerSCLock(providerId string, providerType Provider, lock uint64) error
- func (ta *TransactionWithAuth) MinerSCMinerSettings(info *MinerSCMinerInfo) (err error)
- func (ta *TransactionWithAuth) MinerSCSharderSettings(info *MinerSCMinerInfo) (err error)
- func (ta *TransactionWithAuth) MinerSCUnlock(providerId string, providerType Provider) 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 uint64) (err error)
- func (ta *TransactionWithAuth) ReadPoolUnlock() (err error)
- func (ta *TransactionWithAuth) RegisterMultiSig(walletstr string, mswallet string) error
- func (ta *TransactionWithAuth) Send(toClientID string, val uint64, desc string) error
- func (ta *TransactionWithAuth) SetTransactionCallback(cb TransactionCallback) error
- func (ta *TransactionWithAuth) SetTransactionHash(hash string) error
- func (ta *TransactionWithAuth) SetTransactionNonce(txnNonce int64) error
- func (ta *TransactionWithAuth) StakePoolLock(providerId string, providerType Provider, lock uint64) error
- func (ta *TransactionWithAuth) StakePoolUnlock(providerId string, providerType Provider) error
- func (ta *TransactionWithAuth) StorageSCCollectReward(providerId string, providerType Provider) error
- func (ta *TransactionWithAuth) StorageScUpdateConfig(ip *InputMap) (err error)
- func (ta *TransactionWithAuth) StoreData(data string) error
- func (ta *TransactionWithAuth) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock uint64) (err error)
- func (ta *TransactionWithAuth) UpdateBlobberSettings(blob *Blobber) (err error)
- func (ta *TransactionWithAuth) UpdateValidatorSettings(v *Validator) (err error)
- func (ta *TransactionWithAuth) Verify() error
- func (ta *TransactionWithAuth) VestingAdd(ar *VestingAddRequest, value uint64) (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 uint64) (err error)
- func (ta *TransactionWithAuth) WritePoolUnlock(allocID string) (err error)
- func (ta *TransactionWithAuth) ZCNSCAddAuthorizer(ip *AddAuthorizerPayload) (err error)
- func (ta *TransactionWithAuth) ZCNSCAuthorizerHealthCheck(ip *AuthorizerHealthCheckPayload) (err error)
- func (ta *TransactionWithAuth) ZCNSCCollectReward(providerId string, providerType Provider) error
- func (ta *TransactionWithAuth) ZCNSCDeleteAuthorizer(ip *DeleteAuthorizerPayload) (err error)
- func (ta *TransactionWithAuth) ZCNSCUpdateAuthorizerConfig(ip *AuthorizerNode) (err error)
- func (ta *TransactionWithAuth) ZCNSCUpdateGlobalConfig(ip *InputMap) (err error)
- type TxnFeeOption
- type Validator
- type VestingAddRequest
- type VestingClientList
- type VestingDest
- type VestingDestInfo
- type VestingPoolInfo
- type VestingSCConfig
- type VestingStopRequest
- type WalletCallback
Constants ¶
const ( GET_CLIENT = `/v1/client/get` PUT_TRANSACTION = `/v1/transaction/put` TXN_VERIFY_URL = `/v1/transaction/get/confirmation?hash=` GET_BLOCK_INFO = `/v1/block/get?` GET_MAGIC_BLOCK_INFO = `/v1/block/magic/get?` GET_LATEST_FINALIZED = `/v1/block/get/latest_finalized` GET_LATEST_FINALIZED_MAGIC_BLOCK = `/v1/block/get/latest_finalized_magic_block` GET_FEE_STATS = `/v1/block/get/fee_stats` GET_CHAIN_STATS = `/v1/chain/get/stats` VESTINGSC_PFX = `/v1/screst/` + VestingSmartContractAddress GET_VESTING_CONFIG = VESTINGSC_PFX + `/vesting-config` GET_VESTING_POOL_INFO = VESTINGSC_PFX + `/getPoolInfo` GET_VESTING_CLIENT_POOLS = VESTINGSC_PFX + `/getClientPools` FAUCETSC_PFX = `/v1/screst/` + FaucetSmartContractAddress GET_FAUCETSC_CONFIG = FAUCETSC_PFX + `/faucet-config` // zcn sc ZCNSC_PFX = `/v1/screst/` + ZCNSCSmartContractAddress GET_MINT_NONCE = ZCNSC_PFX + `/v1/mint_nonce` GET_NOT_PROCESSED_BURN_TICKETS = ZCNSC_PFX + `/v1/not_processed_burn_tickets` GET_AUTHORIZER = ZCNSC_PFX + `/getAuthorizer` MINERSC_PFX = `/v1/screst/` + MinerSmartContractAddress GET_MINERSC_NODE = MINERSC_PFX + "/nodeStat" GET_MINERSC_POOL = MINERSC_PFX + "/nodePoolStat" GET_MINERSC_CONFIG = MINERSC_PFX + "/configs" GET_MINERSC_GLOBALS = MINERSC_PFX + "/globalSettings" GET_MINERSC_USER = MINERSC_PFX + "/getUserPools" GET_MINERSC_MINERS = MINERSC_PFX + "/getMinerList" GET_MINERSC_SHARDERS = MINERSC_PFX + "/getSharderList" GET_MINERSC_EVENTS = MINERSC_PFX + "/getEvents" STORAGESC_PFX = "/v1/screst/" + StorageSmartContractAddress STORAGESC_GET_SC_CONFIG = STORAGESC_PFX + "/storage-config" STORAGESC_GET_CHALLENGE_POOL_INFO = STORAGESC_PFX + "/getChallengePoolStat" STORAGESC_GET_ALLOCATION = STORAGESC_PFX + "/allocation" STORAGESC_GET_ALLOCATIONS = STORAGESC_PFX + "/allocations" STORAGESC_GET_READ_POOL_INFO = STORAGESC_PFX + "/getReadPoolStat" STORAGESC_GET_STAKE_POOL_INFO = STORAGESC_PFX + "/getStakePoolStat" STORAGESC_GET_STAKE_POOL_USER_INFO = STORAGESC_PFX + "/getUserStakePoolStat" STORAGESC_GET_USER_LOCKED_TOTAL = STORAGESC_PFX + "/getUserLockedTotal" STORAGESC_GET_BLOBBERS = STORAGESC_PFX + "/getblobbers" STORAGESC_GET_BLOBBER = STORAGESC_PFX + "/getBlobber" STORAGESC_GET_VALIDATOR = STORAGESC_PFX + "/get_validator" STORAGESC_GET_TRANSACTIONS = STORAGESC_PFX + "/transactions" STORAGE_GET_SNAPSHOT = STORAGESC_PFX + "/replicate-snapshots" STORAGE_GET_BLOBBER_SNAPSHOT = STORAGESC_PFX + "/replicate-blobber-aggregates" STORAGE_GET_MINER_SNAPSHOT = STORAGESC_PFX + "/replicate-miner-aggregates" STORAGE_GET_SHARDER_SNAPSHOT = STORAGESC_PFX + "/replicate-sharder-aggregates" STORAGE_GET_AUTHORIZER_SNAPSHOT = STORAGESC_PFX + "/replicate-authorizer-aggregates" STORAGE_GET_VALIDATOR_SNAPSHOT = STORAGESC_PFX + "/replicate-validator-aggregates" STORAGE_GET_USER_SNAPSHOT = STORAGESC_PFX + "/replicate-user-aggregates" )
const ( StorageSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7` VestingSmartContractAddress = `2bba5b05949ea59c80aed3ac3474d7379d3be737e8eb5a968c52295e48333ead` FaucetSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d3` MultiSigSmartContractAddress = `27b5ef7120252b79f9dd9c05505dd28f328c80f6863ee446daede08a84d651a7` MinerSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9` ZCNSCSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712e0` MultiSigRegisterFuncName = "register" MultiSigVoteFuncName = "vote" )
const ( StatusSuccess int = 0 StatusNetworkError int = 1 // TODO: Change to specific error StatusError int = 2 StatusRejectedByUser int = 3 StatusInvalidSignature int = 4 StatusAuthError int = 5 StatusAuthVerifyFailed int = 6 StatusAuthTimeout int = 7 StatusUnknown int = -1 )
const ( OpGetTokenLockConfig int = iota OpGetLockedTokens OpGetUserPools OpGetUserPoolDetail OpGetNotProcessedBurnTickets OpGetMintNonce // storage SC ops // OpStorageSCGetConfig Get global storage SC config OpStorageSCGetConfig // OpStorageSCGetChallengePoolInfo Get challenge pool info OpStorageSCGetChallengePoolInfo // OpStorageSCGetAllocation Get allocation info OpStorageSCGetAllocation // OpStorageSCGetAllocations Get all allocations OpStorageSCGetAllocations // OpStorageSCGetReadPoolInfo Get read pool info OpStorageSCGetReadPoolInfo // OpStorageSCGetStakePoolInfo Get stake pool info OpStorageSCGetStakePoolInfo // OpStorageSCGetStakePoolUserInfo Get blobbers OpStorageSCGetBlobbers // OpStorageSCGetBlobber Get blobber information OpStorageSCGetBlobber // OpStorageSCGetValidator Get transaction info OpStorageSCGetTransactions // OpStorageSCGetSnapshots Get global snapshots OpStorageSCGetSnapshots // OpStorageSCGetBlobberSnapshots Get blobber snapshots OpStorageSCGetBlobberSnapshots // OpStorageSCGetMinerSnapshots Get miner snapshots OpStorageSCGetMinerSnapshots // OpStorageSCGetSharderSnapshots Get sharder snapshots OpStorageSCGetSharderSnapshots // OpStorageSCGetAuthorizerSnapshots Get authorizer snapshots OpStorageSCGetAuthorizerSnapshots // OpStorageSCGetValidatorSnapshots Get validator snapshots OpStorageSCGetValidatorSnapshots // OpStorageSCGetUserSnapshots Get user snapshots OpStorageSCGetUserSnapshots // OpStorageSCGetUserLockedTotal Get global configuration OpZCNSCGetGlobalConfig // OpZCNSCGetMintNonce Get authorizer information OpZCNSCGetAuthorizer // OpZCNSCGetAuthorizerNodes Get authorizer nodes OpZCNSCGetAuthorizerNodes )
const NETWORK_ENDPOINT = "/network"
const (
SharderEndpointHealthCheck = "/v1/healthcheck"
)
const TOKEN_UNIT int64 = 1e10
Variables ¶
var ( ErrNoAvailableSharders = errors.New("zcn: no available sharders") ErrNoEnoughSharders = errors.New("zcn: sharders is not enough") ErrNoEnoughOnlineSharders = errors.New("zcn: online sharders is not enough") ErrInvalidNumSharder = errors.New("zcn: number of sharders is invalid") ErrNoOnlineSharders = errors.New("zcn: no any online sharder") ErrSharderOffline = errors.New("zcn: sharder is offline") ErrInvalidConsensus = errors.New("zcn: invalid consensus") ErrTransactionNotFound = errors.New("zcn: transaction not found") ErrTransactionNotConfirmed = errors.New("zcn: transaction not confirmed") ErrNoAvailableMiners = errors.New("zcn: no available miners") )
var AddSignature = func(privateKey, signature string, hash string) (string, error) { var ( ss = zcncrypto.NewSignatureScheme(_config.chain.SignatureScheme) err error ) err = ss.SetPrivateKey(privateKey) if err != nil { return "", err } return ss.Add(signature, hash) }
var Sharders *node.NodeHolder
var SignFn = func(hash string) (string, error) { sigScheme := zcncrypto.NewSignatureScheme(_config.chain.SignatureScheme) err := sigScheme.SetPrivateKey(_config.wallet.Keys[0].PrivateKey) if err != nil { return "", err } return sigScheme.Sign(hash) }
Functions ¶
func CallZauthDelete ¶ added in v1.17.0
func CallZauthRevoke ¶ added in v1.17.0
func CallZauthSetup ¶ added in v1.17.0
func CallZauthSetup(serverAddr string, token string, splitWallet SplitWallet) error
CallZauthSetup calls the zauth setup endpoint
func CallZvaultDeletePrimaryKey ¶ added in v1.17.0
func CallZvaultNewWalletString ¶ added in v1.17.0
func CallZvaultRetrieveKeys ¶ added in v1.17.0
func CallZvaultRetrieveSharedWallets ¶ added in v1.17.0
func CallZvaultRetrieveWallets ¶ added in v1.17.0
func CallZvaultRevokeKey ¶ added in v1.17.0
func CallZvaultStoreKeyString ¶ added in v1.17.0
func CheckConfig ¶ added in v1.7.1
func CheckConfig() error
func CheckEthHashStatus ¶
CheckEthHashStatus - checking the status of ETH transaction possible values 0 or 1
func ConvertTokenToUSD ¶
ConvertTokenToUSD converts the ZCN tokens to USD amount
- token: ZCN tokens amount
func ConvertZcnTokenToETH ¶
ConvertZcnTokenToETH - converting Zcn tokens to Eth
- f: ZCN tokens amount
func CreateMSVote ¶
func CreateMSVote(proposal, grpClientID, signerWalletstr, toClientID string, token uint64) (string, error)
CreateMSVote create a vote for multisig
func CreateMSWallet ¶
CreateMSWallet returns multisig wallet information
func CreateWalletFromEthMnemonic ¶
func CreateWalletFromEthMnemonic(mnemonic, password string, statusCb WalletCallback) error
CreateWalletFromEthMnemonic - creating new wallet from Eth mnemonics
func CreateWalletOffline ¶ added in v1.8.10
CreateWalletOffline creates the wallet for the config signature scheme.
func CryptoJsDecrypt ¶ added in v1.8.11
func CryptoJsEncrypt ¶ added in v1.8.11
func Decrypt ¶
Decrypt decrypts encrypted text using the key.
- key: key to use for decryption
- text: text to decrypt
func EthToTokens ¶
TokensToEth - converting eth tokens to wei
func GEthToTokens ¶
func GTokensToEth ¶
func GetAllocation ¶
func GetAllocation(allocID string, cb GetInfoCallback) (err error)
GetAllocation obtains allocation information.
func GetAllocations ¶
func GetAllocations(clientID string, cb GetInfoCallback) (err error)
GetAllocations obtains list of allocations of a user.
func GetAuthorizer ¶ added in v1.10.0
func GetAuthorizer(authorizerID string, cb GetInfoCallback) (err error)
GetAuthorizer obtains authorizer information from the sharders.
- authorizerID: authorizer id
- cb: info callback instance, carries the response of the GET request to the sharders
func GetAuthorizerSnapshots ¶ added in v1.8.12
func GetAuthorizerSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetAuthorizerSnapshots obtains list of authorizers snapshots from the sharders. Authorizer snapshots are historical records of the authorizer instance to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number to start fetching snapshots
- limit: how many authorizer snapshots should be fetched
- offset: how many authorizer snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetBalance ¶
func GetBalance(cb GetBalanceCallback) error
GetBalance retrieve wallet balance from sharders
- cb: info callback instance, carries the response of the GET request to the sharders
func GetBalanceWallet ¶
func GetBalanceWallet(walletStr string, cb GetBalanceCallback) error
GetBalanceWallet retreives wallet balance from sharders
- walletStr: wallet string
- cb: info callback instance, carries the response of the GET request to the sharders
func GetBlobber ¶
func GetBlobber(blobberID string, cb GetInfoCallback) (err error)
GetBlobber obtains blobber information.
- blobberID: blobber id
- cb: info callback instance, carries the response of the GET request to the sharders
func GetBlobberSnapshots ¶ added in v1.8.11
func GetBlobberSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetBlobberSnapshots obtains list of allocations of a blobber. Blobber snapshots are historical records of the blobber instance to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number
- limit: how many blobber snapshots should be fetched
- offset: how many blobber snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetBlobbers ¶
func GetBlobbers(cb GetInfoCallback, limit, offset int, active bool)
GetBlobbers obtains list of all active blobbers.
- cb: info callback instance, carries the response of the GET request to the sharders
- limit: how many blobbers should be fetched
- offset: how many blobbers should be skipped
- active: only fetch active blobbers
func GetBlockByRound ¶
func GetChainStats ¶
func GetChainStats(ctx context.Context) (b *block.ChainStats, err error)
func GetChallengePoolInfo ¶
func GetChallengePoolInfo(allocID string, cb GetInfoCallback) (err error)
GetChallengePoolInfo obtains challenge pool information for an allocation.
func GetClientID ¶
GetClientID -- computes Client ID from publickey
func GetClientWalletID ¶ added in v1.5.1
func GetClientWalletID() string
func GetClientWalletKey ¶ added in v1.11.0
func GetClientWalletKey() string
func GetEthBalance ¶
func GetEthBalance(ethAddr string, cb GetBalanceCallback) error
GetEthBalance - getting back balance for ETH wallet
func GetEthClient ¶
func GetEvents ¶ added in v1.3.1
func GetEvents(cb GetInfoCallback, filters map[string]string) (err error)
func GetFaucetSCConfig ¶ added in v1.2.86
func GetFaucetSCConfig(cb GetInfoCallback) (err error)
func GetFeeStats ¶ added in v1.8.16
func GetHardForkRound ¶ added in v1.12.1
GetHardForkRound returns the round number of the hard fork
- hardFork: hard fork name
func GetIdForUrl ¶
GetIdForUrl retrieve the ID of the network node (miner/sharder) given its url.
- url: url of the node.
func GetInfoFromAnyMiner ¶ added in v1.8.16
func GetInfoFromAnySharder ¶ added in v1.8.11
func GetInfoFromAnySharder(urlSuffix string, op int, cb GetInfoCallback)
func GetInfoFromSharders ¶ added in v1.8.10
func GetInfoFromSharders(urlSuffix string, op int, cb GetInfoCallback)
func GetLatestFinalized ¶
func GetLatestFinalizedMagicBlock ¶
func GetLatestFinalizedMagicBlock(ctx context.Context, numSharders int) (m *block.MagicBlock, err error)
GetLatestFinalizedMagicBlock gets latest finalized magic block
- numSharders: number of sharders
- timeout: request timeout
func GetMagicBlockByNumber ¶
func GetMinShardersVerify ¶
func GetMinShardersVerify() int
func GetMinerSCConfig ¶
func GetMinerSCConfig(cb GetInfoCallback) (err error)
GetMinerSCConfig get miner SC configuration
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSCGlobals ¶ added in v1.2.86
func GetMinerSCGlobals(cb GetInfoCallback) (err error)
GetMinerSCGlobals get miner SC globals
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSCNodeInfo ¶
func GetMinerSCNodeInfo(id string, cb GetInfoCallback) (err error)
GetMinerSCNodeInfo get miner information from sharders
- id: the id of miner
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSCNodePool ¶
func GetMinerSCNodePool(id string, cb GetInfoCallback) (err error)
GetMinerSCNodePool get miner smart contract node pool
- id: the id of miner
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSCUserInfo ¶
func GetMinerSCUserInfo(clientID string, cb GetInfoCallback) (err error)
GetMinerSCUserInfo retrieve user stake pools for the providers related to the Miner SC (miners/sharders).
- clientID: user's wallet id
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSharder ¶ added in v1.10.0
func GetMinerSharder(id string, cb GetInfoCallback) (err error)
GetMinerSharder obtains miner sharder information from the sharders.
- id: miner sharder id
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMinerSnapshots ¶ added in v1.8.12
func GetMinerSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetMinerSnapshots obtains a list of miner snapshots starting from a specific round. Miner snapshots are historical records of the miner instance to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number to start fetching snapshots
- limit: how many miner snapshots should be fetched
- offset: how many miner snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMiners ¶
func GetMiners(cb GetInfoCallback, limit, offset int, active bool, stakable bool)
GetMiners obtains list of all active miners.
- cb: info callback instance, carries the response of the GET request to the sharders
- limit: how many miners should be fetched
- offset: how many miners should be skipped
- active: retrieve only active miners
- stakable: retreive only stakable miners
func GetMintNonce ¶ added in v1.8.15
func GetMintNonce(cb GetInfoCallback) error
GetMintNonce retrieve the client's latest mint nonce from sharders
- cb: info callback instance, carries the response of the GET request to the sharders
func GetMultisigPayload ¶
GetMultisigPayload given a multisig wallet as a string, makes a multisig wallet payload to register
func GetMultisigVotePayload ¶
GetMultisigVotePayload given a multisig vote as a string, makes a multisig vote payload to register
func GetNetworkJSON ¶
func GetNetworkJSON() string
GetNetworkJSON retrieve the registered network details in JSON format.
func GetNonce ¶ added in v1.8.3
func GetNonce(cb GetNonceCallback) error
GetNonce retrieve wallet nonce from sharders
- cb: info callback instance, carries the response of the GET request to the sharders
func GetNotProcessedZCNBurnTickets ¶ added in v1.8.15
func GetNotProcessedZCNBurnTickets(ethereumAddress, startNonce string, cb GetInfoCallback) error
GetNotProcessedZCNBurnTickets retrieve burn tickets that are not compensated by minting
- ethereumAddress: ethereum address for the issuer of the burn tickets
- startNonce: start nonce for the burn tickets
- cb: info callback instance, carries the response of the GET request to the sharders
func GetPublicEncryptionKey ¶ added in v1.8.10
GetPublicEncryptionKey returns the public encryption key for the given mnemonic
func GetReadPoolInfo ¶
func GetReadPoolInfo(clientID string, cb GetInfoCallback) (err error)
GetReadPoolInfo obtains information about read pool of a user.
func GetRoundFromSharders ¶ added in v1.11.0
GetRoundFromSharders returns the current round number from the sharders
func GetSharderSnapshots ¶ added in v1.8.12
func GetSharderSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetSharderSnapshots obtains a list of sharder snapshots starting from a specific round. Sharder snapshots are historical records of the sharder instance to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number to start fetching snapshots
- limit: how many sharder snapshots should be fetched
- offset: how many sharder snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetSharders ¶
func GetSharders(cb GetInfoCallback, limit, offset int, active, stakable bool)
GetSharders obtains a list of sharders given the following parameters.
- cb: info callback instance, carries the response of the GET request to the sharders
- limit: how many sharders should be fetched
- offset: how many sharders should be skipped
- active: retrieve only active sharders
- stakable: retrieve only sharders that can be staked
func GetSnapshots ¶ added in v1.8.11
func GetSnapshots(round int64, limit int64, cb GetInfoCallback) (err error)
GetSnapshots obtains list of global snapshots, given an initial round and a limit. Global snapshots are historical records of some aggregate data related to the network (like total staked amount and total reward amount).
- round: round number to start fetching snapshots
- limit: how many snapshots should be fetched
- cb: info callback instance, carries the response of the GET request to the sharders
func GetStableMiners ¶ added in v1.8.17
func GetStableMiners() []string
func GetStakableBlobbers ¶ added in v1.15.10
func GetStakableBlobbers(cb GetInfoCallback, limit, offset int, active bool)
GetStakeableBlobbers obtains list of all active blobbers that can be staked (i.e. still number of delegations < max_delegations) # Inputs
- cb: info callback instance, carries the response of the GET request to the sharders
- limit: how many blobbers should be fetched
- offset: how many blobbers should be skipped
- active: only fetch active blobbers
func GetStakePoolInfo ¶
func GetStakePoolInfo(blobberID string, cb GetInfoCallback) (err error)
GetStakePoolInfo obtains information about stake pool of a blobber and related validator.
func GetStakePoolUserInfo ¶
func GetStakePoolUserInfo(clientID string, offset, limit int, cb GetInfoCallback) (err error)
GetStakePoolUserInfo for a user. # Inputs
- clientID: the id of wallet
- cb: info callback instance, carries the response of the GET request to the sharders
func GetStorageSCConfig ¶
func GetStorageSCConfig(cb GetInfoCallback) (err error)
GetStorageSCConfig obtains Storage SC configurations.
- cb: info callback instance, carries the response of the GET request to the sharders
func GetTransactions ¶ added in v1.8.7
func GetTransactions(toClient, fromClient, block_hash, sort string, limit, offset int, cb GetInfoCallback) (err error)
GetTransactions query transactions from sharders # Inputs
- toClient: receiver
- fromClient: sender
- block_hash: block hash
- sort: desc or asc
- limit: how many transactions should be fetched
- offset: how many transactions should be skipped
- cb: callback to get result
func GetUserLockedTotal ¶ added in v1.8.13
GetUserLockedTotal get total token user locked # Inputs
- clientID wallet id
func GetUserSnapshots ¶ added in v1.8.13
func GetUserSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetUserSnapshots replicates user snapshots from the sharders User snapshots are historical records of the client data to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number to start fetching snapshots
- limit: how many user snapshots should be fetched
- offset: how many user snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetValidator ¶ added in v1.10.0
func GetValidator(validatorID string, cb GetInfoCallback) (err error)
GetValidator obtains validator information.
- validatorID: validator id
- cb: info callback instance, carries the response of the GET request to the sharders
func GetValidatorSnapshots ¶ added in v1.8.12
func GetValidatorSnapshots(round int64, limit int64, offset int64, cb GetInfoCallback) (err error)
GetValidatorSnapshots obtains list of validator snapshots from the sharders. Validator snapshots are historical records of the validator instance to track its change over time and serve graph requests, which are requests that need multiple data points, distributed over an interval of time, usually to plot them on a graph.
- round: round number to start fetching snapshots
- limit: how many validator snapshots should be fetched
- offset: how many validator snapshots should be skipped
- cb: info callback instance, carries the response of the GET request to the sharders
func GetVestingClientList ¶
func GetVestingClientList(clientID string, cb GetInfoCallback) (err error)
func GetVestingPoolInfo ¶
func GetVestingPoolInfo(poolID string, cb GetInfoCallback) (err error)
func GetVestingSCConfig ¶
func GetVestingSCConfig(cb GetInfoCallback) (err error)
func GetWalletAddrFromEthMnemonic ¶
GetWalletAddrFromEthMnemonic - wallet ETH address from mnemoninnc
func GetWalletBalance ¶ added in v1.8.7
GetWalletBalance retrieve wallet balance from sharders
- id: client id
func GetWalletClientID ¶
GetWalletClientID extract wallet client id from wallet string
- walletStr: wallet string to get client id
func GetWalletNonce ¶ added in v1.8.12
GetWalletBalance retrieve wallet nonce from sharders
- clientID: client id
func GetWalletRaw ¶ added in v1.8.8
func GetZcnUSDInfo ¶
GetZcnUSDInfo returns USD value for ZCN token by tokenrate
func Init ¶
Init initialize the SDK with miner, sharder and signature scheme provided in configuration provided in JSON format # Inputs
- chainConfigJSON: json format of zcn config { "block_worker": "https://dev.0chain.net/dns", "signature_scheme": "bls0chain", "min_submit": 50, "min_confirmation": 50, "confirmation_chain_length": 3, "max_txn_query": 5, "query_sleep_time": 5, "preferred_blobbers": ["https://dev.0chain.net/blobber02","https://dev.0chain.net/blobber03"], "chain_id":"0afc093ffb509f059c55478bc1a60351cef7b4e9c008a53a6cc8241ca8617dfe", "ethereum_node":"https://ropsten.infura.io/v3/xxxxxxxxxxxxxxx", "zbox_host":"https://0box.dev.0chain.net", "zbox_app_type":"vult", "sharder_consensous": 2, }
func InitSignatureScheme ¶ added in v1.8.5
func InitSignatureScheme(scheme string)
InitSignatureScheme initializes signature scheme only.
- scheme: signature scheme
func InitZCNSDK ¶
func InitZCNSDK(blockWorker string, signscheme string, configs ...func(*ChainConfig) error) error
InitZCNSDK initializes the SDK given block worker and signature scheme provided.
- blockWorker: block worker, which is the url for the DNS service for locating miners and sharders
- signscheme: signature scheme to be used for signing the transactions
- configs: configuration options
func IsEthTransactionVerified ¶ added in v1.8.11
IsEthTransactionVerified checks if the transaction - given its hash - is verified on the ethereum network
- txHash: transaction hash
func IsMnemonicValid ¶
IsMnemonicValid is a utility function to check the mnemonic valid
- mnemonic: mnemonics to check
func IsSplitWallet ¶ added in v1.17.0
func IsSplitWallet() bool
func IsValidEthAddress ¶
IsValidEthAddress - multiple checks for valid ETH address
func RecoverOfflineWallet ¶ added in v1.8.5
RecoverOfflineWallet recovers the previously generated wallet using the mnemonic.
- mnemonic: mnemonics to recover
func RecoverWallet ¶
func RecoverWallet(mnemonic string, statusCb WalletCallback) error
RecoverWallet recovers the previously generated wallet using the mnemonic. It also registers the wallet again to block chain.
func ResetStableMiners ¶ added in v1.8.17
func ResetStableMiners()
func SetAuthUrl ¶
SetAuthUrl will be called by app to set zauth URL to SDK. # Inputs
- url: the url of zAuth server
func SetLogFile ¶
SetLogFile - sets file path to write log
- logFile: log file path
- verbose: true - console output; false - no console output
func SetLogLevel ¶
func SetLogLevel(lvl int)
SetLogLevel set the log level.
- lvl: 0 disabled; higher number (upto 4) more verbosity
func SetNetwork ¶
SetNetwork set the global network details for the SDK, including urls of the miners and sharders, which are the nodes of the network.
- miners: miner urls.
- sharders: sharder urls.
func SetWallet ¶ added in v1.8.6
SetWallet should be set before any transaction or client specific APIs splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"
func SetWalletInfo ¶
SetWalletInfo should be set before any transaction or client specific APIs. "splitKeyWallet" parameter is valid only if SignatureScheme is "BLS0Chain"
- jsonWallet: json format of wallet
- splitKeyWallet: if wallet keys is split
func SetupAuth ¶
func SetupAuth(authHost, clientID, clientKey, publicKey, privateKey, localPublicKey string, cb AuthCallback) error
SetupAuth prepare auth app with clientid, key and a set of public, private key and local publickey which is running on PC/Mac.
func SignWith0Wallet ¶ added in v1.7.9
func SignWithKey ¶ added in v1.12.1
func SplitKeysWallet ¶ added in v1.17.0
func SuggestEthGasPrice ¶
SuggestEthGasPrice - return back suggested price for gas
func TokensToEth ¶
TokensToEth - converting wei to eth tokens
func TransferEthTokens ¶
TransferEthTokens - transfer ETH tokens to multisign wallet
func UpdateNetworkDetails ¶
func UpdateNetworkDetails() error
func UpdateRequired ¶
func VerifyContentHash ¶
func VerifyWithKey ¶ added in v1.12.1
func WithChainID ¶
func WithChainID(id string) func(c *ChainConfig) error
WithChainID set the chain id. Chain ID is a unique identifier for the blockchain which is set at the time of its creation.
- id: chain id
func WithConfirmationChainLength ¶
func WithConfirmationChainLength(m int) func(c *ChainConfig) error
WithConfirmationChainLength set the confirmation chain length, which is the number of blocks that need to be confirmed.
- m: confirmation chain length
func WithEthereumNode ¶ added in v1.3.1
func WithEthereumNode(uri string) func(c *ChainConfig) error
WithEthereumNode set the ethereum node used for bridge operations.
- uri: ethereum node uri
func WithIsSplitWallet ¶ added in v1.17.0
func WithIsSplitWallet(v bool) func(c *ChainConfig) error
func WithMinConfirmation ¶
func WithMinConfirmation(m int) func(c *ChainConfig) error
WithMinConfirmation set the minimum confirmation, minimum number of nodes that should confirm the transaction.
- m: minimum confirmation
func WithMinSubmit ¶
func WithMinSubmit(m int) func(c *ChainConfig) error
WithMinSubmit set the minimum submit, minimum number of miners that should receive the transaction submission.
- m: minimum submit
func WithParams ¶ added in v1.7.1
func WithSharderConsensous ¶ added in v1.8.17
func WithSharderConsensous(m int) func(c *ChainConfig) error
func ZauthAuthCommon ¶ added in v1.17.0
func ZauthAuthCommon(serverAddr string) sys.AuthorizeFunc
func ZauthSignMsg ¶ added in v1.17.0
func ZauthSignTxn ¶ added in v1.17.0
func ZauthSignTxn(serverAddr string) sys.AuthorizeFunc
ZauthSignTxn returns a function that sends a txn signing request to the zauth server
Types ¶
type AddAuthorizerPayload ¶ added in v1.7.9
type AddAuthorizerPayload struct { PublicKey string `json:"public_key"` URL string `json:"url"` StakePoolSettings AuthorizerStakePoolSettings `json:"stake_pool_settings"` // Used to initially create stake pool }
AddAuthorizerPayload represents the payload for adding an authorizer.
type AuthCallback ¶
type AuthCallback interface { // This call back gives the status of the Two factor authenticator(zauth) setup. OnSetupComplete(status int, err string) }
AuthCallback needs to be implemented by the caller SetupAuth()
type AuthMessage ¶ added in v1.17.0
type AuthResponse ¶ added in v1.17.0
type AuthResponse struct {
Sig string `json:"sig"`
}
type AuthorizerConfig ¶ added in v1.7.1
type AuthorizerHealthCheckPayload ¶ added in v1.8.13
type AuthorizerHealthCheckPayload struct {
ID string `json:"id"` // authorizer ID
}
AuthorizerHealthCheckPayload represents the payload for authorizer health check.
type AuthorizerNode ¶ added in v1.7.1
type AuthorizerNode struct { ID string `json:"id"` URL string `json:"url"` Config *AuthorizerConfig `json:"config"` }
AuthorizerNode represents an authorizer node in the network
type AuthorizerStakePoolSettings ¶ added in v1.7.9
type AuthorizerStakePoolSettings struct { DelegateWallet string `json:"delegate_wallet"` NumDelegates int `json:"num_delegates"` ServiceCharge float64 `json:"service_charge"` }
AuthorizerStakePoolSettings represents the settings for an authorizer's stake pool.
type Blobber ¶
type Blobber struct { // ID is the blobber ID. ID common.Key `json:"id"` // BaseURL is the blobber's base URL used to access the blobber BaseURL string `json:"url"` // Terms of storage service of the blobber (read/write price, max offer duration) Terms Terms `json:"terms"` // Capacity is the total capacity of the blobber Capacity common.Size `json:"capacity"` // Used is the capacity of the blobber used to create allocations Allocated common.Size `json:"allocated"` // LastHealthCheck is the last time the blobber was checked for health LastHealthCheck common.Timestamp `json:"last_health_check"` // StakePoolSettings is the settings of the blobber's stake pool StakePoolSettings StakePoolSettings `json:"stake_pool_settings"` // NotAvailable is true if the blobber is not available NotAvailable bool `json:"not_available"` // IsRestricted is true if the blobber is restricted. // Restricted blobbers needs to be authenticated using AuthTickets in order to be used for allocation creation. // Check Restricted Blobbers documentation for more details. IsRestricted bool `json:"is_restricted"` }
Blobber represents a blobber node.
type BurnTicket ¶ added in v1.8.15
type BurnTicket struct { Hash string `json:"hash"` Amount int64 `json:"amount"` Nonce int64 `json:"nonce"` }
BurnTicket represents the burn ticket of native ZCN tokens used by the bridge protocol to mint ERC20 tokens
type ChainConfig ¶
type ChainConfig struct { ChainID string `json:"chain_id,omitempty"` BlockWorker string `json:"block_worker"` Miners []string `json:"miners"` Sharders []string `json:"sharders"` SignatureScheme string `json:"signature_scheme"` MinSubmit int `json:"min_submit"` MinConfirmation int `json:"min_confirmation"` ConfirmationChainLength int `json:"confirmation_chain_length"` EthNode string `json:"eth_node"` SharderConsensous int `json:"sharder_consensous"` IsSplitWallet bool `json:"is_split_wallet"` }
type CommitMetaData ¶ added in v1.17.0
type CommitMetaData struct { CrudType string MetaData *ConsolidatedFileMeta }
type CommitMetaResponse ¶ added in v1.17.0
type CommitMetaResponse struct { TxnID string MetaData *ConsolidatedFileMeta }
type ConfirmationStatus ¶ added in v1.5.1
type ConfirmationStatus int
const ( Undefined ConfirmationStatus = iota Success // ChargeableError is an error that still charges the user for the transaction. ChargeableError )
type ConsolidatedFileMeta ¶ added in v1.17.0
type CreateAllocationRequest ¶
type CreateAllocationRequest struct { DataShards int `json:"data_shards"` ParityShards int `json:"parity_shards"` Size common.Size `json:"size"` Expiration common.Timestamp `json:"expiration_date"` Owner string `json:"owner_id"` OwnerPublicKey string `json:"owner_public_key"` Blobbers []string `json:"blobbers"` ReadPriceRange PriceRange `json:"read_price_range"` WritePriceRange PriceRange `json:"write_price_range"` }
CreateAllocationRequest is information to create allocation.
type DelegatePool ¶ added in v1.8.4
type DeleteAuthorizerPayload ¶ added in v1.8.9
type DeleteAuthorizerPayload struct {
ID string `json:"id"` // authorizer ID
}
DeleteAuthorizerPayload represents the payload for deleting an authorizer.
type FeeOption ¶ added in v1.8.16
type FeeOption func(*TxnFeeOption)
FeeOption represents txn fee related option type
func WithNoEstimateFee ¶ added in v1.8.16
func WithNoEstimateFee() FeeOption
WithNoEstimateFee would prevent txn fee estimation from remote
type GetBalanceCallback ¶
GetBalanceCallback needs to be implemented by the caller of GetBalance() to get the status
type GetClientResponse ¶
type GetClientResponse struct { ID string `json:"id"` Version string `json:"version"` CreationDate int `json:"creation_date"` PublicKey string `json:"public_key"` }
func GetClientDetails ¶
func GetClientDetails(clientID string) (*GetClientResponse, error)
type GetInfoCallback ¶
type GetInfoCallback interface { // OnInfoAvailable will be called when GetLockTokenConfig is complete // if status == StatusSuccess then info is valid // is status != StatusSuccess then err will give the reason OnInfoAvailable(op int, status int, info string, err string) }
GetInfoCallback represents the functions that will be called when the response of a GET request to the sharders is available
type GetNonceCallback ¶ added in v1.8.3
GetNonceCallback needs to be implemented by the caller of GetNonce() to get the status
type GetNonceCallbackStub ¶ added in v1.8.3
type GetNonceCallbackStub struct {
// contains filtered or unexported fields
}
func (*GetNonceCallbackStub) OnNonceAvailable ¶ added in v1.8.3
func (g *GetNonceCallbackStub) OnNonceAvailable(status int, nonce int64, info string)
type MSTransfer ¶
type MSTransfer struct { ClientID string `json:"from"` ToClientID string `json:"to"` Amount uint64 `json:"amount"` }
MSTransfer - a data structure to hold state transfer from one client to another
type MSVote ¶
type MSVote struct { ProposalID string `json:"proposal_id"` // Client ID in transfer is that of the multi-sig wallet, not the signer. Transfer MSTransfer `json:"transfer"` Signature string `json:"signature"` }
MSVote -- this should mimic the type Vote defined in MultiSig SC
type MSVoteCallback ¶
MSVoteCallback callback definition multisig Vote function
type MSWallet ¶
type MSWallet struct { Id int `json:"id"` SignatureScheme string `json:"signature_scheme"` GroupClientID string `json:"group_client_id"` GroupKey zcncrypto.SignatureScheme `json:"group_key"` SignerClientIDs []string `json:"sig_client_ids"` SignerKeys []zcncrypto.SignatureScheme `json:"signer_keys"` T int `json:"threshold"` N int `json:"num_subkeys"` }
MSWallet Client data necessary for a multi-sig wallet.
func (*MSWallet) UnmarshalJSON ¶ added in v1.3.1
type Miner ¶
type Miner struct { ID string `json:"id"` N2NHost string `json:"n2n_host"` Host string `json:"host"` Port int `json:"port"` PublicKey string `json:"public_key"` ShortName string `json:"short_name"` BuildTag string `json:"build_tag"` TotalStake int64 `json:"total_stake"` Stat interface{} `json:"stat"` }
type MinerSCDelegatePool ¶
type MinerSCDelegatePool struct {
Settings StakePoolSettings `json:"settings"`
}
type MinerSCDelegatePoolInfo ¶
type MinerSCLock ¶
type MinerSCLock struct {
ID string `json:"id"`
}
type MinerSCMinerInfo ¶
type MinerSCMinerInfo struct { SimpleMiner `json:"simple_miner"` MinerSCDelegatePool `json:"stake_pool"` }
MinerSCMinerInfo interface for miner/sharder info functions on miner smart contract.
type MinerSCNodes ¶
type MinerSCNodes struct {
Nodes []Node `json:"Nodes"`
}
MinerSCNodes list of nodes registered to the miner smart contract
type MinerSCUnlock ¶
type MinerSCUnlock struct {
ID string `json:"id"`
}
type MinerSCUserPoolsInfo ¶
type MinerSCUserPoolsInfo struct {
Pools map[string][]*MinerSCDelegatePoolInfo `json:"pools"`
}
MinerSCUserPoolsInfo represents the user stake pools information
type MultisigSCWallet ¶
type MultisigSCWallet struct { ClientID string `json:"client_id"` SignatureScheme string `json:"signature_scheme"` PublicKey string `json:"public_key"` SignerThresholdIDs []string `json:"signer_threshold_ids"` SignerPublicKeys []string `json:"signer_public_keys"` NumRequired int `json:"num_required"` }
MultisigSCWallet --this should mimic MultisigWallet definition in MultiSig SC
type NonceCache ¶ added in v1.8.3
type NonceCache struct {
// contains filtered or unexported fields
}
func NewNonceCache ¶ added in v1.8.3
func NewNonceCache() *NonceCache
func (*NonceCache) Evict ¶ added in v1.8.3
func (nc *NonceCache) Evict(clientId string)
func (*NonceCache) GetNextNonce ¶ added in v1.8.3
func (nc *NonceCache) GetNextNonce(clientId string) int64
func (*NonceCache) Set ¶ added in v1.8.3
func (nc *NonceCache) Set(clientId string, nonce int64)
type PriceRange ¶
PriceRange represents a price range allowed by user to filter blobbers.
type QueryResult ¶ added in v1.8.4
type QueryResultHandle ¶ added in v1.8.4
type QueryResultHandle func(result QueryResult) bool
QueryResultHandle handle query response, return true if it is a consensus-result
type SendTxnData ¶ added in v1.4.1
type SendTxnData struct {
Note string `json:"note"`
}
type SimpleMiner ¶ added in v1.8.4
type SimpleMiner struct {
ID string `json:"id"`
}
SimpleMiner represents a node in the network, miner or sharder.
type SplitWallet ¶ added in v1.17.0
type SplitWallet struct { ClientID string `json:"client_id"` ClientKey string `json:"client_key"` PublicKey string `json:"public_key"` PrivateKey string `json:"private_key"` PeerPublicKey string `json:"peer_public_key"` IsRevoked bool `json:"is_revoked"` ExpiredAt int64 `json:"expired_at"` }
SplitWallet represents wallet info for split wallet The client id and client key are the same as the primary wallet client id and client key
type StakePool ¶ added in v1.8.4
type StakePool struct { Pools map[string]*DelegatePool `json:"pools"` Reward int64 `json:"rewards"` Settings StakePoolSettings `json:"settings"` Minter int `json:"minter"` }
type StakePoolSettings ¶
type Transaction ¶
type Transaction struct {
// contains filtered or unexported fields
}
Transaction data structure that provides the transaction details
func NewMSTransaction ¶
func NewMSTransaction(walletstr string, cb TransactionCallback) (*Transaction, error)
NewMSTransaction new transaction object for multisig operation
func (*Transaction) AddHardfork ¶ added in v1.11.7
func (t *Transaction) AddHardfork(ip *InputMap) (err error)
func (*Transaction) CancelAllocation ¶
func (t *Transaction) CancelAllocation(allocID string) ( err error)
CancelAllocation transaction.
func (*Transaction) CreateAllocation ¶
func (t *Transaction) CreateAllocation(car *CreateAllocationRequest, lock uint64) (err error)
CreateAllocation transaction.
func (*Transaction) CreateReadPool ¶
func (t *Transaction) CreateReadPool() (err error)
CreateReadPool for current user.
func (*Transaction) ExecuteFaucetSCWallet ¶
func (t *Transaction) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
ExecuteFaucetSCWallet implements the Faucet Smart contract for a given wallet
func (*Transaction) ExecuteSmartContract ¶
func (t *Transaction) ExecuteSmartContract(address, methodName string, input interface{}, val uint64, opts ...FeeOption) (*transaction.Transaction, error)
func (*Transaction) FaucetUpdateConfig ¶ added in v1.2.86
func (t *Transaction) FaucetUpdateConfig(ip *InputMap) (err error)
func (*Transaction) FinalizeAllocation ¶
func (t *Transaction) FinalizeAllocation(allocID string) ( err error)
FinalizeAllocation transaction.
func (*Transaction) GetTransactionError ¶
func (t *Transaction) GetTransactionError() string
GetTransactionError implements error string in case of transaction failure
func (*Transaction) GetTransactionHash ¶
func (t *Transaction) GetTransactionHash() string
GetTransactionHash implements retrieval of hash of the submitted transaction
func (*Transaction) GetTransactionNonce ¶ added in v1.8.3
func (t *Transaction) GetTransactionNonce() int64
GetTransactionNonce returns nonce
func (*Transaction) GetVerifyConfirmationStatus ¶ added in v1.5.1
func (t *Transaction) GetVerifyConfirmationStatus() ConfirmationStatus
func (*Transaction) GetVerifyError ¶
func (t *Transaction) GetVerifyError() string
GetVerifyError implements error string in case of verify failure error
func (*Transaction) GetVerifyOutput ¶
func (t *Transaction) GetVerifyOutput() string
GetVerifyOutput implements the verification output from sharders
func (*Transaction) Hash ¶ added in v1.8.3
func (t *Transaction) Hash() string
Hash implements the hash of transaction
func (*Transaction) MinerSCCollectReward ¶ added in v1.7.1
func (t *Transaction) MinerSCCollectReward(providerId string, providerType Provider) error
func (*Transaction) MinerSCDeleteMiner ¶ added in v1.2.86
func (t *Transaction) MinerSCDeleteMiner(info *MinerSCMinerInfo) (err error)
func (*Transaction) MinerSCDeleteSharder ¶ added in v1.2.86
func (t *Transaction) MinerSCDeleteSharder(info *MinerSCMinerInfo) (err error)
func (*Transaction) MinerSCKill ¶ added in v1.8.16
func (t *Transaction) MinerSCKill(providerId string, providerType Provider) error
func (*Transaction) MinerSCLock ¶
func (t *Transaction) MinerSCLock(providerId string, providerType Provider, lock uint64) error
func (*Transaction) MinerSCMinerSettings ¶ added in v1.2.85
func (t *Transaction) MinerSCMinerSettings(info *MinerSCMinerInfo) (err error)
func (*Transaction) MinerSCSharderSettings ¶ added in v1.2.85
func (t *Transaction) MinerSCSharderSettings(info *MinerSCMinerInfo) (err error)
func (*Transaction) MinerSCUnlock ¶ added in v1.7.9
func (t *Transaction) MinerSCUnlock(providerId string, providerType Provider) error
func (*Transaction) MinerScUpdateConfig ¶ added in v1.2.86
func (t *Transaction) MinerScUpdateConfig(ip *InputMap) (err error)
func (*Transaction) MinerScUpdateGlobals ¶ added in v1.2.86
func (t *Transaction) MinerScUpdateGlobals(ip *InputMap) (err error)
func (*Transaction) Output ¶
func (t *Transaction) Output() []byte
Output implements the output of transaction
func (*Transaction) ReadPoolLock ¶
func (t *Transaction) ReadPoolLock(allocID, blobberID string, duration int64, lock uint64) (err error)
ReadPoolLock locks tokens for current user and given allocation, using given duration. If blobberID is not empty, then tokens will be locked for given allocation->blobber only.
func (*Transaction) ReadPoolUnlock ¶
func (t *Transaction) ReadPoolUnlock() (err error)
ReadPoolUnlock for current user and given pool.
func (*Transaction) RegisterMultiSig ¶
func (t *Transaction) RegisterMultiSig(walletstr string, mswallet string) error
RegisterMultiSig register a multisig wallet with the SC.
func (*Transaction) RegisterVote ¶
func (t *Transaction) RegisterVote(signerwalletstr string, msvstr string) error
RegisterVote register a multisig wallet with the SC.
func (*Transaction) Send ¶
func (t *Transaction) Send(toClientID string, val uint64, desc string) error
func (*Transaction) SendWithSignatureHash ¶
func (*Transaction) SetTransactionCallback ¶
func (t *Transaction) SetTransactionCallback(cb TransactionCallback) error
SetTransactionCallback implements storing the callback
func (*Transaction) SetTransactionHash ¶
func (t *Transaction) SetTransactionHash(hash string) error
SetTransactionHash implements verify a previous transaction status
- hash: transaction hash
func (*Transaction) SetTransactionNonce ¶ added in v1.8.3
func (t *Transaction) SetTransactionNonce(txnNonce int64) error
SetTransactionNonce implements method to set the transaction nonce
func (*Transaction) StakePoolLock ¶
func (t *Transaction) StakePoolLock(providerId string, providerType Provider, lock uint64) error
StakePoolLock used to lock tokens in a stake pool of a blobber.
func (*Transaction) StakePoolUnlock ¶
func (t *Transaction) StakePoolUnlock(providerId string, providerType Provider) error
StakePoolUnlock by blobberID and poolID.
func (*Transaction) StorageSCCollectReward ¶ added in v1.7.1
func (t *Transaction) StorageSCCollectReward(providerId string, providerType Provider) error
func (*Transaction) StorageScUpdateConfig ¶ added in v1.2.86
func (t *Transaction) StorageScUpdateConfig(ip *InputMap) (err error)
func (*Transaction) StoreData ¶
func (t *Transaction) StoreData(data string) error
StoreData implements store the data to blockchain
func (*Transaction) UpdateAllocation ¶
func (t *Transaction) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock uint64) (err error)
UpdateAllocation transaction.
func (*Transaction) UpdateBlobberSettings ¶
func (t *Transaction) UpdateBlobberSettings(b *Blobber) (err error)
UpdateBlobberSettings update settings of a blobber.
func (*Transaction) UpdateValidatorSettings ¶ added in v1.8.5
func (t *Transaction) UpdateValidatorSettings(v *Validator) (err error)
UpdateValidatorSettings update settings of a validator.
func (*Transaction) Verify ¶
func (t *Transaction) Verify() error
func (*Transaction) VestingAdd ¶
func (t *Transaction) VestingAdd(ar *VestingAddRequest, value uint64) ( err error)
func (*Transaction) VestingDelete ¶
func (t *Transaction) VestingDelete(poolID string) (err error)
func (*Transaction) VestingStop ¶
func (t *Transaction) VestingStop(sr *VestingStopRequest) (err error)
func (*Transaction) VestingTrigger ¶
func (t *Transaction) VestingTrigger(poolID string) (err error)
func (*Transaction) VestingUnlock ¶
func (t *Transaction) VestingUnlock(poolID string) (err error)
func (*Transaction) VestingUpdateConfig ¶
func (t *Transaction) VestingUpdateConfig(vscc *InputMap) (err error)
func (*Transaction) WritePoolLock ¶
func (t *Transaction) WritePoolLock(allocID, blobberID string, duration int64, lock uint64) (err error)
WritePoolLock locks tokens for current user and given allocation, using given duration. If blobberID is not empty, then tokens will be locked for given allocation->blobber only.
func (*Transaction) WritePoolUnlock ¶
func (t *Transaction) WritePoolUnlock(allocID string) ( err error)
WritePoolUnlock for current user and given pool.
func (*Transaction) ZCNSCAddAuthorizer ¶ added in v1.7.9
func (t *Transaction) ZCNSCAddAuthorizer(ip *AddAuthorizerPayload) (err error)
func (*Transaction) ZCNSCAuthorizerHealthCheck ¶ added in v1.8.14
func (t *Transaction) ZCNSCAuthorizerHealthCheck(ip *AuthorizerHealthCheckPayload) (err error)
func (*Transaction) ZCNSCCollectReward ¶ added in v1.11.8
func (t *Transaction) ZCNSCCollectReward(providerId string, providerType Provider) error
func (*Transaction) ZCNSCDeleteAuthorizer ¶ added in v1.8.9
func (t *Transaction) ZCNSCDeleteAuthorizer(ip *DeleteAuthorizerPayload) (err error)
func (*Transaction) ZCNSCUpdateAuthorizerConfig ¶ added in v1.7.1
func (t *Transaction) ZCNSCUpdateAuthorizerConfig(ip *AuthorizerNode) (err error)
func (*Transaction) ZCNSCUpdateGlobalConfig ¶ added in v1.7.1
func (t *Transaction) ZCNSCUpdateGlobalConfig(ip *InputMap) (err error)
type TransactionCallback ¶
type TransactionCallback interface { OnTransactionComplete(t *Transaction, status int) OnVerifyComplete(t *Transaction, status int) OnAuthComplete(t *Transaction, status int) }
TransactionCallback needs to be implemented by the caller for transaction related APIs
type TransactionCommon ¶ added in v1.8.7
type TransactionCommon interface { // ExecuteSmartContract implements wrapper for smart contract function ExecuteSmartContract(address, methodName string, input interface{}, val uint64, feeOpts ...FeeOption) (*transaction.Transaction, error) // Send implements sending token to a given clientid Send(toClientID string, val uint64, desc string) error //RegisterMultiSig registers a group wallet and subwallets with MultisigSC RegisterMultiSig(walletstr, mswallet string) error VestingAdd(ar *VestingAddRequest, value uint64) error MinerSCLock(providerId string, providerType Provider, lock uint64) error MinerSCUnlock(providerId string, providerType Provider) error MinerSCCollectReward(providerID string, providerType Provider) error MinerSCKill(providerID string, providerType Provider) error StorageSCCollectReward(providerID string, providerType Provider) error FinalizeAllocation(allocID string) error CancelAllocation(allocID string) error CreateAllocation(car *CreateAllocationRequest, lock uint64) error // CreateReadPool() error ReadPoolLock(allocID string, blobberID string, duration int64, lock uint64) error ReadPoolUnlock() error StakePoolLock(providerId string, providerType Provider, lock uint64) error StakePoolUnlock(providerId string, providerType Provider) error UpdateBlobberSettings(blobber *Blobber) error UpdateValidatorSettings(validator *Validator) error UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock uint64) error WritePoolLock(allocID string, blobberID string, duration int64, lock uint64) error WritePoolUnlock(allocID string) error VestingUpdateConfig(*InputMap) error MinerScUpdateConfig(*InputMap) error MinerScUpdateGlobals(*InputMap) error StorageScUpdateConfig(*InputMap) error AddHardfork(ip *InputMap) (err error) FaucetUpdateConfig(*InputMap) error ZCNSCUpdateGlobalConfig(*InputMap) error MinerSCMinerSettings(*MinerSCMinerInfo) error MinerSCSharderSettings(*MinerSCMinerInfo) error MinerSCDeleteMiner(*MinerSCMinerInfo) error MinerSCDeleteSharder(*MinerSCMinerInfo) error // ZCNSCUpdateAuthorizerConfig updates authorizer config by ID ZCNSCUpdateAuthorizerConfig(*AuthorizerNode) error // ZCNSCAddAuthorizer adds authorizer ZCNSCAddAuthorizer(*AddAuthorizerPayload) error // ZCNSCAuthorizerHealthCheck provides health check for authorizer ZCNSCAuthorizerHealthCheck(*AuthorizerHealthCheckPayload) error // GetVerifyConfirmationStatus implements the verification status from sharders GetVerifyConfirmationStatus() ConfirmationStatus // ZCNSCDeleteAuthorizer deletes authorizer ZCNSCDeleteAuthorizer(*DeleteAuthorizerPayload) error ZCNSCCollectReward(providerID string, providerType Provider) error }
type TransactionQuery ¶ added in v1.8.4
func NewTransactionQuery ¶ added in v1.8.4
func NewTransactionQuery(sharders []string, miners []string) (*TransactionQuery, error)
func (*TransactionQuery) FromAll ¶ added in v1.8.4
func (tq *TransactionQuery) FromAll(ctx context.Context, query string, handle QueryResultHandle) error
FromAll query transaction from all sharders whatever it is selected or offline in previous queires, and return consensus result
func (*TransactionQuery) FromAny ¶ added in v1.8.4
func (tq *TransactionQuery) FromAny(ctx context.Context, query string, provider Provider) (QueryResult, error)
FromAny queries transaction from any sharder that is not selected in previous queries. use any used sharder if there is not any unused sharder
func (*TransactionQuery) GetInfo ¶ added in v1.8.4
func (tq *TransactionQuery) GetInfo(ctx context.Context, query string) (*QueryResult, error)
func (*TransactionQuery) Reset ¶ added in v1.8.4
func (tq *TransactionQuery) Reset()
type TransactionScheme ¶
type TransactionScheme interface { TransactionCommon // SetTransactionCallback implements storing the callback // used to call after the transaction or verification is completed SetTransactionCallback(cb TransactionCallback) error // StoreData implements store the data to blockchain StoreData(data string) error // ExecuteFaucetSCWallet implements the `Faucet Smart contract` for a given wallet ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error // GetTransactionHash implements retrieval of hash of the submitted transaction GetTransactionHash() string // SetTransactionHash implements verify a previous transaction status SetTransactionHash(hash string) error // SetTransactionNonce implements method to set the transaction nonce SetTransactionNonce(txnNonce int64) error // Verify implements verify the transaction Verify() error // GetVerifyOutput implements the verification output from sharders GetVerifyOutput() string // GetTransactionError implements error string in case of transaction failure GetTransactionError() string // GetVerifyError implements error string in case of verify failure error GetVerifyError() string // GetTransactionNonce returns nonce GetTransactionNonce() int64 // Output of transaction. Output() []byte // Hash Transaction status regardless of status Hash() string VestingTrigger(poolID string) error VestingStop(sr *VestingStopRequest) error VestingUnlock(poolID string) error VestingDelete(poolID string) error }
TransactionScheme implements few methods for block chain.
Note: to be buildable on MacOSX all arguments should have names.
func NewTransaction ¶
func NewTransaction(cb TransactionCallback, txnFee uint64, nonce int64) (TransactionScheme, error)
NewTransaction new generic transaction object for any operation
- cb: callback for transaction state
- txnFee: Transaction fees (in SAS tokens)
- nonce: latest nonce of current wallet. please set it with 0 if you don't know the latest value
type TransactionVelocity ¶ added in v1.8.16
type TransactionVelocity = float64
const ( RegularTransaction TransactionVelocity = 1.0 FastTransaction TransactionVelocity = 1.3 FasterTransaction TransactionVelocity = 1.6 )
Transaction velocity vs cost factor TODO: Pass it to miner to calculate real time factor
type TransactionWithAuth ¶
type TransactionWithAuth struct {
// contains filtered or unexported fields
}
func (*TransactionWithAuth) AddHardfork ¶ added in v1.11.7
func (t *TransactionWithAuth) AddHardfork(ip *InputMap) (err error)
func (*TransactionWithAuth) CancelAllocation ¶
func (ta *TransactionWithAuth) CancelAllocation(allocID string) ( err error)
CancelAllocation transaction.
func (*TransactionWithAuth) CreateAllocation ¶
func (ta *TransactionWithAuth) CreateAllocation(car *CreateAllocationRequest, lock uint64) (err error)
CreateAllocation transaction.
func (*TransactionWithAuth) CreateReadPool ¶
func (ta *TransactionWithAuth) CreateReadPool() (err error)
CreateReadPool for current user.
func (*TransactionWithAuth) ExecuteFaucetSCWallet ¶
func (ta *TransactionWithAuth) ExecuteFaucetSCWallet(walletStr string, methodName string, input []byte) error
ExecuteFaucetSCWallet impements the Faucet Smart contract for a given wallet
func (*TransactionWithAuth) ExecuteSmartContract ¶
func (ta *TransactionWithAuth) ExecuteSmartContract(address, methodName string, input interface{}, val uint64, feeOpts ...FeeOption) (*transaction.Transaction, error)
func (*TransactionWithAuth) FaucetUpdateConfig ¶ added in v1.2.86
func (ta *TransactionWithAuth) FaucetUpdateConfig(ip *InputMap) (err error)
func (*TransactionWithAuth) FinalizeAllocation ¶
func (ta *TransactionWithAuth) FinalizeAllocation(allocID string) ( err error)
FinalizeAllocation transaction.
func (*TransactionWithAuth) GetTransactionError ¶
func (ta *TransactionWithAuth) GetTransactionError() string
func (*TransactionWithAuth) GetTransactionHash ¶
func (ta *TransactionWithAuth) GetTransactionHash() string
func (*TransactionWithAuth) GetTransactionNonce ¶ added in v1.8.3
func (ta *TransactionWithAuth) GetTransactionNonce() int64
GetTransactionNonce returns nonce
func (*TransactionWithAuth) GetVerifyConfirmationStatus ¶ added in v1.5.1
func (ta *TransactionWithAuth) GetVerifyConfirmationStatus() ConfirmationStatus
func (*TransactionWithAuth) GetVerifyError ¶
func (ta *TransactionWithAuth) GetVerifyError() string
func (*TransactionWithAuth) GetVerifyOutput ¶
func (ta *TransactionWithAuth) GetVerifyOutput() string
func (*TransactionWithAuth) Hash ¶ added in v1.8.3
func (ta *TransactionWithAuth) Hash() string
func (*TransactionWithAuth) MinerSCCollectReward ¶ added in v1.7.1
func (ta *TransactionWithAuth) MinerSCCollectReward(providerId string, providerType Provider) error
func (*TransactionWithAuth) MinerSCDeleteMiner ¶ added in v1.2.86
func (ta *TransactionWithAuth) MinerSCDeleteMiner(info *MinerSCMinerInfo) ( err error)
func (*TransactionWithAuth) MinerSCDeleteSharder ¶ added in v1.2.86
func (ta *TransactionWithAuth) MinerSCDeleteSharder(info *MinerSCMinerInfo) ( err error)
func (*TransactionWithAuth) MinerSCKill ¶ added in v1.8.16
func (ta *TransactionWithAuth) MinerSCKill(providerId string, providerType Provider) error
func (*TransactionWithAuth) MinerSCLock ¶
func (ta *TransactionWithAuth) MinerSCLock(providerId string, providerType Provider, lock uint64) error
func (*TransactionWithAuth) MinerSCMinerSettings ¶ added in v1.2.85
func (ta *TransactionWithAuth) MinerSCMinerSettings(info *MinerSCMinerInfo) ( err error)
func (*TransactionWithAuth) MinerSCSharderSettings ¶ added in v1.2.85
func (ta *TransactionWithAuth) MinerSCSharderSettings(info *MinerSCMinerInfo) ( err error)
func (*TransactionWithAuth) MinerSCUnlock ¶ added in v1.7.9
func (ta *TransactionWithAuth) MinerSCUnlock(providerId string, providerType Provider) error
func (*TransactionWithAuth) MinerScUpdateConfig ¶ added in v1.2.86
func (ta *TransactionWithAuth) MinerScUpdateConfig(ip *InputMap) (err error)
func (*TransactionWithAuth) MinerScUpdateGlobals ¶ added in v1.2.86
func (ta *TransactionWithAuth) MinerScUpdateGlobals(ip *InputMap) (err error)
func (*TransactionWithAuth) Output ¶
func (ta *TransactionWithAuth) Output() []byte
func (*TransactionWithAuth) ReadPoolLock ¶
func (ta *TransactionWithAuth) ReadPoolLock(allocID, blobberID string, duration int64, lock uint64) (err error)
ReadPoolLock locks tokens for current user and given allocation, using given duration. If blobberID is not empty, then tokens will be locked for given allocation->blobber only.
func (*TransactionWithAuth) ReadPoolUnlock ¶
func (ta *TransactionWithAuth) ReadPoolUnlock() ( err error)
ReadPoolUnlock for current user and given pool.
func (*TransactionWithAuth) RegisterMultiSig ¶
func (ta *TransactionWithAuth) RegisterMultiSig(walletstr string, mswallet string) error
RegisterMultiSig register a multisig wallet with the SC.
func (*TransactionWithAuth) Send ¶
func (ta *TransactionWithAuth) Send(toClientID string, val uint64, desc string) error
func (*TransactionWithAuth) SetTransactionCallback ¶
func (ta *TransactionWithAuth) SetTransactionCallback(cb TransactionCallback) error
func (*TransactionWithAuth) SetTransactionHash ¶
func (ta *TransactionWithAuth) SetTransactionHash(hash string) error
func (*TransactionWithAuth) SetTransactionNonce ¶ added in v1.8.3
func (ta *TransactionWithAuth) SetTransactionNonce(txnNonce int64) error
func (*TransactionWithAuth) StakePoolLock ¶
func (ta *TransactionWithAuth) StakePoolLock(providerId string, providerType Provider, lock uint64) error
StakePoolLock used to lock tokens in a stake pool of a blobber.
func (*TransactionWithAuth) StakePoolUnlock ¶
func (ta *TransactionWithAuth) StakePoolUnlock(providerId string, providerType Provider) error
StakePoolUnlock by blobberID
func (*TransactionWithAuth) StorageSCCollectReward ¶ added in v1.7.1
func (ta *TransactionWithAuth) StorageSCCollectReward(providerId string, providerType Provider) error
func (*TransactionWithAuth) StorageScUpdateConfig ¶ added in v1.2.86
func (ta *TransactionWithAuth) StorageScUpdateConfig(ip *InputMap) (err error)
func (*TransactionWithAuth) StoreData ¶
func (ta *TransactionWithAuth) StoreData(data string) error
func (*TransactionWithAuth) UpdateAllocation ¶
func (ta *TransactionWithAuth) UpdateAllocation(allocID string, sizeDiff int64, expirationDiff int64, lock uint64) (err error)
UpdateAllocation transaction.
func (*TransactionWithAuth) UpdateBlobberSettings ¶
func (ta *TransactionWithAuth) UpdateBlobberSettings(blob *Blobber) ( err error)
UpdateBlobberSettings update settings of a blobber.
func (*TransactionWithAuth) UpdateValidatorSettings ¶ added in v1.8.5
func (ta *TransactionWithAuth) UpdateValidatorSettings(v *Validator) ( err error)
UpdateValidatorSettings update settings of a validator.
func (*TransactionWithAuth) Verify ¶
func (ta *TransactionWithAuth) Verify() error
func (*TransactionWithAuth) VestingAdd ¶
func (ta *TransactionWithAuth) VestingAdd(ar *VestingAddRequest, value uint64) (err error)
func (*TransactionWithAuth) VestingDelete ¶
func (ta *TransactionWithAuth) VestingDelete(poolID string) (err error)
func (*TransactionWithAuth) VestingStop ¶
func (ta *TransactionWithAuth) VestingStop(sr *VestingStopRequest) (err error)
func (*TransactionWithAuth) VestingTrigger ¶
func (ta *TransactionWithAuth) VestingTrigger(poolID string) (err error)
func (*TransactionWithAuth) VestingUnlock ¶
func (ta *TransactionWithAuth) VestingUnlock(poolID string) (err error)
func (*TransactionWithAuth) VestingUpdateConfig ¶
func (ta *TransactionWithAuth) VestingUpdateConfig(ip *InputMap) (err error)
func (*TransactionWithAuth) WritePoolLock ¶
func (ta *TransactionWithAuth) WritePoolLock(allocID, blobberID string, duration int64, lock uint64) (err error)
WritePoolLock locks tokens for current user and given allocation, using given duration. If blobberID is not empty, then tokens will be locked for given allocation->blobber only.
func (*TransactionWithAuth) WritePoolUnlock ¶
func (ta *TransactionWithAuth) WritePoolUnlock(allocID string) (err error)
WritePoolUnlock for current user and given pool.
func (*TransactionWithAuth) ZCNSCAddAuthorizer ¶ added in v1.7.9
func (ta *TransactionWithAuth) ZCNSCAddAuthorizer(ip *AddAuthorizerPayload) (err error)
func (*TransactionWithAuth) ZCNSCAuthorizerHealthCheck ¶ added in v1.8.14
func (ta *TransactionWithAuth) ZCNSCAuthorizerHealthCheck(ip *AuthorizerHealthCheckPayload) (err error)
func (*TransactionWithAuth) ZCNSCCollectReward ¶ added in v1.11.8
func (ta *TransactionWithAuth) ZCNSCCollectReward(providerId string, providerType Provider) error
func (*TransactionWithAuth) ZCNSCDeleteAuthorizer ¶ added in v1.8.9
func (ta *TransactionWithAuth) ZCNSCDeleteAuthorizer(ip *DeleteAuthorizerPayload) (err error)
func (*TransactionWithAuth) ZCNSCUpdateAuthorizerConfig ¶ added in v1.7.1
func (ta *TransactionWithAuth) ZCNSCUpdateAuthorizerConfig(ip *AuthorizerNode) (err error)
func (*TransactionWithAuth) ZCNSCUpdateGlobalConfig ¶ added in v1.7.1
func (ta *TransactionWithAuth) ZCNSCUpdateGlobalConfig(ip *InputMap) (err error)
type TxnFeeOption ¶ added in v1.11.0
type TxnFeeOption struct {
// contains filtered or unexported fields
}
type Validator ¶ added in v1.8.5
type Validator struct { ID common.Key `json:"id"` BaseURL string `json:"url"` StakePoolSettings StakePoolSettings `json:"stake_pool_settings"` }
type VestingAddRequest ¶
type VestingClientList ¶
type VestingDest ¶
type VestingDestInfo ¶
type VestingDestInfo struct { ID common.Key `json:"id"` // identifier Wanted common.Balance `json:"wanted"` // wanted amount for entire period Earned common.Balance `json:"earned"` // can unlock Vested common.Balance `json:"vested"` // already vested Last common.Timestamp `json:"last"` // last time unlocked }
type VestingPoolInfo ¶
type VestingPoolInfo struct { ID common.Key `json:"pool_id"` // pool ID Balance common.Balance `json:"balance"` // real pool balance Left common.Balance `json:"left"` // owner can unlock Description string `json:"description"` // description StartTime common.Timestamp `json:"start_time"` // from ExpireAt common.Timestamp `json:"expire_at"` // until Destinations []*VestingDestInfo `json:"destinations"` // receivers ClientID common.Key `json:"client_id"` // owner }
type VestingSCConfig ¶
type VestingStopRequest ¶
type WalletCallback ¶
WalletCallback needs to be implemented for wallet creation.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Utilities to interact with ethereum wallet.
|
Utilities to interact with ethereum wallet. |
AUTOGENERATED! Do not use.
|
AUTOGENERATED! Do not use. |