zcncore

package
v1.18.6 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 46 Imported by: 9

Documentation

Overview

Contains sub-packages and modules for managing users' wallets and issuing transactions.

Index

Constants

View Source
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`

	GET_MINT_NONCE = `/v1/mint_nonce`

	GET_MINERSC_NODE     = "/nodeStat"
	GET_MINERSC_POOL     = "/nodePoolStat"
	GET_MINERSC_USER     = "/getUserPools"
	GET_MINERSC_MINERS   = "/getMinerList"
	GET_MINERSC_SHARDERS = "/getSharderList"
)
View Source
const (
	StorageSmartContractAddress = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d7`
	FaucetSmartContractAddress  = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d3`
	MinerSmartContractAddress   = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712d9`
	ZCNSCSmartContractAddress   = `6dba10422e368813802877a85039d3985d96760ed844092319743fb3a76712e0`
)
View Source
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
)
View Source
const TOKEN_UNIT int64 = 1e10

Variables

View Source
var AddSignature = func(privateKey, signature string, hash string) (string, error) {
	var (
		ss  = zcncrypto.NewSignatureScheme(client.SignatureScheme())
		err error
	)

	err = ss.SetPrivateKey(privateKey)
	if err != nil {
		return "", err
	}

	return ss.Add(signature, hash)
}
View Source
var AvailableRestrictions = map[string][]string{
	"token_transfers": {"transfer"},
	"allocation_file_operations": {
		"read_redeem",
		"commit_connection",
	},
	"allocation_storage_operations": {
		"new_allocation_request",
		"update_allocation_request",
		"finalize_allocation",
		"cancel_allocation",
		"add_free_storage_assigner",
		"free_allocation_request",
	},
	"allocation_token_operations": {
		"read_pool_lock",
		"read_pool_unlock",
		"write_pool_lock",
	},
	"storage_rewards": {
		"collect_reward",
		"stake_pool_lock",
		"stake_pool_unlock",
	},
	"storage_operations": {
		"challenge_response",
		"add_validator",
		"add_blobber",
		"blobber_health_check",
		"validator_health_check",
	},
	"storage_management": {
		"kill_blobber",
		"kill_validator",
		"shutdown_blobber",
		"shutdown_validator",
		"update_blobber_settings",
		"update_validator_settings",
	},
	"miner_operations": {
		"add_miner",
		"add_sharder",
		"miner_health_check",
		"sharder_health_check",
		"contributeMpk",
		"shareSignsOrShares",
		"wait",
		"sharder_keep",
	},
	"miner_management_operations": {
		"delete_miner",
		"delete_sharder",
		"update_miner_settings",
		"kill_miner",
		"kill_sharder",
	},
	"miner_financial_operations": {
		"addToDelegatePool",
		"deleteFromDelegatePool",
		"collect_reward",
	},
	"token_bridging": {
		"mint",
		"burn",
	},
	"authorizer_management_operations": {
		"delete-authorizer",
	},
	"authorizer_operations": {
		"add-authorizer",
		"authorizer-health-check",
		"add-to-delegate-pool",
		"delete-from-delegate-pool",
	},
}

AvailableRestrictions represents supported restrictions mapping.

Functions

func AddHardfork added in v1.17.13

func AddHardfork(input interface{}, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func CallZauthDelete added in v1.17.0

func CallZauthDelete(serverAddr, token, clientID string) error

func CallZauthRetreiveKey added in v1.17.13

func CallZauthRetreiveKey(serverAddr, token, clientID, peerPublicKey string) (string, error)

func CallZauthRevoke added in v1.17.0

func CallZauthRevoke(serverAddr, token, clientID, peerPublicKey string) error

func CallZvaultDeletePrimaryKey added in v1.17.0

func CallZvaultDeletePrimaryKey(serverAddr, token, clientID string) error

func CallZvaultNewSplit added in v1.17.13

func CallZvaultNewSplit(serverAddr, token, clientID string) error

func CallZvaultNewWallet added in v1.17.13

func CallZvaultNewWallet(serverAddr, token string) error

func CallZvaultRetrieveKeys added in v1.17.0

func CallZvaultRetrieveKeys(serverAddr, token, clientID string) (string, error)

func CallZvaultRetrieveRestrictions added in v1.17.13

func CallZvaultRetrieveRestrictions(serverAddr, token, peerPublicKey string) (string, error)

func CallZvaultRetrieveSharedWallets added in v1.17.0

func CallZvaultRetrieveSharedWallets(serverAddr, token string) (string, error)

func CallZvaultRetrieveWallets added in v1.17.0

func CallZvaultRetrieveWallets(serverAddr, token string) (string, error)

func CallZvaultRevokeKey added in v1.17.0

func CallZvaultRevokeKey(serverAddr, token, clientID, publicKey string) error

func CallZvaultStoreKeyString added in v1.17.0

func CallZvaultStoreKeyString(serverAddr, token, privateKey string) error

func CallZvaultUpdateRestrictions added in v1.17.13

func CallZvaultUpdateRestrictions(serverAddr, token, clientID, peerPublicKey string, restrictions []string) error

func CheckConfig added in v1.7.1

func CheckConfig() error

func CheckEthHashStatus

func CheckEthHashStatus(hash string) int

CheckEthHashStatus - checking the status of ETH transaction possible values 0 or 1

func CloseLog

func CloseLog()

CloseLog closes log file

func ConvertToToken

func ConvertToToken(token int64) float64

ConvertToToken converts the SAS tokens to ZCN tokens

  • token: SAS tokens amount

func ConvertToValue

func ConvertToValue(token float64) uint64

ConvertToValue converts ZCN tokens to SAS tokens # Inputs

  • token: ZCN tokens

func ConvertTokenToUSD

func ConvertTokenToUSD(token float64) (float64, error)

ConvertTokenToUSD converts the ZCN tokens to USD amount

  • token: ZCN tokens amount

func ConvertUSDToToken

func ConvertUSDToToken(usd float64) (float64, error)

ConvertUSDToToken converts the USD amount to ZCN tokens

  • usd: USD amount

func ConvertZcnTokenToETH

func ConvertZcnTokenToETH(f float64) (float64, error)

ConvertZcnTokenToETH - converting Zcn tokens to Eth

  • f: ZCN tokens amount

func CreateWalletFromEthMnemonic

func CreateWalletFromEthMnemonic(mnemonic, password string, statusCb WalletCallback) error

CreateWalletFromEthMnemonic - creating new wallet from Eth mnemonics

func CreateWalletOffline added in v1.8.10

func CreateWalletOffline() (string, error)

CreateWalletOffline creates the wallet for the config signature scheme.

func CryptoJsDecrypt added in v1.8.11

func CryptoJsDecrypt(passphrase, encryptedMessage string) (string, error)

func CryptoJsEncrypt added in v1.8.11

func CryptoJsEncrypt(passphrase, message string) (string, error)

func Decrypt

func Decrypt(key, text string) (string, error)

Decrypt decrypts encrypted text using the key.

  • key: key to use for decryption
  • text: text to decrypt

func Encrypt

func Encrypt(key, text string) (string, error)

func EthToTokens

func EthToTokens(tokens float64) int64

TokensToEth - converting eth tokens to wei

func Faucet added in v1.17.13

func Faucet(tokens uint64, input string, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func GEthToTokens

func GEthToTokens(gwei float64) int64

func GTokensToEth

func GTokensToEth(tokens int64) float64

func GetEthBalance

func GetEthBalance(ethAddr string, cb GetBalanceCallback) error

GetEthBalance - getting back balance for ETH wallet

func GetEthClient

func GetEthClient() (*ethclient.Client, error)

func GetIdForUrl

func GetIdForUrl(url string) string

GetIdForUrl retrieve the ID of the network node (miner/sharder) given its url.

  • url: url of the node.

func GetLatestFinalizedMagicBlock

func GetLatestFinalizedMagicBlock() (m *block.MagicBlock, err error)

GetLatestFinalizedMagicBlock gets latest finalized magic block

  • numSharders: number of sharders
  • timeout: request timeout

func GetLogger

func GetLogger() *logger.Logger

GetLogger returns the logger instance

func GetMinerSCNodeInfo

func GetMinerSCNodeInfo(id string) ([]byte, 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) ([]byte, error)

GetMinerSCNodePool get miner smart contract node pool

  • id: the id of miner

func GetMinerSCUserInfo

func GetMinerSCUserInfo(clientID string) ([]byte, error)

GetMinerSCUserInfo retrieve user stake pools for the providers related to the Miner SC (miners/sharders).

  • clientID: user's wallet id

func GetMiners

func GetMiners(active, stakable bool, limit, offset int) ([]byte, error)

func GetMintNonce added in v1.8.15

func GetMintNonce() ([]byte, 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 GetNotProcessedZCNBurnTickets added in v1.8.15

func GetNotProcessedZCNBurnTickets(ethereumAddress, startNonce string) ([]byte, 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

func GetPublicEncryptionKey(mnemonic string) (string, error)

GetPublicEncryptionKey returns the public encryption key for the given mnemonic

func GetPublicEncryptionKeyV2 added in v1.18.6

func GetPublicEncryptionKeyV2(publicKey string) (string, error)

func GetSharders

func GetSharders(active, stakable bool, limit, offset int) ([]byte, error)

func GetUserLockedTotal added in v1.8.13

func GetUserLockedTotal(clientID string) (int64, error)

GetUserLockedTotal get total token user locked # Inputs

  • clientID wallet id

func GetWallet

func GetWallet(walletStr string) (*zcncrypto.Wallet, error)

GetWallet get a wallet object from a wallet string

func GetWalletAddrFromEthMnemonic

func GetWalletAddrFromEthMnemonic(mnemonic string) (string, error)

GetWalletAddrFromEthMnemonic - wallet ETH address from mnemoninnc

func IsEthTransactionVerified added in v1.8.11

func IsEthTransactionVerified(txHash string) (bool, error)

IsEthTransactionVerified checks if the transaction - given its hash - is verified on the ethereum network

  • txHash: transaction hash

func IsMnemonicValid deprecated

func IsMnemonicValid(mnemonic string) bool

Deprecated: Use zcncrypto.IsMnemonicValid() IsMnemonicValid is an utility function to check the mnemonic valid

# Inputs
-	mnemonic: mnemonics

func IsValidEthAddress

func IsValidEthAddress(ethAddr string) (bool, error)

IsValidEthAddress - multiple checks for valid ETH address

func MinerSCCollectReward added in v1.17.13

func MinerSCCollectReward(providerId string, providerType Provider, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerSCKill added in v1.17.13

func MinerSCKill(providerId string, providerType Provider, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerSCLock

func MinerSCLock(providerId string, providerType Provider, lock uint64, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerSCMinerSettings added in v1.17.13

func MinerSCMinerSettings(input *MinerSCMinerInfo, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerSCSharderSettings added in v1.17.13

func MinerSCSharderSettings(input *MinerSCMinerInfo, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerSCUnlock

func MinerSCUnlock(providerId string, providerType Provider, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerScUpdateConfig added in v1.17.13

func MinerScUpdateConfig(input interface{}, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func MinerScUpdateGlobals added in v1.17.13

func MinerScUpdateGlobals(input interface{}, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func RecoverOfflineWallet added in v1.8.5

func RecoverOfflineWallet(mnemonic string) (string, error)

RecoverOfflineWallet recovers the previously generated wallet using the mnemonic.

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 Send added in v1.17.13

func Send(toClientID string, tokens uint64, desc string, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func SetAuthUrl

func SetAuthUrl(url string) error

SetAuthUrl will be called by app to set zauth URL to SDK. # Inputs

  • url: the url of zAuth server

func SetLogFile

func SetLogFile(logFile string, verbose bool)

SetLogFile - sets file path to write log 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 SetWalletInfo

func SetWalletInfo(jsonWallet, sigScheme string, splitKeyWallet bool) error

SetWalletInfo should be set before any transaction or client specific APIs splitKeyWallet parameter is valid only if SignatureScheme is "BLS0Chain"

# Inputs
- jsonWallet: json format of wallet
{
"client_id":"30764bcba73216b67c36b05a17b4dd076bfdc5bb0ed84856f27622188c377269",
"client_key":"1f495df9605a4479a7dd6e5c7a78caf9f9d54e3a40f62a3dd68ed377115fe614d8acf0c238025f67a85163b9fbf31d10fbbb4a551d1cf00119897edf18b1841c",
"keys":[
	{"public_key":"1f495df9605a4479a7dd6e5c7a78caf9f9d54e3a40f62a3dd68ed377115fe614d8acf0c238025f67a85163b9fbf31d10fbbb4a551d1cf00119897edf18b1841c","private_key":"41729ed8d82f782646d2d30b9719acfd236842b9b6e47fee12b7bdbd05b35122"}
],
"mnemonics":"glare mistake gun joke bid spare across diagram wrap cube swear cactus cave repeat you brave few best wild lion pitch pole original wasp",
"version":"1.0",
"date_created":"1662534022",
"nonce":0
}

- 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 deprecated added in v1.7.9

func SignWith0Wallet(hash string, w *zcncrypto.Wallet) (string, error)

Deprecated: use Sign() method in zcncrypto.Wallet

func SignWithKey added in v1.12.1

func SignWithKey(privateKey, hash string) (string, error)

func SplitKeys

func SplitKeys(privateKey string, numSplits int) (string, error)

SplitKeys Split keys from the primary master key

func StorageSCCollectReward added in v1.17.13

func StorageSCCollectReward(providerId string, providerType Provider, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func StorageScUpdateConfig added in v1.17.13

func StorageScUpdateConfig(input interface{}, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func SuggestEthGasPrice

func SuggestEthGasPrice() (int64, error)

SuggestEthGasPrice - return back suggested price for gas

func TokensToEth

func TokensToEth(tokens int64) float64

TokensToEth - converting wei to eth tokens

func TransferEthTokens

func TransferEthTokens(fromPrivKey string, amountTokens, gasPrice int64) (string, error)

TransferEthTokens - transfer ETH tokens to multisign wallet

func ZCNSCAddAuthorizer added in v1.17.13

func ZCNSCAddAuthorizer(input *AddAuthorizerPayload, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZCNSCAuthorizerHealthCheck added in v1.17.13

func ZCNSCAuthorizerHealthCheck(input *AuthorizerHealthCheckPayload, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZCNSCCollectReward added in v1.17.13

func ZCNSCCollectReward(providerId string, providerType Provider, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZCNSCDeleteAuthorizer added in v1.17.13

func ZCNSCDeleteAuthorizer(input *DeleteAuthorizerPayload, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZCNSCUpdateAuthorizerConfig added in v1.17.13

func ZCNSCUpdateAuthorizerConfig(input *AuthorizerNode, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZCNSCUpdateGlobalConfig added in v1.17.13

func ZCNSCUpdateGlobalConfig(input *InputMap, client ...string) (hash, out string, nonce int64, txn *transaction.Transaction, err error)

func ZauthAuthCommon added in v1.17.0

func ZauthAuthCommon(serverAddr string) sys.AuthorizeFunc

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 {
	// OnSetupComplete 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 AuthMessage struct {
	Hash      string `json:"hash"`
	Signature string `json:"signature"`
	ClientID  string `json:"client_id"`
}

type AuthResponse added in v1.17.0

type AuthResponse struct {
	Sig string `json:"sig"`
}

type AuthorizerConfig added in v1.7.1

type AuthorizerConfig struct {
	Fee common.Balance `json:"fee"`
}

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 ConfirmationStatus added in v1.5.1

type ConfirmationStatus int

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 DelegatePool struct {
	Balance      int64  `json:"balance"`
	Reward       int64  `json:"reward"`
	Status       int    `json:"status"`
	RoundCreated int64  `json:"round_created"` // used for cool down
	DelegateID   string `json:"delegate_id"`
}

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 GetBalanceCallback

type GetBalanceCallback interface {
	OnBalanceAvailable(status int, value int64, info string)
}

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

type GetNonceCallback interface {
	OnNonceAvailable(status int, nonce int64, info string)
}

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 InputMap added in v1.2.86

type InputMap struct {
	Fields map[string]string `json:"Fields"`
}

InputMap represents a map of input fields.

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 MinerSCDelegatePoolInfo struct {
	ID         common.Key     `json:"id"`
	Balance    common.Balance `json:"balance"`
	Reward     common.Balance `json:"reward"`      // uncollected reread
	RewardPaid common.Balance `json:"reward_paid"` // total reward all time
	Status     string         `json:"status"`
}

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 MinerSCUserPoolsInfo

type MinerSCUserPoolsInfo struct {
	Pools map[string][]*MinerSCDelegatePoolInfo `json:"pools"`
}

MinerSCUserPoolsInfo represents the user stake pools information

type Node

type Node struct {
	Miner     Miner `json:"simple_miner"`
	StakePool `json:"stake_pool"`
}

Node represents a node (miner or sharder) in the network.

type Params

type Params map[string]string

func (Params) Query

func (p Params) Query() string

type PriceRange

type PriceRange struct {
	Min common.Balance `json:"min"`
	Max common.Balance `json:"max"`
}

PriceRange represents a price range allowed by user to filter blobbers.

type Provider added in v1.7.1

type Provider int

Provider represents the type of provider.

const (
	ProviderMiner Provider = iota + 1
	ProviderSharder
	ProviderBlobber
	ProviderValidator
	ProviderAuthorizer
)

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 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 StakePoolSettings struct {
	DelegateWallet *string  `json:"delegate_wallet,omitempty"`
	NumDelegates   *int     `json:"num_delegates,omitempty"`
	ServiceCharge  *float64 `json:"service_charge,omitempty"`
}

type Terms

type Terms struct {
	ReadPrice        common.Balance `json:"read_price"`  // tokens / GB
	WritePrice       common.Balance `json:"write_price"` // tokens / GB `
	MaxOfferDuration time.Duration  `json:"max_offer_duration"`
}

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 WalletCallback

type WalletCallback interface {
	OnWalletCreateComplete(status int, wallet string, err string)
}

WalletCallback needs to be implemented for wallet creation.

Directories

Path Synopsis
Utilities to interact with ethereum wallet.
Utilities to interact with ethereum wallet.

Jump to

Keyboard shortcuts

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