This is a basic Agoric Dapp that contains three smart contracts postal-service, sell-concert-tickets, and swaparoo, demonstrating different scenarios which can be implemented easily using Agoric SDK. There is also a UI for the sell-concert-tickets contract that a user can use to buy three different types of concert tickets and pay through a wallet extension in the browser.
The following instructions provide a guide to setup an environment for trying dapp-agoric-basics on your local machine. You can also try it in GitHub Codespaces without any local installations or downloads.
Make sure all the required dependencies are already installed (including Node.js, nvm, Docker, Keplr, and that your Node.js version is supported by running nvm use 20 [substituting a later version as appropriate]. See a tutorial here on how to install these dependencies.). Here are the steps to run dapp-agoric-basics:
- Run
yarn installin theagoric-basicsdirectory, to install dependencies of the Dapp. - Run
yarn start:dockerto start the Agoric blockchain in the container. - Run
yarn docker:logsto make sure blocks are being produced by viewing the Docker logs; once your logs resemble the following, stop the logs by pressingctrl+c.demo-agd-1 | 2023-12-27T04:08:06.384Z block-manager: block 1003 begin demo-agd-1 | 2023-12-27T04:08:06.386Z block-manager: block 1003 commit demo-agd-1 | 2023-12-27T04:08:07.396Z block-manager: block 1004 begin demo-agd-1 | 2023-12-27T04:08:07.398Z block-manager: block 1004 commit demo-agd-1 | 2023-12-27T04:08:08.405Z block-manager: block 1005 begin demo-agd-1 | 2023-12-27T04:08:08.407Z block-manager: block 1005 commit - Run
yarn start:contractto start the contracts. - Run
yarn start:uito startsell-concert-ticketscontract UI. - Open a browser and navigate to localhost:5173 to interact with the contract via UI.
See a more detailed tutorial.
To perform unit tests:
- Run
yarn testin the root directory.
To perform end to end tests:
- Run
yarn test:e2ein the root directory.
Here are the step-by-step instructions to run/work on dapp-agoric-basic in GitHub Codespaces:
- Go to repo here: https://github.com/Agoric/dapp-agoric-basics/
- Click on the green <> Code button:
- Click on Codespaces tab and create a new Codespace. If you are already using Codespaces on current repo then click the + button on top right of the Codespaces tab to create a new one.
- You should see a VS Code environment load in your browser followed by a setup. This should take a few minutes.
- Run
yarn start:dockerfollowed byyarn docker:logs- kill it after you seebegin/commit. - Run
yarn start:contract. - Run
yarn start:ui- a pop-up should appear at bottom right. Click open in browser if needed. - Dapp should be loaded in your browser.
- Connect your Wallet and interact with Dapp as usual.
See CONTRIBUTING for more on contributions.
