docs: refactor jsonrpc api document (#1462)

Co-authored-by: wit <wit765765346@gmail>
This commit is contained in:
wit765 2025-09-10 11:56:28 +08:00 committed by GitHub
parent 12eab8e785
commit 8155a2ee7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 3556 additions and 3547 deletions

342
docs/xdc/XDPoS/XDPoS.md Normal file
View file

@ -0,0 +1,342 @@
# Module XDPoS
## Method XDPoS_getBlockInfoByEpochNum
Parameters:
- epochNumber: integer, required, epoch number
Returns:
result: object EpochNumInfo:
- hash: hash of first block in this epoch
- round: round of epoch
- firstBlock: number of first block in this epoch
- lastBlock: number of last block in this epoch
Example:
```shell
epoch=89300
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getBlockInfoByEpochNum",
"params": [
'"${epoch}"'
]
}' | jq
```
## Method XDPoS_getEpochNumbersBetween
Parameters:
- begin: string, required, block number
- end: string, required, block number
Returns:
result: array of uint64
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getEpochNumbersBetween",
"params": [
"0x5439860",
"0x5439c48"
]
}' | jq
```
## Method XDPoS_getLatestPoolStatus
The `XDPoS_getLatestPoolStatus` method retrieves current vote pool and timeout pool content and missing messages.
Parameters:
None
Returns:
result: object MessageStatus
- vote: object
- timeout: object
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getLatestPoolStatus"
}' | jq
```
## Method XDPoS_getMasternodesByNumber
Parameters:
- number: string, required, BlockNumber
Returns:
result: object MasternodesStatus:
- Number: uint64
- Round: uint64
- MasternodesLen: int
- Masternodes: array of address
- PenaltyLen: int
- Penalty: array of address
- StandbynodesLen: int
- Standbynodes: array of address
- Error: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getMasternodesByNumber",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_getMissedRoundsInEpochByBlockNum
Parameters:
- number: string, required, BlockNumber
Returns:
result: object PublicApiMissedRoundsMetadata:
- EpochRound: uint64
- EpochBlockNumber: big.Int
- MissedRounds: array of MissedRoundInfo
MissedRoundInfo:
- Round: uint64
- Miner: address
- CurrentBlockHash: hash
- CurrentBlockNum: big.Int
- ParentBlockHash: hash
- ParentBlockNum: big.Int
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getMissedRoundsInEpochByBlockNum",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_getSigners
The `getSigners` method retrieves the list of authorized signers at the specified block.
Parameters:
- number: string, required, BlockNumber
Returns:
result: array of address
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getSigners",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_getSignersAtHash
The `getSignersAtHash` method retrieves the state snapshot at a given block.
Parameters:
- hash: string, required, block hash
Returns:
same as `XDPoS_getSigners`
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getSignersAtHash",
"params": [
"'"${hash}"'"
]
}' | jq
```
## Method XDPoS_getSnapshot
The `getSnapshot` method retrieves the state snapshot at a given block.
Parameters:
- number: string, required, BlockNumber
Returns:
result: object PublicApiSnapshot:
- number: block number where the snapshot was created
- hash: block hash where the snapshot was created
- signers: array of authorized signers at this moment
- recents: array of recent signers for spam protections
- votes: list of votes cast in chronological order
- tally: current vote tally to avoid recalculating
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getSnapshot",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_getSnapshotAtHash
The `getSnapshotAtHash` method retrieves the state snapshot at a given block.
Parameters:
- hash: string, required, block hash
Returns:
same as `XDPoS_getSnapshot`
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getSnapshotAtHash",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_getV2BlockByHash
Parameters:
- hash: string, required, block hash
Returns:
same as `XDPoS_getV2BlockByNumber`
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getV2BlockByHash",
"params": [
"'"${hash}"'"
]
}' | jq
```
## Method XDPoS_getV2BlockByNumber
Parameters:
- number: string, required, BlockNumber
Returns:
result: object V2BlockInfo:
- Hash: hash
- Round: uint64
- Number: big.Int
- ParentHash: hash
- Committed: bool
- Miner: common.Hash
- Timestamp: big.Int
- EncodedRLP: string
- Error: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_getV2BlockByNumber",
"params": [
"latest"
]
}' | jq
```
## Method XDPoS_networkInformation
Parameters:
None
Returns:
result: object NetworkInformation:
- NetworkId: big.Int
- XDCValidatorAddress: address
- RelayerRegistrationAddress: address
- XDCXListingAddress: address
- XDCZAddress: address
- LendingAddress: address
- ConsensusConfigs: object of XDPoSConfig
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "XDPoS_networkInformation"
}' | jq
```

362
docs/xdc/admin/admin..md Normal file
View file

@ -0,0 +1,362 @@
# Module admin
The `admin` API gives you access to several non-standard RPC methods, which will allow you to have a fine grained control over your Geth instance, including but not limited to network peer and RPC endpoint management.
## Method admin_addPeer
The `addPeer` administrative method requests adding a new remote node to the list of tracked static nodes. The node will try to maintain connectivity to these nodes at all times, reconnecting every once in a while if the remote connection goes down.
Parameters:
- url: string, required, the enode URL of the remote peer to start tracking
Returns:
result: bool, indicating whether the peer was accepted for tracking or some error occurred.
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_addPeer",
"params": [
"enode://1f5a9bd8bd4abb4ecec8812f0f440fec30dd745c91871ac57ebbadcd23ceafbdf7035f29bf0092feb5087ad72ad208dd12966bfcb88b339884e08cff4d167d87@194.180.176.105:38645"
]
}' | jq
```
## Method admin_addTrustedPeer
The `addTrustedPeer` method allows a remote node to always connect, even if slots are full.
Parameters:
- url: string, required
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_addTrustedPeer",
"params": [
"enode://1f5a9bd8bd4abb4ecec8812f0f440fec30dd745c91871ac57ebbadcd23ceafbdf7035f29bf0092feb5087ad72ad208dd12966bfcb88b339884e08cff4d167d87@194.180.176.105:38645"
]
}' | jq
```
## Method admin_datadir
The `datadir` administrative property can be queried for the absolute path the running Geth node currently uses to store all its databases.
Parameters:
None
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_datadir"
}' | jq
```
## Method admin_exportChain
The `exportChain` method exports the current blockchain into a local file. It optionally takes a first and last block number, in which case it exports only that range of blocks.
Parameters:
- fn: string, required, filen name
Returns:
result: bool, indicating whether the operation succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_exportChain",
"params": [
"filename"
]
}' | jq
```
## Method admin_importChain
The `importChain` method imports an exported list of blocks from a local file. Importing involves processing the blocks and inserting them into the canonical chain. The state from the parent block of this range is required. It returns a boolean indicating whether the operation succeeded.
Parameters:
- file: string, required, filen name
Returns:
result: bool, indicating whether the operation succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_importChain",
"params": [
"filename"
]
}' | jq
```
## Method admin_nodeInfo
The `nodeInfo` administrative property can be queried for all the information known about the running Geth node at the networking granularity. These include general information about the node itself as a participant of the P2P overlay protocol, as well as specialized information added by each of the running application protocols (e.g. eth, les, shh, bzz).
Parameters:
None
Returns:
result: object NodeInfo:
- id: string, unique node identifier (also the encryption key)
- name: string, name of the node, including client type, version, OS, custom data
- enode: string, enode URL for adding this peer from remote peers
- ip: string, IP address of the node
- ports: object
- discovery: int, UDP listening port for discovery protocol
- listener: int, TCP listening port for RLPx
- listenAddr: string
- protocols: object
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_nodeInfo"
}' | jq
```
## Method admin_peerEvents
The `peerEvents` creates an RPC subscription which receives peer events from the node's p2p server. The type of events emitted by the server are as follows:
- add: emitted when a peer is added
- drop: emitted when a peer is dropped
- msgsend: emitted when a message is successfully sent to a peer
- msgrecv: emitted when a message is received from a peer
Parameters:
None
Returns:
result: object Subscription
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_peerEvents"
}' | jq
```
## Method admin_peers
The `peers` administrative property can be queried for all the information known about the connected remote nodes at the networking granularity.
Parameters:
None
Returns:
result: array of PeerInfo:
- id: string,unique node identifier (also the encryption key)
- name: string, name of the node, including client type, version, OS, custom data
- caps: array of string, sum-protocols advertised by this particular peer
- network object:
- localAddress: string, local endpoint of the TCP data connection
- remoteAddress: string, remote endpoint of the TCP data connection
- inbound: bool
- trusted: bool
- static: bool
- protocols: object, sub-protocol specific metadata fields
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_peers"
}' | jq
```
## Method admin_removePeer
The `removePeer` method disconnects from a remote node if the connection exists. It returns a boolean indicating validations succeeded. Note a true value doesn't necessarily mean that there was a connection which was disconnected.
Parameters:
- url: string, required
Returns:
result: bool, indicating validations succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_removePeer",
"params": [
"enode://1f5a9bd8bd4abb4ecec8812f0f440fec30dd745c91871ac57ebbadcd23ceafbdf7035f29bf0092feb5087ad72ad208dd12966bfcb88b339884e08cff4d167d87@194.180.176.105:38645"
]
}' | jq
```
## Method admin_removeTrustedPeer
The `removeTrustedPeer` method removes a remote node from the trusted peer set, but it does not disconnect it automatically.
Parameters:
- url: string, required
Returns:
result: bool, indicating validations succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_removeTrustedPeer",
"params": [
"enode://1f5a9bd8bd4abb4ecec8812f0f440fec30dd745c91871ac57ebbadcd23ceafbdf7035f29bf0092feb5087ad72ad208dd12966bfcb88b339884e08cff4d167d87@194.180.176.105:38645"
]
}' | jq
```
## Method admin_startRPC
The `startRPC` method starts the HTTP RPC API server.
Parameters:
- host: string, optional, network interface to open the listener socket on (defaults to "localhost")
- port: int, optional, network port to open the listener socket on (defaults to 8546)
- cors: string, optional, cross-origin resource sharing header to use (defaults to "")
- apis: string, optional, API modules to offer over this interface (defaults to "eth,net,web3")
- vhosts: string, optional
Returns:
result: bool, indicating whether the operation succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_startRPC"
}' | jq
```
## Method admin_startWS
The startWS administrative method starts an WebSocket based JSON RPC API webserver to handle client requests.
Parameters:
- host: string, optional, network interface to open the listener socket on (defaults to "localhost")
- port: int, optional, network port to open the listener socket on (defaults to 8546)
- cors: string, optional, cross-origin resource sharing header to use (defaults to "")
- apis: string, optional, API modules to offer over this interface (defaults to "eth,net,web3")
Returns:
result: bool, indicating whether the operation succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_startWS"
}' | jq
```
## Method admin_stopRPC
The `stopRPC` method shuts down the HTTP server.
Parameters:
None
Returns:
result: bool, indicating whether the operation succeeded
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_stopRPC"
}' | jq
```
## Method admin_stopWS
The `stopWS` administrative method closes the currently open WebSocket RPC endpoint.
Parameters:
None
Returns:
result: bool, indicating whether the endpoint was closed or not
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "admin_stopWS"
}' | jq
```

929
docs/xdc/debug/debug.md Normal file
View file

@ -0,0 +1,929 @@
# Module debug
The `debug` API gives you access to several non-standard RPC methods, which will allow you to inspect, debug and set certain debugging flags during runtime.
## Method debug_blockProfile
The `blockProfile` method turns on block profiling for the given duration and writes profile data to disk. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually using debug_writeBlockProfile.
Parameters:
- file: string, required, file name
- nsec: uint, required, number of seconds
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_blockProfile",
"params": [
"block-profile.bin",
10
]
}' | jq
```
## Method debug_chaindbCompact
The `chaindbCompact` method flattens the entire key-value database into a single level, removing all unused slots and merging all keys.
Parameters:
None
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_chaindbCompact"
}' | jq
```
## Method debug_chaindbProperty
The `chaindbProperty` method returns leveldb properties of the key-value database.
Parameters:
- property: string, required
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_chaindbProperty",
"params": [
""
]
}' | jq
```
## Method debug_cpuProfile
The `cpuProfile` method turns on CPU profiling for the given duration and writes profile data to disk.
Parameters:
- file: string, required, file name
- nsec: uint, required, number of seconds
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_cpuProfile",
"params": [
"cpu-profile.bin",
10
]
}' | jq
```
## Method debug_dbGet
The `dbGet` method returns the raw value of a key stored in the database.
Parameters:
- key: string, required
Returns:
result: array of byte
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_dbGet",
"params": [
"key"
]
}' | jq
```
## Method debug_dumpBlock
The `dumpBlock` method retrieves the entire state of the database at a given block.
Parameters:
- number: BlockNumber, required, block number
Returns:
result: object Dump
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_dumpBlock",
"params": [
"earliest"
]
}' | jq
```
## Method debug_getBadBlocks
The `getBadBlocks` method returns a list of the last 'bad blocks' that the client has seen on the network and returns them as a JSON list of block-hashes.
Parameters:
None
Returns:
result: array of BadBlockArgs
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_getBadBlocks"
}' | jq
```
## Method debug_gcStats
The `gcStats` method returns garbage collection statistics.
Parameters:
None
Returns:
result: ojbect GCStats
See <https://golang.org/pkg/runtime/debug/#GCStats> for information about the fields of the returned object.
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_gcStats"
}' | jq
```
## Method debug_getBlockRlp
The `getBlockRlp` retrieves the RLP encoded for of a single block.
Parameters:
- number: uint64, required, block number
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_getBlockRlp",
"params": [
0
]
}' | jq
```
## Method debug_getModifiedAccountsByHash
The `getModifiedAccountsByHash` method returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash, or storage hash. With one parameter, returns the list of accounts modified in the specified block.
Parameters:
- startHash: hash, required, start block hash
- endHash: hash optional, end block hash
Returns:
result: array of address
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_getModifiedAccountsByNumber",
"params": [
"start-hash",
"end-hash"
]
}' | jq
```
## Method debug_getModifiedAccountsByNumber
The `getModifiedAccountsByNumber` method returns all accounts that have changed between the two blocks specified. A change is defined as a difference in nonce, balance, code hash or storage hash.
Parameters:
- startNum: uint64, required, start block number
- endNum: uint64, optional, end block number
Returns:
result: array of address
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_getModifiedAccountsByNumber",
"params": [
1
]
}' | jq
```
## Method debug_goTrace
The `goTrace` method turns on Go runtime tracing for the given duration and writes trace data to disk.
Parameters:
- file: string, required, file name
- nsec: uint, required, number of seconds
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_goTrace",
"params": [
"go-trace.bin",
10
]
}' | jq
```
## Method debug_freeOSMemory
The debug `freeOSMemory` forces garbage collection.
Parameters:
None
Returns:
result: null
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_freeOSMemory"
}' | jq
```
## Method debug_memStats
The `memStats` method returns detailed runtime memory statistics.
Parameters:
None
Returns:
result: object MemStats
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_memStats"
}' | jq
```
## Method debug_mutexProfile
The `mutexProfile` method turns on mutex profiling for nsec seconds and writes profile data to file. It uses a profile rate of 1 for most accurate information. If a different rate is desired, set the rate and write the profile manually.
Parameters:
- file: string, required, file name
- nsec: uint, required, number of seconds
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_mutexProfile",
"params": [
"mutex-profile.bin",
10
]
}' | jq
```
## Method debug_preimage
The `preimage` method returns the preimage for a sha3 hash, if known.
Parameters:
- hash: hash, required
Returns:
result: array of bytes
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_preimage",
"params": [
"hash",
]
}' | jq
```
## Method debug_printBlock
The `printBlock` method retrieves a block and returns its pretty printed form.
Parameters:
- number: uint64, required, block number
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_printBlock",
"params": [
0
]
}' | jq
```
## Method debug_setBlockProfileRate
The `setBlockProfileRate` method sets the rate (in samples/sec) of goroutine block profile data collection. A non-zero rate enables block profiling, setting it to zero stops the profile. Collected profile data can be written using `debug_writeBlockProfile`.
Parameters:
- rate: int, required
Returns:
result: null
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_setBlockProfileRate",
"params": [
0
]
}' | jq
```
## Method debug_setGCPercent
The `setGCPercent` method sets the garbage collection target percentage. A negative value disables garbage collection.
Parameters:
- v: int, required
Returns:
result: int
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_setGCPercent",
"params": [
80
]
}' | jq
```
## Method debug_setHead
The `setHead` method sets the current head of the local chain by block number. Note, this is a destructive action and may severely damage your chain. Use with extreme caution.
Parameters:
- number: uint64, required, block number
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_setHead",
"params": [
"0x544b420"
]
}' | jq
```
## Method debug_stacks
The `stacks` method returns a printed representation of the stacks of all goroutines. Note that the web3 wrapper for this method takes care of the printing and does not return the string.
Parameters:
None
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_stacks"
}' | jq
```
## Method debug_startCPUProfile
The `startCPUProfile` method turns on CPU profiling indefinitely, writing to the given file.
Parameters:
- file: string, required, file name
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_startCPUProfile",
"params": [
"cpu-profile.bin"
]
}' | jq
```
## Method debug_startGoTrace
The `startGoTrace` starts writing a Go runtime trace to the given file.
Parameters:
- file: string, required, file name
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_startGoTrace",
"params": [
"go-trace.bin"
]
}' | jq
```
## Method debug_stopCPUProfile
The `stopCPUProfile` method stops an ongoing CPU profile.
Parameters:
None
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_stopCPUProfile"
}' | jq
```
## Method debug_stopGoTrace
The `stopGoTrace` method stops writing the Go runtime trace.
Parameters:
None
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_stopGoTrace"
}' | jq
```
## Method debug_storageRangeAt
The `storageRangeAt` method returns the storage at the given block height and transaction index. The result can be paged by providing a maxResult to cap the number of storage slots returned as well as specifying the offset via keyStart (hash of storage key).
Parameters:
- blockHash: Hash, required
- txIndex: int, required
- contractAddress: address, required
- keyStart: array of bytes, required
- maxResult: int, required
Returns:
result: object StorageRangeResult
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_storageRangeAt"
}' | jq
```
## Method debug_traceBlock
The `traceBlock` method will return a full stack trace of all invoked opcodes of all transaction that were included in this block. Note, the parent of this block must be present or it will fail. For the second parameter see TraceConfig reference.
Parameters:
- blob: array of byte, required, the RLP encoded block
- config: object of TraceConfig, optional
Returns:
result: array of object txTraceResult
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_writeMemProfile",
"params": [
"memory-profile.bin",
]
}' | jq
```
## Method debug_traceBlockByHash
The `traceBlockByHash` method accepts a block hash and will replay the block that is already present in the database.
Parameters:
- hash: Hash, required, block hash
- config: TraceConfig, optional
Returns:
result: array of object txTraceResult
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_traceBlockByHash",
"params": [
"block-hash"
]
}' | jq
```
## Method debug_traceBlockByNumber
The `traceBlockByNumber` method accepts a block number and will replay the block that is already present in the database.
Parameters:
- number: BlockNumber, required, block number
- config: TraceConfig, optional
Returns:
result: array of object txTraceResult
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "traceBlockByNumber",
"params": [
"latest"
]
}' | jq
```
## Method debug_traceBlockFromFile
The `traceBlockFromFile` meothod accepts a file containing the RLP of the block.
Parameters:
- file: string, required, file name
- config: object of TraceConfig, optional
Returns:
result: array of object txTraceResult
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_traceBlockFromFile",
"params": [
"filename"
]
}' | jq
```
## Method debug_traceCall
The `traceCall` method lets you run an eth_call within the context of the given block execution using the final state of parent block as the base.
Parameters:
- args: TransactionArgs, required
- blockNrOrHash: BlockNumberOrHash, required, hash or number
- config: TraceCallConfig, optional
Returns:
same as debug_traceTransaction
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_traceCall",
"params": [
{
"to": "0x46eda75e7ca73cb1c2f83c3927211655420dbc44",
"data": "0x3fb5c1cb00000000000000000000000000000000000000000000000000000000000003e7"
},
"latest",
]
}' | jq
```
## Method debug_traceTransaction
The `traceTransaction` method debugging method will attempt to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it will finally attempt to execute the transaction that corresponds to the given hash.
Parameters:
- hash: Hash, required, transaction hash
- config: TraceConfig, optional
Returns:
result: object
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_traceTransaction",
"params": [
"tx-hash"
]
}' | jq
```
## Method debug_verbosity
The `verbosity` method sets the logging verbosity ceiling. Log messages with level up to and including the given level will be printed.
Parameters:
- level: int, required
Returns:
result: null
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_verbosity",
"params": [
3
]
}' | jq
```
## Method debug_vmodule
The `vmodule` method sets the logging verbosity pattern.
Parameters:
- pattern: string, required
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_vmodule",
"params": [
"eth/*=3,p2p=4"
]
}' | jq
```
## Method debug_writeBlockProfile
The `writeBlockProfile` method writes a goroutine blocking profile to the given file.
Parameters:
- file: string, required
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_writeBlockProfile",
"params": [
"block-profile.bin"
]
}' | jq
```
## Method debug_writeMemProfile
The `writeMemProfile` method writes an allocation profile to the given file. Note that the profiling rate cannot be set through the API, it must be set on the command line using the `--pprof-memprofilerate` flag.
Parameters:
- file: string, required, file name
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_writeMemProfile",
"params": [
"memory-profile.bin",
]
}' | jq
```
## Method debug_writeMutexProfile
The `writeMutexProfile` method writes a goroutine blocking profile to the given file.
Parameters:
- file: string, required, file name
Returns:
result: error
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "debug_writeMutexProfile",
"params": [
"mutex-profile.bin",
]
}' | jq
```

1499
docs/xdc/eth/eth.md Normal file

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

148
docs/xdc/miner/miner.md Normal file
View file

@ -0,0 +1,148 @@
# Module miner
The `miner` API is now deprecated because mining was switched off at the transition to proof-of-stake. It existed to provide remote control the node's mining operation and set various mining specific settings. It is provided here for historical interest!
## Method miner_getHashrate
The `getHashrate` method get hashrate in H/s (Hash operations per second).
Parameters:
None
Returns:
result: uint64
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_getHashrate"
}' | jq
```
## Method miner_setEtherbase
The `getHashrate` method get hashrate in H/s (Hash operations per second).
Parameters:
- etherbase: address, required
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_setEtherbase",
"params": [
"0xD4CE02705041F04135f1949Bc835c1Fe0885513c"
]
}' | jq
```
## Method miner_setExtra
The `setExtra` method sets the extra data a miner can include when miner blocks. This is capped at 32 bytes.
Parameters:
- extra: string, required
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_setExtra",
"params": [
"string"
]
}' | jq
```
## Method miner_setGasPrice
The `setGasPrice` method sets the minimal accepted gas price when mining transactions. Any transactions that are below this limit are excluded from the mining process.
Parameters:
- gasPrice: big.Int, required
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_setGasPrice",
"params": [
"0x1"
]
}' | jq
```
## Method miner_start
The `start` method start the miner with the given number of threads. If threads is nil the number of workers started is equal to the number of logical CPUs that are usable by this process. If mining is already running, this method adjust the number of threads allowed to use.
Parameters:
- threads: int, optional
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_start",
"params": [
1
]
}' | jq
```
## Method miner_stop
The `stop` method stop the CPU mining operation.
Parameters:
None
Returns:
result: bool
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "miner_stop"
}' | jq
```

70
docs/xdc/net/net.md Normal file
View file

@ -0,0 +1,70 @@
# Module net
The `net` API provides insight about the networking aspect of the client.
## Method net_listening
The `listening` method returns an indication if the node is listening for network connections.
Parameters:
None
Returns:
result: bool, always listening
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "net_listening"
}' | jq
```
## Method net_peerCount
The `peerCount` method returns the number of connected peers.
Parameters:
None
Returns:
result: uint
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "net_peerCount"
}' | jq
```
## Method net_version
The `version` method returns the devp2p network ID
Parameters:
None
Returns:
result: string
Example:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "net_version"
}' | jq
```

45
docs/xdc/rpc/rpc.md Normal file
View file

@ -0,0 +1,45 @@
# Module rpc
## Method rpc_modules
The `modules` returns the list of RPC services with their version number.
Parameters:
None
Returns:
result: ojbect
Example:
Request:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "rpc_modules"
}' | jq
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1001,
"result": {
"XDPoS": "1.0",
"debug": "1.0",
"eth": "1.0",
"net": "1.0",
"personal": "1.0",
"rpc": "1.0",
"txpool": "1.0",
"web3": "1.0"
}
}
```

150
docs/xdc/txpool/txpool.md Normal file
View file

@ -0,0 +1,150 @@
# Module txpool
## Method txpool_content
The `content` method lists the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with actual transactions.
Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcast multiple ones with varying gas allowances (or even completely different transactions).
Parameters:
None
Returns:
result: ojbect
Example:
Request:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "txpool_content"
}' | jq
```
## Method txpool_contentFrom
The `contentFrom` method retrieves the transactions contained within the txpool, returning pending as well as queued transactions of this address, grouped by nonce.
Parameters:
- addr: addrress, required
Returns:
result: ojbect
Example:
Request:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "txpool_contentFrom",
"params": [
"0xD4CE02705041F04135f1949Bc835c1Fe0885513c"
]
}' | jq
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1001,
"result": {
"pending": {},
"queued": {}
}
}
```
## Method txpool_inspect
The `inspect` lists a textual summary of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. This is a method specifically tailored to developers to quickly see the transactions in the pool and find any potential issues.
The result is an object with two fields pending and queued. Each of these fields are associative arrays, in which each entry maps an origin-address to a batch of scheduled transactions. These batches themselves are maps associating nonces with transactions summary strings.
Please note, there may be multiple transactions associated with the same account and nonce. This can happen if the user broadcast multiple ones with varying gas allowances (or even completely different transactions).
Parameters:
None
Returns:
result: ojbect
Example:
Request:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "txpool_inspect"
}' | jq
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1001,
"result": {
"pending": {},
"queued": {}
}
}
```
## Method txpool_status
The `status` method returns the number of pending and queued transaction in the pool.
The result is an object with two fields pending and queued, each of which is a counter representing the number of transactions in that particular state.
Parameters:
None
Returns:
result: ojbect
Example:
Request:
```shell
curl -s -X POST -H "Content-Type: application/json" ${RPC} -d '{
"jsonrpc": "2.0",
"id": 1001,
"method": "txpool_status"
}' | jq
```
Response:
```json
{
"jsonrpc": "2.0",
"id": 1001,
"result": {
"pending": "0x3",
"queued": "0x0"
}
}
```