Deploy the Factory
The factory contract deploys new cap tables and keeps track of their addresses. Every cap table it creates runs the same implementation, so the factory’s owner can upgrade all of them together.
If you run a transfer agent, deploy your own factory. The wallet that deploys it becomes the owner and controls those upgrades. To try the stack without deploying anything, use the shared demo factory.
Configure the deploy key
The deploy script reads RPC_URL and PRIVATE_KEY from an env file. That key’s wallet becomes the factory owner, so keep it in its own file instead of the long-running root .env (see Three wallets and keys):
RPC_URL=https://rpc.plume.org
PRIVATE_KEY=<factory-owner-private-key>The wallet needs PLUME for gas. The script also needs python3.
Run the deployment script
./scripts/deployFactory.sh .env.prodpnpm deploy-factory runs the same script with the root .env. Add --verify to submit the source to Sourcify.
Note the contract addresses
The script prints the addresses you’ll need:
CapTable (implementation): <IMPLEMENTATION_ADDRESS>
CapTableFactory: <FACTORY_ADDRESS>
Beacon: <BEACON_ADDRESS>These addresses are unique to your deployment. The factory is deployed with CREATE2, so its address comes from the owner wallet, a fixed salt, and the contract bytecode. Every developer gets different addresses, and the same owner gets the same address on any chain that has the standard CREATE2 deployer.
Add the factory to MongoDB
The script registers the factory and its implementation in MongoDB for you. Pass --no-register to skip that and register later with pnpm factory:register.
Point the app at your factory
Set NEXT_PUBLIC_FACTORY_ADDRESS in app/.env.local to the new factory address. If you use the Docker app preview, set it in the root .env too.
Verify the deployment
With --verify, the source goes to Sourcify. Plume’s Blockscout explorer doesn’t list Solidity 0.8.37, so open each contract address on explorer.plume.org after Sourcify succeeds; Blockscout then imports the match. Expect a partial match: compiler metadata is disabled, but the deployed bytecode matches the source.
Check the owner and the live implementation:
cast call <FACTORY_ADDRESS> "owner()(address)" --rpc-url https://rpc.plume.org
cast call <FACTORY_ADDRESS> "capTableImplementation()(address)" --rpc-url https://rpc.plume.orgUpgrade your cap tables
To move every cap table on your factory to a new CapTable implementation:
./scripts/deployFactory.sh .env.prod --upgrade-factory <FACTORY_ADDRESS>The script deploys the new implementation, calls updateCapTableImplementation on your factory, and refreshes the MongoDB record. The signer must be the factory owner.
Register a factory you already have
pnpm factory:register --factory <FACTORY_ADDRESS>The command reads the live implementation from the factory, so you never paste a stale address. The server uses the factory stored in MongoDB for POST /issuer/create, and the app uses NEXT_PUBLIC_FACTORY_ADDRESS, so keep them the same. To inspect the record, connect MongoDB Compass to mongodb://tap:tap@localhost:27027 and open the factories collection in the mongo database.
Shared demo factory
To try the stack without deploying, register TAP’s demo factory on Plume:
REUSE_TAP_FACTORY=1 pnpm bootstrap
# or, with the stack already running:
pnpm factory:register --factory 0xcd6Df14406b0569ceEABa884A18717774EdeaCA1| Role | Address |
|---|---|
Demo CapTableFactory | 0xcd6Df14406b0569ceEABa884A18717774EdeaCA1 |
| Factory owner (TAP deploy key, controls upgrades) | 0x366aA809015061C101983900d0c2ebf7d71B96AF |
| TAP Admin (issuer wallet that mints through the demo factory) | 0x3601a913fD3466f30f5ABb978E484d1B37Ce995D |
Anyone can create cap tables on the demo factory, but only its owner can upgrade them, so production transfer agents should deploy their own. The demo factory predates the CREATE2 deploy script, so its address doesn’t follow the rule above.
Next: Create an Issuer.