metaplex-foundation / metaplex

A directory of what the Metaplex Foundation works on!
https://metaplex.com
Apache License 2.0
3.31k stars 6.27k forks source link

[Bug]: Attempt to debit an account but found no record of a prior credit. #2017

Closed FaisalAli19 closed 2 years ago

FaisalAli19 commented 2 years ago

Which package is this bug report for?

candy machine cli

Issue description

When uploading the images and JSON using nft.storage keep throwing "Attempt to debit an account but found no record of a prior credit." error.

Here is the config file { "price": 5.0, "number": 10000, "gatekeeper": null, "solTreasuryAccount": "", "splTokenAccount": null, "splToken": null, "goLiveDate": "1st April 2022 00:00:00 GMT", "endSettings": null, "whitelistMintSettings": null, "hiddenSettings": null, "storage": "nft-storage", "ipfsInfuraProjectId": null, "ipfsInfuraSecret": null, "nftStorageKey": "", "awsS3Bucket": null, "noRetainAuthority": false, "noMutable": false, "batchSize": 10000 }

Please help me solve this issue. Also is there a way to achieve manual image and json upload ?

Thanks.

Command

ts-node js/packages/cli/src/candy-machine-v2-cli.ts upload -e mainnet-beta -k /Users/jinesh/.config/solana/mainnet_legends.json -cp config.json -c example ./assets

Relevant log output

wallet public key: GLSAiXUv67yjC9rUYfKQJ3XAdNS6sb8hjh8JTitrmonr
USING CUSTOM URL https://psytrbhymqlkfrhudd.dev.genesysgo.net:8899/
(node:51641) ExperimentalWarning: buffer.Blob is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
Beginning the upload for 10000 (img+json) pairs
started at: 1648404103220
initializing candy machine
Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.

Translating error SendTransactionError: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.
    at Connection.sendEncodedTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: []
}
Error deploying config to Solana network. SendTransactionError: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.
    at Connection.sendEncodedTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: []
}
upload was not successful, please re-run. SendTransactionError: failed to send transaction: Transaction simulation failed: Attempt to debit an account but found no record of a prior credit.
    at Connection.sendEncodedTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Connection.sendRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20)
    at async sendAndConfirmRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21)
    at async Provider.send (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18)
    at async Object.rpc [as initializeCandyMachine] (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23)
    at async createCandyMachineV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11)
    at async uploadV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/commands/upload.ts:148:19)
    at async Command.<anonymous> (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) {
  logs: []
}

Operating system

Macos

Priority this issue should have

Medium (should be fixed soon)

Check the Docs First

stegaBOB commented 2 years ago

Looks like the custom RPC youre using is a devnet RPC, but youre trying to upload on mainnet beta.

FaisalAli19 commented 2 years ago

Thanks for pointing it out. But right now I am getting this error even though I have selected the nft.storage Beginning the upload for 10000 (img+json) pairs started at: 1648656720597 initializing candy machine Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1 Program 11111111111111111111111111111111 invoke [1] Transfer: insufficient lamports 999990000, need 16727350800 Program 11111111111111111111111111111111 failed: custom program error: 0x1 Translating error SendTransactionError: failed to send transaction: Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1 at Connection.sendEncodedTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3964:13) at processTicksAndRejections (node:internal/process/task_queues:96:5) at async Connection.sendRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/connection.ts:3921:20) at async sendAndConfirmRawTransaction (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@solana/web3.js/src/util/send-and-confirm-raw-transaction.ts:27:21) at async Provider.send (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/provider.ts:114:18) at async Object.rpc [as initializeCandyMachine] (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/node_modules/@project-serum/anchor/src/program/namespace/rpc.ts:19:23) at async createCandyMachineV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/helpers/accounts.ts:156:11) at async uploadV2 (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/commands/upload.ts:148:19) at async Command. (/Users/jinesh/Desktop/Project/tapintech/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts:269:7) { logs: [ 'Program 11111111111111111111111111111111 invoke [1]', 'Transfer: insufficient lamports 999990000, need 16727350800', 'Program 11111111111111111111111111111111 failed: custom program error: 0x1' ] }

100xlongx commented 2 years ago

Airdrop yourself solana on that wallet. Your error "insufficient lamports" is a result of not having enough sol for the tx.

FaisalAli19 commented 2 years ago

@100xlongx I do have sol in my wallet. But I am trying to upload using the nft.storage option and according to the document no payment is required but for some reason, it's asking for around 16 sol.

https://docs.metaplex.com/candy-machine-v2/configuration

HZfive commented 2 years ago

creating-candy-machine CAUTION To create a Candy Machine, space is allocated on chain to temporarily store the names and URI links (mirroring what is in your .json file in the .cache directory). To store this data on chain, you are required to pay on chain rent costs. After your mint (or whenever you want to end it), you can run the withdraw command to reclaim all of the rent costs. Check the withdraw section for more details. For a 10k collection, the rent costs are approximately 16.7 SOL. This scales linearly with the number of items in your collection. Thus, you can get an approximate on chain rent cost estimate by multiplying the number of items in your collection by 0.00167 SOL.

stegaBOB commented 2 years ago

Thanks for linking the docs! Closing this issue