Deployment

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'll explain why this matters below)

Basic Deployment

The arcium deploy command handles both deploying your program and initializing the MXE account. Here's the basic command structure:

arcium deploy --cluster-offset <cluster-offset> --keypair-path <path-to-your-keypair> --rpc-url <your-rpc-url>

Let's break down what each parameter does:

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:

  • 1116522165

  • 3458519414

  • 768109697

Each represents a different cluster on devnet. They all work the same way, so just pick one for your deployment.

The RPC Connection

The --rpc-url parameter is particularly important. While you could use Solana's default RPC endpoints with the shorthand notation (-u d for devnet), we strongly recommend using a dedicated RPC provider instead. Here's why: the default Solana RPC can be unreliable, especially during deployments where dropped transactions can cause frustrating failures.

Here's how to deploy with a reliable RPC:

arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  --rpc-url https://devnet.helius-rpc.com/?api-key=<your-api-key>

You can get free RPC endpoints from:

Getting a free API key takes just a minute and will save you from deployment headaches.

If You Don't Have a Custom RPC

If you really need to use the default RPC, you can use the shorthand notation:

arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  -u d  # 'd' for devnet

Just be aware that you might encounter dropped transactions. The shorthand options are:

  • d or devnet

  • t or testnet

  • l or localnet

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:

arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  --rpc-url <your-rpc-url> \
  --mempool-size Medium

Available sizes are: 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:

arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  --rpc-url <your-rpc-url> \
  --program-keypair ./program-keypair.json

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:

# Skip program deployment, only initialize MXE account
arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  --rpc-url <your-rpc-url> \
  --skip-deploy

Or if you only want to deploy the program without initialization:

# Deploy program only, skip MXE initialization
arcium deploy --cluster-offset 2326510165 \
  --keypair-path ~/.config/solana/id.json \
  --rpc-url <your-rpc-url> \
  --skip-init

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. You can do this by updating your test file to use the deployed cluster:

// Update your test to use the deployed cluster
const clusterAccount = getClusterAcc(cluster_offset); // Use your deployment offset

// Then run the initialization
await initAddTogetherCompDef(program, owner, false);

Verify Everything's Working

Let's make sure your deployment succeeded:

solana program show <your-program-id> --url <your-rpc-url>

Then run your tests against the deployed program:

arcium test --skip-local-validator --provider.cluster devnet

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:

# Instead of this (unreliable):
arcium deploy ... -u d

# Use this (reliable):
arcium deploy ... --rpc-url https://devnet.helius-rpc.com/?api-key=<your-key>

Running Out of SOL

Check your balance before deploying:

solana balance <your-keypair-pubkey> --url devnet

Need more devnet SOL? Request an airdrop:

solana airdrop 2 <your-keypair-pubkey> --url devnet

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:

  1. Update your client code to connect to the deployed program

  2. Initialize all your computation definitions

  3. Run end-to-end tests with real encrypted computations

  4. Monitor performance and adjust mempool size if needed

If you run into any issues or have questions, don't hesitate to reach out on Discord!

Last updated