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

Receiving INVALID_NODE_ACCOUNT after serialize/deserialize actions #2164

Closed
svetoslav-nikol0v opened this issue Feb 22, 2024 · 0 comments · Fixed by #2165
Closed

Receiving INVALID_NODE_ACCOUNT after serialize/deserialize actions #2164

svetoslav-nikol0v opened this issue Feb 22, 2024 · 0 comments · Fixed by #2165
Assignees
Labels
bug Something isn't working
Milestone

Comments

@svetoslav-nikol0v
Copy link
Contributor

svetoslav-nikol0v commented Feb 22, 2024

Description

The following actions make a transaction to fail
create → serialize → deserialize → freeze → sign → serialize → deserialize → execute

After executing INVALID_NODE_ACCOUNT is immediately received

Steps to reproduce

create → serialize → deserialize → freeze → sign → serialize → deserialize → execute

Additional context

const {
  AccountUpdateTransaction,
  Client,
  TransactionId,
  Timestamp,
  AccountId,
  Transaction,
  PrivateKey,
} = require('@hashgraph/sdk');

async function run() {
   // Setting up Client
  const client = Client.forTestnet();

  const privateKey = PrivateKey.fromStringED25519(
    'e3349d7f2abd86f8850242e7d690c366a4c395eb077d114acf0bc001c41ada43'
  );

  // Creating Transation ID
  const accountId = AccountId.fromString('0.0.2159149');
  const transactionId = new TransactionId(
    accountId,
    Timestamp.fromDate(new Date())
  );

  // Creating a transaction
  const transaction = new AccountUpdateTransaction()
    .setTransactionId(transactionId)
    .setAccountId(accountId)
    .setAccountMemo('Hello');

  // Serializing the transaction
  const bytes = transaction.toBytes();

  // Sending to somewhere...

  // Deserialize when received
  const transactionToFreeze = Transaction.fromBytes(bytes);

  // Freeze the transaction
  transactionToFreeze.freezeWith(client);
  await transactionToFreeze.sign(privateKey);

  // Serialize it again and send it
  const newBytes = transactionToFreeze.toBytes();

  // Deserializing the frozen transaction
  const signedTransaction = Transaction.fromBytes(newBytes);

  const response = await signedTransaction.execute(client);

  const receipt = await response.getReceipt(client)
  console.log(receipt.status.toString());

  client.close();
}
run();

Hedera network

testnet

Version

v2.42.0-beta.3

Operating system

macOS

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

Successfully merging a pull request may close this issue.

1 participant