
The Arkhitect Awareness Series
This article is a part of the Arkhitect Awareness Series, which aims to provide developers and the wider Hedera community with the tools and knowledge needed to build the most secure, reliable dApps that provide real-world utility and applications to current and future users. Find other entries in the series on the Arkhia Medium page.
Why do you need an ECDSA-Based Account?
Before you begin interacting with the JSON RPC Relay on Hedera, you must create a new Elliptic Curve Digital Signature Algorithm (opens in a new tab) (ECDSA)-based account with an alias. Currently, the Hedera JSON-RPC Relay only supports Hedera accounts with an alias set (i.e., public address) based on its ECDSA public key.
Once created, the ECDSA-based account allows developers to utilise the Hedera JSON RPC Relay to build on Hedera using familiar Ethereum tools such as Web3JS, Truffle, Ethers, and Hardhat. Luckily, this is easy to do and can be done by following the steps below.
import { Client, PrivateKey, AccountInfoQuery, TransferTransaction, Hbar} from "@hashgraph/sdk";
const operatorAccountId = `<YOUR_HEDERA_TESTNET_ACCOUNT_ID>`;
const operatorPrivateKey = `<YOUR_HEDERA_TESTNET_PRIVATE_KEY>`;
const client = Client.forTestnet();
client.setOperator(operatorAccountId, operatorPrivateKey);View on GitHub (opens in a new tab)
const newPrivateKey = PrivateKey.generateECDSA();
console.log(`The raw ECDSA private key (use this for JSON RPC wallet import): ${newPrivateKey.toStringRaw()}`);
const newPublicKey = newPrivateKey.publicKey;
console.log(`The raw ECDSA public key (use this for JSON RPC wallet import): ${newPublicKey.toStringRaw()}`);
const aliasAccountId = newPublicKey.toAccountId(0, 0);
console.log(`The alias account id: ${aliasAccountId}`);View on GitHub (opens in a new tab)
Create a function to help log your account info.
const setAliasAccountUsingTx = async (senderAccountId, receiverAccountId, amount) => {
const transferToAliasTx = await new TransferTransaction()
.addHbarTransfer(senderAccountId, new Hbar(-amount))
.addHbarTransfer(receiverAccountId, new Hbar(amount))
.execute(client);
await transferToAliasTx.getReceipt(client);
}View on GitHub (opens in a new tab)
const getAccountInfo = 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}`);
}View on GitHub (opens in a new tab)
Console output
const main = async () => {
await setAliasAccountUsingTx(operatorAccountId, aliasAccountId, 10);
await getAccountInfo(aliasAccountId);
}View on GitHub (opens in a new tab)
The account registration on the Hedera network will be finalised when $HBAR is deposited to the new wallet. The balance of the new account will be your deposit minus the transaction fee from the network. Confirming your account has been registered is easy and can be done swiftly using the Arkhia Explorer (opens in a new tab).

In the top right corner of the explorer, enter the address of your new account and click enter. This will pull data from the Hedera network related to your account. An example has been provided below.

Once you’ve entered your ECDSA-based account with an alias, you should be able to confirm your account has been registered by seeing the account number, balance, and alias all correspond to your account. If these match, your account is good to go.
Once this address has been registered, head to the Arkhia Medium page to learn how to connect to EVM-compatible tools such as MetaMask.
Code Check ✅
import { Client, PrivateKey, AccountInfoQuery, TransferTransaction, Hbar} from "@hashgraph/sdk";
const operatorAccountId = `<YOUR_HEDERA_TESTNET_ACCOUNT_ID>`;
const operatorPrivateKey = `<YOUR_HEDERA_TESTNET_PRIVATE_KEY>`;
const client = Client.forTestnet();
client.setOperator(operatorAccountId, operatorPrivateKey);
const newPrivateKey = PrivateKey.generateECDSA();
console.log(`The raw ECDSA private key (use this for JSON RPC wallet import): ${newPrivateKey.toStringRaw()}`);
const newPublicKey = newPrivateKey.publicKey;
console.log(`The raw ECDSA public key (use this for JSON RPC wallet import): ${newPublicKey.toStringRaw()}`);
const aliasAccountId = newPublicKey.toAccountId(0, 0);
console.log(`The alias account id: ${aliasAccountId}`);
const setAliasAccountUsingTx = async (senderAccountId, receiverAccountId, amount) => {
const transferToAliasTx = await new TransferTransaction()
.addHbarTransfer(senderAccountId, new Hbar(-amount))
.addHbarTransfer(receiverAccountId, new Hbar(amount))
.execute(client);
await transferToAliasTx.getReceipt(client);
}
const getAccountInfo = 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}`);
}
const main = async () => {
await setAliasAccountUsingTx(operatorAccountId, aliasAccountId, 10);
await getAccountInfo(aliasAccountId);
}View on GitHub (opens in a new tab)
About Arkhia
Arkhia is an enterprise-grade Infrastructure-as-a-Service (IaaS) provider for decentralised technologies. We are empowering organisations, teams, and individuals to build fast, modular, and scalable solutions in our high-availability environments for Web3 applications. Purposely built for reliability, resilience, and high throughput on a multi-chain network, the Arkhia API suite benefits anyone needing ultra-reliable network uptime for mission-critical applications. To learn more about how we provide enterprise-grade infrastructure, visit arkhia.io, subscribe to our newsletter, and follow us on Twitter (opens in a new tab) (@arkhia_io) and LinkedIn (opens in a new tab).


