solanasolana-web3jsmetaplexsolana-clicandy-machine

Setting up GenesysGo as RPC Host on Candy Machine V2


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.


Solution

  • 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.