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 dev
Deployment
-
Change to the
contracts
package.cd packages/contracts
-
See that
foundry.toml
has 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 deploy
command.pnpm mud deploy --profile garnet
-
After the deployment is over, look at the
World
information. 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 dev
and specify the chain ID when running vite.cd packages/client export VITE_CHAIN_ID=17069 pnpm vite
When 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.