How to automate stablecoin payouts and treasury operations without one person holding the keys
Put the payout and rebalancing rules in code that runs next to the key, run them on a schedule or from your payroll system's webhooks, and let a multisig approve any change to the rules. Here is how that works.
To automate stablecoin payouts and treasury operations without one person holding the keys, put the rules in code that runs next to the key, and let a multisig approve any change to that code. On Lit Protocol, the wallet's key stays inside a secure enclave, and a Lit Action, a JavaScript function that runs in the same enclave, checks every payment before it signs. Lit Triggers runs the action on a schedule or when your payroll or billing system sends a webhook. In ChainSecured mode, changes to which code can use the wallet need your own Safe, so no single employee can change who gets paid or how much.
What the rules should say
Write down the rules before you write code, because the code will enforce exactly what you write. For payouts, that usually means paying only approved recipients, capping each payment, and requiring approvals above a threshold. For treasury, it means keeping each asset inside a target band, moving only between approved accounts, and capping each move.
The post on how fintechs make sure no single employee can move funds has a payment rule that pays only approved vendors and needs two of three approvers above 10,000 USDC. That rule is a good starting point for payouts.
Payouts on a schedule or from a webhook
Payroll runs on a schedule. A schedule trigger can run the payout action on the first of each month and pay each recipient within the limits in its code. Keep the list of recipients and their amounts in the action's code, so changing who gets paid needs a new version that your Safe approves. If the amounts change every month, have the action read the run from your payroll system and pay only recipients on its list, and require approver signatures on the run that the action checks, the way the payment rule in the fintech post above checks its approvers. Seal the payroll system's API key with Lit.Actions.Encrypt so it is only decrypted inside the action. The post on running a scheduled job that signs transactions shows how to set up a schedule.
Contractor and vendor payouts often start in another system, when an invoice is approved. Your billing system can send a signed webhook, and the action checks the signature before it pays. The post on turning a webhook into a signed blockchain transaction shows the signature check and a contract that refuses to process the same event twice. A plain USDC transfer cannot refuse a repeat, so send payouts through a small payout contract that stores each invoice ID and reverts when it sees one again. That stops a retried or replayed webhook from paying twice.
Treasury rebalancing
A rebalancing job can run every hour, read balances, and move funds between your accounts when an asset leaves its band. Because the action only moves funds back into the band and caps each move, running it more often than planned does not move more than needed. Keep the list of accounts it can move between in the code, so a compromised system cannot add a new destination.
Who can change the rules
Next, decide who can change the rules. A new Lit account starts in API mode, where Lit relays your changes. Convert the account to ChainSecured mode with a Safe as the owner. After that, adding a new version of a rule, adding a wallet, or creating a usage key is a Safe transaction that needs your threshold of signers, and every change is public on Base. Do not give any usage key the scopes that manage groups, because a key with those scopes can make the same changes. Lit's ChainSecured docs also list the limits of the setup: Lit's operator can pause signing, and Lit's own Safe can upgrade the account contracts. The post on proving to auditors that no employee can access your customers' keys explains what an auditor can check and the limits to tell them about.
What the setup protects
No person holds the treasury key, and every payment passes rules that one person cannot skip. A stolen usage key can only make payments that pass those rules, so keep caps tight and balances at a working level. Changes to the rules, including paying a new recipient, need your Safe.
Get started
To create an account, go to the Lit dashboard and click Create an account. To talk about your payout or treasury setup, use the Lit contact form.