daemon

package
v0.0.0-...-910450c Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 5

Documentation

Overview

Package daemon provides a client that encapsulates RPC methods and endpoints that can be hit in a daemon.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockHeader

type BlockHeader struct {
	// BlockSize is the block size in bytes.
	//
	BlockSize uint64 `json:"block_size"`

	// BlockWeight TODO
	//
	BlockWeight uint64 `json:"block_weight"`

	// CumulativeDifficulty is the cumulative difficulty of all
	// blocks up to this one.
	//
	CumulativeDifficulty uint64 `json:"cumulative_difficulty"`

	// CumulativeDifficultyTop64 most significant 64 bits of the
	// 128-bit cumulative difficulty.
	//
	CumulativeDifficultyTop64 uint64 `json:"cumulative_difficulty_top64"`

	// Depth is the number of blocks succeeding this block on the
	// blockchain. (the larger this number, the oldest this block
	// is).
	//
	Depth uint64 `json:"depth"`

	// Difficulty is the difficulty that was set for mining this block.
	//
	Difficulty uint64 `json:"difficulty"`

	// DifficultyTop64 corresponds to the most significant 64-bit of
	// the 128-bit difficulty.
	//
	DifficultyTop64 uint64 `json:"difficulty_top64"`

	// Hash is the hash of this block.
	//
	Hash string `json:"hash"`

	// Height is the number of blocks preceding this block on the
	// blockchain.
	//
	Height uint64 `json:"height"`

	// LongTermWeight TODO
	//
	LongTermWeight uint64 `json:"long_term_weight"`

	// MajorVersion is the major version of the monero protocol at
	// this block height.
	//
	MajorVersion uint `json:"major_version"`

	// MinerTxHash TODO
	//
	MinerTxHash string `json:"miner_tx_hash"`

	// MinorVersion is the minor version of the monero protocol at
	// this block height.
	//
	MinorVersion uint `json:"minor_version"`

	// Nonce is the cryptographic random one-time number used in
	// mining this block.
	//
	Nonce uint64 `json:"nonce"`

	// NumTxes is the number of transactions in this block, not
	// counting the coinbase tx.
	//
	NumTxes uint `json:"num_txes"`

	// OrphanStatus indicates whether this block is part of the
	// longest chain or not (true == not part of it).
	//
	OrphanStatus bool `json:"orphan_status"`

	// PowHash TODO
	//
	PowHash string `json:"pow_hash"`

	// PrevHash is the hash of the block immediately preceding this
	// block in the chain.
	//
	PrevHash string `json:"prev_hash"`

	// Reward the amount of new atomic-units generated in this
	// block and rewarded to the miner (1XMR = 1e12 atomic units).
	//
	Reward uint64 `json:"reward"`

	// Timestamp is the unix timestamp at which the block was
	// recorded into the blockchain.
	//
	Timestamp int64 `json:"timestamp"`

	// WideCumulativeDifficulty is the cumulative difficulty of all
	// blocks in the blockchain as a hexadecimal string
	// representing a 128-bit number.
	//
	WideCumulativeDifficulty string `json:"wide_cumulative_difficulty"`

	// WideDifficulty is the network difficulty as a hexadecimal
	// string representing a 128-bit number.
	//
	WideDifficulty string `json:"wide_difficulty"`
}

type Client

type Client struct {
	Requester
}

Client provides access to the daemon's JSONRPC methods and regular endpoints.

func NewClient

func NewClient(c Requester) *Client

NewClient instantiates a new client for interacting with monero's daemon api.

func (*Client) GenerateBlocks

func (c *Client) GenerateBlocks(
	ctx context.Context, params GenerateBlocksRequestParameters,
) (*GenerateBlocksResult, error)

GenerateBlocks combines functionality from `GetBlockTemplate` and `SubmitBlock` RPC calls to allow rapid block creation.

Difficulty is set permanently to 1 for regtest.

(restricted).

func (*Client) GetAlternateChains

func (c *Client) GetAlternateChains(
	ctx context.Context,
) (*GetAlternateChainsResult, error)

GetAlternateChains displays alternative chains seen by the node.

(restricted).

func (*Client) GetBans

func (c *Client) GetBans(ctx context.Context) (*GetBansResult, error)

GetBans retrieves the list of banned IPs.

(restricted).

func (*Client) GetBlock

func (c *Client) GetBlock(
	ctx context.Context, params GetBlockRequestParameters,
) (*GetBlockResult, error)

GetBlock fetches full block information from a block at a particular hash OR height.

func (*Client) GetBlockCount

func (c *Client) GetBlockCount(
	ctx context.Context,
) (*GetBlockCountResult, error)

func (*Client) GetBlockHeaderByHash

func (c *Client) GetBlockHeaderByHash(
	ctx context.Context, hashes []string,
) (*GetBlockHeaderByHashResult, error)

GetBlockHeaderByHash retrieves block header information for either one or multiple blocks.

func (*Client) GetBlockHeaderByHeight

func (c *Client) GetBlockHeaderByHeight(
	ctx context.Context, height uint64,
) (*GetBlockHeaderByHeightResult, error)

GetBlockHeaderByHeight retrieves block header information for either one or multiple blocks.

func (*Client) GetBlockHeadersRange

func (c *Client) GetBlockHeadersRange(
	ctx context.Context, start, end uint64,
) (*GetBlockHeadersRangeResult, error)

func (*Client) GetBlockTemplate

func (c *Client) GetBlockTemplate(
	ctx context.Context, walletAddress string, reserveSize uint,
) (*GetBlockTemplateResult, error)

GetBlockTemplate gets a block template on which mining a new block.

func (*Client) GetCoinbaseTxSum

func (c *Client) GetCoinbaseTxSum(
	ctx context.Context, height, count uint64,
) (*GetCoinbaseTxSumResult, error)

func (*Client) GetConnections

func (c *Client) GetConnections(
	ctx context.Context,
) (*GetConnectionsResult, error)

func (*Client) GetFeeEstimate

func (c *Client) GetFeeEstimate(
	ctx context.Context, graceBlocks uint64,
) (*GetFeeEstimateResult, error)

func (*Client) GetHeight

func (c *Client) GetHeight(ctx context.Context) (*GetHeightResult, error)

func (*Client) GetInfo

func (c *Client) GetInfo(ctx context.Context) (*GetInfoResult, error)

GetInfo retrieves general information about the state of the node and the network.

func (*Client) GetLastBlockHeader

func (c *Client) GetLastBlockHeader(
	ctx context.Context,
) (*GetLastBlockHeaderResult, error)

func (*Client) GetLimit

func (c *Client) GetLimit(ctx context.Context) (*GetLimitResult, error)

func (*Client) GetMinerData

func (c *Client) GetMinerData(ctx context.Context) (*GetMinerDataResult, error)

func (*Client) GetNetStats

func (c *Client) GetNetStats(ctx context.Context) (*GetNetStatsResult, error)

func (*Client) GetOIndexes

func (c *Client) GetOIndexes(
	ctx context.Context, txid string,
) (indexes []uint64, finalError error)

func (*Client) GetOuts

func (c *Client) GetOuts(
	ctx context.Context, outputs []uint, gettxid bool,
) (*GetOutsResult, error)

func (*Client) GetPeerList

func (c *Client) GetPeerList(
	ctx context.Context,
) (*GetPeerListResult, error)

func (*Client) GetPublicNodes

func (c *Client) GetPublicNodes(
	ctx context.Context, params GetPublicNodesRequestParameters,
) (*GetPublicNodesResult, error)

func (*Client) GetTransactionPool

func (c *Client) GetTransactionPool(
	ctx context.Context,
) (*GetTransactionPoolResult, error)

func (*Client) GetTransactionPoolStats

func (c *Client) GetTransactionPoolStats(
	ctx context.Context,
) (*GetTransactionPoolStatsResult, error)

func (*Client) GetTransactions

func (c *Client) GetTransactions(
	ctx context.Context, txns []string,
) (*GetTransactionsResult, error)

func (*Client) GetVersion

func (c *Client) GetVersion(ctx context.Context) (*GetVersionResult, error)

GetVersion retrieves the version of monerod that the node uses.

(restricted).

func (*Client) HardForkInfo

func (c *Client) HardForkInfo(
	ctx context.Context,
) (*HardForkInfoResult, error)

HardForkInfo looks up informaiton about the last hard fork.

func (*Client) MiningStatus

func (c *Client) MiningStatus(
	ctx context.Context,
) (*MiningStatusResult, error)

func (*Client) OnGetBlockHash

func (c *Client) OnGetBlockHash(
	ctx context.Context, height uint64,
) (string, error)

func (*Client) RPCAccessTracking

func (c *Client) RPCAccessTracking(
	ctx context.Context,
) (*RPCAccessTrackingResult, error)

RPCAccessTracking retrieves statistics that the monero daemon keeps track of about the use of each RPC method and endpoint.

(restricted).

func (*Client) RelayTx

func (c *Client) RelayTx(
	ctx context.Context, txns []string,
) (*RelayTxResult, error)

func (*Client) SetBans

func (c *Client) SetBans(
	ctx context.Context, params SetBansRequestParameters,
) (*SetBansResult, error)

SetBans bans a particular host.

(restricted).

func (*Client) SetLimit

func (c *Client) SetLimit(
	ctx context.Context, params SetLimitRequestParameters,
) (*SetLimitResult, error)

func (*Client) SetLogCategories

func (c *Client) SetLogCategories(
	ctx context.Context, params SetLogCategoriesRequestParameters,
) (*SetLogCategoriesResult, error)

func (*Client) SetLogLevel

func (c *Client) SetLogLevel(
	ctx context.Context, params SetLogLevelRequestParameters,
) (*SetLogLevelResult, error)

func (*Client) StartMining

func (c *Client) StartMining(
	ctx context.Context, params StartMiningRequestParameters,
) (*StartMiningResult, error)

func (*Client) StopMining

func (c *Client) StopMining(
	ctx context.Context,
) (*StopMiningResult, error)

func (*Client) SubmitBlock

func (c *Client) SubmitBlock(ctx context.Context, blobs ...[]byte) (*SubmitBlockResult, error)

func (*Client) SyncInfo

func (c *Client) SyncInfo(ctx context.Context) (*SyncInfoResult, error)

type GenerateBlocksRequestParameters

type GenerateBlocksRequestParameters struct {
	// AmountOfBlocks is the number of blocks to be generated.
	//
	AmountOfBlocks uint64 `json:"amount_of_blocks,omitempty"`

	// WalletAddress is the address of the wallet that will get the rewards
	// of the coinbase transaction for such the blocks generates.
	//
	WalletAddress string `json:"wallet_address,omitempty"`

	// PreviousBlock TODO
	//
	PreviousBlock string `json:"prev_block,omitempty"`

	// StartingNonce TODO
	//
	StartingNonce uint32 `json:"starting_nonce,omitempty"`
}

GenerateBlocksRequestParameters is the set of parameters to be passed to the GenerateBlocks RPC method.

type GenerateBlocksResult

type GenerateBlocksResult struct {
	Blocks []string `json:"blocks"`
	Height int      `json:"height"`

	RPCResultFooter `json:",inline"`
}

GenerateBlocksResult is the result of a call to the GenerateBlocks RPC method.

type GetAlternateChainsResult

type GetAlternateChainsResult struct {
	// Chains is the array of alternate chains seen by the node.
	//
	Chains []struct {
		// BlockHash is the hash of the first diverging block of this
		// alternative chain.
		//
		BlockHash string `json:"block_hash"`

		// BlockHashes TODO
		//
		BlockHashes []string `json:"block_hashes"`

		// Difficulty is the cumulative difficulty of all blocks in the
		// alternative chain.
		//
		Difficulty int64 `json:"difficulty"`

		// DifficultyTop64 is the most-significant 64 bits of the
		// 128-bit network difficulty.
		//
		DifficultyTop64 int `json:"difficulty_top64"`

		// Height is the block height of the first diverging block of
		// this alternative chain.
		//
		Height uint64 `json:"height"`

		// Length is the length in blocks of this alternative chain,
		// after divergence.
		//
		Length uint64 `json:"length"`

		// MainChainParentBlock TODO
		//
		MainChainParentBlock string `json:"main_chain_parent_block"`

		// WideDifficulty is the network difficulty as a hexadecimal
		// string representing a 128-bit number.
		//
		WideDifficulty string `json:"wide_difficulty"`
	} `json:"chains"`

	RPCResultFooter `json:",inline"`
}

GetAlternateChainsResult is the result of a call to the GetAlternateChains RPC method.

type GetBansResult

type GetBansResult struct {
	// Bans contains the list of nodes banned by this node.
	//
	Bans []struct {
		// Host is the string representation of the node that is
		// banned.
		//
		Host string `json:"host"`

		// IP is the integer representation of the host banned.
		//
		IP int `json:"ip"`

		// Seconds represents how many seconds are left for the ban to
		// be lifted.
		//
		Seconds uint `json:"seconds"`
	} `json:"bans"`

	RPCResultFooter `json:",inline"`
}

GetBansResult is the result of a call to the GetBans RPC method.

type GetBlockCountResult

type GetBlockCountResult struct {
	Count uint64 `json:"count"`

	RPCResultFooter `json:",inline"`
}

GetBlockCountResult is the result of a call to the GetBlockCount RPC method.

type GetBlockHeaderByHashResult

type GetBlockHeaderByHashResult struct {
	BlockHeader  BlockHeader   `json:"block_header"`
	BlockHeaders []BlockHeader `json:"block_headers"`

	RPCResultFooter `json:",inline"`
}

GetBlockHeaderByHashResult is the result of a call to the GetBlockHeaderByHash RPC method.

type GetBlockHeaderByHeightResult

type GetBlockHeaderByHeightResult struct {
	BlockHeader BlockHeader `json:"block_header"`

	RPCResultFooter `json:",inline"`
}

GetBlockHeaderByHeightResult is the result of a call to the GetBlockHeaderByHeight RPC method.

type GetBlockHeadersRangeResult

type GetBlockHeadersRangeResult struct {
	Headers []BlockHeader `json:"headers"`

	RPCResultFooter `json:",inline"`
}

GetBlockHeadersRangeResult is the result of a call to the GetBlockHeadersRange RPC method.

type GetBlockRequestParameters

type GetBlockRequestParameters struct {
	Height uint64 `json:"height,omitempty"`
	Hash   string `json:"hash,omitempty"`
}

GetBlockRequestParameters represents the set of possible parameters that can be used for submitting a call to the `get_block` jsonrpc method.

type GetBlockResult

type GetBlockResult struct {
	// Blob is a hexadecimal representation of the block.
	//
	Blob string `json:"blob"`

	// BlockHeader contains the details from the block header.
	//
	BlockHeader BlockHeader `json:"block_header"`

	// JSON is a json representation of the block - see
	// `GetBlockResultJSON`.
	//
	JSON string `json:"json"`

	// MinerTxHash is the hash of the coinbase transaction
	//
	MinerTxHash string `json:"miner_tx_hash"`

	RPCResultFooter `json:",inline"`
}

GetBlockResult is the result of a call to the GetBlock RPC method.

func (*GetBlockResult) InnerJSON

func (j *GetBlockResult) InnerJSON() (*GetBlockResultJSON, error)

InnerJSON parses the content of the JSON embedded in `GetBlockResult`.

type GetBlockResultJSON

type GetBlockResultJSON struct {
	// MajorVersion (same as in the block header)
	//
	MajorVersion uint `json:"major_version"`

	// MinorVersion (same as in the block header)
	//
	MinorVersion uint `json:"minor_version"`

	// Timestamp (same as in the block header)
	//
	Timestamp uint64 `json:"timestamp"`

	// PrevID (same as `block_hash` in the block header)
	//
	PrevID string `json:"prev_id"`

	// Nonce (same as in the block header)
	//
	Nonce int `json:"nonce"`

	// MinerTx contains the miner transaction information.
	//
	MinerTx struct {
		// Version is the transaction version number
		//
		Version int `json:"version"`

		// UnlockTime is the block height when the coinbase transaction
		// becomes spendable.
		//
		UnlockTime int `json:"unlock_time"`

		// Vin lists the transaction inputs.
		//
		Vin []struct {
			Gen struct {
				Height int `json:"height"`
			} `json:"gen"`
		} `json:"vin"`

		// Vout lists the transaction outputs.
		//
		Vout []struct {
			Amount uint64 `json:"amount"`
			Target struct {
				Key string `json:"key"`
			} `json:"target"`
		} `json:"vout"`
		// Extra (aka the transaction id) can be used to include any
		// random 32byte/64char hex string.
		//
		Extra []int `json:"extra"`

		// RctSignatures contain the signatures of tx signers.
		//
		// ps.: coinbase txs DO NOT have signatures.
		//
		RctSignatures struct {
			Type int `json:"type"`
		} `json:"rct_signatures"`
	} `json:"miner_tx"`

	// TxHashes is the list of hashes of non-coinbase transactions in the
	// block.
	//
	TxHashes []string `json:"tx_hashes"`
}

GetBlockResultJSON is the internal json-formatted block information.

func (*GetBlockResultJSON) MinerOutputs

func (c *GetBlockResultJSON) MinerOutputs() uint64

type GetBlockTemplateResult

type GetBlockTemplateResult struct {
	// BlockhashingBlob is the blob on which to try to find a valid nonce.
	//
	BlockhashingBlob string `json:"blockhashing_blob"`

	// BlocktemplateBlob is the blob on which to try to mine a new block.
	//
	BlocktemplateBlob string `json:"blocktemplate_blob"`

	// Difficulty is the difficulty of the next block.
	Difficulty int64 `json:"difficulty"`

	// ExpectedReward is the coinbase reward expected to be received if the
	// block is successfully mined.
	//
	ExpectedReward int64 `json:"expected_reward"`

	// Height is the height on which to mine.
	//
	Height int `json:"height"`

	// PrevHash is the hash of the most recent block on which to mine the
	// next block.
	//
	PrevHash string `json:"prev_hash"`

	// ReservedOffset TODO
	//
	ReservedOffset int `json:"reserved_offset"`

	RPCResultFooter `json:",inline"`
}

GetBlockTemplateResult is the result of a call to the GetBlockTemplate RPC method.

type GetCoinbaseTxSumResult

type GetCoinbaseTxSumResult struct {
	EmissionAmount      int64  `json:"emission_amount"`
	EmissionAmountTop64 int    `json:"emission_amount_top64"`
	FeeAmount           int    `json:"fee_amount"`
	FeeAmountTop64      int    `json:"fee_amount_top64"`
	WideEmissionAmount  string `json:"wide_emission_amount"`
	WideFeeAmount       string `json:"wide_fee_amount"`

	RPCResultFooter `json:",inline"`
}

GetCoinbaseTxSumResult is the result of a call to the GetCoinbaseTxSum RPC method.

type GetConnectionsResult

type GetConnectionsResult struct {
	Connections []struct {
		Address         string `json:"address"`
		AvgDownload     uint64 `json:"avg_download"`
		AvgUpload       uint64 `json:"avg_upload"`
		ConnectionID    string `json:"connection_id"`
		CurrentDownload uint64 `json:"current_download"`
		CurrentUpload   uint64 `json:"current_upload"`
		Height          uint64 `json:"height"`
		Host            string `json:"host"`
		Incoming        bool   `json:"incoming"`
		IP              string `json:"ip"`
		LiveTime        uint64 `json:"live_time"`
		LocalIP         bool   `json:"local_ip"`
		Localhost       bool   `json:"localhost"`
		PeerID          string `json:"peer_id"`
		Port            string `json:"port"`
		RecvCount       uint64 `json:"recv_count"`
		RecvIdleTime    uint64 `json:"recv_idle_time"`
		SendCount       uint64 `json:"send_count"`
		SendIdleTime    uint64 `json:"send_idle_time"`
		State           string `json:"state"`
		SupportFlags    uint64 `json:"support_flags"`
	} `json:"connections"`

	RPCResultFooter `json:",inline"`
}

GetConnectionsResult is the result of a call to the GetConnections RPC method.

type GetFeeEstimateResult

type GetFeeEstimateResult struct {
	// Fee is the per kB fee estimate.
	//
	Fee int `json:"fee"`

	// QuantizationMask indicates that the  fee should be rounded up to an
	// even multiple of this value.
	//
	QuantizationMask int `json:"quantization_mask"`

	RPCResultFooter `json:",inline"`
}

GetFeeEstimateResult is the result of a call to the GetFeeEstimate RPC method.

type GetHeightResult

type GetHeightResult struct {
	Hash   string `json:"hash"`
	Height uint64 `json:"height"`

	RPCResultFooter `json:",inline"`
}

GetHeightResult is the result of a call to the GetHeight RPC method.

type GetInfoResult

type GetInfoResult struct {
	AdjustedTime              uint64 `json:"adjusted_time"`
	AltBlocksCount            int    `json:"alt_blocks_count"`
	BlockSizeLimit            uint64 `json:"block_size_limit"`
	BlockSizeMedian           uint64 `json:"block_size_median"`
	BlockWeightLimit          uint64 `json:"block_weight_limit"`
	BlockWeightMedian         uint64 `json:"block_weight_median"`
	BootstrapDaemonAddress    string `json:"bootstrap_daemon_address"`
	BusySyncing               bool   `json:"busy_syncing"`
	CumulativeDifficulty      int64  `json:"cumulative_difficulty"`
	CumulativeDifficultyTop64 uint64 `json:"cumulative_difficulty_top64"`
	DatabaseSize              uint64 `json:"database_size"`
	Difficulty                uint64 `json:"difficulty"`
	DifficultyTop64           uint64 `json:"difficulty_top64"`
	FreeSpace                 uint64 `json:"free_space"`
	GreyPeerlistSize          uint   `json:"grey_peerlist_size"`
	Height                    uint64 `json:"height"`
	HeightWithoutBootstrap    uint64 `json:"height_without_bootstrap"`
	IncomingConnectionsCount  uint   `json:"incoming_connections_count"`
	Mainnet                   bool   `json:"mainnet"`
	Nettype                   string `json:"nettype"`
	Offline                   bool   `json:"offline"`
	OutgoingConnectionsCount  uint   `json:"outgoing_connections_count"`
	RPCConnectionsCount       uint   `json:"rpc_connections_count"`
	Stagenet                  bool   `json:"stagenet"`
	StartTime                 uint64 `json:"start_time"`
	Synchronized              bool   `json:"synchronized"`
	Target                    uint64 `json:"target"`
	TargetHeight              uint64 `json:"target_height"`
	Testnet                   bool   `json:"testnet"`
	TopBlockHash              string `json:"top_block_hash"`
	TxCount                   uint64 `json:"tx_count"`
	TxPoolSize                uint64 `json:"tx_pool_size"`
	UpdateAvailable           bool   `json:"update_available"`
	Version                   string `json:"version"`
	WasBootstrapEverUsed      bool   `json:"was_bootstrap_ever_used"`
	WhitePeerlistSize         uint   `json:"white_peerlist_size"`
	WideCumulativeDifficulty  string `json:"wide_cumulative_difficulty"`
	WideDifficulty            string `json:"wide_difficulty"`

	RPCResultFooter `json:",inline"`
}

GetInfoResult is the result of a call to the GetInfo RPC method.

type GetLastBlockHeaderResult

type GetLastBlockHeaderResult struct {
	BlockHeader BlockHeader `json:"block_header"`

	RPCResultFooter `json:",inline"`
}

GetLastBlockHeaderResult is the result of a call to the GetLastBlockHeader RPC method.

type GetLimitResult

type GetLimitResult struct {
	// LimitUp is the upload limit in kB/s
	//
	LimitUp uint64 `json:"limit_up"`
	// LimitDown is the download limit in kB/s
	//
	LimitDown uint64 `json:"limit_down"`

	RPCResultFooter `json:",inline"`
}

type GetMinerDataResult

type GetMinerDataResult struct {
	MajorVersion          uint8  `json:"major_version"`
	Height                uint64 `json:"height"`
	PrevId                string `json:"prev_id"`
	SeedHash              string `json:"seed_hash"`
	Difficulty            string `json:"difficulty"`
	MedianWeight          uint64 `json:"median_weight"`
	AlreadyGeneratedCoins uint64 `json:"already_generated_coins"`
	MedianTimestamp       uint64 `json:"median_timestamp"`
	TxBacklog             []struct {
		Id       string `json:"id"`
		BlobSize uint64 `json:"blob_size"`
		Weight   uint64 `json:"weight"`
		Fee      uint64 `json:"fee"`
	} `json:"tx_backlog"`
}

GetMinerDataResult is the result of a call to the GetMinerData RPC method.

type GetNetStatsResult

type GetNetStatsResult struct {
	StartTime       int64  `json:"start_time"`
	TotalBytesIn    uint64 `json:"total_bytes_in"`
	TotalBytesOut   uint64 `json:"total_bytes_out"`
	TotalPacketsIn  uint64 `json:"total_packets_in"`
	TotalPacketsOut uint64 `json:"total_packets_out"`

	RPCResultFooter `json:",inline"`
}

GetNetStatsResult is the result of a call to the GetNetStats RPC method.

type GetOutsResult

type GetOutsResult struct {
	Outs []struct {
		Height   uint64 `json:"height"`
		Key      string `json:"key"`
		Mask     string `json:"mask"`
		Txid     string `json:"txid"`
		Unlocked bool   `json:"unlocked"`
	} `json:"outs"`

	RPCResultFooter `json:",inline"`
}

type GetPeerListResult

type GetPeerListResult struct {
	GrayList  []Peer `json:"gray_list"`
	WhiteList []Peer `json:"white_list"`

	RPCResultFooter `json:",inline"`
}

GetPeerListResult is the result of a call to the GetPeerList RPC method.

type GetPublicNodesRequestParameters

type GetPublicNodesRequestParameters struct {
	Gray           bool `json:"gray"`
	White          bool `json:"white"`
	IncludeBlocked bool `json:"include_blocked"`
}

type GetPublicNodesResult

type GetPublicNodesResult struct {
	WhiteList []Peer `json:"white"`
	GrayList  []Peer `json:"gray"`

	RPCResultFooter `json:",inline"`
}

GetPublicNodesResult is the result of a call to the GetPublicNodes RPC method.

type GetTransactionPoolResult

type GetTransactionPoolResult struct {
	Credits        int `json:"credits"`
	SpentKeyImages []struct {
		IDHash    string   `json:"id_hash"`
		TxsHashes []string `json:"txs_hashes"`
	} `json:"spent_key_images"`
	Status       string `json:"status"`
	TopHash      string `json:"top_hash"`
	Transactions []struct {
		BlobSize           uint64 `json:"blob_size"`
		DoNotRelay         bool   `json:"do_not_relay"`
		DoubleSpendSeen    bool   `json:"double_spend_seen"`
		Fee                uint64 `json:"fee"`
		IDHash             string `json:"id_hash"`
		KeptByBlock        bool   `json:"kept_by_block"`
		LastFailedHeight   uint64 `json:"last_failed_height"`
		LastFailedIDHash   string `json:"last_failed_id_hash"`
		LastRelayedTime    uint64 `json:"last_relayed_time"`
		MaxUsedBlockHeight uint64 `json:"max_used_block_height"`
		MaxUsedBlockIDHash string `json:"max_used_block_id_hash"`
		ReceiveTime        int64  `json:"receive_time"`
		Relayed            bool   `json:"relayed"`
		TxBlob             string `json:"tx_blob"`
		TxJSON             string `json:"tx_json"`
		Weight             uint64 `json:"weight"`
	} `json:"transactions"`
	Untrusted bool `json:"untrusted"`
}

type GetTransactionPoolStatsResult

type GetTransactionPoolStatsResult struct {
	PoolStats struct {
		BytesMax   uint64 `json:"bytes_max"`
		BytesMed   uint64 `json:"bytes_med"`
		BytesMin   uint64 `json:"bytes_min"`
		BytesTotal uint64 `json:"bytes_total"`
		FeeTotal   uint64 `json:"fee_total"`
		Histo      []struct {
			Bytes uint64 `json:"bytes"`
			Txs   uint64 `json:"txs"`
		} `json:"histo"`
		Histo98Pc       uint64 `json:"histo_98pc"`
		Num10M          uint64 `json:"num_10m"`
		NumDoubleSpends uint64 `json:"num_double_spends"`
		NumFailing      uint64 `json:"num_failing"`
		NumNotRelayed   uint64 `json:"num_not_relayed"`
		Oldest          int64  `json:"oldest"`
		TxsTotal        uint64 `json:"txs_total"`
	} `json:"pool_stats"`

	RPCResultFooter `json:",inline"`
}

GetTransactionPoolStatsResult is the result of a call to the GetTransactionPoolStats RPC method.

type GetTransactionsResult

type GetTransactionsResult struct {
	Credits   int                                `json:"credits"`
	Status    string                             `json:"status"`
	TopHash   string                             `json:"top_hash"`
	Txs       []GetTransactionsResultTransaction `json:"txs"`
	TxsAsHex  []string                           `json:"txs_as_hex"`
	Untrusted bool                               `json:"untrusted"`
}

func (*GetTransactionsResult) GetTransactions

func (r *GetTransactionsResult) GetTransactions() ([]*TransactionJSON, error)

type GetTransactionsResultTransaction

type GetTransactionsResultTransaction struct {
	AsHex           string `json:"as_hex"`
	AsJSON          string `json:"as_json"`
	BlockHeight     uint64 `json:"block_height"`
	BlockTimestamp  int64  `json:"block_timestamp"`
	DoubleSpendSeen bool   `json:"double_spend_seen"`
	InPool          bool   `json:"in_pool"`
	OutputIndices   []int  `json:"output_indices"`
	PrunableAsHex   string `json:"prunable_as_hex"`
	PrunableHash    string `json:"prunable_hash"`
	PrunedAsHex     string `json:"pruned_as_hex"`
	TxHash          string `json:"tx_hash"`
}

type GetVersionResult

type GetVersionResult struct {
	Release bool   `json:"release"`
	Version uint64 `json:"version"`

	RPCResultFooter `json:",inline"`
}

GetVersionResult is the result of a call to the GetVersion RPC method.

type HardForkInfoResult

type HardForkInfoResult struct {
	// EarliestHeight is the earliest height at which <version> is allowed.
	//
	EarliestHeight int `json:"earliest_height"`

	// Whether of not the hard fork is enforced.
	//
	Enabled bool `json:"enabled"`

	// State indicates the current hard fork state:
	//
	// 	0 - likely forked
	//	1 - update needed
	//	2 - ready
	//
	State int `json:"state"`

	// The number of votes required to enable <version>.
	//
	Threshold int `json:"threshold"`

	// Version (<version>) corresponds to the major block version for the
	// fork.
	//
	Version int `json:"version"`

	// Votes is the number of votes to enable <version>
	//
	Votes int `json:"votes"`

	// Voting indicates which version this node is voting for/using.
	//
	Voting int `json:"voting"`

	// Window is the size of the voting window.
	//
	Window int `json:"window"`

	RPCResultFooter `json:",inline"`
}

HardForkInfoResult is the result of a call to the HardForkInfo RPC method.

type MiningStatusResult

type MiningStatusResult struct {
	Active                    bool   `json:"active"`
	Address                   string `json:"address"`
	BgIdleThreshold           int    `json:"bg_idle_threshold"`
	BgIgnoreBattery           bool   `json:"bg_ignore_battery"`
	BgMinIdleSeconds          uint64 `json:"bg_min_idle_seconds"`
	BgTarget                  uint64 `json:"bg_target"`
	BlockReward               uint64 `json:"block_reward"`
	BlockTarget               uint64 `json:"block_target"`
	Difficulty                uint64 `json:"difficulty"`
	DifficultyTop64           uint64 `json:"difficulty_top64"`
	IsBackgroundMiningEnabled bool   `json:"is_background_mining_enabled"`
	PowAlgorithm              string `json:"pow_algorithm"`
	Speed                     uint64 `json:"speed"`
	ThreadsCount              uint64 `json:"threads_count"`
	WideDifficulty            string `json:"wide_difficulty"`

	RPCResultFooter `json:",inline"`
}

type Peer

type Peer struct {
	Host        string `json:"host"`
	ID          uint64 `json:"id"`
	IP          uint32 `json:"ip"`
	LastSeen    int64  `json:"last_seen"`
	Port        uint16 `json:"port"`
	PruningSeed uint32 `json:"pruning_seed"`
	RPCPort     uint16 `json:"rpc_port"`
}

type RPCAccessTrackingResult

type RPCAccessTrackingResult struct {
	Data []struct {
		// Count is the number of times that the monero daemon received
		// a request for this RPC method.
		//
		Count uint64 `json:"count"`

		// RPC is the name of the remote procedure call.
		//
		RPC string `json:"rpc"`

		// Time indicates how much time the daemon spent serving this
		// procedure.
		//
		Time uint64 `json:"time"`

		// Credits indicates the number of credits consumed for this
		// method.
		//
		Credits uint64 `json:"credits"`
	} `json:"data"`

	RPCResultFooter `json:",inline"`
}

AccessTrackingResult is the result of a call to the RPCAccessTracking RPC method.

type RPCResultFooter

type RPCResultFooter struct {
	// Status dictates whether the request worked or not. "OK" means good.
	//
	Status string `json:"status"`

	// States if the result is obtained using the bootstrap mode, and is
	// therefore not trusted (`true`), or when the daemon is fully synced
	// and thus handles the RPC locally (`false`).
	//
	Untrusted bool `json:"untrusted"`

	// Credits indicates the number of credits available to the requesting
	// client, if payment for RPC is enabled, otherwise, 0.
	//
	Credits uint64 `json:"credits,omitempty"`

	// TopHash is the hash of the highest block in the chain, If payment
	// for RPC is enabled, otherwise, empty.
	//
	TopHash string `json:"top_hash,omitempty"`
}

RPCResultFooter contains the set of fields that every RPC result message will contain.

type RelayTxResult

type RelayTxResult struct {
	RPCResultFooter `json:",inline"`
}

RelayTxResult is the result of a call to the RelayTx RPC method.

type Requester

type Requester interface {
	// JSONRPC is used for callind methods under `/json_rpc` that follow
	// monero's `v2` response and error encapsulation.
	//
	JSONRPC(
		ctx context.Context, method string, params, result interface{},
	) error

	// RawRequest is used for making a request to an arbitrary endpoint
	// `endpoint` whose response (in JSON format) should be unmarshalled to
	// `response`.
	//
	RawRequest(
		ctx context.Context,
		endpoint string,
		params interface{},
		response interface{},
	) error

	// RawBinaryRequest is used for making a request to an arbitrary endpoint
	// `endpoint` whose response will be returned (which MUST be closed in error = nil)
	//
	RawBinaryRequest(
		ctx context.Context,
		endpoint string,
		body io.Reader,
	) (io.ReadCloser, error)
}

Requester is responsible for making concrete request to Monero's endpoints, i.e., either `jsonrpc` methods or those "raw" endpoints.

type SetBansBan

type SetBansBan struct {
	Host    string `json:"host"`
	Ban     bool   `json:"ban"`
	Seconds int64  `json:"seconds"`
}

type SetBansRequestParameters

type SetBansRequestParameters struct {
	Bans []SetBansBan `json:"bans"`
}

type SetBansResult

type SetBansResult struct {
	RPCResultFooter `json:",inline"`
}

SetBansResult is the result of a call to the SetBans RPC method.

type SetLimitRequestParameters

type SetLimitRequestParameters struct {
	// LimitUp is the upload limit in kB/s
	//
	LimitUp uint64 `json:"limit_up"`
	// LimitDown is the download limit in kB/s
	//
	LimitDown uint64 `json:"limit_down"`
}

type SetLimitResult

type SetLimitResult struct {
	// LimitUp is the upload limit in kB/s
	//
	LimitUp uint64 `json:"limit_up"`
	// LimitDOwn is the download limit in kB/s
	//
	LimitDown uint64 `json:"limit_down"`

	RPCResultFooter `json:",inline"`
}

type SetLogCategoriesRequestParameters

type SetLogCategoriesRequestParameters struct {
	// Categories to log with their corresponding levels formatted as a
	// comma-separated list of <category>:<level> pairs.
	//
	// For instance, to activate verbosity 1 for the `net.http` category
	// and verbosity 4 for `net.dns`:
	//
	// 	net.htpp:1,net.dns:4
	//
	Categories string `json:"categories"`
}

type SetLogCategoriesResult

type SetLogCategoriesResult struct {
	Categories      string `json:"categories"`
	RPCResultFooter `json:",inline"`
}

type SetLogLevelRequestParameters

type SetLogLevelRequestParameters struct {
	// Level is the log level that the daemon should use. From 0 to 4 (less
	// verbose to more verbose).
	//
	Level int8 `json:"level"`
}

type SetLogLevelResult

type SetLogLevelResult struct {
	RPCResultFooter `json:",inline"`
}

type StartMiningRequestParameters

type StartMiningRequestParameters struct {
	MinerAddress     string `json:"miner_address"`
	BackgroundMining bool   `json:"background_mining"`
	IgnoreBattery    bool   `json:"ignore_battery"`
	ThreadsCount     uint   `json:"threads_count"`
}

type StartMiningResult

type StartMiningResult struct {
	RPCResultFooter `json:",inline"`
}

type StopMiningResult

type StopMiningResult struct {
	RPCResultFooter `json:",inline"`
}

type SubmitBlockResult

type SubmitBlockResult struct {
	Status string                  `json:"status"`
	Error  *submitBlockResultError `json:"error"`
}

SubmitBlockResult is the result of a call to the SubmitBlock RPC method.

type SyncInfoResult

type SyncInfoResult struct {
	Credits uint64 `json:"credits"`

	Height                uint64 `json:"height"`
	NextNeededPruningSeed uint64 `json:"next_needed_pruning_seed"`
	Overview              string `json:"overview"`
	Status                string `json:"status"`
	TargetHeight          uint64 `json:"target_height"`
	TopHash               string `json:"top_hash"`
	Untrusted             bool   `json:"untrusted"`
	Peers                 []struct {
		Info struct {
			Address           string `json:"address"`
			AddressType       uint64 `json:"address_type"`
			AvgDownload       uint64 `json:"avg_download"`
			AvgUpload         uint64 `json:"avg_upload"`
			ConnectionID      string `json:"connection_id"`
			CurrentDownload   uint64 `json:"current_download"`
			CurrentUpload     uint64 `json:"current_upload"`
			Height            uint64 `json:"height"`
			Host              string `json:"host"`
			IP                string `json:"ip"`
			Incoming          bool   `json:"incoming"`
			LiveTime          uint64 `json:"live_time"`
			LocalIP           bool   `json:"local_ip"`
			Localhost         bool   `json:"localhost"`
			PeerID            string `json:"peer_id"`
			Port              string `json:"port"`
			PruningSeed       uint64 `json:"pruning_seed"`
			RPCCreditsPerHash uint64 `json:"rpc_credits_per_hash"`
			RPCPort           uint64 `json:"rpc_port"`
			RecvCount         uint64 `json:"recv_count"`
			RecvIdleTime      uint64 `json:"recv_idle_time"`
			SendCount         uint64 `json:"send_count"`
			SendIdleTime      uint64 `json:"send_idle_time"`
			State             string `json:"state"`
			SupportFlags      int    `json:"support_flags"`
		} `json:"info"`
	} `json:"peers"`

	RPCResultFooter `json:",inline"`
}

SyncInfoResult is the result of a call to the SyncInfo RPC method.

type TransactionJSON

type TransactionJSON struct {
	Version    int `json:"version"`
	UnlockTime int `json:"unlock_time"`
	Vin        []struct {
		Key struct {
			Amount     int    `json:"amount"`
			KeyOffsets []uint `json:"key_offsets"`
			KImage     string `json:"k_image"`
		} `json:"key"`
	} `json:"vin"`
	Vout []struct {
		Amount uint64 `json:"amount"`
		Target struct {
			Key string `json:"key"`
		} `json:"target"`
	} `json:"vout"`
	Extra         []byte `json:"extra"`
	RctSignatures struct {
		Type     int    `json:"type"`
		Txnfee   uint64 `json:"txnFee"`
		Ecdhinfo []struct {
			Amount string `json:"amount"`
		} `json:"ecdhInfo"`
		Outpk []string `json:"outPk"`
	} `json:"rct_signatures"`
	RctsigPrunable struct {
		Nbp int `json:"nbp"`
		Bp  []struct {
			A      string   `json:"A"`
			S      string   `json:"S"`
			T1     string   `json:"T1"`
			T2     string   `json:"T2"`
			Taux   string   `json:"taux"`
			Mu     string   `json:"mu"`
			L      []string `json:"L"`
			R      []string `json:"R"`
			LowerA string   `json:"a"`
			B      string   `json:"b"`
			T      string   `json:"t"`
		} `json:"bp,omitempty"`
		Bpp []struct {
			A  string   `json:"A"`
			A1 string   `json:"A1"`
			B  string   `json:"B"`
			R1 string   `json:"r1"`
			S1 string   `json:"s1"`
			D1 string   `json:"d1"`
			L  []string `json:"L"`
			R  []string `json:"R"`
		} `json:"bpp,omitempty"`
		Clsags []struct {
			S  []string `json:"s"`
			C1 string   `json:"c1"`
			D  string   `json:"D"`
		} `json:"CLSAGs,omitempty"`
		Pseudoouts []string `json:"pseudoOuts"`
	} `json:"rctsig_prunable"`
}

Jump to

Keyboard shortcuts

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