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

Error when doing transaction with V5R1 with exit code 133 #82

Open
NicklausFW opened this issue Jan 18, 2025 · 1 comment
Open

Error when doing transaction with V5R1 with exit code 133 #82

NicklausFW opened this issue Jan 18, 2025 · 1 comment

Comments

@NicklausFW
Copy link

NicklausFW commented Jan 18, 2025

I encountered an issue while testing transactions on the TON testnet. Transactions are successful most of the time. However, when sending multiple transactions in rapid succession (e.g., spamming number of times of the same transaction) repeatedly sending the same destination, value, body, mnemonic, and api key. I occasionally receive the following error with exit code 133:

{
  "ok": false,
  "error": "LITE_SERVER_UNKNOWN: cannot apply external message to current state : External message was not accepted\nCannot run message on account: inbound external message rejected by transaction 7C0F48CC81AA6D4ACF09AFBF562E616E9A39B75B18534FC1B27CFFE0C9169A49:\nexitcode=133, steps=49, gas_used=0\nVM Log (truncated):\n...SIGNU\nexecute PUSHCONT x28945F0ADB31E1F2C087\nexecute IFNOT\nexecute XCHG s2\nexecute NOT\nexecute XCHG2 s0,s7\nexecute AND\nexecute THROWIF 132\nexecute XCPU s2,s5\nexecute EQUAL\nexecute THROWIFNOT 133\ndefault exception handler, terminating vm with exit code 133\n",
  "code": 500,
  "status": 500
}

My code:

import { SendMode, TonClient, WalletContractV5R1, internal } from "@ton/ton";
import { mnemonicToPrivateKey } from "@ton/crypto";
async function walletTransferService(
  destination: string,
  value: string,
  body: string,
  mnemonic: string,
  api_key: string
){
  try {
    // Initialize the TON client
    const client = new TonClient({
      endpoint: 'https://testnet.toncenter.com/api/v2/jsonRPC',
      apiKey: api_key,
      timeout: 60000, // Increase timeout to 60 seconds, for example
    });

    // Convert mnemonic to key pair
    const mnemonicArray = mnemonic.split(' ');
    const keyPair = await mnemonicToPrivateKey(mnemonicArray);

    // Open wallet
    const wallet = await client.open(
      WalletContractV5R1.create({
        walletId: { networkGlobalId: -3 },
        publicKey: keyPair.publicKey,
        workchain: 0,
      })
    );

    const seqno = await wallet.getSeqno();

    // Create transfer
    const transfer = wallet.createTransfer({
      seqno,
      secretKey: keyPair.secretKey,
      messages: [
        internal({
          value: value,
          to: destination,
          body: body,
        }),
      ],
      sendMode: SendMode.PAY_GAS_SEPARATELY + SendMode.IGNORE_ERRORS,
    });
    await wallet.send(transfer);

   console.log(`Transfer to ${destination} with value ${value} was successful`);
  } catch (error: any) {
    console.error(error.response);
  }
}

Basically when i keep spamming the transaction, I eventually get that error. But most of the time it works. Anyone know what does exit code 133 mean? Is it because i use the free version of the toncenter api? The error from the toncenter doesn't explain the details of the error, so I'm just confused. I'm just afraid when using the mainnet, it will give the same error. I appreciate your help, thank you! @dvlkv @thekiba @alefmanvladimir

@NicklausFW NicklausFW changed the title Error when doing transaction with V5R1 Error when doing transaction with V5R1 with exit code 133 Jan 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@NicklausFW and others