gagliardetto / metaplex-go

Go clients for the Metaplex Solana programs
MIT License
42 stars 31 forks source link

Transaction loads a writable account that cannot be written #11

Closed ileFixDev closed 2 years ago

ileFixDev commented 2 years ago

Good day, I am currently writing a small program that mints an NFT using the Candy Machine ID. For this, I have https://github.com/metaplex-foundation/metaplex/blob/master/js/packages/cli/src/candy-machine-v2-cli.ts mint_one_token recoded in Go using your libraries. However, I always get as error:

Transaction simulation failed: Transaction loads a writable account that cannot be written.

Do you have any idea what this could be? Thank you very much!

Here is my code:

gagliardetto commented 2 years ago

Hi @ileFixDev

That's a lot of surface for a potential bug to hide into.

Try this: disable the preflight check so that the transaction will execute and fail leaving behind a log.

That way it's going to be a lot easier to understand what's the issue and where.

    sig, err := sendAndConfirmTransaction.SendAndConfirmTransactionWithOpts(
        context.TODO(),
        connection,
        wsClient,
        tx,
        true, // skip preflight and let the tx execute so you have a log to look at and try to understand where it fails.
        rpc.CommitmentFinalized,
    )
       fmt.Println(sig, err)
ileFixDev commented 2 years ago

Hey, thanks for your answer, I have tried a little bit yesterday and got a little further. You can find the new code below. Although it should now be exactly the same as in the TS code, I get with as well as without preflight:

(*jsonrpc.RPCError)(0xc0001c0720)({
 Code: (int) -32002,
 Message: (string) (len=118) "Transaction simulation failed: Error processing Instruction 1: instruction modified data of an account it does not own",
 Data: (map[string]interface {}) (len=3) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "1",
    (string) (len=27) "ExternalAccountDataModified"
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=7 cap=8) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: InitializeMint2",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2008 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=125) "failed to verify account A7BK7wAtG36S3ZHnxRfM4dzHeh5oS7RvzFA9aDNSmw6: instruction modified data of an account it does not own"
  }
 }
})

The Publickey: A7BK7wAtG36S3ZHnxRfM4dzHeh5oS7RvzFA9aDNSmw6 points to the mint.PublicKey() However, I have no idea why that is not accepted, in the TS version it is used the same way.

gagliardetto commented 2 years ago

Maybe the mint must be owned by the candy machine?

    instructions = append(instructions,
        system.NewCreateAccountInstructionBuilder().
            SetOwner(userKeyPair.PublicKey()). // the owner should be the candymachine, cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ
            SetNewAccount(mint.PublicKey()).
            SetSpace(82).
            SetLamports(min).
            SetFundingAccount(userKeyPair.PublicKey()).
            Build(),
ileFixDev commented 2 years ago

If I set the SetOwner() to cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ I get the same error. But for fun, I put the TOKEN_PROGRAM_ID (TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA) from the TS code and now I get the following error:

(*jsonrpc.RPCError)(0xc0007d2120)({
 Code: (int) -32002,
 Message: (string) (len=99) "Transaction simulation failed: Error processing Instruction 3: invalid account data for instruction",
 Data: (map[string]interface {}) (len=3) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "3",
    (string) (len=18) "InvalidAccountData"
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=28 cap=32) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: InitializeMint2",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2008 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=63) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
   (string) (len=70) "Program log: Transfer 2039280 lamports to the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=60) "Program log: Allocate space for the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=73) "Program log: Assign the associated token account to the SPL Token program",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=52) "Program log: Initialize the associated token account",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
   (string) (len=43) "Program log: Instruction: InitializeAccount",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3297 of 177047 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=91) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 26899 of 200000 compute units",
   (string) (len=60) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=32) "Program log: Instruction: MintTo",
   (string) (len=38) "Program log: Error: InvalidAccountData",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 1410 of 200000 compute units",
   (string) (len=96) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA failed: invalid account data for instruction"
  }
 }
})
gagliardetto commented 2 years ago

I think that means that the associated token account does not exist (you need to create it).

gagliardetto commented 2 years ago

https://github.com/gagliardetto/solana-go/blob/2acfcf2684c6dca9a9ae67126d09abc910c3a3fd/programs/associated-token-account/Create.go#L193-L202

gagliardetto commented 2 years ago

Wait, nope, sorry.

ileFixDev commented 2 years ago

Okay all fine xD

gagliardetto commented 2 years ago

found it

you're calling

    userTokenAccountAddress, err := getTokenWallet(mint.PublicKey(), userKeyPair.PublicKey())

but getTokenWallet is func getTokenWallet(wallet solana.PublicKey, mint solana.PublicKey) (solana.PublicKey, error) {

(wrong param order)

ileFixDev commented 2 years ago

Yes, you are right!

Now I ended up with custom program error: 0x7d1 Is there an error code list somewhere?

(*jsonrpc.RPCError)(0xc0001143f0)({
 Code: (int) -32002,
 Message: (string) (len=90) "Transaction simulation failed: Error processing Instruction 4: custom program error: 0x7d1",
 Data: (map[string]interface {}) (len=3) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "4",
    (map[string]interface {}) (len=1) {
     (string) (len=6) "Custom": (json.Number) (len=4) "2001"
    }
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=32 cap=32) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: InitializeMint2",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2008 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=63) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
   (string) (len=70) "Program log: Transfer 2039280 lamports to the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=60) "Program log: Allocate space for the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=73) "Program log: Assign the associated token account to the SPL Token program",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=52) "Program log: Initialize the associated token account",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
   (string) (len=43) "Program log: Instruction: InitializeAccount",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3297 of 177047 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=91) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 26899 of 200000 compute units",
   (string) (len=60) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=32) "Program log: Instruction: MintTo",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2611 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=62) "Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ invoke [1]",
   (string) (len=33) "Program log: Instruction: MintNft",
   (string) (len=40) "Program log: Custom program error: 0x7d1",
   (string) (len=90) "Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ consumed 11274 of 200000 compute units",
   (string) (len=87) "Program cndy3Z4yapfJBmL3ShUp5exZKqR3z33thTzeNMm2gRZ failed: custom program error: 0x7d1"
  }
 }
})
gagliardetto commented 2 years ago

Okay

To find out what that error means, this is the flow:

I don't fully understand it. I supposedly means that the wallet must be the owner of the candy_machine, but that doesn't make sense to me.

gagliardetto commented 2 years ago

Update:

Reading here: https://docs.rs/anchor-lang/latest/anchor_lang/derive.Accounts.html

The constraint means that the data on the candy machine account is a CandyMachine struct, and the field Wallet of that struct must be equal to wallet pubkey.

gagliardetto commented 2 years ago

Here:

    instructions = append(instructions,
        nftcandymachinev2.NewMintNftInstructionBuilder().
            SetCreatorBump(creatorBump).
            SetCandyMachineAccount(candyMachineAddress).
            SetCandyMachineCreatorAccount(candyMachineCreator).
            SetPayerAccount(userKeyPair.PublicKey()).
            SetWalletAccount(userKeyPair.PublicKey()).

The SetWalletAccount(. refers to the wallet of the candy machine, not the user minting.

gagliardetto commented 2 years ago

See here:

https://github.com/metaplex-foundation/metaplex-program-library/blob/f0ba11e0b490e346cfa581a236602d4ed1d0fa6a/candy-machine/program/src/lib.rs#L49-L50

gagliardetto commented 2 years ago

You need to fetch the candy machine, parse it, and use the Wallet field.

    candyMachine, err := anchorProram.GetAccountInfo(context.TODO(), candyMachineAddress)
    if err != nil {
        return "", err
    }
    dec:=bin.NewBorshDecoder(candyMachine.Value.Data.GetBinary())
    var cm CandyMachine
    err= dec.Decode(&cm)
    if err != nil {
        return "", err
    }
    // use cm.Wallet in SetWalletAccount(cm.Wallet)
    fmt.Println(cm.Wallet)
ileFixDev commented 2 years ago

Ohhh yes. That worked. Many, many thanks for your dedicated help. <3

gagliardetto commented 2 years ago

Ohhh yes. That worked. Many, many thanks for your dedicated help. <3

Awesome! :smile:

Closing.

AlienRecall commented 2 years ago

@gagliardetto Hi, I don't want to bother with another issue, so I'll ask here as it's almost the same problem. I'm trying to mint on this candy machine 9TXUXT8WT5HbTDXXin16iFdtgsvR2KnifCZuor41JSVQ but when I send the transaction I get:

(*jsonrpc.RPCError)(0xc000114f30)({
 Code: (int) -32002,
 Message: (string) (len=87) "Transaction simulation failed: Error processing Instruction 4: invalid instruction data",
 Data: (map[string]interface {}) (len=4) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "4",
    (string) (len=22) "InvalidInstructionData"
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=29 cap=32) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=40) "Program log: Instruction: InitializeMint",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2457 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=63) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
   (string) (len=70) "Program log: Transfer 2039280 lamports to the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=60) "Program log: Allocate space for the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=73) "Program log: Assign the associated token account to the SPL Token program",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=52) "Program log: Initialize the associated token account",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
   (string) (len=43) "Program log: Instruction: InitializeAccount",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3297 of 177047 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=91) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 26899 of 200000 compute units",
   (string) (len=60) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=32) "Program log: Instruction: MintTo",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2611 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=73) "Program 11111111111111111111111111111111 failed: invalid instruction data"
  },
  (string) (len=13) "unitsConsumed": (json.Number) (len=5) "31967"
 }
})

I see that there can be problems with my mintTo instruction, so this is how I create it:

mintTo := token.NewMintToInstructionBuilder().
        SetAmount(1).
        SetMintAccount(mint.PublicKey()).
        SetDestinationAccount(userTokenAccountAddress).
        SetAuthorityAccount(payer.PublicKey())

I have tried several things but none worked, can you help me on this? Obv I have tried, with typescript and it worked, so I'm sure that I'm doing something wrong, what it could be?

gagliardetto commented 2 years ago

Hi @AlienRecall

What group of instructions does return that error?

gagliardetto commented 2 years ago

AFAIK you must mint through the candy machine program (it has a mint instruction)

AlienRecall commented 2 years ago

Sorry for the miss understanding, I'm trying to mint a NFT

gagliardetto commented 2 years ago

You're trying to mint an NFT from a candy machine, right?

AlienRecall commented 2 years ago

Yes, I'm trying to write a script that mints a NFT with a given CandyMachineID, same as the guy in this issue

gagliardetto commented 2 years ago

Added an example: https://github.com/gagliardetto/metaplex-go/blob/main/examples/mint-from-candy-machine-v2/mint.go

Let me know if that doesn't work.

AlienRecall commented 2 years ago

Thanks for your time on this example, that helped me a lot, but initially it wasn't working because you missed SetFundingAccount(userKeyPair.PublicKey()). in the NewCreateAccountInstructionBuilder function, after that I was getting Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3, then I've tried to change the SetSpace value always on the instruction 0, from candyMachineRaw.Value.Lamports to uint64(82), after that I got Transaction simulation failed: Error processing Instruction 4: custom program error: 0xa7, what could be the problem? I have to say that I've just copy/pasted your code and changed from MainNetBeta to DevNet, and obviously I've set my secret key and a candy machine

gagliardetto commented 2 years ago

I put the wrong candymachinev2 program ID; fixed, see: https://github.com/gagliardetto/metaplex-go/blob/main/examples/mint-from-candy-machine-v2/mint.go

AlienRecall commented 2 years ago

the error still persist, I get Transaction simulation failed: Error processing Instruction 4: custom program error: 0xa7 and Transaction simulation failed: Error processing Instruction 0: custom program error: 0x3 if I use candyMachineRaw.Value.Lamports as SetSpace value

gagliardetto commented 2 years ago

Updated. Try now.

AlienRecall commented 2 years ago

I had to add SetFundingAccount(userKeyPair.PublicKey()). at instruction 0 (NewCreateAccountInstructionBuilder) or it would gave me insufficient account keys for instruction, after that I get Transaction simulation failed: Error processing Instruction 1: invalid account data for instruction

gagliardetto commented 2 years ago

Try now

AlienRecall commented 2 years ago

the error now is

panic: (*jsonrpc.RPCError)(0xc000223410)({
 Code: (int) -32002,
 Message: (string) (len=89) "Transaction simulation failed: Error processing Instruction 4: custom program error: 0xa7",
 Data: (map[string]interface {}) (len=4) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "4",
    (map[string]interface {}) (len=1) {
     (string) (len=6) "Custom": (json.Number) (len=3) "167"
    }
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=31 cap=32) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: InitializeMint2",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2008 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=63) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
   (string) (len=70) "Program log: Transfer 2039280 lamports to the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=60) "Program log: Allocate space for the associated token account",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=73) "Program log: Assign the associated token account to the SPL Token program",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=52) "Program log: Initialize the associated token account",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
   (string) (len=43) "Program log: Instruction: InitializeAccount",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3297 of 171989 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=91) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 31957 of 200000 compute units",
   (string) (len=60) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=32) "Program log: Instruction: MintTo",
   (string) (len=89) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2611 of 200000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=62) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ invoke [1]",
   (string) (len=39) "Program log: Custom program error: 0xa7",
   (string) (len=89) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ consumed 5346 of 200000 compute units",
   (string) (len=86) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ failed: custom program error: 0xa7"
  },
  (string) (len=13) "unitsConsumed": (json.Number) (len=5) "36576"
 }
})
AlienRecall commented 2 years ago

nevermind, worked, thank you so much for your help

ghazimuharam commented 2 years ago

Hello @AlienRecall, I got the same error as your when I try to mint the NFT, is there anything I should do to get rid of this error? thank you

kalashnikovn commented 2 years ago

Hello, i have same issue

panic: (*jsonrpc.RPCError)(0x140003ad590)({
 Code: (int) -32002,
 Message: (string) (len=89) "Transaction simulation failed: Error processing Instruction 4: custom program error: 0xa7",
 Data: (map[string]interface {}) (len=4) {
  (string) (len=8) "accounts": (interface {}) <nil>,
  (string) (len=3) "err": (map[string]interface {}) (len=1) {
   (string) (len=16) "InstructionError": ([]interface {}) (len=2 cap=2) {
    (json.Number) (len=1) "4",
    (map[string]interface {}) (len=1) {
     (string) (len=6) "Custom": (json.Number) (len=3) "167"
    }
   }
  },
  (string) (len=4) "logs": ([]interface {}) (len=25 cap=32) {
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [1]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=41) "Program log: Instruction: InitializeMint2",
   (string) (len=90) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2250 of 1400000 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=63) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL invoke [1]",
   (string) (len=19) "Program log: Create",
   (string) (len=51) "Program 11111111111111111111111111111111 invoke [2]",
   (string) (len=48) "Program 11111111111111111111111111111111 success",
   (string) (len=52) "Program log: Initialize the associated token account",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [2]",
   (string) (len=44) "Program log: Instruction: InitializeAccount3",
   (string) (len=90) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 2958 of 1385556 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=92) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL consumed 15775 of 1397750 compute units",
   (string) (len=60) "Program ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL success",
   (string) (len=62) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA invoke [1]",
   (string) (len=32) "Program log: Instruction: MintTo",
   (string) (len=90) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA consumed 3022 of 1381975 compute units",
   (string) (len=59) "Program TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA success",
   (string) (len=62) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ invoke [1]",
   (string) (len=39) "Program log: Custom program error: 0xa7",
   (string) (len=90) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ consumed 5349 of 1378953 compute units",
   (string) (len=86) "Program cndyAnrLdpjq1Ssp1z8xxDsB8dxe7u4HL5Nxi2K5WXZ failed: custom program error: 0xa7"
  },
  (string) (len=13) "unitsConsumed": (json.Number) (len=5) "21047"
 }
})

goroutine 1 [running]: