1

I am finalizing my first Candy Machine minting project using Candy Machine V2. I have read that its not a good idea to use the default https://api.mainnet-beta.solana.com host because it can't handle large amounts of traffic. I've update the Candy Machine .env file to use the GeneysisGo endpoint (https://shdw.genesysgo.com/genesysgo/the-genesysgo-rpc-network), my .env file looks like this:

REACT_APP_CANDY_MACHINE_ID=<my ID>

REACT_APP_SOLANA_NETWORK=mainnet-beta
REACT_APP_SOLANA_RPC_HOST=https://ssc-dao.genesysgo.net/
SKIP_PREFLIGHT_CHECK=true

I was reading this article: https://medium.com/@elysianft/lets-put-an-end-to-bad-drops-on-solana-c8cfd6d33e69. It mentions to find the web3.clusterApiUrl(env) and change it with the updated RPC URL from GeneysisGo but I don't see that line in the asssets.ts file as the article mentions. I only see those lines in the following two files:

App.tsx: (looks like this file already takes the rpcHost if there is one).

const connection = new anchor.web3.Connection(
  rpcHost ? rpcHost : anchor.web3.clusterApiUrl('devnet'),
);

cli-nft.ts: Original:

const connection = new web3.Connection(web3.clusterApiUrl(env));

After my update:

const connection = new web3.Connection(rpcUrl || web3.clusterApiUrl(env));

My question is should I actually update this files or is the article out of date?

Any help is appreciated.

bschmitty
  • 1,118
  • 3
  • 16
  • 46

1 Answers1

1

You dont have to change any code atm, that guide is really outdated!.

In order to use a custom RPC you just have to change the .env file and nothing else. Just make sure to use the latest version of candy-machine-ui. Your env file is completly correct btw.

WrathionTBP
  • 832
  • 2
  • 6
  • OK great, that is good to know! I did run "solana config set —url https://ssc-dao.genesysgo.net/" as the article mentioned. Which gave me a successful console output of: "RPC URL: https://ssc-dao.genesysgo.net/". Is this correct? And I don't need to re-upload my assets to candy machine after making this RPC change then do I? – bschmitty Jun 13 '22 at 03:43
  • 1
    `solana config set` wont affect any CMv2 CLI command and wont affect the CMui. In order to use an RPC on a CMv2 cli command you have to add `--rpc-url https://ssc-dao.genesysgo.net` at the end of ur command. You should run `verify_upload` before minting any NFT to check that ur NFTs are ready to go (https://docs.metaplex.com/candy-machine-v2/verify-upload). Also you should follow the official metaplex docs, because are updated (https://docs.metaplex.com/candy-machine-v2/introduction) – WrathionTBP Jun 13 '22 at 03:46
  • When I try to run: "solana config set --rpc-url https://ssc-dao.genesysgo.net" I get: "error: Found argument '--rpc-url' which wasn't expected, or isn't valid in this context". I also tried: "solana config set --url --rpc-url https://ssc-dao.genesysgo.net". What am I missing there? Do I need to be running this command in the terminal if I have already updated the .env file? – bschmitty Jun 13 '22 at 03:51
  • 1
    You dont have to use `solana config set` that is a separate CLI that wont work with metaplex cli. You dont have to use it, the env file is the important thing on the webpage and `--rpc-url` just work to add an rpc into a CandyMachine command like this one `ts-node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e mainnet-beta -k ~/.config/solana/devnet.json -cp config.json -c example --rpc-url https://ssc-dao.genesysgo.net ./assets` in this example Im creating a candy machine in mainnet using a custom rpc. – WrathionTBP Jun 13 '22 at 03:56
  • OK yea when I uploaded my assets I ran: ` ts -node ~/metaplex/js/packages/cli/src/candy-machine-v2-cli.ts upload -e mainnet-beta -k ~/.config/solana/devnet.json -cp config.json -c example ./assets` So everything except the `--rpc-url` portion. I don't need to re-run that command now though do I after changing to a custom RPC endpoint? I just ran verify_upload again and all is looking good: `Using cluster mainnet-beta uploaded (100) out of (100) ready to deploy!` – bschmitty Jun 13 '22 at 04:02
  • 1
    Yeah you will use `https://api.mainnet-beta.solana.com` if you dont use `--rpc-url`, but for high-load commands like `upload` or `withdraw` you should use an rpc with that flag. Check the red box on the `upload` docs (https://docs.metaplex.com/candy-machine-v2/creating-candy-machine) – WrathionTBP Jun 13 '22 at 04:05
  • OK I see, that makes sense. So for larger collections of say 5K and above I should use the `rpc-url` in the upload command and then that same `rpc-url` in the `.env` file. Right now my terminal shows `RPC URL: https://ssc-dao.genesysgo.net/`, should I re-run `solana config set --url https://api.mainnet-beta.solana.com` or should I leave it at the custom RPC as it is now? Does it matter as long as the .env file has `REACT_APP_SOLANA_RPC_HOST=https://ssc-dao.genesysgo.net/`? – bschmitty Jun 13 '22 at 04:14