|
1 | 1 | # Agoric Dapps |
2 | 2 |
|
3 | | -**This is a generic guide to Agoric Dapp projects** |
| 3 | +See |
4 | 4 |
|
5 | | -A dapp is a _decentralized application_ which typically has a browser-based user interface, a public API server, and a contract running on the Agoric blockchain. |
6 | | - |
7 | | -## Using a Dapp |
8 | | - |
9 | | -If you have installed the [Agoric CLI](../getting-started/) and you want to try running a dapp locally on a simulated Agoric VM (i.e., it won't be running on an actual public chain), do the following: |
10 | | - |
11 | | -1. Checkout the latest beta release of the SDK. |
12 | | - |
13 | | - ```sh |
14 | | - cd agoric-sdk |
15 | | - git checkout beta |
16 | | - yarn && yarn build |
17 | | - ``` |
18 | | - |
19 | | -2. Run `agoric init` to make a new local copy of a dapp template. |
20 | | - |
21 | | - ```sh |
22 | | - # Here we chose the Fungible Faucet Dapp. |
23 | | - # You can replace `my-fungible-faucet` with a name of your choice. |
24 | | - agoric init --dapp-template dapp-fungible-faucet --dapp-branch beta my-fungible-faucet |
25 | | - cd my-fungible-faucet |
26 | | - # Install the project dependencies |
27 | | - agoric install |
28 | | - # Start the Agoric VM |
29 | | - agoric start --reset |
30 | | - ``` |
31 | | - |
32 | | -3. Leave this command running (it is your simulated environment). |
33 | | -4. In a separate terminal, deploy the contract and API to the VM. |
34 | | - |
35 | | - ```sh secondary style2 |
36 | | - # Deploy a new instance of the contract to the VM |
37 | | - agoric deploy contract/deploy.js |
38 | | - # Reset the VM's API server |
39 | | - agoric deploy api/deploy.js |
40 | | - ``` |
41 | | - |
42 | | -5. In a third terminal, run the following. |
43 | | - |
44 | | - ```sh secondary style3 |
45 | | - # Start the user interface |
46 | | - cd ui && yarn start |
47 | | - ``` |
48 | | - |
49 | | -6. You can now navigate to [http://localhost:3000](http://localhost:3000) to view your dapp. |
50 | | - |
51 | | -## Modifying this Dapp |
52 | | - |
53 | | -In the Agoric system, components are written in Javascript. |
54 | | - |
55 | | -## Components |
56 | | - |
57 | | -The following are the important directories in an Agoric dapp project: |
58 | | - |
59 | | -- [`contract/`](#contract-directory) defines the on-chain smart contract. |
60 | | -- [`api/`](#api-directory) defines the chain-connected server's `/api` HTTP endpoint. |
61 | | -- [`ui/`](#ui-directory) defines the browser user interface connecting users' personal wallets and the API server. |
62 | | - |
63 | | -Other files and directories in this top-level folder should not typically be modified. |
64 | | - |
65 | | -### Contract Directory |
66 | | - |
67 | | -In the `contract` directory, you can find the following files to edit: |
68 | | - |
69 | | -- **src directory**: Contract source code, starting with `src/contract.js`. |
70 | | - |
71 | | -There are also files and folders that you usually shouldn't edit: |
72 | | - |
73 | | -- **deploy.js**: Generic Agoric contract deployment script. |
74 | | - |
75 | | -### API Directory |
76 | | - |
77 | | -In the `api` directory, you can find the following files to edit: |
78 | | - |
79 | | -- **src directory**: Handler for API HTTP endpoints, starting with `src/handler.js`. |
80 | | - |
81 | | -There are also files and folders that you usually shouldn't edit: |
82 | | - |
83 | | -- **deploy.js**: Generic Agoric API handler deployment script. |
84 | | - |
85 | | -### UI Directory |
86 | | - |
87 | | -The `ui` directory is almost completely under your control. The only files and folders that you usually shouldn't edit are: |
88 | | - |
89 | | -- **public/lib**: The Agoric UI library. |
90 | | -- **public/conf**: Configuration files that are generated by the `contract/deploy.js` script. |
91 | | - |
92 | | -## More Information |
93 | | - |
94 | | -You can [learn more about the Agoric smart contract platform](https://agoric.com). |
| 5 | +- [Getting Started](/guides/getting-started/) |
| 6 | +- [Building Client Dapps](/guides/getting-started/contract-rpc.html) |
| 7 | +- [UI Tutorial](/guides/getting-started/ui-tutorial/) |
0 commit comments