Deploy the current on-chain demos

The repository includes Foundry scripts for Sepolia, Ethereum, Polygon and Amoy, Docker configuration using runtime images tagged by version, and a receipt-based address importer. Use a runtime image version that matches the deployed contracts.

Application Deployed contracts
ERC-7573 keys KeyDecryptionOracle and an allowlisted DemoContract
ERC-8087 calls CallDecryptionOracle and CallDecryptionOracleRouter
Optional Amoy SHA-256 Separate key oracle and DemoContractSha256

The public key demo deliberately exposes key release for teaching. Use demonstration data. A production settlement application needs its own authorized consumer contract.

Simple workflow: oracle, then demo

The oracle script takes the network RPC and the oracle and owner private keys. It derives the addresses, deploys the proxy, and prepares the Docker configuration for the matching off-chain service. The second script deploys the demo and records its address.

The key oracles and their authorized DemoContract consumers are already deployed on all four networks. Use the Remix walkthrough to try them. The steps below are for new deployments.

1. Deploy the oracle and prepare Docker

Set RPC_URL to your network's HTTP(S) endpoint and run from the repository root:

python3 deployment/deploy-oracle.py --rpc-url "$RPC_URL" \
  --rsa-dir /PATH-TO-CONFIG/secrets

The script prompts privately for both keys and simulates the deployment. You can also use ORACLE_PRIVATE_KEY / OWNER_PRIVATE_KEY environment variables or the --oracle-key-file / --owner-key-file options. No wallet addresses need to be entered. The owner key is never saved in the runtime configuration.

Reuse the existing RSA directory containing oracle.p12 and oracle.pw. For a new oracle, omit --rsa-dir to generate these files. The default image tag is 4.0.2; use --image-tag VERSION for another compatible release. Publish the Maven release 4.0.2, then the matching Docker images for your deployed services before starting them. See Docker Build and the release instructions for publishing images from the released Maven artifacts.

Before the first broadcast, rerun with --fee-wei to change the prepared fees; the script preserves the saved keys and simulates again. Omitted fee, gas, port and finality options reuse their saved values. Once broadcasting has started, keep the original settings and use --broadcast --resume for recovery.

After reviewing the simulation:

python3 deployment/deploy-oracle.py --rpc-url "$RPC_URL" \
  --rsa-dir /PATH-TO-CONFIG/secrets --broadcast

The script updates deployment/generated/docker-compose.yml. Each service has its own application.properties, private signer/RSA files, state, contracts.env, and manifest.json under, for example, deployment/generated/sepolia/keys. Use --kind calls for the call oracle, --runtime-dir for another transferable root, or --output for a standalone service directory. Local Anvil uses local/keys or local/calls. Use separate fulfillment keys for concurrently running key and call services on the same chain.

To start a service on the deployment computer, add --start to --broadcast. This pulls and starts its Docker image; otherwise Docker is needed only on the Mac mini. Stop any previous service using the same port or fulfillment account first. Use --hash-method sha256 with the Amoy RPC for the optional SHA-256 key service.

2. Deploy the demo and update its address

python3 deployment/deploy-demo.py --deployment deployment/generated/sepolia/keys
python3 deployment/deploy-demo.py --deployment deployment/generated/sepolia/keys --broadcast

The demo address is saved in contracts.env and manifest.json; key demos are also authorized on their proxy. After starting the service in step 3 and passing the live demo checks, update only this oracle's documentation entry, preserving the other type:

python3 deployment/deploy-demo.py --deployment deployment/generated/sepolia/keys --publish

Build and publish the Maven site as usual. If a broadcast is interrupted, resume the same phase with --broadcast --resume and the same settings. Keep its output directory; do not start another deployment while the original is incomplete or pending. A mined transaction with failed status (0x0) has consumed its nonce. If key proxy creation succeeded but setup failed, --resume validates the existing proxy and retries only missing setup with fresh nonces. Failed proxy creation needs inspection before a fresh attempt. The operator guide has the details.

The script simulates first, then uses RPC gas estimates for each broadcast transaction.

3. Copy the services to the Mac mini

Repeat the deployment for the required networks and oracle types, then copy the complete generated directory. Stop any running source services before copying so their state files are copied consistently:

rsync -a deployment/generated/ user@mac-mini:~/decryption-oracle/

On the Mac mini, install and start Docker Desktop, then run:

cd ~/decryption-oracle
ORACLE_UID=$(id -u) ORACLE_GID=$(id -g) docker compose up -d --pull always

Docker pulls the configured images; no repository, Foundry, Java or Maven installation is needed there. Keep the source services stopped after the move; do not run the same deployment on both machines. The directory contains private fulfillment and RSA keys. See the operator guide for the directory layout and details.

Optional: combined four-network workflow

The env-file workflow below remains available for deploying both oracle types together.

Prepare and simulate

Follow the complete operator guide for accounts, RSA keystore preparation, signer files, permissions and recovery. Use separate key and call fulfillment accounts on each chain, and keep the RSA keystore that matches the call oracle's public key.

From the repository root, copy and edit the relevant network example:

cp deployment/networks/sepolia.env.example deployment/networks/sepolia.env
chmod 600 deployment/networks/sepolia.env
# Fill in the RPC endpoint, addresses, wallet account and public DER key path.
./deployment/deploy.sh sepolia

This compiles and simulates both scripts without sending transactions. The chain IDs are checked: Ethereum 1, Sepolia 11155111, Polygon 137, Amoy 80002.

Deploy and run

After reviewing the simulation, broadcast with the configured Foundry wallet:

./deployment/deploy.sh sepolia broadcast

Successful receipts produce deployment/generated/sepolia/contracts.env, a public manifest, and separate keys.properties / calls.properties. The importer checks the chain, receipts, fees, consumer wiring and signer/public-key agreement. Listeners start at the recorded deployment blocks and keep contract-specific state files.

Prepare the signer files, RSA files and state directories as described in the guide, then stop the previous services for this network and start the matching published images. The image publication prerequisite above also applies here:

export ORACLE_IMAGE_TAG=4.0.2
docker compose -f deployment/docker-compose.yml --profile sepolia up -d --pull always

Repeat with the amoy, ethereum and polygon profiles. The optional amoy-sha256 profile uses its own signer, oracle, demo and state directory. The guide also explains how to resume an interrupted broadcast without redeploying already completed contracts.

Test and publish addresses

Load the generated contracts.env and use the new demo addresses in the key Remix walkthrough and call Remix walkthrough. Check generation → verification → release and store → decrypt → execute against the running services. Then update the website's address registry:

python3 deployment/configure.py sepolia \
  --publish-manifest deployment/generated/sepolia/manifest.json
./mvnw -Dgpg.skip=true verify site site:stage

Repeat the import for each tested network and publish the Maven site through the usual process. Only public addresses, blocks and hash methods enter the registry. Networks without a published record display Not yet published in the key deployment table and call deployment table.