Deploy By Leveraging Ethereum Developer Tools On Hedera
Last updated
Last updated
Learning how to properly use new developer tools requires time and effort. Many seasoned engineers already have their own, reliable set of frameworks and libraries they frequently use. With the release of the Hedera JSON-RPC relay, Ethereum developer tools combined with ECDSA-based Hedera accounts are available for developers only. You can continue to utilize familiar Ethereum tooling to build on Hedera. This blog speaks to the support of 4 Ethereum tools and the enablement of Metamask.
The most common EVM-based tools and workflows across Web3 ecosystems are built on the JSON-RPC specification. You can continue to utilize the following familiar Ethereum tooling, Web3JS, Truffle, Ethers, and Hardhat, to build on Hedera, thanks to the JSON-RPC Relay. As an Ethereum developer, your workflow does not have to change.
You can transfer HBAR, deploy contracts, and perform contract calls bringing even greater usability to the developer community.
Check out the Web3js, Truffle, and Hardhat examples on the repo. It is important to note that when working with Ethersjs and Hardhat, there is an extra step to retrieve the valid Hedera contract address. Learn more about it here.
Before you start, creating a new ECDSA-based account with an alias is important. Currently, the JSON-RPC Relay only supports Hedera accounts with an alias set (i.e., public address) based on its ECDSA public key. You can easily do this by following the steps below:
Create a function to help log your account info.
Console output
The account is officially registered with Hedera when HBAR is initially deposited to the account alias. The transaction fee to create the account is deducted from the initial hbar transfer. The remaining balance, minus the transaction fee to create the account, is the initial balance of the new account. If you want to learn more about auto account creation, read the following documentation and HIP-32.
IMPORTANT NOTE: Private keys for Testnet are displayed here for educational purposes only. Never share your private key(s) with others, as that may result in lost funds or loss of control over your account.
Hashio provides the URLs for each Hedera environment, which allows you to interact with the respective environment nodes on Hedera the same way you would an Ethereum node.
Import your newly created ECDSA-based Hedera account into MetaMask using your private key from above.
Congratulations! 🎉 You’ve successfully connected your Hedera account to MetaMask! You may now send and receive HBAR on the Hedera Testnet via MetaMask!
The release of the JSON-RPC Relay to developers brings greater usability to the developer community by supporting common Ethereum developer tooling while building on Hedera.
Happy Building! Feel free to reach out if you have any questions:
Config | Default | Description |
---|---|---|
web3js
Truffle
ethers
Hardhat
Transfer HBARS
✅
✅
✅
✅
Contract Deployment
✅
✅
✅
✅
Can use the contract instance after deploy without re-initialization
✅
✅
⚠️
⚠️
Contract View Function Call
✅
✅
✅
✅
Contract Function Call
✅
✅
✅
✅
Network Name
Hedera
New RPC URL
Chain ID
296
Currency Symbol
HBAR
CHAIN_ID
0x12a
The network chain id. Local and previewnet envs should use 0x12a
(298). Previewnet, Testnet and Mainnet should use 0x129
(297), 0x128
(296) and 0x127
(295) respectively