About this tutorial: Deploy and launch a local Web application based on the Agoric SDK. Deploy smart contracts and some basic operations on the application. Start the local Web application based on the Agoric SDK deployment.
Note that smart contract writing and testing are not covered. Join our Discord to learn more about that.
Some parts of the deployment process were difficult to describe in words. So some images were inserted to illustrate.
Related websites and Docs are listed below for quick looking up.
# Docs
https://agoric.com/documentation
https://agoric.com/documentation/getting-started/beta.html
https://agoric.com/documentation/getting-started/deploying.html#how-it-works
# Websites
https://agoric.com/
https://commonwealth.im/agoric
https://agoric.com/discord
Agoric uses the Agoric Zoe framework to write JavaScript smart contracts. Therefore the Nodejs package must be installed first.
# Download and install the latest stable version of nodejs
curl -fsSL https://deb.nodesource.com/setup_lts.x | bash - && \
apt-get install -y nodejs build-essential gcc g++ make
# yarn
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add - && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" |tee /etc/apt/sources.list.d/yarn.list && \
apt-get update && \
apt-get install -y yarn
# Download the latest agoric-sdk source code
git clone https://github.com/Agoric/agoric-sdk
cd agoric-sdk
# Install NPM dependencies
yarn install
# build
yarn build
# Install the Agoric command line file in the common directory of $PATH (note that the agoric-sdk directory cannot be deleted).
yarn link-cli /usr/local/bin/agoric
# View the current Agoric SDK version
agoric --version
cd ~/ && agoric init demo
cd ~/demo && agoric install
Input multiple commands to start different programs, and they are in a continues state. Therefore multiple terminals are required.
Start the program. It creates a local web application on which the contract will then be deployed. If the listening port appears, it indicates that the operation is normal.
It is normal for the Web page to display blank when you visit it. After starting the Dapp user, the application will be initialized and the content will be displayed when you refresh the page.
agoric start
The screen below shows without depolyment, no application is displayed at the lower left corner on the page when you access local 127.0.0.1:8000
Deploy the contract onto the simulated blockchain and API to "solo" client
The CLI shows it is starting Dapp User Interface. Just wait until they are deployed.
agoric deploy ./contract/deploy.js ./api/deploy.js
The web user interface communicates with the API in the solo client as well as the wallet (below).
Leave this running in its own shell window and visit http://localhost:3000 (opens new window) in a web browser.
cd ui && yarn start
After finishing the start process, there will be some extra informations shown under each command.
And then the webpage shows corresponding contents.
Visit the Dapp page, and the popup will ask to start the Dapp. Go back to http://127.0.0.1:8000/ and authorize the connection. You can view all the launched Dapps on the Dapp page later.
Now the Dapp is working. Click the bottom MINT FUNGIBLE TOKENS
and the Dashboard on http://127.0.0.1:8000/ will show the Offer. Click Approve and 1000 Tokens will be added to the Purses
section, avaliable to be transfered.