Documentation
¶
Overview ¶
Package jsonrpc is the json-rpc2 server of ngcore.
Encoding conventions, identical on every human-facing surface (see docs.ngchain.org/rpc for the method reference):
- addresses (and keys) are bs58 strings
- all other raw bytes (hashes, code, calldata, RLP payloads) are lowercase hex, never base64
- money never touches a float: tx-composition `value`/`fee` params are DECIMAL STRINGS of whole NG ("1.5", parsed exactly); balances return as decimal strings of raw units (NG is 18-decimal)
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetWorkParams ¶
type GetWorkParams struct {
GenTx string `json:"gen"`
}
GetWorkParams carries the miner's OWN signed generate tx. The post-state StateRoot is folded into the pow preimage and depends on the block's contents including this generate, so getWork must fold it in and seal the root BEFORE returning — the miner can no longer append its generate after the fact and still carry a correct root.
type GetWorkReply ¶
type GetWorkReply struct {
WorkID uint64 `json:"id"`
Block string `json:"block"`
Txs string `json:"txs"`
}
GetWorkReply hands the miner a FULLY-ASSEMBLED unsealing block (generate folded in, StateRoot sealed) — it needs only a nonce. Txs is kept as an empty list for wire-compat but is no longer needed to reconstruct.
type Server ¶
type Server struct {
*ServerConfig
*jsonrpc2http.Server
// contains filtered or unexported fields
}
Server is a json-rpc v2 server, reachable over HTTP POST at / and over WebSocket at /ws (the latter additionally serves subscriptions).
type ServerConfig ¶
type SubmitWorkParams ¶
SubmitWorkParams carries only the found nonce for a stored work id: the block (with its generate and StateRoot) was fully assembled at getWork time.