Getting Started with Deployment
So you’ve built and tested your MXE locally, and now you’re ready to deploy it to Solana devnet. This guide will walk you through the deployment process and share some tips to make it go smoothly.What You’ll Need
Before we dive into deployment, let’s make sure you have everything ready:- Your MXE built successfully with
arcium build - Tests passing locally with
arcium test - A Solana keypair with around 2-5 SOL for deployment costs (program deployment and account initialization)
- Access to a reliable RPC endpoint - we strongly recommend getting a free API key from Helius, or QuickNode
Preparing Your Program
Before you deploy, there are a couple of important things to consider about how your program handles computation definitions.Handling Large Circuits with Offchain Storage
Here’s something important to know: right now, Arcis compiled circuits aren’t super efficient with their encoding, which means your circuit files can easily be several MBs in size. That makes initializing computation definitions on-chain pretty expensive - and will require a lot of transactions to fully upload. The good news is you can store your circuits offchain instead. Just upload them to IPFS, a public S3 bucket, or even Supabase object storage - wherever works for you. Here’s how to update your program to use offchain storage: Standard approach (works for small circuits):The
circuit_hash! macro embeds the SHA-256 hash of your compiled circuit at compile time. The hash is read from build/{circuit_name}.hash, which is generated automatically during arcium build. ARX nodes verify this hash when fetching your circuit to ensure the circuit hasn’t been tampered with.Important: Always use circuit_hash! for off-chain circuits. Don’t use a placeholder like [0u8; 32] - this will cause verification to fail on ARX nodes.- Build your project with
arcium buildto generate the circuit files and hashes - Upload the
.arcisfiles frombuild/folder to your preferred storage service - Update your init functions with the public URLs and
circuit_hash!macro calls
Note on Cluster Configuration
When testing locally, you’ve been usingarciumEnv.arciumClusterOffset with getClusterAccAddress() in your test code. For devnet deployment, you’ll use the same pattern with your chosen cluster offset - we’ll show you exactly how in the post-deployment section.
Basic Deployment
Thearcium deploy command handles both deploying your program and initializing the MXE account. Here’s the basic command structure:
Understanding Cluster Offsets
The--cluster-offset tells your MXE which Arcium cluster it should connect to. Think of clusters as groups of nodes that will perform your encrypted computations. For devnet, you can choose from these offsets:
123456789
Choosing Your RPC Provider
The--rpc-url parameter is particularly important. While you could use Solana’s default RPC endpoints with the shorthand notation (-u d for devnet), the default RPC can be unreliable and cause deployment failures due to dropped transactions.
Recommended approach with a reliable RPC:
Advanced Deployment Options
Once you’re comfortable with basic deployment, you might want to customize things further.Adjusting Mempool Size
The mempool determines how many computations your MXE can queue up. The default “Tiny” size works fine for testing, but you might want more capacity for production:Tiny, Small, Medium, Large. Start small and increase if you need more capacity.
Using a Custom Program Address
If you need your program at a specific address (maybe for consistency across deployments), you can provide a program keypair:Partial Deployments
Sometimes you might need to run just part of the deployment process. For instance, if you’ve already deployed the program but need to reinitialize the MXE account:After Deployment
Initialize Your Computation Definitions
Your MXE is deployed, but you still need to initialize the computation definitions. This tells the Arcium network what encrypted operations your MXE can perform. Computation definitions only need to be initialized once - they persist on-chain and don’t need to be re-initialized unless you’re deploying to a new program address. You can initialize them anytime after deployment completes successfully. Remember how we mentioned you’d need to update your cluster configuration? Now’s the time! You’ll need to update your test or client code to derive the cluster account (and the related PDAs) from the cluster offset you selected during deployment. Local testing pattern:cluster_offset value that you used during deployment! This ensures your program talks to the right cluster.
Once you’ve updated the cluster configuration, you can run the initialization:
Verify Everything’s Working
Let’s make sure your deployment succeeded:Common Issues and Solutions
Dealing with Dropped Transactions
If your deployment fails with transaction errors, it’s almost always the RPC. Switch to a dedicated provider:Running Out of SOL
Check your balance before deploying:Deployment Partially Failed?
No worries, you can complete the missing steps. If the program deployed but initialization failed, just run with--skip-deploy. If initialization succeeded but deployment failed, use --skip-init.
What’s Next?
With your MXE deployed, you’re ready to:- Update your client code to connect to the deployed program
- Initialize all your computation definitions
- Run end-to-end tests with real encrypted computations
- Monitor performance and adjust mempool size if needed