Initialization
Now that you have your environment set up already, let's see about how to instantiate.
You can instantiate the SDK by passing it the CoreOptions
object as an argument. Although, CoreOptions
has many fields most are optional. We'll focus on the required options for now.
chainId
The target chain on which you want to utilize the deployed instance of zkFi.
account
It is the shielded account of the user who wants to perform private transactions of enquire about its balance or transaction history. AShieldedAccount
can be simply generated from a random seed. A seed is a randombigint
number generated from a secure entropy source. You can generate the account by:const account = ShieldedAccount.generate(seed)
Now you can pass the account to theCoreOption
.rpc
RPC URL of the provided chain or the viemPublicClient
.explorerApi
API URL of block explorer. You must append the API key of the block explorer in the API URL itself. For example, Optimism Sepolia's base API URL ishttps://api-sepolia-optimistic.etherscan.io/api
. But, when including inCoreOptions
, you must include theapikey
parameter. That is, API URL that you must pass is:
After configuring options simply create an SDK instance as:
The SDK instance (zkfi
) above is ready to be utilized now. Next, let's see how to craft a shielded/private transaction i.e a ZTransaction
instance.
Last updated