Deploy to a blockchain
In this tutorial you deploy a MUD application to our test blockchain, Garnet (opens in a new tab)
Setup
Create a new MUD application from the template.
Use the vanilla template.
pnpm create mud@latest tutorial --template vanilla
cd tutorial
pnpm devDeployment
-
Change to the
contractspackage.cd packages/contracts -
See that
foundry.tomlhas a[profile.garnet]section with the RPC URL. -
Connect to the Garnet faucet (opens in a new tab) to obtain test ETH.
-
Specify the private key for the address that got the test ETH on Garnet.
export PRIVATE_KEY=0x <your private key goes here> -
Deploy using the
mud deploycommand.pnpm mud deploy --profile garnet -
After the deployment is over, look at the
Worldinformation. The key,17069, is the chain ID for Garnet.cat worlds.json | jq .\"17069\" -
To go to your application, specify the chain ID on the URL (opens in a new tab). You can also quit out of the
pnpm devand specify the chain ID when running vite.cd packages/client export VITE_CHAIN_ID=17069 pnpm viteWhen you do that, it is no longer necessary to specify the chain ID on the URL. The default URL (opens in a new tab) takes you directly to the onchain application.