Skip to content

Commit 7dfd937

Browse files
feat: documentation of donation tutorials (#372)
* feat: WIP - donation-dapp * fix: updated steps number * feat: added withdrawal step in run application of frontend integration step * added smart contract build instructions * hygiene fixes * added unit testing examples --------- Co-authored-by: tanuj-aelf <[email protected]>
1 parent 896c76a commit 7dfd937

40 files changed

+2132
-0
lines changed

docs/index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ aelf is a high-performance, cloud-native, layer-1 blockchain with Mainnet nodes
3030
- [Staking](/quick-start/developers/single-pool-staking-dapp/) dApp
3131
- [Dice Game](/quick-start/developers/dice-game-dapp/) dApp
3232
- [NFT Indexer](/quick-start/advance-tutorials/nft-indexer/) dApp
33+
- [Donation](/quick-start/developers/donation-dapp/) dApp
3334

3435
- For node operators
3536
- [Simulate](/quick-start/node-operators/simulating-a-bp-node/) a BP node
Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
#### Create A Wallet
2+
3+
To send transactions on the aelf blockchain, you must have a wallet.
4+
5+
- Run this command to create aelf wallet.
6+
7+
```bash title="Terminal"
8+
aelf-command create
9+
```
10+
11+
![result](/img/create_wallet_output.png)
12+
13+
- You will be prompted to save your account, please do **save** your account as shown below:
14+
15+
```bash title="Terminal"
16+
? Save account info into a file? (Y/n) Y
17+
```
18+
19+
**Make sure to choose Y to save your account information.**
20+
21+
:::tip
22+
ℹ️ Note: If you do not save your account information (by selecting n or N), do not export the wallet password. Only **proceed to the next** step if you have saved your account information.
23+
:::
24+
25+
- Next, enter and confirm your password. Then export your wallet address and password as shown below:
26+
27+
<Tabs>
28+
<TabItem value="Linux and macOs" label="Linux and macOs" default>
29+
```bash title="Terminal"
30+
export WALLET_ADDRESS="YOUR_WALLET_ADDRESS"
31+
```
32+
</TabItem>
33+
34+
<TabItem value="Windows" label="Windows">
35+
```bash title="Command Prompt"
36+
$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS"
37+
```
38+
</TabItem>
39+
</Tabs>
40+
41+
<Tabs>
42+
<TabItem value="Linux and macOs" label="Linux and macOs" default>
43+
```bash title="Terminal"
44+
export WALLET_PASSWORD="YOUR_WALLET_PASSWORD"
45+
```
46+
</TabItem>
47+
48+
<TabItem value="Windows" label="Windows">
49+
```bash title="Command Prompt"
50+
$env:WALLET_PASSWORD = "YOUR_WALLET_PASSWORD"
51+
```
52+
</TabItem>
53+
</Tabs>
54+
55+
#### Acquire Testnet Tokens (Faucet) for Development
56+
57+
To deploy smart contracts or execute on-chain transactions on aelf, you'll require testnet ELF tokens.
58+
59+
**Get ELF Tokens**
60+
61+
Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`.
62+
63+
![result](/img/get-token-ui.png)
64+
65+
**Deploy Smart Contract:**
66+
67+
The smart contract needs to be deployed on the chain before users can interact with it.
68+
69+
Run the following command to deploy a contract. Remember to export the path of DonationApp.dll.patched to CONTRACT_PATH.
70+
71+
<Tabs>
72+
<TabItem value="Linux and macOs" label="Linux and macOs" default>
73+
```bash title="Terminal"
74+
export CONTRACT_PATH=$(find ~+ . -path "*patched*" | head -n 1)
75+
```
76+
77+
```bash title="Terminal"
78+
aelf-deploy -a $WALLET_ADDRESS -p $WALLET_PASSWORD -c $CONTRACT_PATH -e https://tdvw-test-node.aelf.io/
79+
```
80+
81+
</TabItem>
82+
83+
<TabItem value="Windows" label="Windows">
84+
```bash title="Command Prompt"
85+
$CONTRACT_PATH = Get-ChildItem -Recurse -Filter "*patched*" | Select-Object -First 1 -ExpandProperty FullName
86+
$env:CONTRACT_PATH = $CONTRACT_PATH
87+
```
88+
89+
```bash title="Command Prompt"
90+
aelf-deploy -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -c $env:CONTRACT_PATH -e https://tdvw-test-node.aelf.io/
91+
```
92+
93+
</TabItem>
94+
</Tabs>
95+
96+
- Please wait for approximately 1 to 2 minutes. If the deployment is successful, it will provide you with the contract address.
97+
![result](/img/deploy-result.png)
98+
99+
- Copy the smart contract address from the `address` field
100+
![result](/img/Contract_Address.png)
101+
102+
- Export your smart contract address:
103+
104+
<Tabs>
105+
<TabItem value="Linux and macOs" label="Linux and macOs" default>
106+
```bash title="Terminal"
107+
export CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS e.g. 2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS"
108+
```
109+
</TabItem>
110+
111+
<TabItem value="Windows" label="Windows">
112+
```bash title="Command Prompt"
113+
$env:CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS e.g. 2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS"
114+
```
115+
</TabItem>
116+
</Tabs>
117+
118+
:::tip
119+
ℹ️ Note: You are to copy the smart contract address as we will be referencing it in the next steps!
120+
:::
121+
122+
:::info
123+
🎉 You have successfully deployed your Donation dApp smart contract on the aelf testnet! In the next steps, we will be building the frontend components that allow us to interact with our deployed smart contract!
124+
:::
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## 🎯 Conclusion
2+
3+
🎉 Congratulations on completing the **Donation dApp** tutorial! 🎉 You've taken a significant leap into blockchain development by creating a fully functional Donation dApp on the aelf blockchain. 🌟
4+
5+
**📚 What You've Learned**
6+
7+
Throughout this tutorial, you've gained expertise in:
8+
9+
- **🛠️ Setting Up Your Development Environment**: Preparing your workspace with all the tools and configurations needed for your blockchain journey.
10+
11+
- **💻 Developing Your Smart Contract**: Writing and deploying a smart contract that handles campaign creation, donations, and fund management.
12+
13+
- **🚀 Deploying the Smart Contract**: Bringing your smart contract to life on the aelf blockchain, making it ready for real-world use.
14+
15+
- **🔧 Building a Fully Interactive dApp**: Integrating wallet connectivity, creating and managing campaigns, processing donations, and ensuring a seamless user experience.
16+
17+
18+
**🔍 Final Output**
19+
20+
By the end of this tutorial, you've achieved:
21+
22+
- **📜 A Deployed Donation Smart Contract**: Capable of managing campaigns with features like creation, editing, deletion, and fund withdrawal.
23+
24+
- **💻 An Operational Donation dApp**: Empowering users to donate, view campaign details, and manage profiles effortlessly.
25+
26+
27+
**➡️ What's Next?**
28+
29+
Now that you've mastered the basics, here are some advanced ideas to explore:
30+
31+
- **📈 Advanced Features**: Add functionalities like recurring donations, donor recognition, or campaign performance analytics.
32+
33+
- **🔒 Enhancing Security**: Implement additional measures to secure user funds and protect sensitive data.
34+
35+
- **🌍 Cross-Chain Interoperability**: Leverage aelf’s cross-chain capabilities to expand your Donation dApp to other blockchain ecosystems.
36+
37+
The world of decentralized applications holds limitless possibilities. With your newfound skills, you're ready to innovate, build, and make a meaningful impact with blockchain technology. 🚀
38+
39+
Happy coding and scaling your **Donation dApp!** 😊

0 commit comments

Comments
 (0)