Client Configuration
Configure the common parameters
Your should provide a client configuration when instantiating ZkBobClient
. This includes pools and chains description according to the following parameters:
ClientConfig.pools
The ClientConfig.pools
field contains descriptions of the supported privacy pools and maps the arbitrary pool name (aka pool alias) with the associated pool parameters.
where
chainId
- the chain identifier (137
for pool on Polygon,1
for Ethereum Mainnet etc)poolAddress
- 0x-prefixed pool smart-contract addresstokenAddress
- 0x-prefixed token smart-contract address served by the current poolrelayerUrls
- the list of the relayer URLs to interact with the pool (please note the most of the pool operations are performed through the relayer). The list should be non-empty.
Currently the multi-relayer configuration isn't supported. So if you provide several relayer URLs the first one will be used.
delegatedProverUrls
- the optional list of external entities calledprover
which are designated to perform proof calculations. Helpful for low-performance devices.depositScheme
- a deposit scheme for depositing tokens. It depends on pool's token. It's anDepositType
enum value as follows:
coldStorageConfigPath
- optional field which contains URL for the coldstorage config. Coldstorage is pre-downloaded files with pool transactions. It's needed to speed-up the user's state synchronization process.minTxAmount
- the minimum transaction amount in the pool dimension (500,000,000
is the default if that parameter is omitted).feeDecimals
- the number of digits after the decimal point in the transaction fee (it will always rounded-up). Fees will not round iffeeDecimals
isundefined
.isNative
- should be true for WETH deployments.ddSubgraph
- name of the subgraph to fetch pending direct deposit transactions.parameters
- SNARK parameters set the alias (string name). The set MUST exist inClientConfig.snarkParamsSet
otherwise the global parameters set inClientConfig.snarkParams
will used if that parameter is omitted.
ClientConfig.chains
ClientConfig.chains
field contains chain description which are used in the pools defined in the client config. For the every Pool.chainId
the chain with the associated ID should be defined here.
where rpcUrls
contain a list of JSON RPC endpoints which can interact with that chain. It's recommended to use several endpoints to decrease the probability of RPC interaction errors.
ClientConfig.snarkParams
ClientConfig.snarkParams
contains URLs of the zk-SNARK parameters and associated verification keys. It's needed to calculate and verify transactions proofs. The parameters are created before the pool deployment (during the Ceremony) and should be public available for the every pool.
snarkParams
is a common parameters applicable for all defined pools without parameters
customization field
ClientConfig.snarkParamsSet
ClientConfig.snarkParamsSet
contains customized URLs of the zk-SNARK parameters and associated verification keys. This field implements the multiparameters support feature.
ClientConfig.supportID
ClientConfig.supportId
is a unique random string sent to the relayer in every request. It's needed to track the user's activity for support purposes. The most common way to generate it is using the uuid.v4()
method of the uuid package.
Please note the supportId
updates every time the library loads so there is no way to link all user actions on the relayer side. That field is optional but in most cases the relayer requires it and all requests without supportId
will be rejected.
ClientConfig.forcedMultithreading
ClientConfig.forcedMultithreading
is an optional field needed to override the multithreading mode selection (by default it selects automatically depending on the browser). The mode will select automatically when undefined. For example, to activate singlethread mode set forcedMultithreading
to false
.
Client library multipool configuration example
Minimal Configurations for Deployed Solutions
To get started with already deployed privacy pools you can download the minimal config file for the production or development environment.
The following configurations contain only the mandatory fields. To instantiate the ZkBobClient object do not forget to provide other parameters. For example the client can be initialized without supportId
but most likely the relayer will reject any request without this field.
Last updated