solution: setup custom upstream methods

This commit is contained in:
Igor Artamonov
2019-08-25 20:50:16 -04:00
parent e5c9124705
commit bc83b1b120
33 changed files with 678 additions and 92 deletions

View File

@@ -98,6 +98,68 @@ Dshackle currently supports
- `ws` websocket connection (supposed to be used in addition to `rpc` connection)
- `grpc` connects to another Dshackle instance
=== Methods
.By default an ethereum upstream supports following JSON RPC methods:
- `eth_gasPrice`
- `eth_call`
- `eth_estimateGas`
- `eth_getBlockTransactionCountByHash`
- `eth_getUncleCountByBlockHash`
- `eth_getBlockByHash`
- `eth_getTransactionByHash`
- `eth_getTransactionByBlockHashAndIndex`
- `eth_getStorageAt`
- `eth_getCode`
- `eth_getUncleByBlockHashAndIndex`
- `eth_getTransactionCount`
- `eth_blockNumber`
- `eth_getBalance`
- `eth_sendRawTransaction`
- `eth_getBlockTransactionCountByNumber`
- `eth_getUncleCountByBlockNumber`
- `eth_getBlockByNumber`
- `eth_getTransactionByBlockNumberAndIndex`
- `eth_getTransactionReceipt`
- `eth_getUncleByBlockNumberAndIndex`
.Plus following methods are answered directly by Dshackle
- `net_version`
- `net_peerCount`
- `net_listening`
- `web3_clientVersion`
- `eth_protocolVersion`
- `eth_syncing`
- `eth_coinbase`
- `eth_mining`
- `eth_hashrate`
- `eth_accounts`
It's possible to enable additional methods that are available on upstream, or disable an existing method. For that purpose
there is `methods` configuration:
[source, yaml]
----
upstreams:
- id: my-node
chain: ethereum
labels:
archive: true
methods:
enabled:
- name: trace_transaction
disabled:
- name: eth_getBlockByNumber
----
Such configuration option allows to execute methods `trace_transaction` and also disables `eth_getBlockByNumber` on that
particular upstream. If a client tries to execute method `trace_transaction` it will be executed on that upstream, or
another upstream will have such method enabled.
Together with label `archive: true` it's possible to specify during execution that a client wants to execute method only
on an archive node.
=== Authentication
==== TLS

View File

@@ -52,8 +52,8 @@ Where:
- `items` as a list of independent requests, which may be executed in different nodes in parallels or in different order, with:
* `method` - a JSON RPC standard name, ex: `eth_getBlockByHash`
* `payload` - list of parameters for the methods, encoded as JSON string, ex. `["0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331", true]`
- `Selector` and `AvailabilityEnum` are described in reference, in short they allow to specify which nodes are allowed
to execute the request.
- `Selector` and `AvailabilityEnum` are described in reference, in short they allow to specify which nodes must be selected
to execute the reques (i.e. "execute only on an archive node")
.NativeCallReplyItem
[source,proto]