gi
This is a basic dApp to demonstrate how to build on stacks.
Contracts holds all of the clarity contracts that are published to stacks and that users can interact with.
This is our clarity smart contract that we will publish to the chain and interact with from the frontend.
To test:
- Install Clarinet
cd contracts
clarinet console
- In the console:
(contract-call? .hello-stacks write-message u"Hello there")
- In the console:
To test on devnet (required for later):
- In
contracts
:clarinet integrate
- While devnet is loading: install Leather on Chrome
- In Leather: press use existing key, then paste the mnemonic from
accounts.wallet_1
insettings/Devnet.toml
- Set a password for Leather
- Go to
localhost:8000
- Look through the transactions (bottom right) and find the contract deploy of hello-stacks
- If you can't find it, press 'View All Recent Transactions' at the bottom
- Copy the contract field of the transaction
- Press 'Sandbox' (top right)
- Press 'Connect Stacks Wallet'
- Connect with the imported account
- Press the function symbol (call functions)
- Paste in the copied contract field into the top input box
- Press 'Get Contract'
- Press 'write-message'
- Add a message and press 'call function'
- Confirm the transaction on the wallet
- Go back to the 'Transactions' page and look for the confirmed transaction
This is our basic React frontend that interacts with the smart contracts. It allows a user to send and receive a message.
To test:
- Make sure devnet is running (follow previous instructions)
- In a different terminal:
cd frontend
yarn install
yarn dev
- Go to
localhost:5173
- Submit a message using the UI
- Go back to the block explorer (
localhost:8000
) and wait for the message to be processed by the chain - Copy the transaction ID and paste it back into the frontend (
localhost:5173
) to retrieve the message