Filecoin and Ethereum address mapping

This article mainly talks about the mapping relationship between filecoin addresses and Ethereum addresses, and does not involve the specific encoding details of filecoin.

Before talking about the address in detail, you need to first understand the actors of filecoin. Actors can be thought of as hard-coded filecoin contracts. Actor types include system, init, reward, cron, power, market, verifiedRegistry, datacap, eam, paych, miner, multisig, account, placeholder, ethaccount, evm

Some of them are singleton actors, currently including system, init, reward, cron, power, market, verifiedRegistry, datacap, and eam. Singleton contracts are pre-created, and these actors only have f0 addresses.

Some are multiple actors, currently including paych, miner, multisig, account, placeholder, ethaccount, and evm. Multiple instances of actors are created by users. Among them, the paych, miner, and multisig addresses start with f2, the account addresses start with f1 and f3, the placeholder and ethaccount start with f4, and the evm address is special. The evm address has both f2 and f4 addresses.

Filecoin addresses currently have 5 address types

The f0 address is the numbered address on the filecoin chain. Each multi-instance actor will be assigned a uin64 type number when it is first created on the chain. This number is the f0 address. Generally, multiple actors have unique numbers. Except evm type actor

The f1 and f3 addresses are account type addresses. The addresses are generated by the public key, and the public key contains all the information. The f1 and f3 addresses can be generated off-chain. This address will only be created on the chain after the first transfer, and an f0 address will be assigned at the same time.

f2 is the actor address of paych, miner, and multisig types. When these actors are created, an f2 address will be generated through some algorithms. These f2 addresses have corresponding f0 addresses.

The address starting with f4 currently corresponds to the Ethereum address one-to-one, and contains the complete Ethereum address information. Each Ethereum address can be directly converted into an f4 address. When transferring money to this address for the first time, a placeholder type actor is generated on the chain and an f0 address is assigned. When using an actor of placeholder type to generate a contract, the address type is converted from placeholder to ethaccount. The generated Ethereum smart contract is an actor of type evm. This actor has both f2 and f4 addresses, and these two addresses correspond to the same f0 address.

When converting an Ethereum address to a filecoin address, each Ethereum address can be directly converted to an F4 address.

When converting the filecoin address to an Ethereum address, if it is an f4 address or the f2 or f0 addresses corresponding to the f4 address, it will be converted to an Ethereum address based on the f4 address.

Other filecoin addresses unrelated to f4 are converted into Ethereum addresses based on their f0 addresses. The conversion rule is 0xff0000000000000000000000+8-digit f0 number to form a 20-digit Ethereum address.

Guess you like

Origin blog.csdn.net/u013259665/article/details/129583341