PoolService
The Pool
resource is a top-level container for other resources such as MPCKeys, DeviceGroups, and MPCWallets. Pools segregate funds via authorization.
info
You must invoke CreatePool before creating a Pool-scoped resource so that you can specify the Pool as the parent of the new resource.
When you create a Pool, the Pool becomes associated with your authenticating identity (e.g., API Key). Subsequent API calls to Pool-scoped resources are then authorized based on whether your authenticated identity is associated with the parent Pool.
Use Cases
Use cases for pools include:
- Segregating funds (i.e., MPCWallets and MPCKeys) based on location/jurisdiction.
- Segregating funds based on corporate entity.
- Segregating funds based on development environment (e.g., production vs. staging).
caution
You should not create a new Pool for every new end user of your application. A proper use of Pools should result in the order of roughly 1 - 100 Pools for your application.
Sample Code
// Simplified example code:
// First, create a new Pool.
createPoolReq := &PoolsRpc.CreatePoolRequest{}
Pool, _ := PoolServiceClient.CreatePool(ctx, createPoolReq)
// Next, create a wallet within that Pool.
createWalletReq := &walletsRpc.CreateWalletRequest{
Parent: Pool.GetName(),
}
wallet, _ := walletServiceClient.CreateWallet(ctx, createWalletReq)