{"id":28472106,"url":"https://github.com/filecoin-project/fevm-hardhat-kit","last_synced_at":"2025-07-02T00:31:03.339Z","repository":{"id":63428426,"uuid":"551190059","full_name":"filecoin-project/fevm-hardhat-kit","owner":"filecoin-project","description":"A starter hardhat project for developing, deploying, and testing Solidity smart contracts on the FEVM (Ethereum Virtual Machine on Filecoin)","archived":false,"fork":false,"pushed_at":"2025-01-30T02:35:42.000Z","size":1851,"stargazers_count":187,"open_issues_count":8,"forks_count":89,"subscribers_count":17,"default_branch":"main","last_synced_at":"2025-06-07T11:10:03.061Z","etag":null,"topics":["filecoin","hardhat","javascript","solidity"],"latest_commit_sha":null,"homepage":"","language":"Solidity","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/filecoin-project.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-10-14T01:23:04.000Z","updated_at":"2025-03-28T07:15:51.000Z","dependencies_parsed_at":"2023-11-30T01:33:47.981Z","dependency_job_id":"3fc9b54e-8433-4ced-a23a-8fa890dc2282","html_url":"https://github.com/filecoin-project/fevm-hardhat-kit","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"purl":"pkg:github/filecoin-project/fevm-hardhat-kit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filecoin-project%2Ffevm-hardhat-kit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filecoin-project%2Ffevm-hardhat-kit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filecoin-project%2Ffevm-hardhat-kit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filecoin-project%2Ffevm-hardhat-kit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/filecoin-project","download_url":"https://codeload.github.com/filecoin-project/fevm-hardhat-kit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/filecoin-project%2Ffevm-hardhat-kit/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263055896,"owners_count":23406789,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["filecoin","hardhat","javascript","solidity"],"created_at":"2025-06-07T11:10:04.001Z","updated_at":"2025-07-02T00:31:03.306Z","avatar_url":"https://github.com/filecoin-project.png","language":"Solidity","funding_links":[],"categories":[],"sub_categories":[],"readme":"# FEVM Hardhat Kit\n\n## Cloning the Repo\n\nOpen up your terminal (or command prompt) and navigate to a directory you would like to store this code on. Once there type in the following command:\n\n\n```\ngit clone --recurse-submodules https://github.com/filecoin-project/fevm-hardhat-kit.git\ncd fevm-hardhat-kit\nyarn install\n```\n\n\nThis will clone the hardhat kit onto your computer, switch directories into the newly installed kit, and install the dependencies the kit needs to work.\n\n\n## Get a Private Key\n\nYou can get a private key from a wallet provider [such as Metamask](https://support.metamask.io/configure/accounts/how-to-export-an-accounts-private-key/).\n\n\n## Add your Private Key as an Environment Variable\n\nAdd your private key as an environment variable by running this command:\n\n ```\nexport PRIVATE_KEY='abcdef'\n```\n\nIf you use a .env file, don't commit and push any changes to .env files that may contain sensitive information, such as a private key! If this information reaches a public GitHub repository, someone can use it to check if you have any Mainnet funds in that wallet address, and steal them!\n\n\n## Get the Deployer Address\n\nRun this command:\n```\nyarn hardhat get-address\n```\n\nThis will show you the ethereum-style address associated with that private key and the filecoin-style f4 address (also known as t4 address on testnets)! The Ethereum address can now be exclusively used for almost all FEVM tools, including the faucet.\n\n\n## Fund the Deployer Address\n\nGo to the [Calibrationnet testnet faucet](https://faucet.calibration.fildev.network/), and paste in the Ethereum address from the previous step. This will send some calibration testnet FIL to the account.\n\n\n## Deploy the Contracts\n\nCurrently there are 3 main types of contracts:\n\n* Basic Solidity Examples: Simple contracts to show off basic solidity\n\n* Filecoin API Examples: Contracts that demo how to use the Filecoin APIs in Solidity to access storage deals and other Filecoin specific functions.\n\n* Basic Deal Client: A contract that demos how to create Filecoin storage deals within Solidity smart contracts. See below to learn more.\n\n\nType in the following command in the terminal to deploy all contracts:\n\n ```\nyarn hardhat deploy\n```\n\nThis will compile all the contracts in the contracts folder and deploy them to the Calibrationnet test network automatically!\n\nKeep note of the deployed contract addresses for the next step.\n\n## Interact with the Contracts\n\nYou can interact with contracts via hardhat tasks, found in the 'tasks' folder. For example, to interact with the SimpleCoin contract:\n\nType in the following command in the terminal:\n\n ```\nyarn hardhat get-balance --contract 'THE DEPLOYED CONTRACT ADDRESS HERE' --account 'YOUR ETHEREUM ADDRESS HERE'\n```\n\nThe console should read that your account has 12000 SimpleCoin!\n\n## Filecoin APIs\n\nThe primary advantage of the FEVM over other EVM based chains is the ability to access and program around Filecoin storage deals. This can be done in the FEVM via the [Filecoin.sol library maintained by Zondax](https://github.com/Zondax/filecoin-solidity). **Note this library is currently in BETA**. It is unaudited, and the APIs will likely be changing with time. This repo will be updated as soon as possible when a breaking change occurs.\n\nThe library is included in this kit as an NPM package and will automatically be downloaded when you perform the `yarn` command (don't confuse these with the included mocks)!\n\nCurrently you will find a getter contract that calls the getter methods on the MarketAPI to get storage deal data and store that data. To do this you will need *dealIDs* which you can [find here on FilFox](https://calibration.filfox.info/en/deal).\n\nAs an example to store most of the data available for a deal run the store-all command with a specified dealID. Below is an example of using this command below with a deal on Calibrationnet testnet with a dealID of 707.\n\n```\nyarn hardhat store-all --contract \"DEPLOYED FILECOIN_MARKET_CONSUMER CONTRACT ADDRESS HERE\" --dealid \"707\"\n```\n\n### Preparing Data for Storage\n\nBefore storing a file with a storage provider, it needs to be prepared by turning it into a .car file and the metadata must be recorded. To do this, the hardhat kit has a [tool submodule](https://github.com/filecoin-project/fevm-hardhat-kit/tree/main/tools), written in the language Go, which can do this for you. You can also use the [FVM Data Depot website](https://data.lighthouse.storage/) will automatically convert files to the .car format, output all the necessary metadata, and act as an HTTP retrieval point for the storage providers.\n\n### Client Contract - Making Storage Deals in Solidity\n\nUnder contracts, within the `basic-deal-client` sub-directory, you will find a file called `DealClient.sol`. This is an example contract that uses the Filecoin.sol API's to create storage deals via Solidity smart contracts on Filecoin. This works by emitting a Solidity event that [Boost storage providers](https://boost.filecoin.io/) can listen to. To learn more about this contract feel free to [checkout the app kit repo](https://github.com/filecoin-project/fvm-starter-kit-deal-making) which includes a detailed readme and a frontend.\n\n### Bounty Contract\n\nUnder contracts, within the `filecoin-api-examples` sub-directory, you will find a file called `deal-rewarder.sol`. This is a basic example contract that uses the Filecoin.sol API's to create bounties for specific data to be stored on the Filecoin blockchain. This is intended to be an example to illustrate how you can use the Filecoin APIs to do some cool functionality. To learn more about this contract feel free to [checkout the original Foundry project](https://github.com/lotus-web3/deal-bounty-contract) which includes a detailed readme.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilecoin-project%2Ffevm-hardhat-kit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffilecoin-project%2Ffevm-hardhat-kit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffilecoin-project%2Ffevm-hardhat-kit/lists"}