pumpdotfun-sdk icon indicating copy to clipboard operation
pumpdotfun-sdk copied to clipboard

custom program error: 2006 | A seeds constraint was violated in getBuyInstructions for creator_vault PDA

Open lxiiiixi opened this issue 7 months ago • 16 comments

I'm encountering a custom program error: 2006 | A seeds constraint was violated when executing a transaction that combines token creation and buying using the Pump SDK's getBuyInstructions method. The error occurs in the Buy instruction of the Pump program (6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P), specifically related to the creator_vault account. The logs indicate a mismatch between the expected and provided seeds for the creator_vault PDA, with references to SysvarRent111111111111111111111111111111111 and an unexpected address (AK2V6xjrFH8s9e9wDk5dA7kcbzY1bbUKXYaxnia69w2a). This issue appears after a requirement change where the buyer's private key is provided first, and the creator signs the transaction, instead of the creator signing first. The creator_vault PDA seems to be incorrectly derived or passed, potentially due to missing or incorrect seeds in the getBuyInstructions method.

Pump SDK Version: [email protected] Solana Web3.js Version: @solana/[email protected] Anchor Version: @coral-xyz/[email protected] Node.js Version: v23.4.0

I create a token using a createTx transaction, signed by mintTokenKeypair and tokenCreatorKeypair. Call pumpSdk.getBuyInstructions to generate a Buy instruction with the following parameters: const buyTx = await pumpSdk.getBuyInstructions( tokenBuyerPublicKey, mintTokenKeypair.publicKey, globalAccount.feeRecipient, buyAmount, buyAmountWithSlippage );

Combine createTx and buyTx instructions into a single transaction: const instructions = [ ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1_000_000 }), ...createTx.instructions, ...buyTx.instructions, ]; const messageV0 = new TransactionMessage({ payerKey: tokenCreatorPublicKey, recentBlockhash: blockhash, instructions, }).compileToV0Message(); const transaction = new VersionedTransaction(messageV0); transaction.sign([mintTokenKeypair, tokenBuyerKeypair, tokenCreatorKeypair]);

Send the transaction, resulting in the error:Program log: AnchorError caused by account: creator_vault. Error Code: ConstraintSeeds. Error Number: 2006. Error Message: A seeds constraint was violated. Program log: Left: SysvarRent111111111111111111111111111111111 Program log: Right: AK2V6xjrFH8s9e9wDk5dA7kcbzY1bbUKXYaxnia69w2a

Expected Behavior The Buy instruction should execute successfully without the 2006 error, using the correct creator_vault PDA derived with the appropriate seeds (e.g., ["vault", tokenCreatorPublicKey, mint]). The transaction should allow the buyer to purchase tokens while respecting the new requirement where the buyer's private key is provided, and the creator signs the transaction. Actual Behavior The transaction fails with the 2006 error, indicating a seeds constraint violation for the creator_vault account (2Hj63JyK4qPR6E5DqEYe4spi2PCbdyfgGyEqBKM1t5yG). The logs suggest the program expected a different PDA, and SysvarRent111111111111111111111111111111111 is incorrectly referenced in the error context.

There is an example transaction: https://solscan.io/tx/4WF6JT4XWjc4B9KSz95orrPqUHdvAUMjDZdeBpoxqhLKQ8t7fH2nySLGz6H4W8dz5Q5WAxypEnpnKfvQgzVKNfTi

Questions

What are the correct seeds for the creator_vault PDA in the Buy instruction? Should it include tokenCreatorPublicKey, mint, or other accounts? Is SysvarRent111111111111111111111111111111111 expected in the Buy instruction, or is its presence a bug in the SDK? How should getBuyInstructions be modified to support the new requirement (buyer provides private key, creator signs)? Should tokenCreatorPublicKey be passed explicitly? Is there an updated SDK version or Anchor IDL that addresses this issue?

Any guidance on resolving this error or confirming the creator_vault PDA seeds would be greatly appreciated!

lxiiiixi avatar May 13 '25 03:05 lxiiiixi

this is because of the IDL change which pump-fun made. I've created and MR ( #110 ) for the fix. I guess it'll be merged and released soon.

you can temporarily fix it by copying this file: https://github.com/pump-fun/pump-public-docs/blob/main/idl/pump.json

into

your project/node_modules/pumpdotfun-sdk/dist/esm/IDL/pump-fun.json and your project/node_modules/pumpdotfun-sdk/dist/cjs/IDL/pump-fun.json

Image

oksuz avatar May 13 '25 07:05 oksuz

It works for me, thanks oksuz

alinejad-m avatar May 13 '25 10:05 alinejad-m

i copied the new idl.json to the node_modules/pumpdotfun-sdk/dist/esm/IDL/pump-fun.json and node_modules/pumpdotfun-sdk/dist/cjs/IDL/pump-fun.json

but it has the same error Program Error: "Instruction #4 Failed - custom program error: 2006 | A seeds constraint was violated"

guxuanzhizzzz avatar May 13 '25 12:05 guxuanzhizzzz

Download https://github.com/pump-fun/pump-public-docs/blob/main/idl/pump.json and copy in this location src/IDL/pump-fun.json (replace it with old one)

alinejad-m avatar May 13 '25 12:05 alinejad-m

For those looking for a temporary solution https://www.npmjs.com/package/@peixer/pumpdotfun-sdk

Peixer avatar May 13 '25 12:05 Peixer

Does the Pump AMM SDK have any cases involving token redemption? The official website does not have the correct documentation.

JessLong avatar May 13 '25 13:05 JessLong

it does work, but when i buy the new launch token , it has some error

Image

guxuanzhizzzz avatar May 13 '25 14:05 guxuanzhizzzz

any help using SDK with ipfs por image? thanks

SOLMAINNET avatar May 13 '25 16:05 SOLMAINNET

Does someone have information what is the status of this issue? Is anyone working on resolving it?

As I understand official PumpFun team is mentioning their SDK, is that the reason this thread/issue is not more active here?

I'm trying to figure out what should be my next step. Any advice is appreciated.

SpaceChickenDev avatar May 16 '25 12:05 SpaceChickenDev

For those looking for a temporary solution https://www.npmjs.com/package/@peixer/pumpdotfun-sdk @Peixer

It doesn't work for creating new tokens :( Image

DanyaKulko avatar May 16 '25 12:05 DanyaKulko

Temporary solution, hope @rckprtr to update the SDK library.

https://github.com/thejoven/pumpdotfun-sdk-main

thejoven avatar May 17 '25 10:05 thejoven

i think he just forgot about that project, no any signs of being active and trying to fix it

horohovskiy avatar May 19 '25 18:05 horohovskiy

Temporary solution, hope @rckprtr to update the SDK library.

https://github.com/thejoven/pumpdotfun-sdk-main

{
  InstructionError: [ 3, {
      Custom: 3012,
    } ],
}
[1/1] Failed to create token
{
  InstructionError: [ 3, {
      Custom: 3012,
    } ],
}

Getting that error when attempting to create a token

LightYagami200 avatar May 20 '25 00:05 LightYagami200

I see there is some demand for this, ill try to push the changes here this upcoming weekend if time permits. There are a few things that need to be added with the new pumpfun idl to allow launching, buying, and selling. If someone else has the bandwidth hit me up and i can walk you through the changes.

frogwiftools avatar May 21 '25 01:05 frogwiftools

Temporary solution, hope @rckprtr to update the SDK library. https://github.com/thejoven/pumpdotfun-sdk-main

{
  InstructionError: [ 3, {
      Custom: 3012,
    } ],
}
[1/1] Failed to create token
{
  InstructionError: [ 3, {
      Custom: 3012,
    } ],
}

Getting that error when attempting to create a token

https://github.com/rckprtr/pumpdotfun-sdk/pull/112

thejoven avatar May 22 '25 17:05 thejoven

hello guys. i have now an updated version of the sdk.

new: 0.1 MADE A SERVER OUT OF IT which uses localhost 3008 and waits for buy calls 1.0 realtime price tracker which includes stoploss and take profit(SL/TP) sells, the tracked price uses the bought entry price including fees as start price for pricetracker to check the price-difference in % since bought for SL/TP 2.0 trailing stoploss added 3.0 migrationtracker added ( so price gets tracked even after migration from pumpfun->raydium) 3.1 SL/TP and trailing-Stoploss work with migration 4.0 added Raydium buys and sells possibility 5.0 Jito possibility added (uses 0.1% fee for mev protection) 5.1 Snipe enabled via jito, transaction go through in under a second mev proctected 6.0 made the code easy to use, simple functions which are stand alone 7.0 multiple coins trackable at the same time (for me it works with up to 100 tokens at the same time) 8.0 Sell retrys up to 50 times if it doesnt work(for me the highest retry was 3 times in 3 seconds because the was much volume) 9.0 Buy+Sell Slippage for pumpfun or raydium(jupiter) and Jitofee are all customizeable numbers in settings on top of the code (this code uses pumpfun free api so we will never get into ratelimits!)

how to use: -send /buy/tokenadress/solamount ("/buy/xxxxpump/1.0") to localhost 3008 and the bot will snipe into it via jito with mev protection for 0.1% of transaction

  • requires: Helius free membership to track your transactions and you wallet key

i worked on this for several month and now updated it to new pumpfun IDL.

if you want to buy my new version for private use for 5 SOL: Telegram: @Patrick_whale

HakimApo avatar May 25 '25 18:05 HakimApo