Launching Full Ethereum Compatibility on Harmony
At Harmony, our roadmap in 2021 is to scale Ethereum applications and cross-chain finance. Today we’re excited to announce a critical milestone in our pursuit — full compatibility with Ethereum tools — Metamask, Web3.js, Ether.js, Truffle, Remix.
Over the past few months, we have met with many developers, organized a few hackathons, conducted community calls, followed the spectacularly exploding DeFi and NFT space — all of this to understand what are the hurdles for developers to grow and scale their applications, and what prevents millions of more users to benefit from decentralized finance, social money and digital collectibles communities powered by blockchain.
The answers and insights are rather practical. Developers and users are already familiar with the mature Ethereum ecosystem but are looking for lower fees and faster transactions. Porting assets and deploying applications to a new platform needs to be simple, it should only take from a few seconds to a few minutes. This drove us to prioritize completing a full Ethereum tool-chain support on Harmony — Developers can now easily port their applications already written using ether.js or web3.js onto Harmony. Users can use the Metamask wallet to transact their assets on Harmony, without worrying about high fees or latency.
What Ethereum compatibility already exists on Harmony?
- Harmony is fully EVM compatible, already supporting Ethereum v1.9.9 Muir Glacier.
- Ethereum-Harmony Horizon bridge, using which you can bring ETH and ERC20/HRC721 assets to Harmony and take ONE and HRC20/HRC721 assets to Ethereum, in a permissionless way. Try it out here.
- Deploy smart contracts using Truffle and Remix.
What are we launching today?
As of Epoch 442 (Thursday, February 4, 2021, ~10am PT), Harmony will support Ethereum RPC, which means we can now recognize the Ethereum transaction data structure.
What does this mean:
- Users can now connect to the Harmony network using Metamask wallet.
- Users can create accounts, send and receive transactions of native ONE or HRC20/HRC721 using Metamask.
- Users can interact with dApps written using web3/ether.js but deployed on Harmony, simply using their Metamask account.
- Developers can directly deploy dApps written using web3/ether.js on Harmony.
If you’re keen to know details about how we made this happen, here’s a technical snippet.
Harmony’s transaction data structure includes two additional fields, ‘ShardID’ and ‘ToShardID’, on top of Ethereum’s transaction structure. Metamask didn’t work with Harmony out of the box since any transaction submitted by Metamask to the Harmony nodes across shards would not have the ‘ShardID’ and ‘ToShardID’ fields and as a result be rejected.
To solve this, the core developers proposed a new logic that lets shards recognize the original Ethereum transaction data structure without ShardID and ToShardID in it. This way the original Ethereum transaction can be treated and processed as an intra-shard transaction.
Now, Harmony reserves a unique ChainID for each shard and assigns transactions to shards based on the ChainID, which can be derived from the V field of the txn signature. With this change introduced in the latest node-software, the new transaction type can be accepted and processed by the validators across shards, making Harmony fully-compatible with existing Ethereum tooling.
How to navigate between Harmony and Ethereum address format?
For each Harmony account address (‘one…’), there is a corresponding Ethereum address format (‘0x…’). You can easily find the ONE-Ethereum corresponding address pair on the Harmony Explorer, just toggle to switch between the address format.
Note: when using Metamask to send transactions on the Harmony network, you have to specify the corresponding Ethereum address format (starting with ‘0x’), instead of the ONE address ( starting with ‘one’). On the Harmony ONE wallet, you can send transactions using either the ONE or corresponding ETH (‘0x’) address format.
What can users and developers do?
Connect Metamask with Harmony. You can find detailed instructions here.
Harmony custom RPC for Shard 0 on mainnet
- Network Name: Harmony Mainnet S0
- New RPC URL: https://api.harmony.one
- Chain ID: 1666600000
- Currency symbol (optional): ONE
- Block Explorer URL (optional): https://explorer.harmony.one
After connecting Metamask with Harmony Shard 0 on mainnet, you can easily do the following:
- Import an existing Harmony account into Metamask using your private keys.
- Create a new Harmony account directly on Metamask, which can later be imported into ONE wallet, if needed.
- Receive ONE and HRC20 tokens in your Metamask account from any Harmony account.
- Send ONE and HRC20 tokens from your Metamask account to any Harmony account, using the Ethereum address format of the recipient account.
- Search for your transaction history on Harmony block explorer, using your Ethereum or Harmony address format.
We are excited to have these Ethereum compatibility layers on the Harmony stack.
Tune into our ETHDenver workshop by Ganesha Upadhyaya on Feb 7th, 12.30pm MT, who will talk about how to migrate solidity contracts to Harmony with minimal changes, using Metamask and Ether.js with our network endpoints, and building cross-chain applications with our bridge. A cross-chain Uniswap fork is already live on our mainnet.