The cre contract deploy command compiles and deploys smart contracts to the blockchain.
Foundry is required to compile Solidity contracts. Install it by running:
curl -L https://foundry.paradigm.xyz | bash
foundryupcre initWhen prompted, select:
- Language:
Golang - Template:
Custom data feed: Updating on-chain data periodically using offchain API data - RPC URL: Enter your Sepolia RPC URL (e.g.,
https://ethereum-sepolia-rpc.publicnode.com)
Example:
Project name? [my-project]: my-project
✔ Golang
✔ Custom data feed: Updating on-chain data periodically using offchain API data
Sepolia RPC URL? [https://ethereum-sepolia-rpc.publicnode.com]: https://ethereum-sepolia-rpc.publicnode.com
Workflow name? [my-workflow]: my-workflow
cd my-projectEdit the .env file and add your private key:
CRE_ETH_PRIVATE_KEY=0x...your_private_key...
⚠️ Important: Never commit your private key to version control. The.envfile should be in.gitignore.
cre contract deployThe command will:
- Compile all Solidity contracts using Foundry
- Display the contracts to be deployed
- Ask for confirmation
- Deploy each contract and display the address
Example output:
Compiling contracts with Foundry...
Compiler run successful!
Contract Deployment
===================
Project Root: /path/to/my-project
Target Chain: ethereum-testnet-sepolia
Config File: /path/to/my-project/contracts/contracts.yaml
Contracts:
- BalanceReader (balance_reader): deploy
- MessageEmitter (message_emitter): deploy
- ReserveManager (reserve_manager): deploy
- IERC20 (ierc20): skip
Deploying BalanceReader...
Address: 0xf95DF418d791e8da0D12C6E88Bc4443a056A9E22
Tx Hash: 0x62815513c355be832cab16bb9840d1c26de0e074efe65441591a09b28c7e68a2
Deploying MessageEmitter...
Address: 0x63Cb753C77908cbD2Cc9A4B37B0D6DC7F5fF00a1
Tx Hash: 0x741bb347f74aaa85ae9c97bcb670de4cf2b6f638a0a14a837ff0508e6f3c0c94
Deploying ReserveManager...
Address: 0x8cFc0495AaAAF2fa6BC39eaaA5952d5027e79C88
Tx Hash: 0xb47ffb1f8d80e17852644cd0ea38d4dfed8a287a81753c6fcf13ff7867f75683
[OK] Contracts deployed successfully
Deployed addresses saved to: /path/to/my-project/contracts/deployed_contracts.yaml
cre contract deploy [flags]| Flag | Description |
|---|---|
--chain |
Override the target chain from contracts.yaml |
--dry-run |
Validate configuration without deploying |
--yes |
Skip confirmation prompt |
-v, --verbose |
Show detailed logs |
# Deploy with confirmation prompt
cre contract deploy
# Deploy without confirmation
cre contract deploy --yes
# Validate without deploying
cre contract deploy --dry-run
# Deploy to a different chain
cre contract deploy --chain ethereum-testnet-sepoliaLocated at contracts/contracts.yaml, this file defines which contracts to deploy:
chain: ethereum-testnet-sepolia
contracts:
- name: BalanceReader
package: balance_reader
deploy: true
constructor: []
- name: MessageEmitter
package: message_emitter
deploy: true
constructor: []
- name: ReserveManager
package: reserve_manager
deploy: true
constructor: []
- name: IERC20
package: ierc20
deploy: false # Skip deployment (interface only)After deployment, contract addresses are saved to contracts/deployed_contracts.yaml:
chain_id: 16015286601757825753
chain_name: ethereum-testnet-sepolia
timestamp: "2026-01-06T22:00:37Z"
contracts:
BalanceReader:
address: 0xf95DF418d791e8da0D12C6E88Bc4443a056A9E22
tx_hash: 0x62815513c355be832cab16bb9840d1c26de0e074efe65441591a09b28c7e68a2
MessageEmitter:
address: 0x63Cb753C77908cbD2Cc9A4B37B0D6DC7F5fF00a1
tx_hash: 0x741bb347f74aaa85ae9c97bcb670de4cf2b6f638a0a14a837ff0508e6f3c0c94
ReserveManager:
address: 0x8cFc0495AaAAF2fa6BC39eaaA5952d5027e79C88
tx_hash: 0xb47ffb1f8d80e17852644cd0ea38d4dfed8a287a81753c6fcf13ff7867f75683After deployment, you can reference contract addresses in your workflow configuration using placeholders:
{
"contract_address": "{{contracts.MessageEmitter.address}}"
}These placeholders are automatically replaced with actual addresses when you run cre workflow deploy.
Install Foundry:
curl -L https://foundry.paradigm.xyz | bash
foundryupEnsure your .env file contains a valid private key:
CRE_ETH_PRIVATE_KEY=0x... # Must be a valid hex stringCheck that your project.yaml has the correct RPC configuration:
rpcs:
- chain_name: ethereum-testnet-sepolia
url: https://ethereum-sepolia-rpc.publicnode.comIf contracts fail to compile, check:
- Solidity version compatibility in your
.solfiles - All imported files exist in
contracts/evm/src/ - Import paths are correct (use relative paths like
./keystone/IReceiver.sol)