Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BadKeyError: Failed to parse correct key for get-account-info example #175

Closed
SimiHunjan opened this issue Jan 27, 2020 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@SimiHunjan
Copy link
Contributor

SimiHunjan commented Jan 27, 2020

const { Client, AccountInfoQuery } = require("@hashgraph/sdk");
require("dotenv").config();

async function main() {
    const operatorPrivateKey = process.env.OPERATOR_KEY;
    const operatorAccount = process.env.OPERATOR_ID;

    if (operatorPrivateKey == null || operatorAccount == null) {
        throw new Error("environment variables OPERATOR_KEY and OPERATOR_ID must be present");
    }

    const client = new Client({
        network: { "0.testnet.hedera.com:50211": "0.0.3" },
        operator: {
            account: operatorAccount,
            privateKey: operatorPrivateKey
        }
    });

    const info = await new AccountInfoQuery()
        .setAccountId(operatorAccount)
        .execute(client);

    console.log(`${operatorAccount} info = ${JSON.stringify(info, null, 4)}`);
}

main();

Error: (node:26920) UnhandledPromiseRejectionWarning: BadKeyError: Failed to parse correct key

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants