Deploy a contract
Learn how to deploy a contract to the FVM using one of many different tools and workflows.
THIS SECTION IS UNDER DEVELOPMENT
The FVM project is still in beta, as is the FVM documentation. We’re working on improving everything. Feel free to dive into the docs, but keep in mind that things will likely change pretty often.
Go to remix.ethereum.org.
Create a new Blank workspace:
Create a new file called
Write or paste your contract into the new file. When pasting, you may receive a warning about crypto scams.
Compile your contract by either pressing
s, clicking on the Save button, or by selecting the Compile tab and clicking Compile contract.sol.
Select the Deploy tab:
Select your network from the Environment tab. If you want to deploy your contract to the Wallaby testnet, follow the Add to MetaMask guide:
If everything was successful, you will see a success message at the bottom of the IDE window:
You can deploy a contract using Hardhat. We’re going to use the FEVM Hardhat Kit repository in the Filecoin Project GitHub organization to get started quickly.
You must have the following installed:
You should also have an address on the Filecoin Wallaby testnet. See the Add to MetaMask page for information on how to get an address. You also need test-FIL
tFIL in your wallet. See the Use a Faucet page for information on how to get test funds.
filecoin-project/FEVM-Hardhat-Kitrepository and move into the
git clone https://github.com/filecoin-project/FEVM-Hardhat-Kit.git cd FEVM-Hardhat-Kit
Install the project dependencies with Yarn:
Export your private key from MetaMask. See the MetaMask documentation to find out how to export your private key.
In your terminal, create an environment variable called
PRIVATE_KEYand paste in the private key from MetaMask:
contractsfolder in a contract called
SimpleCoin.sol. Deploy this contract using Hardhat:
yarn hardhat deploy
... Compiled 1 Solidity file successfully Wallet Ethereum Address: 0x119bB8b0e3C3E5A1f2b608265342E3ef52c29594 Wallet f4Address: f410fcgn3rmhdyps2d4vwbatfgqxd55jmffmunzmqczq deploying "SimpleCoin" (tx: 0x2a2c50f8e34b582845e1f1991bc16cc6202caddc726af4737e2f5a9f47739ff4)...: deployed at 0x73867E39f7492a2ee2EBECBDF9c9FbcCabe4b760 with 17522415 gas ✨ Done in 79.61s.
The deployment process should take a couple of minutes. Once the contract has been successfully deployed, Hardhat will give you a contract address you can use to interact with the contract.
You can now interact with your contract using the contract address given by Hardhat.