Documentation
¶
Overview ¶
Copyright 2017 Marin Basic <marin@marin-basic.com>. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2017 Marin Basic <marin@marin-basic.com>. All rights reserved. Copyright SerHack Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2017 Marin Basic <marin@marin-basic.com>. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Copyright 2017 Marin Basic <marin@marin-basic.com>. All rights reserved. Use of this source code is governed by a MIT-style license that can be found in the LICENSE file.
Index ¶
- type Ban
- type BanResponse
- type Block
- type BlockCount
- type BlockDetails
- type BlockHeader
- type BlockHeaderResponse
- type BlockTemplate
- type Connection
- type ConnectionResponse
- type DaemonClient
- func (c *DaemonClient) GetBans() (BanResponse, error)
- func (c *DaemonClient) GetBlock(height uint, hash string) (Block, error)
- func (c *DaemonClient) GetBlockCount() (BlockCount, error)
- func (c *DaemonClient) GetBlockHeaderByHash(hash string) (BlockHeaderResponse, error)
- func (c *DaemonClient) GetBlockHeaderByHeight(height uint) (BlockHeaderResponse, error)
- func (c *DaemonClient) GetBlockTemplate(walletAddress string, reserveSize uint) (BlockTemplate, error)
- func (c *DaemonClient) GetConnections() (ConnectionResponse, error)
- func (c *DaemonClient) GetHardForkInfo() (HardForkInfo, error)
- func (c *DaemonClient) GetInfo() (Info, error)
- func (c *DaemonClient) GetLastBlockHeader() (BlockHeaderResponse, error)
- func (c *DaemonClient) OnGetBlockHash(blockHeight int) (string, error)
- func (c *DaemonClient) SetBans(bans []Ban) (string, error)
- func (c *DaemonClient) SubmitBlock(blockBlobData string) (string, error)
- type HardForkInfo
- type Info
- type MinerTransactionInfo
- type TransactionInputs
- type TransactionOutputs
- type WalletClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ban ¶
type Ban struct {
Ip uint `json:"ip"`
Ban bool `json:"ban, omitempty"`
Seconds uint `json:"seconds"`
}
Ban ip - unsigned int; IP address to ban, in Int format. ban - boolean; Set true to ban. seconds - unsigned int; Number of seconds to ban node.
type BanResponse ¶
BanResponse bans - A list of nodes status - string; General RPC error code. "OK" means everything looks good.
type Block ¶
type Block struct {
Blob string `json:"blob"`
BlockHeader BlockHeader `json:"block_header"`
Json string `json:"json"`
Status string `status`
}
Block blob - string; Hexadecimal blob of block information. block_header - A structure containing block header information. See getlastblockheader. json - json string; JSON formatted block details: status - string; General RPC error code. "OK" means everything looks good.
func (*Block) ParseJSON ¶
func (b *Block) ParseJSON() (BlockDetails, error)
Parse json string to BlockDetails struct
type BlockCount ¶
BlockCount count - unsigned int; Number of blocks in longest chain seen by the node. status - string; General RPC error code. "OK" means everything looks good.
type BlockDetails ¶
type BlockDetails struct {
MajorVersion uint `json:"major_version"`
MinorVersion uint `json:"minor_version"`
Timestamp uint `json:"timestamp"`
Nonce uint `json:"nonce"`
PrevId string `json:"prev_id"`
TxHashes []string `json:"tx_hashes"`
MinerTransactionInfo MinerTransactionInfo `json:"miner_tx"`
}
BlockDetails major_version - Same as in block header. minor_version - Same as in block header. timestamp - Same as in block header. prev_id - Same as prev_hash in block header. nonce - Same as in block header. miner_tx - Miner transaction information version - Transaction version number. tx_hashes - List of hashes of non-coinbase transactions in the block. If there are no other transactions, this will be an empty list.
type BlockHeader ¶
type BlockHeader struct {
Depth uint `json:"depth"`
Difficulty uint `json:"difficulty"`
Hash string `json:"hash"`
Height uint `json:"height"`
MajorVersion uint `json:"major_version"`
MinorVersion uint `json:"minor_version"`
Nonce uint `json:"nonce"`
OrphanStatus bool `json:"orphan_status"`
PrevHash string `json:"prev_hash"`
Reward uint `json:"reward "`
Timestamp uint `json:"timestamp"`
}
BlockHeader depth - unsigned int; The number of blocks succeeding this block on the blockchain. A larger number means an older block. difficulty - unsigned int; The strength of the Monero network based on mining power. hash - string; The hash of this block. height - unsigned int; The number of blocks preceding this block on the blockchain. major_version - unsigned int; The major version of the monero protocol at this block height. minor_version - unsigned int; The minor version of the monero protocol at this block height. nonce - unsigned int; a cryptographic random one-time number used in mining a Monero block. orphan_status - boolean; Usually false. If true, this block is not part of the longest chain. prev_hash - string; The hash of the block immediately preceding this block in the chain. reward - unsigned int; The amount of new atomic units generated in this block and rewarded to the miner. Note: 1 XMR = 1e12 atomic units. timestamp - unsigned int; The time the block was recorded into the blockchain.
type BlockHeaderResponse ¶
type BlockHeaderResponse struct {
BlockHeader BlockHeader `json:"block_header"`
Status string `json:"status"`
}
BlockHeaderResponse block_header - A structure containing block header information. status - string; General RPC error code. "OK" means everything looks good.
type BlockTemplate ¶
type BlockTemplate struct {
BlockTemplateBlob string `json:"blocktemplate_blob "`
Difficulty uint `json:"difficulty"`
Height uint `json:"height"`
PrevHash string `json:"prev_hash"`
ReservedOffset uint `json:"reserved_offset"`
Status string `json:"status"`
}
BlockTemplate blocktemplate_blob - string; Blob on which to try to mine a new block. difficulty - unsigned int; Difficulty of next block. height - unsigned int; Height on which to mine. prev_hash - string; Hash of the most recent block on which to mine the next block. reserved_offset - unsigned int; Reserved offset. status - string; General RPC error code. "OK" means everything looks good.
type Connection ¶
type Connection struct {
AvgDownload uint `json:"avg_download"`
AvgUpload uint `json:"avg_upload"`
CurrentDownload uint `json:"current_download"`
CurrentUpload uint `json:"current_upload"`
Incoming bool `json:"incoming"`
Ip string `json:"ip"`
LiveTime uint `json:"live_time"`
LocalIp bool `json:"local_ip"`
Localhost bool `json:"localhost"`
PeerId string `json:"peer_id"`
Port string `json:"port"`
RecvCount uint `json:"recv_count"`
RecvIdleTime uint `json:"recv_idle_time"`
SendCount uint `json:"send_count"`
SendIdleTime uint `json:"send_idle_time"`
State string `json:"state"`
}
Connection avg_download - unsigned int; Average bytes of data downloaded by node. avg_upload - unsigned int; Average bytes of data uploaded by node. current_download - unsigned int; Current bytes downloaded by node. current_upload - unsigned int; Current bytes uploaded by node. incoming - boolean; Is the node getting information from your node? ip - string; The node's IP address. live_time - unsigned int local_ip - boolean localhost - boolean peer_id - string; The node's ID on the network. port - stringl The port that the node is using to connect to the network. recv_count - unsigned int recv_idle_time - unsigned int send_count - unsigned int send_idle_time - unsigned int state - string
type ConnectionResponse ¶
type ConnectionResponse struct {
Connections []Connection `json:"connections"`
Status string `json:"status"`
}
ConnectionRespose connections - List of all connections and their info:
type DaemonClient ¶
type DaemonClient struct {
// contains filtered or unexported fields
}
func NewDaemonClient ¶
func NewDaemonClient(endpoint string) *DaemonClient
Creates new daemon client
func (*DaemonClient) GetBlock ¶
func (c *DaemonClient) GetBlock(height uint, hash string) (Block, error)
Full block information can be retrieved by either block height or hash, like with the above block header calls. For full block information, both lookups use the same method, but with different input parameters.
func (*DaemonClient) GetBlockCount ¶
func (c *DaemonClient) GetBlockCount() (BlockCount, error)
Look up how many blocks are in the longest chain known to the node.
func (*DaemonClient) GetBlockHeaderByHash ¶
func (c *DaemonClient) GetBlockHeaderByHash(hash string) (BlockHeaderResponse, error)
Block header information can be retrieved using either a block's hash or height. This method includes a block's hash as an input parameter to retrieve basic information about the block.
func (*DaemonClient) GetBlockHeaderByHeight ¶
func (c *DaemonClient) GetBlockHeaderByHeight(height uint) (BlockHeaderResponse, error)
Similar to GetBlockHeaderByHash above, this method includes a block's height as an input parameter to retrieve basic information about the block.
func (*DaemonClient) GetBlockTemplate ¶
func (c *DaemonClient) GetBlockTemplate(walletAddress string, reserveSize uint) (BlockTemplate, error)
Get BlockTemplate
func (*DaemonClient) GetConnections ¶
func (c *DaemonClient) GetConnections() (ConnectionResponse, error)
Retrieve information about incoming and outgoing connections to your node.
func (*DaemonClient) GetHardForkInfo ¶
func (c *DaemonClient) GetHardForkInfo() (HardForkInfo, error)
Look up information regarding hard fork voting and readiness.
func (*DaemonClient) GetInfo ¶
func (c *DaemonClient) GetInfo() (Info, error)
Retrieve general information about the state of your node and the network.
func (*DaemonClient) GetLastBlockHeader ¶
func (c *DaemonClient) GetLastBlockHeader() (BlockHeaderResponse, error)
Block header information for the most recent block is easily retrieved with this method. No inputs are needed.
func (*DaemonClient) OnGetBlockHash ¶
func (c *DaemonClient) OnGetBlockHash(blockHeight int) (string, error)
Look up a block's hash by its height.
func (*DaemonClient) SetBans ¶
func (c *DaemonClient) SetBans(bans []Ban) (string, error)
Ban another node by IP.
func (*DaemonClient) SubmitBlock ¶
func (c *DaemonClient) SubmitBlock(blockBlobData string) (string, error)
Submit a mined block to the network.
type HardForkInfo ¶
type HardForkInfo struct {
EarliestHeight uint `json:"earliest_height"`
Enabled bool `json:"enabled"`
State uint `json:"state"`
Status string `json:"status"`
Threshold uint `json:"threshold"`
Version uint `json:"version"`
Votes uint `json:"votes"`
Voting uint `json:"voting"`
Window uint `json:"window"`
}
HardForkInfo earliest_height - unsigned int; Block height at which hard fork would be enabled if voted in. enabled - boolean; Tells if hard fork is enforced. state - unsigned int; Current hard fork state: 0 (There is likely a hard fork), 1 (An update is needed to fork properly), or 2 (Everything looks good). status - string; General RPC error code. "OK" means everything looks good. threshold - unsigned int; Minimum percent of votes to trigger hard fork. Default is 80. version - unsigned int; The major block version for the fork. votes - unsigned int; Number of votes towards hard fork. voting - unsigned int; Hard fork voting status. window - unsigned int; Number of blocks over which current votes are cast. Default is 10080 blocks.
type Info ¶
type Info struct {
AltBlocksCount uint `json:"alt_blocks_count"`
Difficulty uint `json:"difficulty"`
GreyPeerlistSize uint `json:"grey_peerlist_size"`
Height uint `json:"height"`
IncomingConnectionsCount uint `json:"incoming_connections_count"`
OutgoingConnectionsCount uint `json:"outgoing_connections_count"`
Status string `json:"status"`
Target uint `json:"target"`
TargetHeight uint `json:"target_height"`
Testnet bool `json:"testnet"`
TopBlockHash string `json:"top_block_hash"`
TxCount uint `json:"tx_count"`
TxPoolSiz uint `json:"tx_pool_siz"`
WhitePeerlistSize uint `json:"white_peerlist_size"`
}
Info alt_blocks_count - unsigned int; Number of alternative blocks to main chain. difficulty - unsigned int; Network difficulty (analogous to the strength of the network) grey_peerlist_size - unsigned int; Grey Peerlist Size height - unsigned int; Current length of longest chain known to daemon. incoming_connections_count - unsigned int; Number of peers connected to and pulling from your node. outgoing_connections_count - unsigned int; Number of peers that you are connected to and getting information from. status - string; General RPC error code. "OK" means everything looks good. target - unsigned int; Current target for next proof of work. target_height - unsigned int; The height of the next block in the chain. testnet - boolean; States if the node is on the testnet (true) or mainnet (false). top_block_hash - string; Hash of the highest block in the chain. tx_count - unsigned int; Total number of non-coinbase transaction in the chain. tx_pool_siz - unsigned int; Number of transactions that have been broadcast but not included in a block. white_peerlist_size - unsigned int; White Peerlist Size
type MinerTransactionInfo ¶
type MinerTransactionInfo struct {
Version uint `json:"version"`
UnlockTime int `json:"unlock_time"`
TransactionInputs []TransactionInputs `json:"vin"`
TransactionOutputs []TransactionOutputs `json:"vout"`
Extra []string `json:"extra"`
Signatures []string `json:"signatures"`
}
MinerTransactionInfo version - Transaction version number. unlock_time - The block height when the coinbase transaction becomes spendable. vin - List of transaction inputs: gen - Miner txs are coinbase txs, or "gen". height - This block height, a.k.a. when the coinbase is generated. vout - List of transaction outputs. Each output contains: extra - Usually called the "transaction ID" but can be used to include any random 32 byte/64 character hex string. signatures - Contain signatures of tx signers. Coinbased txs do not have signatures.
type TransactionInputs ¶
type TransactionInputs struct {
Gen struct {
Height uint `json:"height"`
} `json:"gen"`
}
TransactionInputs gen - Miner txs are coinbase txs, or "gen".
type TransactionOutputs ¶
type TransactionOutputs struct {
Amount uint `json:"amount"`
Target struct {
Key string `json:"key"`
} `json:"target"`
}
TransactionOutputs amount - The amount of the output, in atomic units.
type WalletClient ¶
type WalletClient struct {
// contains filtered or unexported fields
}
func NewWalletClient ¶
func NewWalletClient(endpoint string) *WalletClient
Creates new wallet client