Filecoin Docs
BasicsStorage providersNodesNetworksSmart contractsReference
  • Welcome to Filecoin Docs
  • Basics
    • What is Filecoin
      • Crypto-economics
      • Blockchain
      • Storage model
      • Storage market
      • Retrieval market
      • Programming on Filecoin
      • Networks
    • The blockchain
      • Actors
      • Addresses
      • Blocks and tipsets
      • Consensus
      • Drand
      • Proofs
    • Assets
      • The FIL token
      • Wallets
      • Metamask setup
      • Get FIL
      • Transfer FIL
    • Interplanetary consensus
    • How storage works
      • Filecoin plus
      • Storage onramps
      • Filecoin and IPFS
    • How retrieval works
      • Basic retrieval
      • Serving retrievals
      • Saturn
    • Project and community
      • Forums and FIPs
      • Filecoin compared to
      • Filecoin FAQs
      • Related projects
      • Social media
      • The Filecoin project
      • Ways to contribute
  • Storage providers
    • Basics
      • Quickstart guide
    • Filecoin economics
      • Storage proving
      • FIL collateral
      • Block rewards
      • Slashing
      • Committed capacity
    • Filecoin deals
      • Storage deals
      • Verified deals
      • Filecoin programs and tools
      • Snap deals
      • Charging for data
      • Auxiliary services
      • Return-on-investment
    • Architecture
      • Software components
      • Storage provider automation
      • Sealing pipeline
      • Sealing rate
      • Sealing-as-a-service
      • Network indexer
    • Infrastructure
      • Storage
      • Network
      • Backup and disaster recovery
      • Reference architectures
    • Skills
      • Linux
      • Network
      • Security
      • Storage
      • Sales
      • Industry
    • PDP
      • Prerequisites
      • Install & Run Lotus
      • Install & Run YugabyteDB
      • Install & Run Curio
      • Enable PDP
      • Use PDP
  • Nodes
    • Implementations
      • Lotus
      • Venus
    • Full-nodes
      • Pre-requisites
      • Basic setup
      • Node providers
    • Lite-nodes
      • Spin up a lite-node
  • Smart contracts
    • Fundamentals
      • The Filecoin Virtual Machine
      • Filecoin EVM runtime
      • ERC-20 quickstart
      • Roadmap
      • Support
      • FAQs
    • Filecoin EVM-runtime
      • Actor types
      • Address types
      • FILForwarder
      • Difference with Ethereum
      • How gas works
      • Precompiles
    • Programmatic storage
      • Aggregated deal-making
      • Direct deal-making
      • Cross-Chain Data Bridge(CCDB)
      • Data replication, renewal and repair (RaaS)
      • RaaS interfaces
    • Developing contracts
      • Get test tokens
      • Remix
      • Hardhat
      • Foundry
      • Solidity libraries
      • Call built-in actors
      • Filecoin.sol
      • Direct deal-making with Client contract
      • Using RaaS
      • Verify a contract
      • Best practices
    • Advanced
      • Wrapped FIL
      • Oracles
      • Multicall
      • Multisig
      • FEVM Indexers
      • Cross-chain bridges
      • Aggregated deal-making
      • Contract automation
      • Relay
  • Networks
    • Mainnet
      • Explorers
      • RPCs
      • Network performance
    • Calibration
      • Explorers
      • RPCs
    • Local testnet
      • Get test tokens
    • Deprecated networks
  • Reference
    • General
      • Glossary
      • Specifications
      • Tools
    • Exchanges
      • Exchange integration
    • Built-in actors
      • Protocol API
      • Filecoin.sol
    • JSON-RPC
      • Auth
      • Chain
      • Client
      • Create
      • Eth
      • Gas
      • I
      • Log
      • Market
      • Miner
      • Mpool
      • Msig
      • Net
      • Node
      • Paych
      • Raft
      • Start
      • State
      • Sync
      • Wallet
      • Web3
  • Builder Cookbook
    • Overview
    • Table of Contents
    • Data Storage
      • Store Data
      • Retrieve Data
      • Privacy & Access Control
    • dApps
      • Chain-Data Query
      • Oracles
      • Cross-Chain Bridges
      • Decentralized Database
Powered by GitBook
LogoLogo

Basics

  • Overview
  • Crypto-economics
  • Storage model
  • Reference

Developers

  • The FVM
  • EVM-runtime
  • Quickstart
  • Transfer FIL

Contact

  • GitHub
  • Slack
  • Twitter
On this page
  • The problem
  • The solution
  • Use FILForwarder
  • Glif.io
  • Manually

Was this helpful?

Edit on GitHub
Export as PDF
  1. Smart contracts
  2. Filecoin EVM-runtime

FILForwarder

The FilForwarder is a smart contract that lets users transfer FIL from an Ethereum-based f4 address to a Filecoin address of a different type.

PreviousAddress typesNextDifference with Ethereum

Last updated 2 months ago

Was this helpful?

The problem

Filecoin has multiple : f0, f1, f2, f3, and f4. Each address space fits a particular need for the Filecoin network. The f410 address spaces allow Ethereum addresses to be integrated into the Filecoin network.

Users interacting with the Filecoin EVM runtime need to use f4 addresses, masked to the Ethereum-style 0x address. These addresses can be created from wallets like MetaMask, Coinbase wallet, or any other EVM-based wallet that allows for custom networks. There are use cases where a user with FIL in an 0x-style address would want to send FIL to an f1, f2, or f3 address. For example, taking FIL out of a smart contract and sending it to a multi-sig account or an exchange.

This is where the problem lies. Ethereum-based wallets do not recognize the f1, f2, or f3 address formats, making it impossible to send FIL from an Ethereum-style address.

The solution

The FilForwarder exposes a smart contract method called forward that takes a byte-level definition of a protocol address in an f-style and a message value. It then uses the internal Filecoin APIs exposed using the Filecoin EVM runtime to properly send FIL funds reliably and as cheaply as possible. This also has the side effect of creating the actor ID should the address receiving address be considered new. In this way, using FilForwarder from an Ethereum wallet to any other Filecoin address space is safe and reliable.

Use FILForwarder

You can use the FilForwarder contract in two ways:

  • Using the Glif.io browser wallet

  • Manually invoking the contract

Glif.io

Before we start, make sure you know the address you’d like to forward your FIL to. You’ll need to ensure that the f410 Ethereum-style address has enough FIL to cover the transaction costs.

  1. Go to .

  2. Select the network you want to use from the dropdown and click Connect Wallet.

    In this example, we’re using the (now deprecated) Hyperspace testnet.

  3. Confirm that you want to connect your wallet to Glif.io. You will only be prompted to do this once.

  4. Click Close on the connection confirmation screen.

  5. Select your wallet address from the dropdown and click Forward FIL.

  6. Enter the destination address for your FIL, along with the amount of FIL you want to send:

  7. Double-check that your destination address is correct and click Send.

  8. You can check the transaction by clicking the transaction ID.

  9. Your funds should be available at the destination after around two minutes. You can check that your funds have arrived by searching for the destination address in a block explorer.

  10. If you can’t see your funds, make sure you’re viewing the correct network.

It generally takes around two minutes for a transaction to complete and for the funds to be available at the destination.

Manually

Prerequisites

This guide assumes you have the following installed:

Environment setup

First, we need to grab the FilForwarder kit and install the dependencies:

  1. Clone the FilForwarder repository and install the dependencies:

git clone [https://github.com/FilOzone/FilForwarder](https://github.com/FilOzone/FilForwarder)
cd FilForwarder
  1. Use Yarn to install the project's dependencies:

yarn install
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...

...

✨  Done in 16.34s.
  1. Create an environment variable for your private key.

export PRIVATE_KEY='<YOUR PRIVATE KEY>'

# For example
# export PRIVATE_KEY='d52cd65a5746ae71cf3d07a8cf392ca29d7acb96deba7d94b19a9cf3c9f63022'l

Always be careful when dealing with your private key. Double-check that you’re not hardcoding it anywhere or committing it to source control like GitHub. Anyone with access to your private key has complete control over your funds.

Invoke the contract

Inside this repository is a Hardhat task called forward. This task will use the private key to send funds using the contract. This task uses the fil-forwarder-{CHAIN_ID}.json file to determine the deployed contract address for a given network. These addresses should always be the same, but these files prevent you from having to specify it each time.

The forward command uses the following syntax:

yarn hardhat forward \
    --network <NETWORK> \
    --destination <DESTINATION_ADDRESS> \
    --amount <AMOUNT>
  • NETWORK: The network you want to use. The options are mainnet and calibration.

  • DESTINATION_ADDRESS: The address you want to send FIL to. This is a string, like t01024 or t3tejq3lb3szsq7spvttqohsfpsju2jof2dbive2qujgz2idqaj2etuolzgbmro3owsmpuebmoghwxgt6ricvq.

  • AMOUNT: The amount of FIL you want to send. The value 3.141 would be 3.141 FIL.

Examples

  1. To send 9 FIL to a t3 address on the Calibration testnet, run:

yarn hardhat forward \
    --network calibration \
    --destination t3tejq3lb3szsq7spvttqohsfpsju2jof2dbive2qujgz2idqaj2etuolzgbmro3owsmpuebmoghwxgt6ricvq \
    --amount 9.0
  1. To send 42.5 FIL to a t1 address on the Calibration testnet, run:

yarn hardhat forward \
    --network calibration \
    --destination t010135 \
    --amount 42.5

The FilForwarder contract can be interacted with using standard Ethereum tooling like Hardhat or Remix. In this guide, we’re going to use Hardhat, but these steps can be easily replicated using the .

A Filecoin address stored in

The contract is deterministically deployed on all Filecoin networks at 0x2b3ef6906429b580b7b2080de5ca893bc282c225. Any contract claiming to be a FilForwarder that does not reside at this address should not be trusted. Any dApp can connect to the wallet and use the ABI in this repository to call this method using any frontend. See the above for steps on using a GUI.

web-based IDE Remix
Yarn
MetaMask
Glif section
Was this page helpful?
address spaces
Glif.io
Select the network you want to use.
Choose a wallet provider.
Wallet successfully connected to Glif
Select FIL Forward
Enter a destination address and an amount.
Check your transaction by clicking the ID.
Funds in a block explorer.
Change network within a block explorer.