In this quickstart tutorial we’ll walk through how to deploy your first smart-contract to the Filecoin network. We’re going to install a browser-based wallet called Metamask, create a new wallet address, supply some test currency to that wallet, and then use a browser-based development environment called Remix to deploy a smart contract to the Filecoin network.

We’re going to be creating an ERC-20 token in this quickstart. The ERC-20 contract is used a lot in representing a massive array of tokens across multiple blockchains, primarily the Ethereum blockchain.

Accounts and assets

We’re going to be using MetaMask, a cryptocurrency wallet that lives in your browser making it very easy for users to interact with web3-based sites!

Create a wallet

Before we can interact with the Filecoin network, we need funds. But before we can get any funds, we need somewhere to put them!

  1. Open your browser and visit the MetaMask website.

  2. Install the wallet by clicking the Download for button. MetaMask is available for Brave, Chrome, Edge, Firefox, and Opera.

  3. Once you have installed MetaMask, it will open a Get started window.

    Get started with MetaMask.

  4. Follow the prompts until you MetaMask asks if you are New to MetaMask.

  5. Because you still need an account on the Filecoin network, select Create a wallet.

    Create a wallet in MetaMask.

  6. Enter a secure password. You will use this password every time you want to open this wallet in this browser.

  7. Click Next until you get to the Secret Recovery Phrase window. Read the information about what this recovery phrase is on this page.

  8. Once you’ve followed the instructions and saved your recovery phrase, click Next.

  9. Confirm that you saved the recovery phrase correctly by clicking on the words in order.

  10. Once you’ve done that, you should have your account set up!

Switch networks

You may notice that we are currently connected to the Ethereum Mainnet. We need to point MetaMask to the Filecoin network, specifically the [Hyperspace testnet]({« reref “available-networks#hyerspace” >}}). We’ll use a website called chainlist.org to give MetaMask the information it needs quickly.

  1. Go to chainlist.org.
  2. Enable the Testnets toggle and enter Filecoin into the search bar.
  3. Scroll down to find the Filecoin – Hyperspace testnet:
  4. In MetaMask click Next and then Continue when prompted to connect Chainlist.org to MetaMask:
  5. Back on the Chainlist.org page, click the Filecoin – Hyperspace testnet connect button again.
  6. In MetaMask click Approve when prompted to Allow this site to add a network:
  7. Click Switch network when prompted by MetaMask:
  8. Open MetaMask, and you should see that you’re now on the Filecoin Hyperspace testnet: Nice! Now we’ve got the Filecoin Hyperspace testnet set up within MetaMask. You’ll notice that our MetaMask window shows 0 TFIL. Test-filecoin (TFIL) is FIL that has no value in the real world, and developers use it for testing. We’ll grab some TFIL next.

Get some funds

  1. Open your browser and open MetaMask.
  2. Click your account to copy the address to your clipboard:
  3. Go to hyperspace.yoga and scrolldown to the Faucet section.
  4. Paste your address into the address field, complete the I am human captcha, and then click Send:
  5. The faucet should give you a link to the transaction. Click it to view your transaction:
  6. The block explorer will show you the transaction history for your address. After a couple of minutes, you should see 5 tFIL transferred to your address.
  7. Open MetaMask to confirm that you received the tFIL:

That’s all there is to it! Getting tFil is easy!

Contract creation

The development environment we’re going to be using is called Remix, viewable at remix.ethereum.org. Remix is an incredibly sophisticated tool, and there’s a lot you can play around with! In this tutorial however, we’re going to stick to the very basics. If you want to learn more, check out the Remix documentation.

Create a workspace

In Remix, workspaces are siloed environments where you can create a contract, or group of contracts, for each project. Let’s create a new workspace to create our new ERC-20 token.

  1. Open remix.ethereum.org.

  2. Click the + icon next to Workspaces to create a new workspace:

    Create a new Remix workspace.

  3. In the Choose a template dropdown, select ERC 20.

  4. Select the Mintable checkbox.

  5. Enter a fun name for your token in the Workspace name field. Something like CorgiCoin works fine.

    Name your workspace in Remix.

  6. Click OK to create your new workspace.

Customize the contract

The contract template we’re using is pretty simple; we just need to modify a couple of variables.

  1. Under the contract directory, click MyToken.sol.

  2. In the editor panel, replace MyToken with whatever you’d like to name your token. In this example, we’ll use CorgiCoin.

  3. On the same line, replace the second string with whatever you want the symbol of your token to be. In this example, we’ll use CRG.

    Edit your contract in Remix.

That’s all we need to change within this contract. You can see on line 4 that this contract is importing another contract from @openzeppelin for us, meaning that we can keep our custom token contract simple.


  1. Click the green play symbol at the top of the workspace to compile your contract. You can also press CMD + s on MacOS or CTRL + s on Linux and Windows.
  2. Remix automatically fetches the two import contracts from the top of our .sol contract. You can see these imported contracts under the .deps directory. You can browse the contracts there, but Remix will not save any changes you make.

Remix showing imported contracts.


Now that we’ve successfully compiled our contract, we need to deploy it somewhere! This is where our previous MetaMask setup comes into play.

  1. Click the Deploy tab from the left.

    Click deploy within Remix.

  2. Under the Environment dropdown, select Injected Provider - MetaMask.

    Select the proper network within Remix.

  3. MetaMask will open a new window confirming that you want to connect your account to Remix.

  4. Click Next and then Connect to connect your tFIL account to Remix.

  5. Back in Remix, under the Account field, you’ll see that it says something like 0x5A5... (5000 ether). This value is 5000 tFIL, but Remix doesn’t natively support the Filecoin network and thus doesn’t understand what tFIL is. This isn’t a problem; it’s just a little quirk of using Remix.

    Remix showing 5000 tFil.

  6. Under the Contract dropdown, ensure the contract you created is selected.

    Select your contract in Remix.

  7. Click Deploy.

    Remix showing the deploy button.

  8. MetaMask will open a window and as you to confirm the transaction. Scroll down and click Confirm to have MetaMask deploy the contract.

  9. Back in Remix, a message at the bottom of the screen shows that the creation of your token is pending.

    A pending transaction in Remix.

  10. Wait around 90 seconds for the deployment to complete.

On the Filecoin network, a new set of blocks, also called a tipset, is created every thirty seconds. When deploying a contract, the transaction needs to be received by the network, and then the network needs to confirm the contract. This process takes around one to two tipsets to process – or around 60 to 90 seconds.

Use your contract

Now that we’ve compiled and deployed the contract, it’s time to actually interact with it!

Mint your tokens

Let’s call a method within the deployed contract to mint some tokens.

  1. Back in Remix, open the Deployed Contracts dropdown, within the Deploy sidebar tab.

    Remix showing my deployed contracts.

  2. Expand the mint method. You must fill in two fields here: to and amount.

    Remix showing the mint method of a contract.

  3. The to field specifies where address you want these initial tokens sent to. Open MetaMask, copy your address, and paste it into this field.

  4. This field expects an attoFil value. 1 FIL is equal to 1,000,000,000,000,000,000 attoFil. So if you wanted to mint 100 FIL, you would enter 100 followed by 18 zeros: 100000000000000000000.

    Enter a value into Remix.

  5. Click Transact.

    Click transact in Remix.

  6. MetaMask will open a window and ask you to confirm the transaction. Again, you must wait for the network to process the transaction, which should take about 90 seconds. You can move on to the next section while you’re waiting.

    Remix pending the minting of a contract.

Add to MetaMask

Currently, MetaMask has no idea what our token is or what it even does. We can fix this by explicitly telling MetaMask the address of our contract.

  1. Go back to Remix and open the Deploy sidebar tab.

  2. Under Deployed Contracts, you should see your contract address at the top. Click the copy icon to copy the address to your clipboard.

    Copy your contract’s deployment address.

  3. Open MetaMask, select Assets, and click Import your tokens:

  4. In the Token contract address field, paste the contract address you just copied from Remix and then click Add custom token. MetaMask should autofill the rest of the information based on what it can find from the Filecoin network.

  5. Click Import token.

  6. You should now be able to see that you have 100 of your tokens within your MetaMask wallet!

Share your tokens

Having a bunch of tokens in your personal MetaMask is nice, but why not send some tokens to a friend? Your friend needs to create a wallet in MetaMask as we did in the Create a wallet and Switch networks sections. They will also need to import your contract deployment address like you did in the Add your tokens to MetaMask section. Remember, you need to pay gas for every transaction that you make! If your friend tries to send some of your tokens to someone else but can’t, it might be because they don’t have any tFil.