0

My setting is like below

enter image description here

This is my code

const {
    Client,
    PrivateKey,
    Hbar,
    AccountId,
    AccountCreateTransaction,
} = require("@hashgraph/sdk");

async function main() {
    //Create your local client
    const node = {"127.0.0.1:50211": new AccountId(3)}
    const client = Client.forNetwork(node).setMirrorNetwork("127.0.0.1:5600");
    //Set the transaction fee paying account
    client.setOperator(AccountId.fromString("0.0.2"),PrivateKey.fromString("302e020100300506032b65700..."));
    //Submit a transaction to your local node
    const newAccount = await new AccountCreateTransaction()
        .setKey(PrivateKey.fromString("302e020100300506032b65700..."))
        .setInitialBalance(new Hbar(316))
        .execute(client);
    //Get receipt
    const receipt = await newAccount.getReceipt(client);
    //Get the account ID
    const newAccountId = receipt.accountId;
    console.log(newAccountId);
}
void main();

After I dwongraded docker-compose, when I run the code this error is occured.

enter image description here

How can I fix it?

The result have to be lik this enter image description here

The new Error enter image description here

YJ C
  • 1
  • 1
  • This error is coming from the @ hashgraph package in your node_modules folder. The line of code that is throwing this error is actually commented out in the [latest version of @hashgraph, line 466](https://www.npmjs.com/package/@hashgraph/sdk?activeTab=explore). This makes me think that you have run into a known bug with the package, so maybe you just need to update. If not that, then I suspect you will need to provide more details on your packages/versions/dependencies, or provide a reproducible example in some way, if you want additional help from StackOverflow. – Jake Mar 10 '23 at 06:47
  • I checked the version of @hashgraph, and updated to v.2.22.0. I downgraded node to v.14.17.6 and npm to v.6.14.17 becuase the error (npm ERR! Tracker "idealTree:inflate:" already exist) is ocurred. And the error is occured again.. The code is same. – YJ C Mar 14 '23 at 08:24

0 Answers0