You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -808,3 +809,25 @@ You need to pass a file with a list of transaction hashes to trace. The file sho
808
809
809
810
### RPC Traffic logging
810
811
With `SETH_LOG_LEVEL=trace` we will also log to console all traffic between Seth and RPC node. This can be useful for debugging as you can see all the requests and responses.
812
+
813
+
814
+
### Read-only mode
815
+
It's possible to use Seth in read-only mode only for transaction confirmation and tracing. Following operations will fail:
816
+
* contract deployment
817
+
* gas estimations (we need the pk/address to check nonce)
818
+
* RPC health check (we need a pk to send a transaction to ourselves)
819
+
* pending nonce protection (we need an address to check pending transactions)
820
+
* ephemeral keys (we need a pk to fund them)
821
+
822
+
The easiest way to enable read-only mode is to client via `ClientBuilder`:
when builder is called with `WithReadOnlyMode()` it will disable all the operations mentioned above and all the configuration settings related to them.
Copy file name to clipboardExpand all lines: seth/client_builder.go
+51-2Lines changed: 51 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -7,9 +7,17 @@ import (
7
7
"github.com/pkg/errors"
8
8
)
9
9
10
+
const (
11
+
NoPkForRpcHealthCheckErr="you need to provide at least one private key to check the RPC health"
12
+
NoPkForNonceProtection="you need to provide at least one private key to enable nonce protection"
13
+
NoPkForEphemeralKeys="you need to provide at least one private key to generate and fund ephemeral addresses"
14
+
NoPkForGasPriceEstimation="you need to provide at least one private key to enable gas price estimations"
15
+
)
16
+
10
17
typeClientBuilderstruct {
11
-
config*Config
12
-
errors []error
18
+
config*Config
19
+
readonlybool
20
+
errors []error
13
21
}
14
22
15
23
// NewClientBuilder creates a new ClientBuilder with reasonable default values. You only need to pass private key(s) and RPC URL to build a usable config.
// WithReadOnlyMode sets the client to read-only mode. It removes all private keys from all Networks and disables nonce protection and ephemeral addresses.
0 commit comments