• Stars
    star
    183
  • Rank 208,826 (Top 5 %)
  • Language
    Solidity
  • License
    MIT License
  • Created almost 2 years ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A starter hardhat project for developing, deploying, and testing Solidity smart contracts on the FEVM (Ethereum Virtual Machine on Filecoin)

FEVM Hardhat Kit

Cloning the Repo

Open 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:

git clone --recurse-submodules https://github.com/filecoin-project/fevm-hardhat-kit.git
cd fevm-hardhat-kit
yarn install

This will clone the hardhat kit onto your computer, switch directories into the newly installed kit, and install the dependencies the kit needs to work.

Get a Private Key

You can get a private key from a wallet provider such as Metamask.

Add your Private Key as an Environment Variable

Add your private key as an environment variable by running this command:

export PRIVATE_KEY='abcdef'

If 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!

Get the Deployer Address

Run this command:

yarn hardhat get-address

This 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.

Fund the Deployer Address

Go to the Calibrationnet testnet faucet, and paste in the Ethereum address from the previous step. This will send some calibration testnet FIL to the account.

Deploy the Contracts

Currently there are 3 main types of contracts:

  • Basic Solidity Examples: Simple contracts to show off basic solidity

  • Filecoin API Examples: Contracts that demo how to use the Filecoin APIs in Solidity to access storage deals and other Filecoin specific functions.

  • Basic Deal Client: A contract that demos how to create Filecoin storage deals within Solidity smart contracts. See below to learn more.

Type in the following command in the terminal to deploy all contracts:

yarn hardhat deploy

This will compile all the contracts in the contracts folder and deploy them to the Calibrationnet test network automatically!

Keep note of the deployed contract addresses for the next step.

Interact with the Contracts

You can interact with contracts via hardhat tasks, found in the 'tasks' folder. For example, to interact with the SimpleCoin contract:

Type in the following command in the terminal:

yarn hardhat get-balance --contract 'THE DEPLOYED CONTRACT ADDRESS HERE' --account 'YOUR ETHEREUM ADDRESS HERE'

The console should read that your account has 12000 SimpleCoin!

Filecoin APIs

The 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. 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.

The 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)!

Currently 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.

As 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.

yarn hardhat store-all --contract "DEPLOYED FILECOIN_MARKET_CONSUMER CONTRACT ADDRESS HERE" --dealid "707"

Preparing Data for Storage

Before 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, written in the language Go, which can do this for you. You can also use the FVM Data Depot website will automatically convert files to the .car format, output all the necessary metadata, and act as an HTTP retrieval point for the storage providers.

Client Contract - Making Storage Deals in Solidity

Under 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 can listen to. To learn more about this contract feel free to checkout the app kit repo which includes a detailed readme and a frontend.

Bounty Contract

Under 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 which includes a detailed readme.

More Repositories

1

lotus

Reference implementation of the Filecoin protocol, written in Go
Go
2,663
star
2

venus

Filecoin Full Node Implementation in Go
Go
2,054
star
3

slate

WIP - We're building the place you go to discover, share, and sell files on the web.
JavaScript
526
star
4

rust-fil-proofs

Proofs for Filecoin in Rust
Rust
487
star
5

community

Filecoin community and ecosystem channels, discussion forums, and more
474
star
6

community-china

Resources and forum for the Chinese community, maintained and moderated by CoinSummer & PL.
C
436
star
7

ref-fvm

Reference implementation of the Filecoin Virtual Machine
Rust
378
star
8

devgrants

๐Ÿ‘Ÿ Apply for a Filecoin devgrant. Help build the Filecoin ecosystem!
371
star
9

specs

The Filecoin protocol specification
SCSS
368
star
10

FIPs

The Filecoin Improvement Proposal repository
Jupyter Notebook
288
star
11

filecoin-docs

Filecoin Docs
Shell
218
star
12

fvm-specs

home of the FVM (Filecoin Virtual Machine) project โš™๏ธ
168
star
13

cpp-filecoin

C++17 implementation of Filecoin
C++
126
star
14

neptune

Rust Poseidon implementation.
Rust
125
star
15

notary-governance

114
star
16

filecoin-plus-large-datasets

Hub for client applications for DataCap at a large scale
110
star
17

boost

Boost is a tool for Filecoin storage providers to manage data storage and retrievals on Filecoin.
Go
110
star
18

lassie

A minimal universal retrieval client library for IPFS and Filecoin
Go
106
star
19

filecoin-ffi

C and CGO bindings for Filecoin's Rust libraries
Rust
94
star
20

specs-actors

DEPRECATED Specification of builtin actors, in the form of executable code.
Go
86
star
21

filecoin-plus-client-onboarding

80
star
22

builtin-actors

The Filecoin built-in actors
Rust
78
star
23

go-fil-markets

Shared Implementation of Storage and Retrieval Markets for Filecoin Node Implementations
Go
78
star
24

research

Home for Filecoin Research
74
star
25

go-jsonrpc

Low Boilerplate JSON-RPC 2.0 library
Go
74
star
26

bls-signatures

BLS Signatures in Rust
Rust
72
star
27

ec-gpu

OpenCL code generator for finite-field arithmetic over arbitrary prime fields
Rust
69
star
28

rust-gpu-tools

Rust tools for OpenCL and GPU management.
Rust
66
star
29

replication-game

Compete on the fastest replication algorithm
Rust
59
star
30

slingshot

Official repository for Filecoin's Space Race 2: Slingshot
58
star
31

filecoin

GitHub home for the Filecoin Project
52
star
32

starling

Demo storage client for archival video data
JavaScript
51
star
33

venus-docs

Content for Venus tutorial
Shell
49
star
34

lily

capturing on-chain state for the filecoin network
Go
48
star
35

rust-filecoin-proofs-api

Rust
43
star
36

consensus

Filecoin consensus work
Python
42
star
37

blstrs

Rust
40
star
38

mir

Go
40
star
39

go-data-transfer

Data Transfer Shared Component for go-filecoin & go-lotus
Go
39
star
40

dagstore

a sharded store to hold large IPLD graphs efficiently, packaged as location-transparent attachable CAR files, with mechanical sympathy
Go
39
star
41

merkletree

_merkle_ is a lightweight Rust implementation of a Merkle tree, external dependencies agnostic, std::hash compatible with efficient memory layout
Rust
37
star
42

storetheindex

A storethehash based directory of CIDs
Go
36
star
43

fvm-starter-kit-deal-making

Full dapp starter kit for automating Filecoin deal making
JavaScript
36
star
44

go-statemachine

Go
34
star
45

dealbot

๐Ÿค–๐Ÿค A bot for making deals
Go
32
star
46

benchmarks

A place for community-submitted Filecoin benchmarks
JavaScript
32
star
47

core-devs

Technical Project Management: Meeting notes and agenda items
32
star
48

lotus-docs

Documentation for Lotus
HTML
29
star
49

fevm-data-dao-kit

A kit to demonstrate the basics of getting a DataDAO up and running on the Filecoin Virtual Machine (FVM).
JavaScript
29
star
50

go-hamt-ipld

An implementation of a HAMT using ipld
Go
28
star
51

sentinel

Filecoin Network monitoring and analysis tools.
27
star
52

filecoin-explorer

Filecoin block explorer
JavaScript
26
star
53

motion

๐Ÿ๏ธ Accelerating Data onto FileCoin
Go
25
star
54

rust-fil-nse-gpu

Rust interface to GPU implementation of Filecoin's Narrow Stacked Expander (NSE) sealing algorithm
Rust
24
star
55

testnet-hyperspace

Meta info about the developer-focused Hyperspace testnet for Filecoin developers
24
star
56

sector-storage

A concrete implementation of the specs-storage interface
Go
24
star
57

fevm-foundry-kit

A starter foundry project for developing, deploying, and testing Solidity smart contracts on the FEVM (Ethereum Virtual Machine on Filecoin)
Solidity
23
star
58

testnet-wallaby

Meta info about the Wallaby testnet for FVM developers
20
star
59

go-legs

Does the legwork for go-data-transfer
Go
20
star
60

filecoin-client-tutorial

Store data on the Filecoin Network in under 5 minutes.
JavaScript
20
star
61

go-leb128

LEB128 integer encoding
Go
20
star
62

awesome-filecoin

Curated list of useful resources for Filecoin
19
star
63

venus-wallet

a remote wallet for provider sign service
Go
19
star
64

eudico

lotus, but also other things
Go
19
star
65

go-state-types

Primitive and low level types used in chain state and actor method parameters
Go
19
star
66

designdocs

Docs that capture the design intent for important components
18
star
67

neptune-triton

Futhark implementation of neptune-compatible Poseidon.
C
18
star
68

orient

โ†ปObserve-Orient-Decide-Actโ†ฉ
Common Lisp
18
star
69

test-vectors

๐Ÿ’Ž VM and Chain test vectors for Filecoin implementations
Go
18
star
70

filecoin-solidity

Filecoin Solidity API Library
Solidity
17
star
71

go-address

Go
17
star
72

venus-sealer

Go
17
star
73

filsnap

MetaMask snap for interacting with Filecoin dapps.
TypeScript
16
star
74

data-prep-tools

Python
16
star
75

fvm-evm

EVM runtime for the Filecoin Virtual Machine
Rust
15
star
76

actors-utils

Collection of libraries to implement common patterns and standards on the Filecoin Virtual Machine
Rust
15
star
77

filecoin-network-viz

Filecoin Network Visualization Frontend
JavaScript
14
star
78

rust-fil-sector-builder

Rust
13
star
79

fvm-docs

Documentation and website build scripts for the Filecoin Virtual Machine (FVM) project.
HTML
12
star
80

chain-validation

(DEPRECATED) See https://github.com/filecoin-project/test-vectors instead. (was: chain validation tools)
Go
11
star
81

fvm-runtime-experiment

Rust
11
star
82

fungi

A distributed task runner
Go
11
star
83

filecoin-fvm-localnet

A complete filecoin lotus and boost docker image to spin up a localnet for smart contract development
Shell
11
star
84

go-dagaggregator-unixfs

Go
10
star
85

go-fil-commp-hashhash

A hash.Hash implementation of fil-commitment-unsealed
Go
10
star
86

statediff

State Inspector ๐Ÿ•ต๏ธโ€
Go
10
star
87

lua-filecoin

Prototype of Filecoin in Lua
Lua
10
star
88

go-amt-ipld

Implementation of an array mapped trie using go and ipld
Go
9
star
89

fil-blst

Assembly
9
star
90

go-sectorbuilder

Go
8
star
91

sp-automation

Jinja
8
star
92

oni

๐Ÿ‘น (DEPRECATED; see README) Project Oni | Network Validation
Go
7
star
93

helm-charts

Smarty
7
star
94

boost-docs

Documentation for Boost
7
star
95

slate-react-system

A component, constants, and experience library for the Filecoin Network / Textile Services
7
star
96

go-storage-miner

A Filecoin storage miner
Go
7
star
97

system-test-matrix

The Filecoin System Test Matrix is a dashboard with a detailed list of Filecoin features and behaviors and a mapping between those features and test suites, systems and subsystems that those features are related to.
TypeScript
7
star
98

go-data-segment

Go
6
star
99

raas-starter-kit

JavaScript
6
star
100

go-f3

Golang implementation of Fast Finality in Filecoin (F3)
Go
6
star