Ready. This template is published in uzolabs/templates and has been deployed and verified on testnet. It’s a learning template and hasn’t been audited. Use test funds only.
What you’ll build
A copy of one template in a folder of your own, with its contract deployed and verified on testnet and its web app running athttp://localhost:5173. The steps below use the token template. Swap token for nft, dex-integration or gasless-app to use another one.
Prerequisites
- Node.js 20.19 or newer, Foundry, a browser wallet and some tBOT. See Prerequisites.
- A fresh test wallet that holds nothing of value. You’ll paste its private key into a local
.envfile.
Steps
1
Download the template
giget copies one folder from GitHub without the rest of the repo or its git history.
Terminal
2
Install
Terminal
npm install also installs the web app in frontend/, so there’s no second install.3
Add your test key
Terminal
.env and paste your test wallet’s private key after PRIVATE_KEY=. The file is in .gitignore, so git won’t commit it. Leave MAINNET=false..env
@uzolabs/sdk. Each template adds its own settings below these, such as TOKEN_NAME for the token template.4
Deploy
Terminal
deployments/968.json, with the address and constructor arguments.frontend/.env, withVITE_CONTRACT_ADDRESSandVITE_CHAIN_ID.frontend/src/abi.ts, refreshed from the compiled contract.
npm run deploy:hardhat. Both toolchains build the same contracts/ folder and run the same tests.The DEX integration template has no contract, so it skips this step. Run npm run quote instead.5
Run the web app
Terminal
http://localhost:5173, connect your wallet and, if it asks, click “Switch to BOT Chain Testnet”.Verify
BOTScan is a Blockscout explorer, so verifying source code needs no API key. Wait about a minute after deploying so the explorer can index the contract, then run:Terminal
npm run verify:hardhat if you deployed with Hardhat. Open the BOTScan link from the deploy output and check that the Contract tab shows your source code.
Deploying to mainnet
Add--mainnet to a command, or set MAINNET=true in .env. The script shows a warning and waits for you to type MAINNET. Anything else cancels. It also refuses to run in CI, where nobody can type the confirmation.
Terminal
Troubleshooting
"has 0 tBOT, so it cannot pay for gas"
"has 0 tBOT, so it cannot pay for gas"
Your wallet needs tBOT. Get 10 from the faucet (once per address every 24 hours) and check that the address in the error is the one you funded.
"PRIVATE_KEY is not set"
"PRIVATE_KEY is not set"
Run
cp .env.example .env in the template folder and paste your test key after PRIVATE_KEY=."forge: command not found"
"forge: command not found"
Install Foundry and open a new terminal. On Windows, check that
~/.foundry/bin is on your PATH. See Prerequisites."HTTP request failed" or an RPC 503
"HTTP request failed" or an RPC 503
The public RPC is sometimes busy for a minute. The scripts retry for about 15 seconds. Wait and run the same command again. Steps that already went through are not repeated.
Verification fails right after deploying
Verification fails right after deploying
The explorer hasn’t indexed the contract yet. Wait a minute and run
npm run verify again. It’s safe to run more than once.The web app still shows an old contract
The web app still shows an old contract
Vite reads
frontend/.env when it starts. Stop npm run frontend and start it again after each deploy.npm warns about install scripts
npm warns about install scripts
npm 11 skips some packages’ install scripts until you approve them. The templates don’t need them, so you can ignore the warning.
Next steps
Token walkthrough
What each file in the token template does.
Deploy with Foundry
Deploy and verify by hand with Foundry.