Simple token aleo full stack dApp to create your own token and control minting of your token with your deployed wallet address.
- Download the Puzzle Wallet (alpha) from the Chrome store here
- Follow the instructions in the wallet to create an Aleo address
- Follow the instructions here for downloading Rust & Leo
- Clone this repo
gh repo clone puzzlehq/build-a-token
- Cd into the program folder
- Rename the program to the name of your choice (must be more than 9 characters)
- Update name of the inputs file with the new name
- Update name of the program in the program.json with the new name
- Hardcode your wallet address for deploying in the fields marked OWNER_ADDRESS
- Delete .env.example and replace with a .env with the same fields
- Replace the private key field with the private key of the address you are using to deploy
- Clean any existing build and outputs files by running:
leo clean
- Create a new main.aleo file for your token aleo program by running a function with Leo cli like:
leo run mint_private aleo1726dd49l5u7tcqaqxksrk6pw5kfcdxvevvkas4j3lmns882frcxqp45h9j 100u64
The new main.aleo will be in the build folder under program now -- you will need this to deploy the program to the Aleo network.
- Fund the aleo address you are using for deployment via the faucet QR code in the faucet tab of the wallet
- Deploy the
.aleo
program through dev.puzzle.online
- In
Dashboard.tsx
, change the program id in useRecords hook to the name of your deployed program - In
Dashboard.tsx
, change the program id in useExecute hook to the name of your deployed program - Hardcode your owner address in
Dashboard.tsx
at the bottom to unlock mint functionality in UI - In
Mint.tsx
, change the program id in useRecords hook to the name of your deployed program - In
Mint.tsx
, change the program id in useExecute hook to the name of your deployed program - Run
pnpm i && pnpm dev
(or your package manager of choice) - Connect your Puzzle wallet
- When your owner account is connected, you'll be able to mint tokens
- You can transfer tokens with any connected account that has a balance of these newly minted tokens
- Create another wallet and try connecting your account -- you'll see that you can't mint token