1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### admin_addPeer
+
+AddPeer requests connecting to a remote node, and also maintaining the new
+connection at all times, even reconnecting if it is lost.
+
+
+#### Params (1)
+
+Parameters must be given _by position_.
+
+
+__1:__
+url string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_addPeer", "params": [+```go +func (api *privateAdminAPI) AddPeer(url string) (bool, error) { + server := api.node.Server() + if server == nil { + return false, ErrNodeStopped + } + node, err := enode.Parse(enode.ValidSchemes, url) + if err != nil { + return false, fmt.Errorf("invalid enode: %v", err) + } + server.AddPeer(node) + return true, nil +}// AddPeer requests connecting to a remote node, and also maintaining the new +// connection at all times, even reconnecting if it is lost. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_addTrustedPeer", "params": [+```go +func (api *privateAdminAPI) AddTrustedPeer(url string) (bool, error) { + server := api.node.Server() + if server == nil { + return false, ErrNodeStopped + } + node, err := enode.Parse(enode.ValidSchemes, url) + if err != nil { + return false, fmt.Errorf("invalid enode: %v", err) + } + server.AddTrustedPeer(node) + return true, nil +}// AddTrustedPeer allows a remote node to always connect, even if slots are full + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_datadir", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ admin.datadir();
+ ```
+
+
++```go +func (api *publicAdminAPI) Datadir() string { + return api.node.DataDir() +}// Datadir retrieves the current data directory the node is using. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_ecbp1100", "params": [+```go +func (api *PrivateAdminAPI) Ecbp1100(blockNr rpc.BlockNumber) (bool, error) { + i := uint64(blockNr.Int64()) + err := api.eth.blockchain.Config().SetECBP1100Transition(&i) + return api.eth.blockchain.IsArtificialFinalityEnabled() && api.eth.blockchain.Config().IsEnabled(api.eth.blockchain.Config().GetECBP1100Transition, api.eth.blockchain.CurrentBlock().Number()), err +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+first *uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+last *uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_exportChain", "params": [+```go +func (api *PrivateAdminAPI) ExportChain(file string, first *uint64, last *uint64) (bool, error) { + if first == nil && last != nil { + return false, errors.New("last cannot be specified without first") + } + if first != nil && last == nil { + head := api.eth.BlockChain().CurrentHeader().Number.Uint64() + last = &head + } + if _, err := os.Stat(file); err == nil { + return false, errors.New("location would overwrite an existing file") + } + out, err := os.OpenFile(file, os.O_CREATE|os.O_WRONLY|os.O_TRUNC, os.ModePerm) + if err != nil { + return false, err + } + defer out.Close() + var writer io.Writer = out + if strings.HasSuffix(file, ".gz") { + writer = gzip.NewWriter(writer) + defer writer.(*gzip.Writer).Close() + } + if first != nil { + if err := api.eth.BlockChain().ExportN(writer, *first, *last); err != nil { + return false, err + } + } else if err := api.eth.BlockChain().Export(writer); err != nil { + return false, err + } + return true, nil +}// ExportChain exports the current blockchain into a local file, +// or a range of blocks if first and last are non-nil + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_importChain", "params": [+```go +func (api *PrivateAdminAPI) ImportChain(file string) (bool, error) { + in, err := os.Open(file) + if err != nil { + return false, err + } + defer in.Close() + var reader io.Reader = in + if strings.HasSuffix(file, ".gz") { + if reader, err = gzip.NewReader(reader); err != nil { + return false, err + } + } + stream := rlp.NewStream(reader, 0) + blocks, index := make([ // ImportChain imports a blockchain from a local file. + ]*types.Block, 0, 2500), 0 + for batch := 0; ; batch++ { + for len(blocks) < cap(blocks) { + block := new(types.Block) + if err := stream.Decode(block); err == io.EOF { + break + } else if err != nil { + return false, fmt.Errorf("block %d: failed to parse: %v", index, err) + } + blocks = append(blocks, block) + index++ + } + if len(blocks) == 0 { + break + } + if hasAllBlocks(api.eth.BlockChain(), blocks) { + blocks = blocks[:0] + continue + } + if _, err := api.eth.BlockChain().InsertChain(blocks); err != nil { + return false, fmt.Errorf("batch %d: failed to insert: %v", batch, err) + } + blocks = blocks[:0] + } + return true, nil +} +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_maxPeers", "params": [+```go +func (api *PrivateAdminAPI) MaxPeers(n int) (bool, error) { + api.eth.protocolManager.maxPeers = n + api.eth.p2pServer.MaxPeers = n + for i := api.eth.protocolManager.peers.Len(); i > n; i = api.eth.protocolManager.peers.Len() { + p := api.eth.protocolManager.peers.WorstPeer() + if p == nil { + break + } + api.eth.protocolManager.removePeer(p.id) + } + return true, nil +}// MaxPeers sets the maximum peer limit for the protocol manager and the p2p server. + +``` +View on GitHub → +
+*p2p.NodeInfo
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - enode:
+ - type: `string`
+
+ - enr:
+ - type: `string`
+
+ - id:
+ - type: `string`
+
+ - ip:
+ - type: `string`
+
+ - listenAddr:
+ - type: `string`
+
+ - name:
+ - type: `string`
+
+ - ports:
+ - additionalProperties: `false`
+ - properties:
+ - discovery:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - listener:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: `object`
+
+ - protocols:
+ - additionalProperties: `false`
+ - properties:
+ - discovery:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - listener:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "enode": {
+ "type": "string"
+ },
+ "enr": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "ip": {
+ "type": "string"
+ },
+ "listenAddr": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "ports": {
+ "additionalProperties": false,
+ "properties": {
+ "discovery": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "listener": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "protocols": {
+ "additionalProperties": false,
+ "properties": {
+ "discovery": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "listener": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_nodeInfo", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ admin.nodeInfo();
+ ```
+
+
++```go +func (api *publicAdminAPI) NodeInfo() (*p2p.NodeInfo, error) { + server := api.node.Server() + if server == nil { + return nil, ErrNodeStopped + } + return server.NodeInfo(), nil +}// NodeInfo retrieves all the information we know about the host node at the +// protocol granularity. + +``` +View on GitHub → +
+[]*p2p.PeerInfo
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - caps:
+ - items:
+ - type: `string`
+
+ - type: `array`
+
+ - enode:
+ - type: `string`
+
+ - enr:
+ - type: `string`
+
+ - id:
+ - type: `string`
+
+ - name:
+ - type: `string`
+
+ - network:
+ - additionalProperties: `false`
+ - properties:
+ - inbound:
+ - type: `boolean`
+
+ - localAddress:
+ - type: `string`
+
+ - remoteAddress:
+ - type: `string`
+
+ - static:
+ - type: `boolean`
+
+ - trusted:
+ - type: `boolean`
+
+
+ - type: `object`
+
+ - protocols:
+ - additionalProperties: `false`
+ - properties:
+ - inbound:
+ - type: `boolean`
+
+ - localAddress:
+ - type: `string`
+
+ - remoteAddress:
+ - type: `string`
+
+ - static:
+ - type: `boolean`
+
+ - trusted:
+ - type: `boolean`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "caps": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "enode": {
+ "type": "string"
+ },
+ "enr": {
+ "type": "string"
+ },
+ "id": {
+ "type": "string"
+ },
+ "name": {
+ "type": "string"
+ },
+ "network": {
+ "additionalProperties": false,
+ "properties": {
+ "inbound": {
+ "type": "boolean"
+ },
+ "localAddress": {
+ "type": "string"
+ },
+ "remoteAddress": {
+ "type": "string"
+ },
+ "static": {
+ "type": "boolean"
+ },
+ "trusted": {
+ "type": "boolean"
+ }
+ },
+ "type": "object"
+ },
+ "protocols": {
+ "additionalProperties": false,
+ "properties": {
+ "inbound": {
+ "type": "boolean"
+ },
+ "localAddress": {
+ "type": "string"
+ },
+ "remoteAddress": {
+ "type": "string"
+ },
+ "static": {
+ "type": "boolean"
+ },
+ "trusted": {
+ "type": "boolean"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_peers", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ admin.peers();
+ ```
+
+
++```go +func (api *publicAdminAPI) Peers() ([ // Peers retrieves all the information we know about each individual peer at the +// protocol granularity. +]*p2p.PeerInfo, error) { + server := api.node.Server() + if server == nil { + return nil, ErrNodeStopped + } + return server.PeersInfo(), nil +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_removePeer", "params": [+```go +func (api *privateAdminAPI) RemovePeer(url string) (bool, error) { + server := api.node.Server() + if server == nil { + return false, ErrNodeStopped + } + node, err := enode.Parse(enode.ValidSchemes, url) + if err != nil { + return false, fmt.Errorf("invalid enode: %v", err) + } + server.RemovePeer(node) + return true, nil +}// RemovePeer disconnects from a remote node if the connection exists + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_removeTrustedPeer", "params": [+```go +func (api *privateAdminAPI) RemoveTrustedPeer(url string) (bool, error) { + server := api.node.Server() + if server == nil { + return false, ErrNodeStopped + } + node, err := enode.Parse(enode.ValidSchemes, url) + if err != nil { + return false, fmt.Errorf("invalid enode: %v", err) + } + server.RemoveTrustedPeer(node) + return true, nil +}// RemoveTrustedPeer removes a remote node from the trusted peer set, but it +// does not disconnect it automatically. + +``` +View on GitHub → +
+*string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+port *int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+cors *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__4:__
+apis *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__5:__
+vhosts *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_startRPC", "params": [+```go +func (api *privateAdminAPI) StartRPC(host *string, port *int, cors *string, apis *string, vhosts *string) (bool, error) { + api.node.lock.Lock() + defer api.node.lock.Unlock() + if host == nil { + h := DefaultHTTPHost + if api.node.config.HTTPHost != "" { + h = api.node.config.HTTPHost + } + host = &h + } + if port == nil { + port = &api.node.config.HTTPPort + } + config := httpConfig{CorsAllowedOrigins: api.node.config.HTTPCors, Vhosts: api.node.config.HTTPVirtualHosts, Modules: api.node.config.HTTPModules} + if cors != nil { + config.CorsAllowedOrigins = nil + for _, origin := // StartRPC starts the HTTP RPC API server. + range strings.Split(*cors, ",") { + config.CorsAllowedOrigins = append(config.CorsAllowedOrigins, strings.TrimSpace(origin)) + } + } + if vhosts != nil { + config.Vhosts = nil + for _, vhost := range strings.Split(*host, ",") { + config.Vhosts = append(config.Vhosts, strings.TrimSpace(vhost)) + } + } + if apis != nil { + config.Modules = nil + for _, m := range strings.Split(*apis, ",") { + config.Modules = append(config.Modules, strings.TrimSpace(m)) + } + } + if err := api.node.http.setListenAddr(*host, *port); err != nil { + return false, err + } + if err := api.node.http.enableRPC(api.node.rpcAPIs, config); err != nil { + return false, err + } + if err := api.node.http.start(); err != nil { + return false, err + } + return true, nil +} +``` +View on GitHub → +
+*string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+port *int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+allowedOrigins *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__4:__
+apis *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_startWS", "params": [+```go +func (api *privateAdminAPI) StartWS(host *string, port *int, allowedOrigins *string, apis *string) (bool, error) { + api.node.lock.Lock() + defer api.node.lock.Unlock() + if host == nil { + h := DefaultWSHost + if api.node.config.WSHost != "" { + h = api.node.config.WSHost + } + host = &h + } + if port == nil { + port = &api.node.config.WSPort + } + config := wsConfig{Modules: api.node.config.WSModules, Origins: api.node.config.WSOrigins} + if apis != nil { + config.Modules = nil + for _, m := // StartWS starts the websocket RPC API server. + range strings.Split(*apis, ",") { + config.Modules = append(config.Modules, strings.TrimSpace(m)) + } + } + if allowedOrigins != nil { + config.Origins = nil + for _, origin := range strings.Split(*allowedOrigins, ",") { + config.Origins = append(config.Origins, strings.TrimSpace(origin)) + } + } + server := api.node.wsServerForPort(*port) + if err := server.setListenAddr(*host, *port); err != nil { + return false, err + } + if err := server.enableWS(api.node.rpcAPIs, config); err != nil { + return false, err + } + if err := server.start(); err != nil { + return false, err + } + api.node.http.log.Info("WebSocket endpoint opened", "url", api.node.WSEndpoint()) + return true, nil +} +``` +View on GitHub → +
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_stopRPC", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ admin.stopRPC();
+ ```
+
+
++```go +func (api *privateAdminAPI) StopRPC() (bool, error) { + api.node.http.stop() + return true, nil +}// StopRPC shuts down the HTTP server. + +``` +View on GitHub → +
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "admin_stopWS", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ admin.stopWS();
+ ```
+
+
++```go +func (api *privateAdminAPI) StopWS() (bool, error) { + api.node.http.stopWS() + api.node.ws.stop() + return true, nil +}// StopWS terminates all WebSocket servers. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### debug_accountRange
+
+AccountRange enumerates all accounts in the given block and start point in paging request
+
+
+#### Params (6)
+
+Parameters must be given _by position_.
+
+
+__1:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+start []byte
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a variable length byte array`
+ - pattern: `^0x([a-fA-F0-9]?)+$`
+ - title: `bytes`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a variable length byte array",
+ "pattern": "^0x([a-fA-F0-9]?)+$",
+ "title": "bytes",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+maxResults int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__4:__
+nocode bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+__5:__
+nostorage bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+__6:__
+incompletes bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+state.IteratorDump
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - accounts:
+ - patternProperties:
+ - .*:
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - balance:
+ - type: `string`
+
+ - code:
+ - type: `string`
+
+ - codeHash:
+ - type: `string`
+
+ - key:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - root:
+ - type: `string`
+
+ - storage:
+ - patternProperties:
+ - .*:
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+ - next:
+ - pattern: `^0x([a-fA-F0-9]?)+$`
+ - title: `bytes`
+ - type: `string`
+
+ - root:
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "accounts": {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "balance": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "codeHash": {
+ "type": "string"
+ },
+ "key": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "root": {
+ "type": "string"
+ },
+ "storage": {
+ "patternProperties": {
+ ".*": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "next": {
+ "pattern": "^0x([a-fA-F0-9]?)+$",
+ "title": "bytes",
+ "type": "string"
+ },
+ "root": {
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_accountRange", "params": [+```go +func (api *PublicDebugAPI) AccountRange(blockNrOrHash rpc.BlockNumberOrHash, start [ // AccountRange enumerates all accounts in the given block and start point in paging request +]byte, maxResults int, nocode, nostorage, incompletes bool) (state.IteratorDump, error) { + var stateDb *state.StateDB + var err error + if number, ok := blockNrOrHash.Number(); ok { + if number == rpc.PendingBlockNumber { + _, stateDb = api.eth.miner.Pending() + } else { + var block *types.Block + if number == rpc.LatestBlockNumber { + block = api.eth.blockchain.CurrentBlock() + } else { + block = api.eth.blockchain.GetBlockByNumber(uint64(number)) + } + if block == nil { + return state.IteratorDump{}, fmt.Errorf("block #%d not found", number) + } + stateDb, err = api.eth.BlockChain().StateAt(block.Root()) + if err != nil { + return state.IteratorDump{}, err + } + } + } else if hash, ok := blockNrOrHash.Hash(); ok { + block := api.eth.blockchain.GetBlockByHash(hash) + if block == nil { + return state.IteratorDump{}, fmt.Errorf("block %s not found", hash.Hex()) + } + stateDb, err = api.eth.BlockChain().StateAt(block.Root()) + if err != nil { + return state.IteratorDump{}, err + } + } else { + return state.IteratorDump{}, errors.New("either block number or block hash must be specified") + } + if maxResults > AccountRangeMaxResults || maxResults <= 0 { + maxResults = AccountRangeMaxResults + } + return stateDb.IteratorDump(nocode, nostorage, incompletes, start, maxResults), nil +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_backtraceAt", "params": [+```go +func (*HandlerT) BacktraceAt(location string) error { + return glogger.BacktraceAt(location) +}// BacktraceAt sets the log backtrace location. See package log for details on +// the pattern syntax. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+nsec uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_blockProfile", "params": [+```go +func (*HandlerT) BlockProfile(file string, nsec uint) error { + runtime.SetBlockProfileRate(1) + time.Sleep(time.Duration(nsec) * time.Second) + defer runtime.SetBlockProfileRate(0) + return writeProfile("block", file) +}// BlockProfile turns on goroutine 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. + +``` +View on GitHub → +
++```go +func (api *PrivateDebugAPI) ChaindbCompact() error { + for b := byte(0); b < 255; b++ { + log.Info("Compacting chain database", "range", fmt.Sprintf("0x%0.2X-0x%0.2X", b, b+1)) + if err := api.b.ChainDb().Compact([ // ChaindbCompact flattens the entire key-value database into a single level, + // removing all unused slots and merging all keys. + ]byte{b}, []byte{b + 1}); err != nil { + log.Error("Database compaction failed", "err", err) + return err + } + } + return nil +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_chaindbProperty", "params": [+```go +func (api *PrivateDebugAPI) ChaindbProperty(property string) (string, error) { + if property == "" { + property = "leveldb.stats" + } else if !strings.HasPrefix(property, "leveldb.") { + property = "leveldb." + property + } + return api.b.ChainDb().Stat(property) +}// ChaindbProperty returns leveldb properties of the key-value database. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+nsec uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_cpuProfile", "params": [+```go +func (h *HandlerT) CpuProfile(file string, nsec uint) error { + if err := h.StartCPUProfile(file); err != nil { + return err + } + time.Sleep(time.Duration(nsec) * time.Second) + h.StopCPUProfile() + return nil +}// CpuProfile turns on CPU profiling for nsec seconds and writes +// profile data to file. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+state.Dump
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - accounts:
+ - patternProperties:
+ - .*:
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - balance:
+ - type: `string`
+
+ - code:
+ - type: `string`
+
+ - codeHash:
+ - type: `string`
+
+ - key:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - root:
+ - type: `string`
+
+ - storage:
+ - patternProperties:
+ - .*:
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+ - root:
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "accounts": {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "balance": {
+ "type": "string"
+ },
+ "code": {
+ "type": "string"
+ },
+ "codeHash": {
+ "type": "string"
+ },
+ "key": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "root": {
+ "type": "string"
+ },
+ "storage": {
+ "patternProperties": {
+ ".*": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "root": {
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_dumpBlock", "params": [+```go +func (api *PublicDebugAPI) DumpBlock(blockNr rpc.BlockNumber) (state.Dump, error) { + if blockNr == rpc.PendingBlockNumber { + _, stateDb := api.eth.miner.Pending() + return stateDb.RawDump(false, false, true), nil + } + var block *types.Block + if blockNr == rpc.LatestBlockNumber { + block = api.eth.blockchain.CurrentBlock() + } else { + block = api.eth.blockchain.GetBlockByNumber(uint64(blockNr)) + } + if block == nil { + return state.Dump{}, fmt.Errorf("block #%d not found", blockNr) + } + stateDb, err := api.eth.BlockChain().StateAt(block.Root()) + if err != nil { + return state.Dump{}, err + } + return stateDb.RawDump(false, false, true), nil +}// DumpBlock retrieves the entire state of the database at a given block. + +``` +View on GitHub → +
++```go +func (*HandlerT) FreeOSMemory() { + debug.FreeOSMemory() +}// FreeOSMemory forces a garbage collection. + +``` +View on GitHub → +
+*debug.GCStats
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - LastGC:
+ - format: `date-time`
+ - type: `string`
+
+ - NumGC:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Pause:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - type: `array`
+
+ - PauseEnd:
+ - items:
+ - format: `date-time`
+ - type: `string`
+
+ - type: `array`
+
+ - PauseQuantiles:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - type: `array`
+
+ - PauseTotal:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "LastGC": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "NumGC": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Pause": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "PauseEnd": {
+ "items": {
+ "format": "date-time",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "PauseQuantiles": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "PauseTotal": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_gcStats", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ debug.gcStats();
+ ```
+
+
++```go +func (*HandlerT) GcStats() *debug.GCStats { + s := new(debug.GCStats) + debug.ReadGCStats(s) + return s +}// GcStats returns GC statistics. + +``` +View on GitHub → +
+[]*BadBlockArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - block:
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - error:
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactions:
+ - items:
+ - additionalProperties: `true`
+
+ - type: `array`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - uncles:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+
+ - type: `object`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - rlp:
+ - type: `string`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "block": {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "error": {
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactions": {
+ "items": {
+ "additionalProperties": true
+ },
+ "type": "array"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "uncles": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "type": "object"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "rlp": {
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_getBadBlocks", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ debug.getBadBlocks();
+ ```
+
+
++```go +func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([ // GetBadBlocks 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 +]*BadBlockArgs, error) { + blocks := api.eth.BlockChain().BadBlocks() + results := make([]*BadBlockArgs, len(blocks)) + var err error + for i, block := range blocks { + results[i] = &BadBlockArgs{Hash: block.Hash()} + if rlpBytes, err := rlp.EncodeToBytes(block); err != nil { + results[i].RLP = err.Error() + } else { + results[i].RLP = fmt.Sprintf("0x%x", rlpBytes) + } + if results[i].Block, err = ethapi.RPCMarshalBlock(block, true, true); err != nil { + results[i].Block = ðapi.RPCMarshalBlockT{Error: err.Error()} + } + } + return results, nil +} +``` +View on GitHub → +
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_getBlockRlp", "params": [+```go +func (api *PublicDebugAPI) GetBlockRlp(ctx context.Context, number uint64) (string, error) { + block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) + if block == nil { + return "", fmt.Errorf("block #%d not found", number) + } + encoded, err := rlp.EncodeToBytes(block) + if err != nil { + return "", err + } + return fmt.Sprintf("%x", encoded), nil +}// GetBlockRlp retrieves the RLP encoded for of a single block. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+endHash *common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+commonAddress []common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_getModifiedAccountsByHash", "params": [+```go +func (api *PrivateDebugAPI) GetModifiedAccountsByHash(startHash common.Hash, endHash *common.Hash) ([ // GetModifiedAccountsByHash 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. +]common.Address, error) { + var startBlock, endBlock *types.Block + startBlock = api.eth.blockchain.GetBlockByHash(startHash) + if startBlock == nil { + return nil, fmt.Errorf("start block %x not found", startHash) + } + if endHash == nil { + endBlock = startBlock + startBlock = api.eth.blockchain.GetBlockByHash(startBlock.ParentHash()) + if startBlock == nil { + return nil, fmt.Errorf("block %x has no parent", endBlock.Number()) + } + } else { + endBlock = api.eth.blockchain.GetBlockByHash(*endHash) + if endBlock == nil { + return nil, fmt.Errorf("end block %x not found", *endHash) + } + } + return api.getModifiedAccounts(startBlock, endBlock) +} +``` +View on GitHub → +
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+endNum *uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+commonAddress []common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_getModifiedAccountsByNumber", "params": [+```go +func (api *PrivateDebugAPI) GetModifiedAccountsByNumber(startNum uint64, endNum *uint64) ([ // GetModifiedAccountsByNumber 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. +]common.Address, error) { + var startBlock, endBlock *types.Block + startBlock = api.eth.blockchain.GetBlockByNumber(startNum) + if startBlock == nil { + return nil, fmt.Errorf("start block %x not found", startNum) + } + if endNum == nil { + endBlock = startBlock + startBlock = api.eth.blockchain.GetBlockByHash(startBlock.ParentHash()) + if startBlock == nil { + return nil, fmt.Errorf("block %x has no parent", endBlock.Number()) + } + } else { + endBlock = api.eth.blockchain.GetBlockByNumber(*endNum) + if endBlock == nil { + return nil, fmt.Errorf("end block %d not found", *endNum) + } + } + return api.getModifiedAccounts(startBlock, endBlock) +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+nsec uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_goTrace", "params": [+```go +func (h *HandlerT) GoTrace(file string, nsec uint) error { + if err := h.StartGoTrace(file); err != nil { + return err + } + time.Sleep(time.Duration(nsec) * time.Second) + h.StopGoTrace() + return nil +}// GoTrace turns on tracing for nsec seconds and writes +// trace data to file. + +``` +View on GitHub → +
+*runtime.MemStats
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Alloc:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - BuckHashSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - BySize:
+ - items:
+ - additionalProperties: `false`
+ - properties:
+ - Frees:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Mallocs:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Size:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: `object`
+
+ - maxItems: `61`
+ - minItems: `61`
+ - type: `array`
+
+ - DebugGC:
+ - type: `boolean`
+
+ - EnableGC:
+ - type: `boolean`
+
+ - Frees:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - GCCPUFraction:
+ - type: `number`
+
+ - GCSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapAlloc:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapIdle:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapInuse:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapObjects:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapReleased:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - HeapSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - LastGC:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Lookups:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - MCacheInuse:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - MCacheSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - MSpanInuse:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - MSpanSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Mallocs:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - NextGC:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - NumForcedGC:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - NumGC:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - OtherSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - PauseEnd:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - PauseNs:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - PauseTotalNs:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - StackInuse:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - StackSys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Sys:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - TotalAlloc:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Alloc": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "BuckHashSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "BySize": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "Frees": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Mallocs": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Size": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "maxItems": 61,
+ "minItems": 61,
+ "type": "array"
+ },
+ "DebugGC": {
+ "type": "boolean"
+ },
+ "EnableGC": {
+ "type": "boolean"
+ },
+ "Frees": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "GCCPUFraction": {
+ "type": "number"
+ },
+ "GCSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapAlloc": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapIdle": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapInuse": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapObjects": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapReleased": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "HeapSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "LastGC": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Lookups": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "MCacheInuse": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "MCacheSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "MSpanInuse": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "MSpanSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Mallocs": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "NextGC": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "NumForcedGC": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "NumGC": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "OtherSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "PauseEnd": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "PauseNs": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "PauseTotalNs": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "StackInuse": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "StackSys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Sys": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "TotalAlloc": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_memStats", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ debug.memStats();
+ ```
+
+
++```go +func (*HandlerT) MemStats() *runtime.MemStats { + s := new(runtime.MemStats) + runtime.ReadMemStats(s) + return s +}// MemStats returns detailed runtime memory statistics. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+nsec uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_mutexProfile", "params": [+```go +func (*HandlerT) MutexProfile(file string, nsec uint) error { + runtime.SetMutexProfileFraction(1) + time.Sleep(time.Duration(nsec) * time.Second) + defer runtime.SetMutexProfileFraction(0) + return writeProfile("mutex", file) +}// MutexProfile 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. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_preimage", "params": [+```go +func (api *PrivateDebugAPI) Preimage(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { + if preimage := rawdb.ReadPreimage(api.eth.ChainDb(), hash); preimage != nil { + return preimage, nil + } + return nil, errors.New("unknown preimage") +}// Preimage is a debug API function that returns the preimage for a sha3 hash, if known. + +``` +View on GitHub → +
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_printBlock", "params": [+```go +func (api *PublicDebugAPI) PrintBlock(ctx context.Context, number uint64) (string, error) { + block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) + if block == nil { + return "", fmt.Errorf("block #%d not found", number) + } + return spew.Sdump(block), nil +}// PrintBlock retrieves a block and returns its pretty printed form. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*types.Transaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_removePendingTransaction", "params": [+```go +func (api *PrivateDebugAPI) RemovePendingTransaction(hash common.Hash) (*types.Transaction, error) { + return api.eth.txPool.RemoveTx(hash), nil +}// RemovePendingTransaction removes a transaction from the txpool. +// It returns the transaction removed, if any. + +``` +View on GitHub → +
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_seedHash", "params": [+```go +func (api *PublicDebugAPI) SeedHash(ctx context.Context, number uint64) (string, error) { + block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) + if block == nil { + return "", fmt.Errorf("block #%d not found", number) + } + ecip1099FBlock := api.b.ChainConfig().GetEthashECIP1099Transition() + epochLength := ethash.CalcEpochLength(number, ecip1099FBlock) + epoch := ethash.CalcEpoch(number, epochLength) + return fmt.Sprintf("0x%x", ethash.SeedHash(epoch, epochLength)), nil +}// SeedHash retrieves the seed hash of a block. + +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_setBlockProfileRate", "params": [+```go +func (*HandlerT) SetBlockProfileRate(rate int) { + runtime.SetBlockProfileRate(rate) +}// SetBlockProfileRate sets the rate of goroutine block profile data collection. +// rate 0 disables block profiling. + +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_setGCPercent", "params": [+```go +func (*HandlerT) SetGCPercent(v int) int { + return debug.SetGCPercent(v) +}// SetGCPercent sets the garbage collection target percentage. It returns the previous +// setting. A negative value disables GC. + +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_setHead", "params": [+```go +func (api *PrivateDebugAPI) SetHead(number hexutil.Uint64) { + api.b.SetHead(uint64(number)) +}// SetHead rewinds the head of the blockchain to a previous block. + +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_setMutexProfileFraction", "params": [+```go +func (*HandlerT) SetMutexProfileFraction(rate int) { + runtime.SetMutexProfileFraction(rate) +}// SetMutexProfileFraction sets the rate of mutex profiling. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_stacks", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ debug.stacks();
+ ```
+
+
++```go +func (*HandlerT) Stacks() string { + buf := new(bytes.Buffer) + pprof.Lookup("goroutine").WriteTo(buf, 2) + return buf.String() +}// Stacks returns a printed representation of the stacks of all goroutines. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *StdTraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - TxHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "TxHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+string []string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_standardTraceBadBlockToFile", "params": [+```go +func (api *PrivateDebugAPI) StandardTraceBadBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([ // StandardTraceBadBlockToFile dumps the structured logs created during the +// execution of EVM against a block pulled from the pool of bad ones to the +// local file system and returns a list of files to the caller. +]string, error) { + blocks := api.eth.blockchain.BadBlocks() + for _, block := range blocks { + if block.Hash() == hash { + return api.standardTraceBlockToFile(ctx, block, config) + } + } + return nil, fmt.Errorf("bad block %#x not found", hash) +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *StdTraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - TxHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "TxHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+string []string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_standardTraceBlockToFile", "params": [+```go +func (api *PrivateDebugAPI) StandardTraceBlockToFile(ctx context.Context, hash common.Hash, config *StdTraceConfig) ([ // StandardTraceBlockToFile dumps the structured logs created during the +// execution of EVM to the local file system and returns a list of files +// to the caller. +]string, error) { + block := api.eth.blockchain.GetBlockByHash(hash) + if block == nil { + return nil, fmt.Errorf("block %#x not found", hash) + } + return api.standardTraceBlockToFile(ctx, block, config) +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_startCPUProfile", "params": [+```go +func (h *HandlerT) StartCPUProfile(file string) error { + h.mu.Lock() + defer h.mu.Unlock() + if h.cpuW != nil { + return errors.New("CPU profiling already in progress") + } + f, err := os.Create(expandHome(file)) + if err != nil { + return err + } + if err := pprof.StartCPUProfile(f); err != nil { + f.Close() + return err + } + h.cpuW = f + h.cpuFile = file + log.Info("CPU profiling started", "dump", h.cpuFile) + return nil +}// StartCPUProfile turns on CPU profiling, writing to the given file. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_startGoTrace", "params": [+```go +func (h *HandlerT) StartGoTrace(file string) error { + h.mu.Lock() + defer h.mu.Unlock() + if h.traceW != nil { + return errors.New("trace already in progress") + } + f, err := os.Create(expandHome(file)) + if err != nil { + return err + } + if err := trace.Start(f); err != nil { + f.Close() + return err + } + h.traceW = f + h.traceFile = file + log.Info("Go tracing started", "dump", h.traceFile) + return nil +}// StartGoTrace turns on tracing, writing to the given file. + +``` +View on GitHub → +
++```go +func (h *HandlerT) StopCPUProfile() error { + h.mu.Lock() + defer h.mu.Unlock() + pprof.StopCPUProfile() + if h.cpuW == nil { + return errors.New("CPU profiling not in progress") + } + log.Info("Done writing CPU profile", "dump", h.cpuFile) + h.cpuW.Close() + h.cpuW = nil + h.cpuFile = "" + return nil +}// StopCPUProfile stops an ongoing CPU profile. + +``` +View on GitHub → +
++```go +func (h *HandlerT) StopGoTrace() error { + h.mu.Lock() + defer h.mu.Unlock() + trace.Stop() + if h.traceW == nil { + return errors.New("trace not in progress") + } + log.Info("Done writing Go trace", "dump", h.traceFile) + h.traceW.Close() + h.traceW = nil + h.traceFile = "" + return nil +}// StopTrace stops an ongoing trace. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+txIndex int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+contractAddress common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__4:__
+keyStart hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__5:__
+maxResult int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+StorageRangeResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - nextKey:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - storage:
+ - patternProperties:
+ - .*:
+ - additionalProperties: `false`
+ - properties:
+ - key:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "nextKey": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "storage": {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": false,
+ "properties": {
+ "key": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_storageRangeAt", "params": [+```go +func (api *PrivateDebugAPI) StorageRangeAt(blockHash common.Hash, txIndex int, contractAddress common.Address, keyStart hexutil.Bytes, maxResult int) (StorageRangeResult, error) { + block := api.eth.blockchain.GetBlockByHash(blockHash) + if block == nil { + return StorageRangeResult{}, fmt.Errorf("block %#x not found", blockHash) + } + _, _, statedb, err := api.computeTxEnv(block, txIndex, 0) + if err != nil { + return StorageRangeResult{}, err + } + st := statedb.StorageTrie(contractAddress) + if st == nil { + return StorageRangeResult{}, fmt.Errorf("account %x doesn't exist", contractAddress) + } + return storageRangeAt(st, keyStart, maxResult) +}// StorageRangeAt returns the storage at the given block height and transaction index. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+number uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_testSignCliqueBlock", "params": [, +```go +func (api *PublicDebugAPI) TestSignCliqueBlock(ctx context.Context, address common.Address, number uint64) (common.Address, error) { + block, _ := api.b.BlockByNumber(ctx, rpc.BlockNumber(number)) + if block == nil { + return common.Address{}, fmt.Errorf("block #%d not found", number) + } + header := block.Header() + header.Extra = make([ // TestSignCliqueBlock fetches the given block number, and attempts to sign it as a clique header with the + // given address, returning the address of the recovered signature + // + // This is a temporary method to debug the externalsigner integration, + // TODO: Remove this method when the integration is mature + ]byte, 32+65) + encoded := clique.CliqueRLP(header) + account := accounts.Account{Address: address} + wallet, err := api.b.AccountManager().Find(account) + if err != nil { + return common.Address{}, err + } + signature, err := wallet.SignData(account, accounts.MimetypeClique, encoded) + if err != nil { + return common.Address{}, err + } + sealHash := clique.SealHash(header).Bytes() + log.Info("test signing of clique block", "Sealhash", fmt.Sprintf("%x", sealHash), "signature", fmt.Sprintf("%x", signature)) + pubkey, err := crypto.Ecrecover(sealHash, signature) + if err != nil { + return common.Address{}, err + } + var signer common.Address + copy(signer[:], crypto.Keccak256(pubkey[1:])[12:]) + return signer, nil +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceBadBlock", "params": [+```go +func (api *PrivateDebugAPI) TraceBadBlock(ctx context.Context, hash common.Hash, config *TraceConfig) ([ // TraceBadBlock returns the structured logs created during the execution of +// EVM against a block pulled from the pool of bad ones and returns them as a JSON +// object. +]*txTraceResult, error) { + blocks := api.eth.blockchain.BadBlocks() + for _, block := range blocks { + if block.Hash() == hash { + return api.traceBlock(ctx, block, config) + } + } + return nil, fmt.Errorf("bad block %#x not found", hash) +} +``` +View on GitHub → +
+[]byte
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a variable length byte array`
+ - pattern: `^0x([a-fA-F0-9]?)+$`
+ - title: `bytes`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a variable length byte array",
+ "pattern": "^0x([a-fA-F0-9]?)+$",
+ "title": "bytes",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceBlock", "params": [+```go +func (api *PrivateDebugAPI) TraceBlock(ctx context.Context, blob [ // TraceBlock returns the structured logs created during the execution of EVM +// and returns them as a JSON object. +]byte, config *TraceConfig) ([]*txTraceResult, error) { + return traceBlockRLP(ctx, api.eth, blob, config) +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceBlockByHash", "params": [+```go +func (api *PrivateDebugAPI) TraceBlockByHash(ctx context.Context, hash common.Hash, config *TraceConfig) ([ // TraceBlockByHash returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +]*txTraceResult, error) { + block := api.eth.blockchain.GetBlockByHash(hash) + if block == nil { + return nil, fmt.Errorf("block %#x not found", hash) + } + return api.traceBlock(ctx, block, config) +} +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceBlockByNumber", "params": [+```go +func (api *PrivateDebugAPI) TraceBlockByNumber(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([ // TraceBlockByNumber returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +]*txTraceResult, error) { + return traceBlockByNumber(ctx, api.eth, number, config) +} +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceBlockFromFile", "params": [+```go +func (api *PrivateDebugAPI) TraceBlockFromFile(ctx context.Context, file string, config *TraceConfig) ([ // TraceBlockFromFile returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +]*txTraceResult, error) { + blob, err := ioutil.ReadFile(file) + if err != nil { + return nil, fmt.Errorf("could not read file: %v", err) + } + return api.TraceBlock(ctx, blob, config) +} +``` +View on GitHub → +
+ethapi.CallArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+__3:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+interface interface{}
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceCall", "params": [+```go +func (api *PrivateDebugAPI) TraceCall(ctx context.Context, args ethapi.CallArgs, blockNrOrHash rpc.BlockNumberOrHash, config *TraceConfig) (interface{}, error) { + statedb, header, err := api.eth.APIBackend.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if err != nil { + var block *types.Block + if hash, ok := blockNrOrHash.Hash(); ok { + block = api.eth.blockchain.GetBlockByHash(hash) + } else if number, ok := blockNrOrHash.Number(); ok { + block = api.eth.blockchain.GetBlockByNumber(uint64(number)) + } + if block == nil { + return nil, fmt.Errorf("block %v not found: %v", blockNrOrHash, err) + } + reexec := defaultTraceReexec + if config != nil && config.Reexec != nil { + reexec = *config.Reexec + } + _, _, statedb, err = api.computeTxEnv(block, 0, reexec) + if err != nil { + return nil, err + } + } + msg := args.ToMessage(api.eth.APIBackend.RPCGasCap()) + vmctx := core.NewEVMContext(msg, header, api.eth.blockchain, nil) + return api.traceTx(ctx, msg, vmctx, statedb, config) +}// TraceCall lets you trace a given eth_call. It collects the structured logs created during the execution of EVM +// if the given transaction was added on top of the provided block and returns them as a JSON object. +// You can provide -2 as a block number to trace on top of the pending block. +// Try to retrieve the specified block + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+interface interface{}
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_traceTransaction", "params": [+```go +func (api *PrivateDebugAPI) TraceTransaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) { + return traceTransaction(ctx, api.eth, hash, config) +}// TraceTransaction returns the structured logs created during the execution of EVM +// and returns them as a JSON object. + +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_verbosity", "params": [+```go +func (*HandlerT) Verbosity(level int) { + glogger.Verbosity(log.Lvl(level)) +}// Verbosity sets the log verbosity ceiling. The verbosity of individual packages +// and source files can be raised using Vmodule. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_vmodule", "params": [+```go +func (*HandlerT) Vmodule(pattern string) error { + return glogger.Vmodule(pattern) +}// Vmodule sets the log verbosity pattern. See package log for details on the +// pattern syntax. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_writeBlockProfile", "params": [+```go +func (*HandlerT) WriteBlockProfile(file string) error { + return writeProfile("block", file) +}// WriteBlockProfile writes a goroutine blocking profile to the given file. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_writeMemProfile", "params": [+```go +func (*HandlerT) WriteMemProfile(file string) error { + return writeProfile("heap", file) +}// WriteMemProfile 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. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "debug_writeMutexProfile", "params": [+```go +func (*HandlerT) WriteMutexProfile(file string) error { + return writeProfile("mutex", file) +}// WriteMutexProfile writes a goroutine blocking profile to the given file. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### eth_accounts
+
+Accounts returns the collection of accounts this node manages
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+commonAddress []common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_accounts", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.accounts();
+ ```
+
+
++```go +func (s *PublicAccountAPI) Accounts() [ // Accounts returns the collection of accounts this node manages +]common.Address { + return s.am.Accounts() +} +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_blockNumber", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.blockNumber();
+ ```
+
+
++```go +func (s *PublicBlockChainAPI) BlockNumber() hexutil.Uint64 { + header, _ := s.b.HeaderByNumber(context.Background(), rpc.LatestBlockNumber) + return hexutil.Uint64(header.Number.Uint64()) +}// BlockNumber returns the block number of the chain head. + +``` +View on GitHub → +
+CallArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+__3:__
+overrides *map[common.Address]account
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - patternProperties:
+ - .*:
+ - additionalProperties: `false`
+ - properties:
+ - balance:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - code:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - state:
+ - patternProperties:
+ - .*:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+
+ - type: `object`
+
+ - stateDiff:
+ - patternProperties:
+ - .*:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": false,
+ "properties": {
+ "balance": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "code": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "state": {
+ "patternProperties": {
+ ".*": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "stateDiff": {
+ "patternProperties": {
+ ".*": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_call", "params": [+```go +func (s *PublicBlockChainAPI) Call(ctx context.Context, args CallArgs, blockNrOrHash rpc.BlockNumberOrHash, overrides *map // Call executes the given transaction on the state for the given block number. +// +// Additionally, the caller can specify a batch of contract for fields overriding. +// +// Note, this function doesn't make and changes in the state/blockchain and is +// useful to execute and retrieve values. +[common.Address]account) (hexutil.Bytes, error) { + var accounts map[common.Address]account + if overrides != nil { + accounts = *overrides + } + result, err := DoCall(ctx, s.b, args, blockNrOrHash, accounts, vm.Config{}, 5*time.Second, s.b.RPCGasCap()) + if err != nil { + return nil, err + } + if len(result.Revert()) > 0 { + return nil, newRevertError(result) + } + return result.Return(), result.Err +} +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_chainId", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.chainId();
+ ```
+
+
++```go +func (api *PublicEthereumAPI) ChainId() hexutil.Uint64 { + chainID := new(big.Int) + if config := api.e.blockchain.Config(); config.IsEnabled(config.GetEIP155Transition, api.e.blockchain.CurrentBlock().Number()) { + chainID = config.GetChainID() + } + return (hexutil.Uint64)(chainID.Uint64()) +}// ChainId is the EIP-155 replay-protection chain id for the current ethereum chain config. + +``` +View on GitHub → +
+*hexutil.Big
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_chainId", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.chainId();
+ ```
+
+
++```go +func (s *PublicBlockChainAPI) ChainId() *hexutil.Big { + return (*hexutil.Big)(s.b.ChainConfig().GetChainID()) +}// ChainId returns the chainID value for transaction replay protection. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_coinbase", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.coinbase();
+ ```
+
+
++```go +func (api *PublicEthereumAPI) Coinbase() (common.Address, error) { + return api.Etherbase() +}// Coinbase is the address that mining rewards will be send to (alias for Etherbase) + +``` +View on GitHub → +
+CallArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash *rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_estimateGas", "params": [+```go +func (s *PublicBlockChainAPI) EstimateGas(ctx context.Context, args CallArgs, blockNrOrHash *rpc.BlockNumberOrHash) (hexutil.Uint64, error) { + bNrOrHash := rpc.BlockNumberOrHashWithNumber(rpc.PendingBlockNumber) + if blockNrOrHash != nil { + bNrOrHash = *blockNrOrHash + } + return DoEstimateGas(ctx, s.b, args, bNrOrHash, s.b.RPCGasCap()) +}// EstimateGas returns an estimate of the amount of gas needed to execute the +// given transaction against the current pending block. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_etherbase", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.etherbase();
+ ```
+
+
++```go +func (api *PublicEthereumAPI) Etherbase() (common.Address, error) { + return api.e.Etherbase() +}// Etherbase is the address that mining rewards will be send to + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*SignTransactionResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - raw:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - tx:
+ - additionalProperties: `false`
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "raw": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "tx": {
+ "additionalProperties": false,
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_fillTransaction", "params": [+```go +func (s *PublicTransactionPoolAPI) FillTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) { + if err := args.setDefaults(ctx, s.b); err != nil { + return nil, err + } + tx := args.toTransaction() + data, err := rlp.EncodeToBytes(tx) + if err != nil { + return nil, err + } + return &SignTransactionResult{data, tx}, nil +}// FillTransaction fills the defaults (nonce, gas, gasPrice) on a given unsigned transaction, +// and returns it to the caller for further processing (signing + broadcast) + +``` +View on GitHub → +
+*hexutil.Big
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_gasPrice", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.gasPrice();
+ ```
+
+
++```go +func (s *PublicEthereumAPI) GasPrice(ctx context.Context) (*hexutil.Big, error) { + price, err := s.b.SuggestPrice(ctx) + return (*hexutil.Big)(price), err +}// GasPrice returns a suggestion for a gas price. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Big
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getBalance", "params": [, +```go +func (s *PublicBlockChainAPI) GetBalance(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Big, error) { + state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if state == nil || err != nil { + return nil, err + } + return (*hexutil.Big)(state.GetBalance(address)), state.Error() +}// GetBalance returns the amount of wei for the given address in the state of the +// given block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta +// block numbers are also allowed. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+fullTx bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalBlockT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - error:
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactions:
+ - items:
+ - additionalProperties: `true`
+
+ - type: `array`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - uncles:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "error": {
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactions": {
+ "items": {
+ "additionalProperties": true
+ },
+ "type": "array"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "uncles": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getBlockByHash", "params": [+```go +func (s *PublicBlockChainAPI) GetBlockByHash(ctx context.Context, hash common.Hash, fullTx bool) (*RPCMarshalBlockT, error) { + block, err := s.b.BlockByHash(ctx, hash) + if block != nil { + return s.rpcMarshalBlock(ctx, block, true, fullTx) + } + return nil, err +}// GetBlockByHash returns the requested block. When fullTx is true all transactions in the block are returned in full +// detail, otherwise only the transaction hash is returned. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+fullTx bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalBlockT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - error:
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactions:
+ - items:
+ - additionalProperties: `true`
+
+ - type: `array`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - uncles:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "error": {
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactions": {
+ "items": {
+ "additionalProperties": true
+ },
+ "type": "array"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "uncles": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getBlockByNumber", "params": [+```go +func (s *PublicBlockChainAPI) GetBlockByNumber(ctx context.Context, number rpc.BlockNumber, fullTx bool) (*RPCMarshalBlockT, error) { + block, err := s.b.BlockByNumber(ctx, number) + if block != nil && err == nil { + response, err := s.rpcMarshalBlock(ctx, block, true, fullTx) + if err == nil && number == rpc.PendingBlockNumber { + response.setAsPending() + } + return response, err + } + return nil, err +}// GetBlockByNumber returns the requested canonical block. +// * When blockNr is -1 the chain head is returned. +// * When blockNr is -2 the pending chain head is returned. +// * When fullTx is true all transactions in the block are returned, otherwise +// only the transaction hash is returned. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getBlockTransactionCountByHash", "params": [+```go +func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint { + if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil { + n := hexutil.Uint(len(block.Transactions())) + return &n + } + return nil +}// GetBlockTransactionCountByHash returns the number of transactions in the block with the given hash. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getBlockTransactionCountByNumber", "params": [+```go +func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint { + if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil { + n := hexutil.Uint(len(block.Transactions())) + return &n + } + return nil +}// GetBlockTransactionCountByNumber returns the number of transactions in the block with the given block number. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getCode", "params": [, +```go +func (s *PublicBlockChainAPI) GetCode(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) { + state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if state == nil || err != nil { + return nil, err + } + code := state.GetCode(address) + return code, state.Error() +}// GetCode returns the code stored at the given address in the state for the given block number. + +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+interface interface{}
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getFilterChanges", "params": [+```go +func (api *PublicFilterAPI) GetFilterChanges(id rpc.ID) (interface{}, error) { + api.filtersMu.Lock() + defer api.filtersMu.Unlock() + if f, found := api.filters[id]; found { + if !f.deadline.Stop() { + <-f.deadline.C + } + f.deadline.Reset(deadline) + switch f.typ { + case PendingTransactionsSubscription, BlocksSubscription, SideBlocksSubscription: + hashes := f.hashes + f.hashes = nil + return returnHashes(hashes), nil + case LogsSubscription, MinedAndPendingLogsSubscription: + logs := f.logs + f.logs = nil + return returnLogs(logs), nil + } + } + return [ // GetFilterChanges returns the logs for the filter with the given id since + // last time it was called. This can be used for polling. + // + // For pending transaction and block filters the result is []common.Hash. + // (pending)Log filters return []Log. + // + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterchanges + ]interface{}{}, fmt.Errorf("filter not found") +} +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+typesLog []*types.Log
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - data:
+ - pattern: `^0x([a-fA-F0-9]?)+$`
+ - title: `bytes`
+ - type: `string`
+
+ - logIndex:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - removed:
+ - type: `boolean`
+
+ - topics:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - transactionHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "data": {
+ "pattern": "^0x([a-fA-F0-9]?)+$",
+ "title": "bytes",
+ "type": "string"
+ },
+ "logIndex": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "removed": {
+ "type": "boolean"
+ },
+ "topics": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "transactionHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getFilterLogs", "params": [+```go +func (api *PublicFilterAPI) GetFilterLogs(ctx context.Context, id rpc.ID) ([ // GetFilterLogs returns the logs for the filter with the given id. +// If the filter could not be found an empty array of logs is returned. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getfilterlogs +]*types.Log, error) { + api.filtersMu.Lock() + f, found := api.filters[id] + api.filtersMu.Unlock() + if !found || f.typ != LogsSubscription { + return nil, fmt.Errorf("filter not found") + } + var filter *Filter + if f.crit.BlockHash != nil { + filter = NewBlockFilter(api.backend, *f.crit.BlockHash, f.crit.Addresses, f.crit.Topics) + } else { + begin := rpc.LatestBlockNumber.Int64() + if f.crit.FromBlock != nil { + begin = f.crit.FromBlock.Int64() + } + end := rpc.LatestBlockNumber.Int64() + if f.crit.ToBlock != nil { + end = f.crit.ToBlock.Int64() + } + filter = NewRangeFilter(api.backend, begin, end, f.crit.Addresses, f.crit.Topics) + } + logs, err := filter.Logs(ctx) + if err != nil { + return nil, err + } + return returnLogs(logs), nil +} +``` +View on GitHub → +
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getHashrate", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.getHashrate();
+ ```
+
+
++```go +func (api *API) GetHashrate() uint64 { + return uint64(api.ethash.Hashrate()) +}// GetHashrate returns the current hashrate for local CPU miner and remote miner. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalHeaderT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getHeaderByHash", "params": [+```go +func (s *PublicBlockChainAPI) GetHeaderByHash(ctx context.Context, hash common.Hash) *RPCMarshalHeaderT { + header, _ := s.b.HeaderByHash(ctx, hash) + if header != nil { + return s.rpcMarshalHeader(ctx, header) + } + return nil +}// GetHeaderByHash returns the requested header by hash. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalHeaderT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getHeaderByNumber", "params": [+```go +func (s *PublicBlockChainAPI) GetHeaderByNumber(ctx context.Context, number rpc.BlockNumber) (*RPCMarshalHeaderT, error) { + header, err := s.b.HeaderByNumber(ctx, number) + if header != nil && err == nil { + response := s.rpcMarshalHeader(ctx, header) + if number == rpc.PendingBlockNumber { + response.setAsPending() + } + return response, err + } + return nil, err +}// GetHeaderByNumber returns the requested canonical block header. +// * When blockNr is -1 the chain head is returned. +// * When blockNr is -2 the pending chain head is returned. + +``` +View on GitHub → +
+FilterCriteria
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Addresses:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - BlockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - FromBlock:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - ToBlock:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Topics:
+ - items:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Addresses": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "BlockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "FromBlock": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "ToBlock": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Topics": {
+ "items": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+typesLog []*types.Log
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - data:
+ - pattern: `^0x([a-fA-F0-9]?)+$`
+ - title: `bytes`
+ - type: `string`
+
+ - logIndex:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - removed:
+ - type: `boolean`
+
+ - topics:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - transactionHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "data": {
+ "pattern": "^0x([a-fA-F0-9]?)+$",
+ "title": "bytes",
+ "type": "string"
+ },
+ "logIndex": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "removed": {
+ "type": "boolean"
+ },
+ "topics": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "transactionHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getLogs", "params": [+```go +func (api *PublicFilterAPI) GetLogs(ctx context.Context, crit FilterCriteria) ([ // GetLogs returns logs matching the given argument that are stored within the state. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_getlogs +]*types.Log, error) { + var filter *Filter + if crit.BlockHash != nil { + filter = NewBlockFilter(api.backend, *crit.BlockHash, crit.Addresses, crit.Topics) + } else { + begin := rpc.LatestBlockNumber.Int64() + if crit.FromBlock != nil { + begin = crit.FromBlock.Int64() + } + end := rpc.LatestBlockNumber.Int64() + if crit.ToBlock != nil { + end = crit.ToBlock.Int64() + } + filter = NewRangeFilter(api.backend, begin, end, crit.Addresses, crit.Topics) + } + logs, err := filter.Logs(ctx) + if err != nil { + return nil, err + } + return returnLogs(logs), err +} +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+storageKeys []string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*AccountResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - accountProof:
+ - items:
+ - type: `string`
+
+ - type: `array`
+
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - balance:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - codeHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - storageHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - storageProof:
+ - items:
+ - additionalProperties: `false`
+ - properties:
+ - key:
+ - type: `string`
+
+ - proof:
+ - items:
+ - type: `string`
+
+ - type: `array`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: `object`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "accountProof": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "balance": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "codeHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "storageHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "storageProof": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "key": {
+ "type": "string"
+ },
+ "proof": {
+ "items": {
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getProof", "params": [, +```go +func (s *PublicBlockChainAPI) GetProof(ctx context.Context, address common.Address, storageKeys [ // GetProof returns the Merkle-proof for a given account and optionally some storage keys. +]string, blockNrOrHash rpc.BlockNumberOrHash) (*AccountResult, error) { + state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if state == nil || err != nil { + return nil, err + } + storageTrie := state.StorageTrie(address) + storageHash := types.EmptyRootHash + codeHash := state.GetCodeHash(address) + storageProof := make([]StorageResult, len(storageKeys)) + if storageTrie != nil { + storageHash = storageTrie.Hash() + } else { + codeHash = crypto.Keccak256Hash(nil) + } + for i, key := range storageKeys { + if storageTrie != nil { + proof, storageError := state.GetStorageProof(address, common.HexToHash(key)) + if storageError != nil { + return nil, storageError + } + storageProof[i] = StorageResult{key, (*hexutil.Big)(state.GetState(address, common.HexToHash(key)).Big()), toHexSlice(proof)} + } else { + storageProof[i] = StorageResult{key, &hexutil.Big{}, []string{}} + } + } + accountProof, proofErr := state.GetProof(address) + if proofErr != nil { + return nil, proofErr + } + return &AccountResult{Address: address, AccountProof: toHexSlice(accountProof), Balance: (*hexutil.Big)(state.GetBalance(address)), CodeHash: codeHash, Nonce: hexutil.Uint64(state.GetNonce(address)), StorageHash: storageHash, StorageProof: storageProof}, state.Error() +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getRawTransactionByBlockHashAndIndex", "params": [+```go +func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) hexutil.Bytes { + if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil { + return newRPCRawTransactionFromBlockIndex(block, uint64(index)) + } + return nil +}// GetRawTransactionByBlockHashAndIndex returns the bytes of the transaction for the given block hash and index. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getRawTransactionByBlockNumberAndIndex", "params": [+```go +func (s *PublicTransactionPoolAPI) GetRawTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) hexutil.Bytes { + if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil { + return newRPCRawTransactionFromBlockIndex(block, uint64(index)) + } + return nil +}// GetRawTransactionByBlockNumberAndIndex returns the bytes of the transaction for the given block number and index. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getRawTransactionByHash", "params": [+```go +func (s *PublicTransactionPoolAPI) GetRawTransactionByHash(ctx context.Context, hash common.Hash) (hexutil.Bytes, error) { + tx, _, _, _, err := s.b.GetTransaction(ctx, hash) + if err != nil { + return nil, err + } + if tx == nil { + if tx = s.b.GetPoolTransaction(hash); tx == nil { + return nil, nil + } + } + return rlp.EncodeToBytes(tx) +}// GetRawTransactionByHash returns the bytes of the transaction for the given hash. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+key string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__3:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getStorageAt", "params": [, +```go +func (s *PublicBlockChainAPI) GetStorageAt(ctx context.Context, address common.Address, key string, blockNrOrHash rpc.BlockNumberOrHash) (hexutil.Bytes, error) { + state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if state == nil || err != nil { + return nil, err + } + res := state.GetState(address, common.HexToHash(key)) + return res[ // GetStorageAt returns the storage from the state at the given address, key and + // block number. The rpc.LatestBlockNumber and rpc.PendingBlockNumber meta block + // numbers are also allowed. + :], state.Error() +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCTransaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - r:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - s:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - v:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "r": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "s": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "v": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getTransactionByBlockHashAndIndex", "params": [+```go +func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction { + if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil { + return newRPCTransactionFromBlockIndex(block, uint64(index)) + } + return nil +}// GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCTransaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - r:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - s:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - v:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "r": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "s": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "v": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getTransactionByBlockNumberAndIndex", "params": [+```go +func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction { + if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil { + return newRPCTransactionFromBlockIndex(block, uint64(index)) + } + return nil +}// GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCTransaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - r:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - s:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - v:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "r": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "s": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "v": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getTransactionByHash", "params": [+```go +func (s *PublicTransactionPoolAPI) GetTransactionByHash(ctx context.Context, hash common.Hash) (*RPCTransaction, error) { + tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash) + if err != nil { + return nil, err + } + if tx != nil { + return newRPCTransaction(tx, blockHash, blockNumber, index), nil + } + if tx := s.b.GetPoolTransaction(hash); tx != nil { + return newRPCPendingTransaction(tx), nil + } + return nil, nil +}// GetTransactionByHash returns the transaction for the given hash + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+blockNrOrHash rpc.BlockNumberOrHash
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getTransactionCount", "params": [, +```go +func (s *PublicTransactionPoolAPI) GetTransactionCount(ctx context.Context, address common.Address, blockNrOrHash rpc.BlockNumberOrHash) (*hexutil.Uint64, error) { + if blockNr, ok := blockNrOrHash.Number(); ok && blockNr == rpc.PendingBlockNumber { + nonce, err := s.b.GetPoolNonce(ctx, address) + if err != nil { + return nil, err + } + return (*hexutil.Uint64)(&nonce), nil + } + state, _, err := s.b.StateAndHeaderByNumberOrHash(ctx, blockNrOrHash) + if state == nil || err != nil { + return nil, err + } + nonce := state.GetNonce(address) + return (*hexutil.Uint64)(&nonce), state.Error() +}// GetTransactionCount returns the number of transactions the given address has sent for the given block number + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+mapstringinterface map[string]interface{}
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - patternProperties:
+ - .*:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getTransactionReceipt", "params": [+```go +func (s *PublicTransactionPoolAPI) GetTransactionReceipt(ctx context.Context, hash common.Hash) (map // GetTransactionReceipt returns the transaction receipt for the given transaction hash. +[string]interface{}, error) { + tx, blockHash, blockNumber, index, err := s.b.GetTransaction(ctx, hash) + if err != nil { + return nil, nil + } + receipts, err := s.b.GetReceipts(ctx, blockHash) + if err != nil { + return nil, err + } + if len(receipts) <= int(index) { + return nil, nil + } + receipt := receipts[index] + var signer types.Signer = types.FrontierSigner{} + if tx.Protected() { + signer = types.NewEIP155Signer(tx.ChainId()) + } + from, _ := types.Sender(signer, tx) + fields := map[string]interface{}{"blockHash": blockHash, "blockNumber": hexutil.Uint64(blockNumber), "transactionHash": hash, "transactionIndex": hexutil.Uint64(index), "from": from, "to": tx.To(), "gasUsed": hexutil.Uint64(receipt.GasUsed), "cumulativeGasUsed": hexutil.Uint64(receipt.CumulativeGasUsed), "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom} + if len(receipt.PostState) > 0 { + fields["root"] = hexutil.Bytes(receipt.PostState) + } else { + fields["status"] = hexutil.Uint(receipt.Status) + } + if receipt.Logs == nil { + fields["logs"] = [][]*types.Log{} + } + if receipt.ContractAddress != (common.Address{}) { + fields["contractAddress"] = receipt.ContractAddress + } + return fields, nil +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalBlockT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - error:
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactions:
+ - items:
+ - additionalProperties: `true`
+
+ - type: `array`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - uncles:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "error": {
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactions": {
+ "items": {
+ "additionalProperties": true
+ },
+ "type": "array"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "uncles": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getUncleByBlockHashAndIndex", "params": [+```go +func (s *PublicBlockChainAPI) GetUncleByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) (*RPCMarshalBlockT, error) { + block, err := s.b.BlockByHash(ctx, blockHash) + if block != nil { + uncles := block.Uncles() + if index >= hexutil.Uint(len(uncles)) { + log.Debug("Requested uncle not found", "number", block.Number(), "hash", blockHash, "index", index) + return nil, nil + } + block = types.NewBlockWithHeader(uncles[index]) + return s.rpcMarshalBlock(ctx, block, false, false) + } + return nil, err +}// GetUncleByBlockHashAndIndex returns the uncle block for the given block hash and index. When fullTx is true +// all transactions in the block are returned in full detail, otherwise only the transaction hash is returned. + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+index hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*RPCMarshalBlockT
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - difficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - error:
+ - type: `string`
+
+ - extraData:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - gasLimit:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasUsed:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - logsBloom:
+ - items:
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - maxItems: `256`
+ - minItems: `256`
+ - type: `array`
+
+ - miner:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - mixHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - number:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - parentHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - receiptsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - sha3Uncles:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - size:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - stateRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - timestamp:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - totalDifficulty:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - transactions:
+ - items:
+ - additionalProperties: `true`
+
+ - type: `array`
+
+ - transactionsRoot:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - uncles:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "difficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "error": {
+ "type": "string"
+ },
+ "extraData": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "gasLimit": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasUsed": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "logsBloom": {
+ "items": {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "maxItems": 256,
+ "minItems": 256,
+ "type": "array"
+ },
+ "miner": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "mixHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "number": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "parentHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "receiptsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "sha3Uncles": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "size": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "stateRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "timestamp": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "totalDifficulty": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "transactions": {
+ "items": {
+ "additionalProperties": true
+ },
+ "type": "array"
+ },
+ "transactionsRoot": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "uncles": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getUncleByBlockNumberAndIndex", "params": [+```go +func (s *PublicBlockChainAPI) GetUncleByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) (*RPCMarshalBlockT, error) { + block, err := s.b.BlockByNumber(ctx, blockNr) + if block != nil { + uncles := block.Uncles() + if index >= hexutil.Uint(len(uncles)) { + log.Debug("Requested uncle not found", "number", blockNr, "hash", block.Hash(), "index", index) + return nil, nil + } + block = types.NewBlockWithHeader(uncles[index]) + return s.rpcMarshalBlock(ctx, block, false, false) + } + return nil, err +}// GetUncleByBlockNumberAndIndex returns the uncle block for the given block hash and index. When fullTx is true +// all transactions in the block are returned in full detail, otherwise only the transaction hash is returned. + +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getUncleCountByBlockHash", "params": [+```go +func (s *PublicBlockChainAPI) GetUncleCountByBlockHash(ctx context.Context, blockHash common.Hash) *hexutil.Uint { + if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil { + n := hexutil.Uint(len(block.Uncles())) + return &n + } + return nil +}// GetUncleCountByBlockHash returns number of uncles in the block for the given block hash + +``` +View on GitHub → +
+rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getUncleCountByBlockNumber", "params": [+```go +func (s *PublicBlockChainAPI) GetUncleCountByBlockNumber(ctx context.Context, blockNr rpc.BlockNumber) *hexutil.Uint { + if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil { + n := hexutil.Uint(len(block.Uncles())) + return &n + } + return nil +}// GetUncleCountByBlockNumber returns number of uncles in the block for the given block number + +``` +View on GitHub → +
+[4]string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - type: string
+
+
+ - maxItems: `4`
+ - minItems: `4`
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "maxItems": 4,
+ "minItems": 4,
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_getWork", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.getWork();
+ ```
+
+
++```go +func (api *API) GetWork() ([4]string, error) { + if api.ethash.remote == nil { + return [4]string{}, errors.New("not supported") + } + var ( + workCh = make(chan [4]string, 1) + errc = make(chan error, 1) + ) + select { + case api.ethash.remote.fetchWorkCh <- &sealWork{errc: errc, res: workCh}: + case <-api.ethash.remote.exitCh: + return [4]string{}, errEthashStopped + } + select { + case work := <-workCh: + return work, nil + case err := <-errc: + return [4]string{}, err + } +}// GetWork returns a work package for external miner. +// +// The work package consists of 3 strings: +// result[0] - 32 bytes hex encoded current block header pow-hash +// result[1] - 32 bytes hex encoded seed hash used for DAG +// result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty +// result[3] - hex encoded block number + +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_hashrate", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.hashrate();
+ ```
+
+
++```go +func (api *PublicEthereumAPI) Hashrate() hexutil.Uint64 { + return hexutil.Uint64(api.e.Miner().HashRate()) +}// Hashrate returns the POW hashrate + +``` +View on GitHub → +
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_mining", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.mining();
+ ```
+
+
++```go +func (api *PublicMinerAPI) Mining() bool { + return api.e.IsMining() +}// Mining returns an indication if this node is currently mining. + +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_newBlockFilter", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.newBlockFilter();
+ ```
+
+
++```go +func (api *PublicFilterAPI) NewBlockFilter() rpc.ID { + var ( + headers = make(chan *types.Header) + headerSub = api.events.SubscribeNewHeads(headers) + ) + api.filtersMu.Lock() + api.filters[headerSub.ID] = &filter{typ: BlocksSubscription, deadline: time.NewTimer(deadline), hashes: make([ // NewBlockFilter creates a filter that fetches blocks that are imported into the chain. + // It is part of the filter package since polling goes with eth_getFilterChanges. + // + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newblockfilter + ]common.Hash, 0), s: headerSub} + api.filtersMu.Unlock() + go func() { + for { + select { + case h := <-headers: + api.filtersMu.Lock() + if f, found := api.filters[headerSub.ID]; found { + f.hashes = append(f.hashes, h.Hash()) + } + api.filtersMu.Unlock() + case <-headerSub.Err(): + api.filtersMu.Lock() + delete(api.filters, headerSub.ID) + api.filtersMu.Unlock() + return + } + } + }() + return headerSub.ID +} +``` +View on GitHub → +
+FilterCriteria
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Addresses:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - BlockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - FromBlock:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - ToBlock:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Topics:
+ - items:
+ - items:
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - type: `array`
+
+ - type: `array`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Addresses": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "BlockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "FromBlock": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "ToBlock": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Topics": {
+ "items": {
+ "items": {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "type": "array"
+ },
+ "type": "array"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_newFilter", "params": [+```go +func (api *PublicFilterAPI) NewFilter(crit FilterCriteria) (rpc.ID, error) { + logs := make(chan [ // NewFilter creates a new filter and returns the filter id. It can be + // used to retrieve logs when the state changes. This method cannot be + // used to fetch logs that are already stored in the state. + // + // Default criteria for the from and to block are "latest". + // Using "latest" as block number will return logs for mined blocks. + // Using "pending" as block number returns logs for not yet mined (pending) blocks. + // In case logs are removed (chain reorg) previously returned logs are returned + // again but with the removed property set to true. + // + // In case "fromBlock" > "toBlock" an error is returned. + // + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newfilter + ]*types.Log) + logsSub, err := api.events.SubscribeLogs(ethereum.FilterQuery(crit), logs) + if err != nil { + return rpc.ID(""), err + } + api.filtersMu.Lock() + api.filters[logsSub.ID] = &filter{typ: LogsSubscription, crit: crit, deadline: time.NewTimer(deadline), logs: make([]*types.Log, 0), s: logsSub} + api.filtersMu.Unlock() + go func() { + for { + select { + case l := <-logs: + api.filtersMu.Lock() + if f, found := api.filters[logsSub.ID]; found { + f.logs = append(f.logs, l...) + } + api.filtersMu.Unlock() + case <-logsSub.Err(): + api.filtersMu.Lock() + delete(api.filters, logsSub.ID) + api.filtersMu.Unlock() + return + } + } + }() + return logsSub.ID, nil +} +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_newPendingTransactionFilter", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.newPendingTransactionFilter();
+ ```
+
+
++```go +func (api *PublicFilterAPI) NewPendingTransactionFilter() rpc.ID { + var ( + pendingTxs = make(chan [ // NewPendingTransactionFilter creates a filter that fetches pending transaction hashes + // as transactions enter the pending state. + // + // It is part of the filter package because this filter can be used through the + // `eth_getFilterChanges` polling method that is also used for log filters. + // + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_newpendingtransactionfilter + ]common.Hash) + pendingTxSub = api.events.SubscribePendingTxs(pendingTxs) + ) + api.filtersMu.Lock() + api.filters[pendingTxSub.ID] = &filter{typ: PendingTransactionsSubscription, deadline: time.NewTimer(deadline), hashes: make([]common.Hash, 0), s: pendingTxSub} + api.filtersMu.Unlock() + go func() { + for { + select { + case ph := <-pendingTxs: + api.filtersMu.Lock() + if f, found := api.filters[pendingTxSub.ID]; found { + f.hashes = append(f.hashes, ph...) + } + api.filtersMu.Unlock() + case <-pendingTxSub.Err(): + api.filtersMu.Lock() + delete(api.filters, pendingTxSub.ID) + api.filtersMu.Unlock() + return + } + } + }() + return pendingTxSub.ID +} +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_newSideBlockFilter", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.newSideBlockFilter();
+ ```
+
+
++```go +func (api *PublicFilterAPI) NewSideBlockFilter() rpc.ID { + var ( + headers = make(chan *types.Header) + headerSub = api.events.SubscribeNewSideHeads(headers) + ) + api.filtersMu.Lock() + api.filters[headerSub.ID] = &filter{typ: SideBlocksSubscription, deadline: time.NewTimer(deadline), hashes: make([ // NewSideBlockFilter creates a filter that fetches blocks that are imported into the chain with a non-canonical status. + // It is part of the filter package since polling goes with eth_getFilterChanges. + ]common.Hash, 0), s: headerSub} + api.filtersMu.Unlock() + go func() { + for { + select { + case h := <-headers: + api.filtersMu.Lock() + if f, found := api.filters[headerSub.ID]; found { + f.hashes = append(f.hashes, h.Hash()) + } + api.filtersMu.Unlock() + case <-headerSub.Err(): + api.filtersMu.Lock() + delete(api.filters, headerSub.ID) + api.filtersMu.Unlock() + return + } + } + }() + return headerSub.ID +} +``` +View on GitHub → +
+[]*RPCTransaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - r:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - s:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - v:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "r": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "s": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "v": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_pendingTransactions", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.pendingTransactions();
+ ```
+
+
++```go +func (s *PublicTransactionPoolAPI) PendingTransactions() ([ // PendingTransactions returns the transactions that are in the transaction pool +// and have a from address that is one of the accounts this node manages. +]*RPCTransaction, error) { + pending, err := s.b.GetPoolTransactions() + if err != nil { + return nil, err + } + accounts := make(map[common.Address]struct{}) + for _, wallet := range s.b.AccountManager().Wallets() { + for _, account := range wallet.Accounts() { + accounts[account.Address] = struct{}{} + } + } + transactions := make([]*RPCTransaction, 0, len(pending)) + for _, tx := range pending { + var signer types.Signer = types.HomesteadSigner{} + if tx.Protected() { + signer = types.NewEIP155Signer(tx.ChainId()) + } + from, _ := types.Sender(signer, tx) + if _, exists := accounts[from]; exists { + transactions = append(transactions, newRPCPendingTransaction(tx)) + } + } + return transactions, nil +} +``` +View on GitHub → +
+hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_protocolVersion", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.protocolVersion();
+ ```
+
+
++```go +func (s *PublicEthereumAPI) ProtocolVersion() hexutil.Uint { + return hexutil.Uint(s.b.ProtocolVersion()) +}// ProtocolVersion returns the current Ethereum protocol version this node supports + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+gasPrice *hexutil.Big
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+gasLimit *hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_resend", "params": [+```go +func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxArgs, gasPrice *hexutil.Big, gasLimit *hexutil.Uint64) (common.Hash, error) { + if sendArgs.Nonce == nil { + return common.Hash{}, fmt.Errorf("missing transaction nonce in transaction spec") + } + if err := sendArgs.setDefaults(ctx, s.b); err != nil { + return common.Hash{}, err + } + matchTx := sendArgs.toTransaction() + var price = matchTx.GasPrice() + if gasPrice != nil { + price = gasPrice.ToInt() + } + var gas = matchTx.Gas() + if gasLimit != nil { + gas = uint64(*gasLimit) + } + if err := checkTxFee(price, gas, s.b.RPCTxFeeCap()); err != nil { + return common.Hash{}, err + } + pending, err := s.b.GetPoolTransactions() + if err != nil { + return common.Hash{}, err + } + for _, p := // Resend accepts an existing transaction and a new gas price and limit. It will remove + // the given transaction from the pool and reinsert it with the new gas price and limit. + // Before replacing the old transaction, ensure the _new_ transaction fee is reasonable. + range pending { + var signer types.Signer = types.HomesteadSigner{} + if p.Protected() { + signer = types.NewEIP155Signer(p.ChainId()) + } + wantSigHash := signer.Hash(matchTx) + if pFrom, err := types.Sender(signer, p); err == nil && pFrom == sendArgs.From && signer.Hash(p) == wantSigHash { + if gasPrice != nil && (*big.Int)(gasPrice).Sign() != 0 { + sendArgs.GasPrice = gasPrice + } + if gasLimit != nil && *gasLimit != 0 { + sendArgs.Gas = gasLimit + } + signedTx, err := s.sign(sendArgs.From, sendArgs.toTransaction()) + if err != nil { + return common.Hash{}, err + } + if err = s.b.SendTx(ctx, signedTx); err != nil { + return common.Hash{}, err + } + return signedTx.Hash(), nil + } + } + return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash()) +} +``` +View on GitHub → +
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_sendRawTransaction", "params": [+```go +func (s *PublicTransactionPoolAPI) SendRawTransaction(ctx context.Context, encodedTx hexutil.Bytes) (common.Hash, error) { + tx := new(types.Transaction) + if err := rlp.DecodeBytes(encodedTx, tx); err != nil { + return common.Hash{}, err + } + return SubmitTransaction(ctx, s.b, tx) +}// SendRawTransaction will add the signed transaction to the transaction pool. +// The sender is responsible for signing the transaction and using the correct nonce. + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_sendTransaction", "params": [+```go +func (s *PublicTransactionPoolAPI) SendTransaction(ctx context.Context, args SendTxArgs) (common.Hash, error) { + account := accounts.Account{Address: args.From} + wallet, err := s.b.AccountManager().Find(account) + if err != nil { + return common.Hash{}, err + } + if args.Nonce == nil { + s.nonceLock.LockAddr(args.From) + defer s.nonceLock.UnlockAddr(args.From) + } + if err := args.setDefaults(ctx, s.b); err != nil { + return common.Hash{}, err + } + tx := args.toTransaction() + signed, err := wallet.SignTx(account, tx, s.b.ChainConfig().GetChainID()) + if err != nil { + return common.Hash{}, err + } + return SubmitTransaction(ctx, s.b, signed) +}// SendTransaction creates a transaction for the given argument, sign it and submit it to the +// transaction pool. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+data hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_sign", "params": [+```go +func (s *PublicTransactionPoolAPI) Sign(addr common.Address, data hexutil.Bytes) (hexutil.Bytes, error) { + account := accounts.Account{Address: addr} + wallet, err := s.b.AccountManager().Find(account) + if err != nil { + return nil, err + } + signature, err := wallet.SignText(account, data) + if err == nil { + signature[64] += 27 + } + return signature, err +}// Sign calculates an ECDSA signature for: +// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message). +// +// Note, the produced signature conforms to the secp256k1 curve R, S and V values, +// where the V value will be 27 or 28 for legacy reasons. +// +// The account associated with addr must be unlocked. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+*SignTransactionResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - raw:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - tx:
+ - additionalProperties: `false`
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "raw": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "tx": {
+ "additionalProperties": false,
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_signTransaction", "params": [+```go +func (s *PublicTransactionPoolAPI) SignTransaction(ctx context.Context, args SendTxArgs) (*SignTransactionResult, error) { + if args.Gas == nil { + return nil, fmt.Errorf("gas not specified") + } + if args.GasPrice == nil { + return nil, fmt.Errorf("gasPrice not specified") + } + if args.Nonce == nil { + return nil, fmt.Errorf("nonce not specified") + } + if err := args.setDefaults(ctx, s.b); err != nil { + return nil, err + } + if err := checkTxFee(args.GasPrice.ToInt(), uint64(*args.Gas), s.b.RPCTxFeeCap()); err != nil { + return nil, err + } + tx, err := s.sign(args.From, args.toTransaction()) + if err != nil { + return nil, err + } + data, err := rlp.EncodeToBytes(tx) + if err != nil { + return nil, err + } + return &SignTransactionResult{data, tx}, nil +}// SignTransaction will sign the given transaction with the from account. +// The node needs to have the private key of the account corresponding with +// the given from address and it needs to be unlocked. + +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+id common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_submitHashRate", "params": [+```go +func (api *API) SubmitHashRate(rate hexutil.Uint64, id common.Hash) bool { + if api.ethash.remote == nil { + return false + } + var done = make(chan struct{}, 1) + select { + case api.ethash.remote.submitRateCh <- &hashrate{done: done, rate: uint64(rate), id: id}: + case <-api.ethash.remote.exitCh: + return false + } + <-done + return true +}// SubmitHashrate can be used for remote miners to submit their hash rate. +// This enables the node to report the combined hash rate of all miners +// which submit work through this node. +// +// It accepts the miner hash rate and an identifier which must be unique +// between nodes. + +``` +View on GitHub → +
+types.BlockNonce
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+hash common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+digest common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_submitWork", "params": [+```go +func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) bool { + if api.ethash.remote == nil { + return false + } + var errc = make(chan error, 1) + select { + case api.ethash.remote.submitWorkCh <- &mineResult{nonce: nonce, mixDigest: digest, hash: hash, errc: errc}: + case <-api.ethash.remote.exitCh: + return false + } + err := <-errc + return err == nil +}// SubmitWork can be used by external miner to submit their POW solution. +// It returns an indication if the work was accepted. +// Note either an invalid solution, a stale work a non-existent work will return false. + +``` +View on GitHub → +
+RPCSubscriptionParamsName
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+subscriptionOptions interface{}
+
+ + Required: No
+
+
+
+
+
+
+#### Result
+
+
+
+subscriptionID rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_subscribe", "params": [+```go +func (sub *RPCSubscription) Subscribe(subscriptionName RPCSubscriptionParamsName, subscriptionOptions interface{}) (subscriptionID rpc.ID, err error) { + return +}// Subscribe creates a subscription to an event channel. +// Subscriptions are not available over HTTP; they are only available over WS, IPC, and Process connections. + +``` +View on GitHub → +
+interface{}
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_syncing", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ eth.syncing();
+ ```
+
+
++```go +func (s *PublicEthereumAPI) Syncing() (interface{}, error) { + progress := s.b.Downloader().Progress() + if progress.CurrentBlock >= progress.HighestBlock { + return false, nil + } + return map // Syncing returns false in case the node is currently not syncing with the network. It can be up to date or has not + // yet received the latest block headers from its pears. In case it is synchronizing: + // - startingBlock: block number this node started to synchronise from + // - currentBlock: block number this node is currently importing + // - highestBlock: block number of the highest block header this node has received from peers + // - pulledStates: number of state entries processed until now + // - knownStates: number of known state entries that still need to be pulled + [string]interface{}{"startingBlock": hexutil.Uint64(progress.StartingBlock), "currentBlock": hexutil.Uint64(progress.CurrentBlock), "highestBlock": hexutil.Uint64(progress.HighestBlock), "pulledStates": hexutil.Uint64(progress.PulledStates), "knownStates": hexutil.Uint64(progress.KnownStates)}, nil +} +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_uninstallFilter", "params": [+```go +func (api *PublicFilterAPI) UninstallFilter(id rpc.ID) bool { + api.filtersMu.Lock() + f, found := api.filters[id] + if found { + delete(api.filters, id) + } + api.filtersMu.Unlock() + if found { + f.s.Unsubscribe() + } + return found +}// UninstallFilter removes the filter with the given filter id. +// +// https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_uninstallfilter + +``` +View on GitHub → +
+rpc.ID
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "eth_unsubscribe", "params": [+```go +func (sub *RPCSubscription) Unsubscribe(id rpc.ID) error { + return nil +}// Unsubscribe terminates an existing subscription by ID. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### ethash_getHashrate
+
+GetHashrate returns the current hashrate for local CPU miner and remote miner.
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "ethash_getHashrate", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ ethash.getHashrate();
+ ```
+
+
++```go +func (api *API) GetHashrate() uint64 { + return uint64(api.ethash.Hashrate()) +}// GetHashrate returns the current hashrate for local CPU miner and remote miner. + +``` +View on GitHub → +
+[4]string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - type: string
+
+
+ - maxItems: `4`
+ - minItems: `4`
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "maxItems": 4,
+ "minItems": 4,
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "ethash_getWork", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ ethash.getWork();
+ ```
+
+
++```go +func (api *API) GetWork() ([4]string, error) { + if api.ethash.remote == nil { + return [4]string{}, errors.New("not supported") + } + var ( + workCh = make(chan [4]string, 1) + errc = make(chan error, 1) + ) + select { + case api.ethash.remote.fetchWorkCh <- &sealWork{errc: errc, res: workCh}: + case <-api.ethash.remote.exitCh: + return [4]string{}, errEthashStopped + } + select { + case work := <-workCh: + return work, nil + case err := <-errc: + return [4]string{}, err + } +}// GetWork returns a work package for external miner. +// +// The work package consists of 3 strings: +// result[0] - 32 bytes hex encoded current block header pow-hash +// result[1] - 32 bytes hex encoded seed hash used for DAG +// result[2] - 32 bytes hex encoded boundary condition ("target"), 2^256/difficulty +// result[3] - hex encoded block number + +``` +View on GitHub → +
+hexutil.Uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+id common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "ethash_submitHashRate", "params": [+```go +func (api *API) SubmitHashRate(rate hexutil.Uint64, id common.Hash) bool { + if api.ethash.remote == nil { + return false + } + var done = make(chan struct{}, 1) + select { + case api.ethash.remote.submitRateCh <- &hashrate{done: done, rate: uint64(rate), id: id}: + case <-api.ethash.remote.exitCh: + return false + } + <-done + return true +}// SubmitHashrate can be used for remote miners to submit their hash rate. +// This enables the node to report the combined hash rate of all miners +// which submit work through this node. +// +// It accepts the miner hash rate and an identifier which must be unique +// between nodes. + +``` +View on GitHub → +
+types.BlockNonce
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+hash common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+digest common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "ethash_submitWork", "params": [+```go +func (api *API) SubmitWork(nonce types.BlockNonce, hash, digest common.Hash) bool { + if api.ethash.remote == nil { + return false + } + var errc = make(chan error, 1) + select { + case api.ethash.remote.submitWorkCh <- &mineResult{nonce: nonce, mixDigest: digest, hash: hash, errc: errc}: + case <-api.ethash.remote.exitCh: + return false + } + err := <-errc + return err == nil +}// SubmitWork can be used by external miner to submit their POW solution. +// It returns an indication if the work was accepted. +// Note either an invalid solution, a stale work a non-existent work will return false. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### miner_getHashrate
+
+GetHashrate returns the current hashrate of the miner.
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+
+uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_getHashrate", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ miner.getHashrate();
+ ```
+
+
++```go +func (api *PrivateMinerAPI) GetHashrate() uint64 { + return api.e.miner.HashRate() +}// GetHashrate returns the current hashrate of the miner. + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_setEtherbase", "params": [+```go +func (api *PrivateMinerAPI) SetEtherbase(etherbase common.Address) bool { + api.e.SetEtherbase(etherbase) + return true +}// SetEtherbase sets the etherbase of the miner + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_setExtra", "params": [+```go +func (api *PrivateMinerAPI) SetExtra(extra string) (bool, error) { + if err := api.e.Miner().SetExtra([ // SetExtra sets the extra data string that is included when this miner mines a block. + ]byte(extra)); err != nil { + return false, err + } + return true, nil +} +``` +View on GitHub → +
+hexutil.Big
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_setGasPrice", "params": [+```go +func (api *PrivateMinerAPI) SetGasPrice(gasPrice hexutil.Big) bool { + api.e.lock.Lock() + api.e.gasPrice = (*big.Int)(&gasPrice) + api.e.lock.Unlock() + api.e.txPool.SetGasPrice((*big.Int)(&gasPrice)) + return true +}// SetGasPrice sets the minimum accepted gas price for the miner. + +``` +View on GitHub → +
+int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_setRecommitInterval", "params": [+```go +func (api *PrivateMinerAPI) SetRecommitInterval(interval int) { + api.e.Miner().SetRecommitInterval(time.Duration(interval) * time.Millisecond) +}// SetRecommitInterval updates the interval for miner sealing work recommitting. + +``` +View on GitHub → +
+*int
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "miner_start", "params": [+```go +func (api *PrivateMinerAPI) Start(threads *int) error { + if threads == nil { + return api.e.StartMining(runtime.NumCPU()) + } + return api.e.StartMining(*threads) +}// Start starts 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 and updates the minimum price required by the +// transaction pool. + +``` +View on GitHub → +
++```go +func (api *PrivateMinerAPI) Stop() { + api.e.StopMining() +}// Stop terminates the miner, both at the consensus engine level as well as at +// the block creation level. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### net_listening
+
+Listening returns an indication if the node is listening for network connections.
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "net_listening", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ net.listening();
+ ```
+
+
++```go +func (s *PublicNetAPI) Listening() bool { + return true +}// Listening returns an indication if the node is listening for network connections. + +``` +View on GitHub → +
+hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "net_peerCount", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ net.peerCount();
+ ```
+
+
++```go +func (s *PublicNetAPI) PeerCount() hexutil.Uint { + return hexutil.Uint(s.net.PeerCount()) +}// PeerCount returns the number of connected peers + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "net_version", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ net.version();
+ ```
+
+
++```go +func (s *PublicNetAPI) Version() string { + return fmt.Sprintf("%d", s.networkVersion) +}// Version returns the current ethereum protocol version. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### personal_deriveAccount
+
+DeriveAccount requests a HD wallet to derive a new account, optionally pinning
+it for later reuse.
+
+
+#### Params (3)
+
+Parameters must be given _by position_.
+
+
+__1:__
+url string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+path string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__3:__
+pin *bool
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+accounts.Account
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - url:
+ - additionalProperties: `false`
+ - properties:
+ - Path:
+ - type: `string`
+
+ - Scheme:
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "url": {
+ "additionalProperties": false,
+ "properties": {
+ "Path": {
+ "type": "string"
+ },
+ "Scheme": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_deriveAccount", "params": [+```go +func (s *PrivateAccountAPI) DeriveAccount(url string, path string, pin *bool) (accounts.Account, error) { + wallet, err := s.am.Wallet(url) + if err != nil { + return accounts.Account{}, err + } + derivPath, err := accounts.ParseDerivationPath(path) + if err != nil { + return accounts.Account{}, err + } + if pin == nil { + pin = new(bool) + } + return wallet.Derive(derivPath, *pin) +}// DeriveAccount requests a HD wallet to derive a new account, optionally pinning +// it for later reuse. + +``` +View on GitHub → +
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+sig hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_ecRecover", "params": [, +```go +func (s *PrivateAccountAPI) EcRecover(ctx context.Context, data, sig hexutil.Bytes) (common.Address, error) { + if len(sig) != crypto.SignatureLength { + return common.Address{}, fmt.Errorf("signature must be %d bytes long", crypto.SignatureLength) + } + if sig[crypto.RecoveryIDOffset] != 27 && sig[crypto.RecoveryIDOffset] != 28 { + return common.Address{}, fmt.Errorf("invalid Ethereum signature (V is not 27 or 28)") + } + sig[crypto.RecoveryIDOffset] -= 27 + rpk, err := crypto.SigToPub(accounts.TextHash(data), sig) + if err != nil { + return common.Address{}, err + } + return crypto.PubkeyToAddress(*rpk), nil +}// EcRecover returns the address for the account that was used to create the signature. +// Note, this function is compatible with eth_sign and personal_sign. As such it recovers +// the address of: +// hash = keccak256("\x19Ethereum Signed Message:\n"${message length}${message}) +// addr = ecrecover(hash, signature) +// +// Note, the signature must conform to the secp256k1 curve R, S and V values, where +// the V value must be 27 or 28 for legacy reasons. +// +// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_ecRecover + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+password string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_importRawKey", "params": [+```go +func (s *PrivateAccountAPI) ImportRawKey(privkey string, password string) (common.Address, error) { + key, err := crypto.HexToECDSA(privkey) + if err != nil { + return common.Address{}, err + } + ks, err := fetchKeystore(s.am) + if err != nil { + return common.Address{}, err + } + acc, err := ks.ImportECDSA(key, password) + return acc.Address, err +}// ImportRawKey stores the given hex encoded ECDSA key into the key directory, +// encrypting it with the passphrase. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_initializeWallet", "params": [+```go +func (s *PrivateAccountAPI) InitializeWallet(ctx context.Context, url string) (string, error) { + wallet, err := s.am.Wallet(url) + if err != nil { + return "", err + } + entropy, err := bip39.NewEntropy(256) + if err != nil { + return "", err + } + mnemonic, err := bip39.NewMnemonic(entropy) + if err != nil { + return "", err + } + seed := bip39.NewSeed(mnemonic, "") + switch wallet := wallet.( // InitializeWallet initializes a new wallet at the provided URL, by generating and returning a new private key. + type) { + case *scwallet.Wallet: + return mnemonic, wallet.Initialize(seed) + default: + return "", fmt.Errorf("specified wallet does not support initialization") + } +} +``` +View on GitHub → +
+[]common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_listAccounts", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ personal.listAccounts();
+ ```
+
+
++```go +func (s *PrivateAccountAPI) ListAccounts() [ // listAccounts will return a list of addresses for accounts this node manages. +]common.Address { + return s.am.Accounts() +} +``` +View on GitHub → +
+[]rawWallet
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - accounts:
+ - items:
+ - additionalProperties: `false`
+ - properties:
+ - address:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - url:
+ - additionalProperties: `false`
+ - properties:
+ - Path:
+ - type: `string`
+
+ - Scheme:
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+ - type: `array`
+
+ - failure:
+ - type: `string`
+
+ - status:
+ - type: `string`
+
+ - url:
+ - type: `string`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "accounts": {
+ "items": {
+ "additionalProperties": false,
+ "properties": {
+ "address": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "url": {
+ "additionalProperties": false,
+ "properties": {
+ "Path": {
+ "type": "string"
+ },
+ "Scheme": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ },
+ "type": "array"
+ },
+ "failure": {
+ "type": "string"
+ },
+ "status": {
+ "type": "string"
+ },
+ "url": {
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_listWallets", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ personal.listWallets();
+ ```
+
+
++```go +func (s *PrivateAccountAPI) ListWallets() [ // ListWallets will return a list of wallets this node manages. +]rawWallet { + wallets := make([]rawWallet, 0) + for _, wallet := range s.am.Wallets() { + status, failure := wallet.Status() + raw := rawWallet{URL: wallet.URL().String(), Status: status, Accounts: wallet.Accounts()} + if failure != nil { + raw.Failure = failure.Error() + } + wallets = append(wallets, raw) + } + return wallets +} +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_lockAccount", "params": [+```go +func (s *PrivateAccountAPI) LockAccount(addr common.Address) bool { + if ks, err := fetchKeystore(s.am); err == nil { + return ks.Lock(addr) == nil + } + return false +}// LockAccount will lock the account associated with the given address when it's unlocked. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_newAccount", "params": [+```go +func (s *PrivateAccountAPI) NewAccount(password string) (common.Address, error) { + ks, err := fetchKeystore(s.am) + if err != nil { + return common.Address{}, err + } + acc, err := ks.NewAccount(password) + if err == nil { + log.Info("Your new key was generated", "address", acc.Address) + log.Warn("Please backup your key file!", "path", acc.URL.Path) + log.Warn("Please remember your password!") + return acc.Address, nil + } + return common.Address{}, err +}// NewAccount will create a new account and returns the address for the new account. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+passphrase *string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_openWallet", "params": [+```go +func (s *PrivateAccountAPI) OpenWallet(url string, passphrase *string) error { + wallet, err := s.am.Wallet(url) + if err != nil { + return err + } + pass := "" + if passphrase != nil { + pass = *passphrase + } + return wallet.Open(pass) +}// OpenWallet initiates a hardware wallet opening procedure, establishing a USB +// connection and attempting to authenticate via the provided passphrase. Note, +// the method may return an extra challenge requiring a second open (e.g. the +// Trezor PIN matrix challenge). + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+passwd string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_sendTransaction", "params": [+```go +func (s *PrivateAccountAPI) SendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) { + if args.Nonce == nil { + s.nonceLock.LockAddr(args.From) + defer s.nonceLock.UnlockAddr(args.From) + } + signed, err := s.signTransaction(ctx, &args, passwd) + if err != nil { + log.Warn("Failed transaction send attempt", "from", args.From, "to", args.To, "value", args.Value.ToInt(), "err", err) + return common.Hash{}, err + } + return SubmitTransaction(ctx, s.b, signed) +}// SendTransaction will create a transaction from the given arguments and +// tries to sign it with the key associated with args.To. If the given passwd isn't +// able to decrypt the key it fails. + +``` +View on GitHub → +
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+addr common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__3:__
+passwd string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_sign", "params": [, +```go +func (s *PrivateAccountAPI) Sign(ctx context.Context, data hexutil.Bytes, addr common.Address, passwd string) (hexutil.Bytes, error) { + account := accounts.Account{Address: addr} + wallet, err := s.b.AccountManager().Find(account) + if err != nil { + return nil, err + } + signature, err := wallet.SignTextWithPassphrase(account, passwd, data) + if err != nil { + log.Warn("Failed data sign attempt", "address", addr, "err", err) + return nil, err + } + signature[crypto.RecoveryIDOffset] += 27 + return signature, nil +}// Sign calculates an Ethereum ECDSA signature for: +// keccack256("\x19Ethereum Signed Message:\n" + len(message) + message)) +// +// Note, the produced signature conforms to the secp256k1 curve R, S and V values, +// where the V value will be 27 or 28 for legacy reasons. +// +// The key used to calculate the signature is decrypted with the given password. +// +// https://github.com/ethereum/go-ethereum/wiki/Management-APIs#personal_sign + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+passwd string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_signAndSendTransaction", "params": [+```go +func (s *PrivateAccountAPI) SignAndSendTransaction(ctx context.Context, args SendTxArgs, passwd string) (common.Hash, error) { + return s.SendTransaction(ctx, args, passwd) +}// SignAndSendTransaction was renamed to SendTransaction. This method is deprecated +// and will be removed in the future. It primary goal is to give clients time to update. + +``` +View on GitHub → +
+SendTxArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+passwd string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+
+
+
+*SignTransactionResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - raw:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - tx:
+ - additionalProperties: `false`
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "raw": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "tx": {
+ "additionalProperties": false,
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_signTransaction", "params": [+```go +func (s *PrivateAccountAPI) SignTransaction(ctx context.Context, args SendTxArgs, passwd string) (*SignTransactionResult, error) { + if args.Gas == nil { + return nil, fmt.Errorf("gas not specified") + } + if args.GasPrice == nil { + return nil, fmt.Errorf("gasPrice not specified") + } + if args.Nonce == nil { + return nil, fmt.Errorf("nonce not specified") + } + if err := checkTxFee(args.GasPrice.ToInt(), uint64(*args.Gas), s.b.RPCTxFeeCap()); err != nil { + return nil, err + } + signed, err := s.signTransaction(ctx, &args, passwd) + if err != nil { + log.Warn("Failed transaction sign attempt", "from", args.From, "to", args.To, "value", args.Value.ToInt(), "err", err) + return nil, err + } + data, err := rlp.EncodeToBytes(signed) + if err != nil { + return nil, err + } + return &SignTransactionResult{data, signed}, nil +}// SignTransaction will create a transaction from the given arguments and +// tries to sign it with the key associated with args.To. If the given passwd isn't +// able to decrypt the key it fails. The transaction is returned in RLP-form, not broadcast +// to other nodes + +``` +View on GitHub → +
+common.Address
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash POINTER`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash POINTER",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+password string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__3:__
+duration *uint64
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of the integer`
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of the integer",
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+bool
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_unlockAccount", "params": [+```go +func (s *PrivateAccountAPI) UnlockAccount(ctx context.Context, addr common.Address, password string, duration *uint64) (bool, error) { + if s.b.ExtRPCEnabled() && !s.b.AccountManager().Config().InsecureUnlockAllowed { + return false, errors.New("account unlock with HTTP access is forbidden") + } + const max = uint64(time.Duration(math.MaxInt64) / time.Second) + var d time.Duration + if duration == nil { + d = 300 * time.Second + } else if *duration > max { + return false, errors.New("unlock duration too large") + } else { + d = time.Duration(*duration) * time.Second + } + ks, err := fetchKeystore(s.am) + if err != nil { + return false, err + } + err = ks.TimedUnlock(accounts.Account{Address: addr}, password, d) + if err != nil { + log.Warn("Failed account unlock attempt", "address", addr, "err", err) + } + return err == nil, err +}// UnlockAccount will unlock the account associated with the given address with +// the given password for duration seconds. If duration is nil it will use a +// default of 300 seconds. It returns an indication if the account was unlocked. + +``` +View on GitHub → +
+string
+
+ + Required: ✓ Yes
+
+
+
+
+
+__2:__
+pin string
+
+ + Required: ✓ Yes
+
+
+
+
+
+
+#### Result
+
+_None_
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "personal_unpair", "params": [+```go +func (s *PrivateAccountAPI) Unpair(ctx context.Context, url string, pin string) error { + wallet, err := s.am.Wallet(url) + if err != nil { + return err + } + switch wallet := wallet.( // Unpair deletes a pairing between wallet and geth. + type) { + case *scwallet.Wallet: + return wallet.Unpair([]byte(pin)) + default: + return fmt.Errorf("specified wallet does not support pairing") + } +} +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### trace_block
+
+Block returns the structured logs created during the execution of
+EVM and returns them as a JSON object.
+The correct name will be TraceBlockByNumber, though we want to be compatible with Parity trace module.
+
+
+#### Params (2)
+
+Parameters must be given _by position_.
+
+
+__1:__
+number rpc.BlockNumber
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - oneOf:
+
+ - description: `The block height description`
+ - enum: earliest, latest, pending
+ - title: `blockNumberTag`
+ - type: string
+
+
+ - description: `Hex representation of a uint64`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: string
+
+
+ - title: `blockNumberIdentifier`
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "oneOf": [
+ {
+ "description": "The block height description",
+ "enum": [
+ "earliest",
+ "latest",
+ "pending"
+ ],
+ "title": "blockNumberTag",
+ "type": [
+ "string"
+ ]
+ },
+ {
+ "description": "Hex representation of a uint64",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": [
+ "string"
+ ]
+ }
+ ],
+ "title": "blockNumberIdentifier"
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+interface []interface{}
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `true`
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": true
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "trace_block", "params": [+```go +func (api *PrivateTraceAPI) Block(ctx context.Context, number rpc.BlockNumber, config *TraceConfig) ([ // Block returns the structured logs created during the execution of +// EVM and returns them as a JSON object. +// The correct name will be TraceBlockByNumber, though we want to be compatible with Parity trace module. +]interface{}, error) { + var block *types.Block + switch number { + case rpc.PendingBlockNumber: + block = api.eth.miner.PendingBlock() + case rpc.LatestBlockNumber: + block = api.eth.blockchain.CurrentBlock() + default: + block = api.eth.blockchain.GetBlockByNumber(uint64(number)) + } + if block == nil { + return nil, fmt.Errorf("block #%d not found", number) + } + config = setConfigTracerToParity(config) + traceResults, err := traceBlockByNumber(ctx, api.eth, number, config) + if err != nil { + return nil, err + } + traceReward, err := traceBlockReward(ctx, api.eth, block, config) + if err != nil { + return nil, err + } + traceUncleRewards, err := traceBlockUncleRewards(ctx, api.eth, block, config) + if err != nil { + return nil, err + } + results := [ // Fetch the block that we want to trace + ]interface{}{} + for _, result := range traceResults { + var tmp []interface{} + if err := json.Unmarshal(result.Result.(json.RawMessage), &tmp); err != nil { + return nil, err + } + results = append(results, tmp...) + } + results = append(results, traceReward) + for _, uncleReward := range traceUncleRewards { + results = append(results, uncleReward) + } + return results, nil +} +``` +View on GitHub → +
+ethapi.CallArgs
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - data:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "data": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+txTraceResult []*txTraceResult
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - items:
+
+ - additionalProperties: `false`
+ - properties:
+ - error:
+ - type: `string`
+
+ - result:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ - type: array
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "items": [
+ {
+ "additionalProperties": false,
+ "properties": {
+ "error": {
+ "type": "string"
+ },
+ "result": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ],
+ "type": [
+ "array"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "trace_filter", "params": [+```go +func (api *PrivateTraceAPI) Filter(ctx context.Context, args ethapi.CallArgs, config *TraceConfig) ([]*txTraceResult, error) { + return nil, nil +} +``` +View on GitHub → +
+common.Hash
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of a Keccak 256 hash`
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of a Keccak 256 hash",
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+__2:__
+config *TraceConfig
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - additionalProperties: `false`
+ - properties:
+ - Debug:
+ - type: `boolean`
+
+ - DisableMemory:
+ - type: `boolean`
+
+ - DisableReturnData:
+ - type: `boolean`
+
+ - DisableStack:
+ - type: `boolean`
+
+ - DisableStorage:
+ - type: `boolean`
+
+ - Limit:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Reexec:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - Timeout:
+ - type: `string`
+
+ - Tracer:
+ - type: `string`
+
+ - overrides:
+ - additionalProperties: `true`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "additionalProperties": false,
+ "properties": {
+ "Debug": {
+ "type": "boolean"
+ },
+ "DisableMemory": {
+ "type": "boolean"
+ },
+ "DisableReturnData": {
+ "type": "boolean"
+ },
+ "DisableStack": {
+ "type": "boolean"
+ },
+ "DisableStorage": {
+ "type": "boolean"
+ },
+ "Limit": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Reexec": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "Timeout": {
+ "type": "string"
+ },
+ "Tracer": {
+ "type": "string"
+ },
+ "overrides": {
+ "additionalProperties": true
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+interface interface{}
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "trace_transaction", "params": [+```go +func (api *PrivateTraceAPI) Transaction(ctx context.Context, hash common.Hash, config *TraceConfig) (interface{}, error) { + config = setConfigTracerToParity(config) + return traceTransaction(ctx, api.eth, hash, config) +}// Transaction returns the structured logs created during the execution of EVM +// and returns them as a JSON object. + +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### txpool_content
+
+Content returns the transactions contained within the transaction pool.
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+mapstringmapstringmapstringRPCTransaction map[string]map[string]map[string]*RPCTransaction
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - patternProperties:
+ - .*:
+ - patternProperties:
+ - .*:
+ - patternProperties:
+ - .*:
+ - additionalProperties: `false`
+ - properties:
+ - blockHash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - blockNumber:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - from:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - gas:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - gasPrice:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - hash:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - input:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: `string`
+
+ - nonce:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - r:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - s:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - to:
+ - pattern: `^0x[a-fA-F\d]{64}$`
+ - title: `keccak`
+ - type: `string`
+
+ - transactionIndex:
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint64`
+ - type: `string`
+
+ - v:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+ - value:
+ - pattern: `^0x[a-fA-F0-9]+$`
+ - title: `integer`
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "patternProperties": {
+ ".*": {
+ "patternProperties": {
+ ".*": {
+ "patternProperties": {
+ ".*": {
+ "additionalProperties": false,
+ "properties": {
+ "blockHash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "blockNumber": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "from": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "gas": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "gasPrice": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "hash": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "input": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": "string"
+ },
+ "nonce": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "r": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "s": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "to": {
+ "pattern": "^0x[a-fA-F\\d]{64}$",
+ "title": "keccak",
+ "type": "string"
+ },
+ "transactionIndex": {
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint64",
+ "type": "string"
+ },
+ "v": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ },
+ "value": {
+ "pattern": "^0x[a-fA-F0-9]+$",
+ "title": "integer",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "txpool_content", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ txpool.content();
+ ```
+
+
++```go +func (s *PublicTxPoolAPI) Content() map // Content returns the transactions contained within the transaction pool. +[string]map[string]map[string]*RPCTransaction { + content := map[string]map[string]map[string]*RPCTransaction{"pending": make(map[string]map[string]*RPCTransaction), "queued": make(map[string]map[string]*RPCTransaction)} + pending, queue := s.b.TxPoolContent() + for account, txs := range pending { + dump := make(map[string]*RPCTransaction) + for _, tx := range txs { + dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx) + } + content["pending"][account.Hex()] = dump + } + for account, txs := range queue { + dump := make(map[string]*RPCTransaction) + for _, tx := range txs { + dump[fmt.Sprintf("%d", tx.Nonce())] = newRPCPendingTransaction(tx) + } + content["queued"][account.Hex()] = dump + } + return content +} +``` +View on GitHub → +
+map[string]map[string]map[string]string
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - patternProperties:
+ - .*:
+ - patternProperties:
+ - .*:
+ - patternProperties:
+ - .*:
+ - type: `string`
+
+
+ - type: `object`
+
+
+ - type: `object`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "patternProperties": {
+ ".*": {
+ "patternProperties": {
+ ".*": {
+ "patternProperties": {
+ ".*": {
+ "type": "string"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": "object"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "txpool_inspect", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ txpool.inspect();
+ ```
+
+
++```go +func (s *PublicTxPoolAPI) Inspect() map // Inspect retrieves the content of the transaction pool and flattens it into an +// easily inspectable list. +[string]map[string]map[string]string { + content := map[string]map[string]map[string]string{"pending": make(map[string]map[string]string), "queued": make(map[string]map[string]string)} + pending, queue := s.b.TxPoolContent() + var format = func(tx *types.Transaction) string { + if to := tx.To(); to != nil { + return fmt.Sprintf("%s: %v wei + %v gas × %v wei", tx.To().Hex(), tx.Value(), tx.Gas(), tx.GasPrice()) + } + return fmt.Sprintf("contract creation: %v wei + %v gas × %v wei", tx.Value(), tx.Gas(), tx.GasPrice()) + } + for account, txs := // Define a formatter to flatten a transaction into a string + range pending { + dump := make(map[string]string) + for _, tx := range txs { + dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx) + } + content["pending"][account.Hex()] = dump + } + for account, txs := range queue { + dump := make(map[string]string) + for _, tx := range txs { + dump[fmt.Sprintf("%d", tx.Nonce())] = format(tx) + } + content["queued"][account.Hex()] = dump + } + return content +} +``` +View on GitHub → +
+map[string]hexutil.Uint
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - patternProperties:
+ - .*:
+ - description: `Hex representation of a uint`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `uint`
+ - type: `string`
+
+
+ - type: object
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "patternProperties": {
+ ".*": {
+ "description": "Hex representation of a uint",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "uint",
+ "type": "string"
+ }
+ },
+ "type": [
+ "object"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "txpool_status", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ txpool.status();
+ ```
+
+
++```go +func (s *PublicTxPoolAPI) Status() map // Status returns the number of pending and queued transaction in the pool. +[string]hexutil.Uint { + pending, queue := s.b.Stats() + return map[string]hexutil.Uint{"pending": hexutil.Uint(pending), "queued": hexutil.Uint(queue)} +} +``` +View on GitHub → +
+1.11.22-unstable/generated-at:2021-01-23T04:50:40-06:00 |
+| OpenRPC | 1.2.6 |
+
+---
+
+
+
+
+### web3_clientVersion
+
+ClientVersion returns the node name
+
+
+#### Params (0)
+
+_None_
+
+#### Result
+
+
+
+
+string
+
+ + Required: ✓ Yes
+
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "web3_clientVersion", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ web3.clientVersion();
+ ```
+
+
++```go +func (s *publicWeb3API) ClientVersion() string { + return s.stack.Server().Name +}// ClientVersion returns the node name + +``` +View on GitHub → +
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+
+
+#### Result
+
+
+
+
+hexutil.Bytes
+
+ + Required: ✓ Yes
+
+
+=== "Schema"
+
+ ``` Schema
+
+ - description: `Hex representation of some bytes`
+ - pattern: `^0x([a-fA-F\d])+$`
+ - title: `dataWord`
+ - type: string
+
+
+ ```
+
+=== "Raw"
+
+ ``` Raw
+ {
+ "description": "Hex representation of some bytes",
+ "pattern": "^0x([a-fA-F\\d])+$",
+ "title": "dataWord",
+ "type": [
+ "string"
+ ]
+ }
+ ```
+
+
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ``` shell
+ curl -X POST http://localhost:8545 --data '{"jsonrpc": "2.0", id": 42, "method": "web3_sha3", "params": []}'
+ ```
+
+=== "Javascript Console"
+
+ ``` js
+ web3.sha3(input);
+ ```
+
+
++```go +func (s *publicWeb3API) Sha3(input hexutil.Bytes) hexutil.Bytes { + return crypto.Keccak256(input) +}// Sha3 applies the ethereum sha3 implementation on the input. +// It assumes the input is hex encoded. + +``` +View on GitHub → +
+{{ .description }} {{ if .summary }}_{{ .summary }}_{{- end }}
+{{- else -}}
+{{ .name }} {{ .description }} {{ if .summary }}_{{ .summary }}_{{- end }}
+{{- end }}
+
+ + Required: {{ if .required }}✓ Yes{{ else }}No{{- end}}
+{{ if .deprecated }} + Deprecated: :warning: Yes{{- end}}
+{{ if (or (gt (len .schema) 1) .schema.properties) }}
+=== "Schema"
+
+ ` + "```" + ` Schema
+ {{ bulletJSON .schema 1 }}
+ ` + "```" + `
+
+=== "Raw"
+
+ ` + "```" + ` Raw
+ {{ asjson .schema 1 1 }}
+ ` + "```" + `
+{{ end }}
+{{ end }}
+
+{{ define "methodTpl" }}
+{{ $methodmap := tomap . }}
+### {{ .Name }}
+
+{{ .Summary }}
+
+#### Params ({{ .Params | len }})
+{{ if gt (.Params | len) 0 }}
+{{ if eq $methodmap.paramStructure "by-position" }}Parameters must be given _by position_.{{ else if eq $methodmap.paramStructure "by-name" }}Parameters must be given _by name_.{{ end }}
+{{ range $index, $param := .Params }}
+{{ $parammap := . | tomap }}
+__{{ sum $index 1 }}:__ {{ template "contentDescTpl" $parammap }}
+{{ end }}
+{{ else }}
+_None_
+{{- end}}
+
+#### Result
+
+{{ if .Result -}}
+{{ $result := .Result | tomap }}
+{{- if ne $result.name "Null" }}
+{{ template "contentDescTpl" $result }}
+{{- else -}}
+_None_
+{{- end }}
+{{- end }}
+
+#### Client Method Invocation Examples
+
+=== "Shell"
+
+ ` + "```" + ` shell
+ {{ methodFormatCURL . }}
+ ` + "```" + `
+
+=== "Javascript Console"
+
+ ` + "```" + ` js
+ {{ methodFormatJSConsole . }}
+ ` + "```" + `
+
+{{ $docs := .ExternalDocs | tomap }}
++{{ .Description }} +View on GitHub → +
+{{ .Info.Version }} |
+| OpenRPC | {{ .Openrpc }} |
+
+---
+
+{{ range .Methods }}
+{{ template "methodTpl" . }}
+{{ end }}
+`)
+ if err != nil {
+ t.Fatal(err)
+ }
+
+ moduleMethods := func() (grouped map[string][]meta_schema.MethodObject) {
+ if res.Methods == nil {
+ return
+ }
+ grouped = make(map[string][]meta_schema.MethodObject)
+ for _, m := range *res.Methods {
+ moduleName := strings.Split(string(*m.Name), "_")[0]
+ group, ok := grouped[moduleName]
+ if !ok {
+ group = []meta_schema.MethodObject{}
+ }
+ group = append(group, m)
+ grouped[moduleName] = group
+ }
+ return
+ }()
+
+ _ = os.MkdirAll("../docs/JSON-RPC-API/modules", os.ModePerm)
+
+ for module, group := range moduleMethods {
+ fname := fmt.Sprintf("../docs/JSON-RPC-API/modules/%s.md", module)
+ fi, err := os.OpenFile(fname, os.O_CREATE|os.O_RDWR, os.ModePerm)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fi.Truncate(0)
+
+ nDoc := &meta_schema.OpenrpcDocument{}
+ *nDoc = *res
+ nDoc.Methods = (*meta_schema.Methods)(&group)
+ err = tpl.Execute(fi, nDoc)
+ if err != nil {
+ t.Fatal(err)
+ }
+ fi.Sync()
+ fi.Close()
+ }
+}
+
+// printBullet handles transforming a JSON JSON schema into bullet points, which I think are more legible.
+func printBullet(any interface{}, depth int) (out string) {
+ defer func() {
+ out += "\n"
+ }()
+ switch typ := any.(type) {
+ case map[string]interface{}:
+ out += "\n"
+ ordered := []string{}
+ for k := range typ {
+ ordered = append(ordered, k)
+ }
+ sort.Slice(ordered, func(i, j int) bool {
+ return ordered[i] < ordered[j]
+ })
+ for _, k := range ordered {
+ v := typ[k]
+ out += fmt.Sprintf("%s- %s: %s", strings.Repeat("\t", depth), k, printBullet(v, depth+1))
+ }
+ case []interface{}:
+
+ // Don't know why this isn't working. Doesn't fire.
+ // if c, ok := any.([]string); ok {
+ // return strings.Join(c, ",")
+ // }
+
+ stringSet := []string{}
+ for _, vv := range typ {
+ if s, ok := vv.(string); ok {
+ stringSet = append(stringSet, s)
+ }
+ }
+ if len(stringSet) == len(typ) {
+ return strings.Join(stringSet, ", ")
+ }
+
+ out += "\n"
+ for _, vv := range typ {
+ out += printBullet(vv, depth+1)
+ }
+ default:
+ return fmt.Sprintf("`%v`", any)
+ }
+ return
+}
diff --git a/mkdocs.yml b/mkdocs.yml
index 133ac5082f..ac7598b7d4 100644
--- a/mkdocs.yml
+++ b/mkdocs.yml
@@ -38,6 +38,9 @@ theme:
- navigation.sections
# - navigation.instant
+extra_css:
+ - assets/css/extra.css
+
use_directory_urls: true
plugins:
@@ -62,29 +65,12 @@ markdown_extensions:
- pymdownx.emoji
- pymdownx.superfences
- pymdownx.details
+ - pymdownx.tabbed
- pymdownx.magiclink:
repo_url_shortener: true
repo_url_shorthand: true
social_url_shorthand: true
- pymdownx.tasklist:
custom_checkbox: true
-
-# Page tree
-nav:
- - Home: index.md
- - Getting Started:
- - Installation: getting-started/installation.md
- - CLI: getting-started/run-cli.md
- - Core:
- - All tools: core/alltools.md
- - EVMC: core/evmc.md
- - APIs:
- - JSON-RPC: apis/jsonrpc-apis.md
- - OpenRPC: apis/openrpc.md
- - Developers:
- - Build from source: developers/build-from-source.md
- - Documentation: developers/documentation.md
- - Versioning: developers/versioning.md
- - New release: developers/create-new-release.md
- - Tutorials:
- - Setup private network: tutorials/private-network.md
+ - pymdownx.highlight:
+ linenums: true
diff --git a/node/node.go b/node/node.go
index ec68ffb3b4..26267fabf6 100644
--- a/node/node.go
+++ b/node/node.go
@@ -718,3 +718,10 @@ func GetAPIsByWhitelist(apis []rpc.API, modules []string, exposeAll bool) (regis
}
return registeredApis
}
+
+// InprocDiscovery_DEVELOPMENTONLY is a development workaround method
+// only, and should not be considered a stable part of the public interface for this receiver.
+// Current workaround for https://github.com/open-rpc/meta-schema/issues/356.
+func (n *Node) InprocDiscovery_DEVELOPMENTONLY() *go_openrpc_reflect.Document {
+ return n.inprocOpenRPC
+}