Wallet structure: how to organize and scale your wallets
Every transaction starts with a wallet. The way you structure them will shape how scalable and maintainable your automation setup is. Option 1: Single wallet with many accounts (HD path fan-out)By default, Turnkey wallets use a hierarchical deterministic (HD) structure. That means you can generate unlimited accounts from a single wallet seed, each with its own address. This is ideal for:
- Managing multiple user deposit addresses
- Creating large numbers of accounts for batching or privacy
- Assigning different onchain roles (e.g. one account for contract deployment, another for transfers)
Use this when you need separation by use case. For example:
- One wallet for treasury ops
- One for NFT mints
- One for sequencing contracts
This option is best when you need strict isolation — e.g. multi-tenant environments, or wallets with different authentication requirements. Each sub-org has its own root users and policy namespace. Downside: more setup, more moving parts. Most teams use a combination: they generate many accounts under a few wallets and reserve sub-orgs for user-facing or high-risk cases.
Trigger model: what kicks off transactions
Transaction automation can be reactive, proactive, or user-driven. The right model depends on your use case. Event-driven (most common):A transaction is triggered by an external event — a webhook, an internal job, or an offchain signal. Examples:
- Market resolution triggers a payout
- Onchain price changes trigger a rebalancing tx
- A user hits a “claim” button in your app
Useful for treasury management, yield compounding, or periodic distribution flows. Run a job hourly/daily and trigger signing from there. Manual with automation fallback:
Sometimes a human should have the final say, but you want the transaction to be ready to go. You can submit a tx to Turnkey that requires approval, then notify a signer via Slack, email, or dashboard. Tip: Think in terms of “intent capture” (when does your system decide something needs to happen) vs. “signing execution” (when and how does it actually get signed).
Policy model: what rules do you want enforced?
Policies are your automation safety net. Every action goes through the policy engine before it’s allowed, and is explicitly denied by default. You’ll want to decide:How many approvers?
- Use single-party approvals for low-risk flows (e.g. daily payouts)
- Add quorum-based approvals (2-of-N) for anything that could move real money
- You can enforce consensus based on value thresholds, contract targets, asset type, and more
- Assign narrow permissions to service accounts (e.g. only sign txs from wallet A to address X)
- Add additional controls per user role or tag (e.g. “engineer” vs. “ops”)
- Restrict by destination address (eth.tx.to)
- Restrict by method ID (eth.tx.data[:4])
- Restrict by value (eth.tx.value)
- Combine all of the above with consensus rules
- Require user co-signing for certain transactions
- Allow delegated signing within strict bounds
- Use different policies for different environments (e.g. testnet policy vs. mainnet)
Integration model: which interface drives automation?
All interfaces (CLI, SDK, API) go through the same policy and enclave flow. The only difference is where your logic lives. CLI:Best for prototyping or scripting internal workflows (e.g. rotate a key, create a wallet). You can also use it in CI pipelines. SDK:
Ideal for integrating into apps or backend services. Available in multiple programming languages. Handles signing, retries, and activity submission. Direct API:
Use this if you want full control or are building from a non-standard language. Slightly more effort to get right, but fully supported. Dashboard:
Not for automation — but useful for manual approval flows, audit trails, and monitoring. Common pattern:
- Use SDK in your backend to submit signing requests
- Use webhook or polling to detect consensus-needed flows
- Use CLI for one-off or recovery flows
- Use dashboard to inspect what happened
You’ll also want to decide whether your sessions should be scoped. Scoped sessions allow you to define exactly what a given session key is allowed to do — and enforce it via Turnkey’s policy engine. For example, you can issue sessions that:
- are read-only
- can only sign transactions below a certain value
- can only interact with specific contracts or functions (e.g. a swap function on Uniswap)