Skip to main content

Deploy a Contract

caution

Make sure you are using a test / throwaway wallet, to be safe. Don't ever reveal the private key of your main wallet!

This guide will help you deploy a smart contract to MXC (Wannsee testnet) using Foundry.

Prerequisites

Steps

Create a project with Foundry

To scafold a new foundry run:

forge init hello_foundry && cd hello_foundry

Deploy the contract

Replace YOUR_PRIVATE_KEY below with your private key which has some Test MXC Token on MXC Wannsee testnet.

Deploy the contract located at src/Counter.sol.

Note: The --legacy flag is needed because EIP-1559 is currently disabled on MXC, it will be re-enabled in the future.

forge create --legacy --rpc-url https://wannsee-rpc.mxc.com --private-key YOUR_PRIVATE_KEY src/Counter.sol:Counter
info

Deploy using Remix IDE if you get an error -> Error: (code: -32000, message: contract creation code storage out of gas, data: None)!

View your contract

Paste the address from the output into the MXC Wannsee block explorer and verify that the contract was deployed.