简体   繁体   中英

SendTransactionError: failed to send transaction: Node is unhealthy

I'm trying to send a transaction with a memo program inside it. The problem appears on solana cli and web3 too.

This is the command: solana transfer --from./.cache/solana.json RECIVER_PUBLIC_KEY 0.00001 --allow-unfunded-recipient --url https://api.tes.net.solana.com --fee-payer./.cache/solana.json --with-memo hello

and this the response: Error: RPC response error -32005: Node is unhealthy

The same with typescript/js snippet:

async function sendRawTransaction(message:string):Promise<string>{
    const connection = await new Connection(CONNECTION_STRING);
    let tx = new Transaction().add(
        SystemProgram.transfer({
          fromPubkey: WALLET.publicKey,
          toPubkey: RECIVER_ADDRESS,
          lamports: 0,
        }),
      );
    await tx.add(
        new TransactionInstruction({
          keys: [{ pubkey: WALLET.publicKey, isSigner: true, isWritable: true }],
          data: Buffer.from(message, "utf-8"),
          programId: MEMO_PROGRAM,
        })
    );
    return new Promise((res, rej)=>{
        sendAndConfirmTransaction(connection, tx, [WALLET]).then(s=>{
            console.log(s)
            res(s)
        }).catch(e=>{
            console.log(e)
            rej(e)
        })
    })
}

and the response is:

SendTransactionError: failed to send transaction: Node is unhealthy
    at Connection.sendEncodedTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6812:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Connection.sendRawTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6769:20)
    at async Connection.sendTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6759:12)
    at async sendAndConfirmTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:2219:21) {
  logs: undefined
}
node:internal/process/promises:288
            triggerUncaughtException(err, true /* fromPromise */);
            ^

SendTransactionError: failed to send transaction: Node is unhealthy
    at Connection.sendEncodedTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6812:13)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Connection.sendRawTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6769:20)
    at async Connection.sendTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:6759:12)
    at async sendAndConfirmTransaction (/Users/manueltardivo/Sviluppo/Notarify/Refactor/ntf-blackbox/node_modules/@solana/web3.js/lib/index.cjs.js:2219:21) {
  logs: undefined
}

Node.js v18.4.0
[nodemon] app crashed - waiting for file changes before starting...

I've already tried to delete node_modules and re install them. Could be a problem with the RPC provider?

Copying my answer from https://solana.stackexchange.com/questions/4303/solana-error-creating-memo-program-node-is-unhealthy-solana-web3/

Under normal circumstances, "node is unhealthy" often means that the node has fallen behind from the rest of the.network, so you either need to wait for it to catch up, or you need to use another RPC node.

However, I can tell you that tes.net is currently down, so you'll need to use another.network until it's back up, either de.net or a local solana-test-validator .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM