Leveraging Ethereum Developer Tools On Hedera | Hedera (2024)

Leveraging Ethereum Developer Tools On Hedera

Leveraging Ethereum Developer Tools On Hedera | Hedera (1)

Aug 25, 2022

by Abi Castro

Learning how to properly use new sets of developer tools requires time and effort. Many seasoned engineers already have their ol’ 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.

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

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 get started it is important to create a new ECDSA-based account with an alias. 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:

Leveraging Ethereum Developer Tools On Hedera | Hedera (2)

// generate an ECDSA key-pairconst newPrivateKey = PrivateKey.generateECDSA();console.log(`The raw private key (use this for JSON RPC wallet import): ${newPrivateKey.toStringRaw()}`);const newPublicKey = newPrivateKey.publicKey;// account publickey aliasconst aliasAccountId = newPublicKey.toAccountId(0, 0);console.log(`The alias account id: ${aliasAccountId}`);

Leveraging Ethereum Developer Tools On Hedera | Hedera (3)

const operatorAccountId = AccountId.fromString(process.env.OPERATOR_ID);const operatorPrivateKey = PrivateKey.fromString(process.env.OPERATOR_PVKEY);// Hbar transfers will auto-create a Hedera Account// for long-form account Ids that do not have accounts yetconst tokenTransferTxn = async (senderAccountId, receiverAccountId, hbarAmount) => { const transferToAliasTx = new TransferTransaction() .addHbarTransfer(senderAccountId, new Hbar(-hbarAmount)) .addHbarTransfer(receiverAccountId, new Hbar(hbarAmount)) .freezeWith(client); const signedTx = await transferToAliasTx.sign(operatorPrivateKey); const txResponse = await signedTx.execute(client); await txResponse.getReceipt(client);}

Create a function to help log your account info.

Leveraging Ethereum Developer Tools On Hedera | Hedera (4)

const logAccountInfo = async (accountId) => { const info = await new AccountInfoQuery() .setAccountId(accountId) .execute(client); console.log(`The normal account ID: ${info.accountId}`); console.log(`Account Balance: ${info.balance}`);}

Leveraging Ethereum Developer Tools On Hedera | Hedera (5)

const main = async () => { await tokenTransferTxn(operatorAccountId, aliasAccountId, 100); await logAccountInfo(aliasAccountId);} main();

Console output

Leveraging Ethereum Developer Tools On Hedera | Hedera (6)

The raw private key (use this for JSON RPC wallet import): 81cd442a945d2c9f04ed5bf355a59db9e9f7553b9d4c319938eb9176085cb4c8The alias account id: 0.0.302d300706052b8104000a03220002d47f1da5a3e086c568776d5be31165c65a135bb48951b4ccbf4284b025225ff4The normal account ID: 0.0.47995491Account Balance: 99.31142415 ℏ

The account is officially registered with Hedera when hbars are 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 interested in learning 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.

Step 1: Go to HashIO, the SwirldsLabs hosted version of the JSON-RPC Relay, and copy the Testnet URL.

HashIO provides the URLs for each Hedera environment that will let you interact with the respective environment nodes on Hedera the same way you would an Ethereum node.

Leveraging Ethereum Developer Tools On Hedera | Hedera (7)

Step 2: Open Metamask and add Hedera as a custom network.

Network Name

Hedera

New RPC URL

https://testnet.hashio.io/api

Chain ID

296

Currency Symbol

HBAR

Config

Default

Description

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

Step 3: Import your Hedera account into Metamask

Import your newly created ECDSA-based Hedera account into Metamask using your private key from above.

Leveraging Ethereum Developer Tools On Hedera | Hedera (8)

Use your private key to import your Hedera account into Metamask

Leveraging Ethereum Developer Tools On Hedera | Hedera (9)

Your Hedera Account in Metamask

You’ve successfully connected your Hedera account to Metamask! You may now receive and send hbar on testnet through Metamask!

The release of the JSON-RPC Relay to developers is bringing greater usability to the developer community by enabling the support of common Ethereum developer tooling while building on Hedera.

Happy Building!

Leveraging Ethereum Developer Tools On Hedera | Hedera (2024)

FAQs

Will HBAR reach $20? ›

Considering growth required and time required, HBAR has a low chance of reaching $20 in the near future.

Does Hedera have a future? ›

End of 2024: With ongoing network improvements and a recovering crypto market, Hedera's price could rise to around $0.2. These developments, including improved developer tooling and network resilience, are key drivers for this potential increase.

What problem does HBAR solve? ›

Dual role of HBAR

Hbars are used to pay application transaction fees and protect the network from attack through proof-of-stake. Developers use hbars to pay for network services, such as transferring hbars, minting fungible and non-fungible tokens, calling smart contracts, and logging data.

Is Hedera Ethereum compatible? ›

These distinctions in network behaviors are intentional design choices made to align with EVM standards, thereby achieving EVM compatibility. This approach ensures that while Hedera aligns closely with Ethereum, it also maintains its distinctive features and optimization.

How much will Hedera be worth in 2025? ›

$ 0.146726

Can HBAR get to $100? ›

According to our Hedera Hashgraph prediction algorithm, the price of Hedera Hashgraph will not reach $100.

Which crypto will explode in 2024? ›

Here's our list of cryptos that will explode in 2024: Dogeverse (DOGEVERSE) – A multi-chain Doge token expected to boom in 2024. WienerAI (WAI) – A prime meme coin contender for explosive growth in 2024. Slothana (SLOTH) – A hot Solana meme token raising over $550K in a few hours.

Is HBAR a good long-term investment? ›

Hedera Hashgraph is trading at 0.0801 as of the 17th of April 2024, a 1.39 percent increase since the beginning of the trading day. Hedera Hashgraph has a very high chance of experiencing financial distress in the next few years of operation. It also did not have a very good performance during the last 90 trading days.

What is the real world use of HBAR? ›

Hedera (HBAR): Use cases

Moreover, Hedera is designed to cater to applications associated with decentralized identity, remittances, and fraud prevention. It also serves as a platform for decentralized finance (DeFi) applications, play-to-earn (P2E) gaming, and metaverse functionalities.

What is so special about HBAR? ›

Hedera Hashgraph's most unique feature is its data structure for grouping transactions called a hashgraph, which claims to process more transactions more cheaply than existing blockchains.

What is the realistic price of HBAR? ›

HBAR price saw major fluctuations since 2019, peaking in 2021 due to Google's partnership. Future HBAR values are projected between $0.051 and $0.35, influenced by recent partnerships.

Who is HBAR partnering with? ›

The HBAR Foundation, which supports the Hedera ecosystem, announced Tuesday that shares in BlackRock's ICS U.S. Treasury money market fund had been tokenized on the Hedera blockchain in collaboration with Archax.

Who has partnered with Hedera? ›

Hedera's robust ecosystem is built by a global community, on a network governed by a diverse council of industry-leading organizations, including abrdn, Avery Dennison, Boeing, Chainlink Labs, COFRA Holding, DBS Bank, Dell, Dentons, Deutsche Telekom, DLA Piper, EDF (Électricité de France), eftpos, Google, Hitachi, IBM, ...

Will Hedera be on Coinbase? ›

Can I buy Hedera on Coinbase? Yes, Hedera is currently available on Coinbase's centralized exchange.

Can HBAR reach 1 USD? ›

Price Prediction: HBAR could reach at least $1 this bull cycle due to its scalability and cost-effective technology. Functionality: XRP is well-known as a cross-border payment solution. Financial institutions use it to facilitate fast and cost-effective international money transfers.

What is the price of HBAR in 2040? ›

By 2040, the maximum price of the HBAR Coin is projected to be around $23.42. Our average price forecast for Hedera is $22.94 in 2040. Conversely, if the market turns bearish, the minimum price level of HBAR Coin could fall down to $22.30 by 2040.

What will Hedera crypto be worth in 2030? ›

Hedera price prediction 2030: Hedera's price for 2030 according to our analysis should range between $0.48 to $0.73 and the average price of HBAR should be around $0.6.

Top Articles
Latest Posts
Article information

Author: Foster Heidenreich CPA

Last Updated:

Views: 6359

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Foster Heidenreich CPA

Birthday: 1995-01-14

Address: 55021 Usha Garden, North Larisa, DE 19209

Phone: +6812240846623

Job: Corporate Healthcare Strategist

Hobby: Singing, Listening to music, Rafting, LARPing, Gardening, Quilting, Rappelling

Introduction: My name is Foster Heidenreich CPA, I am a delightful, quaint, glorious, quaint, faithful, enchanting, fine person who loves writing and wants to share my knowledge and understanding with you.