Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Added Staking dApp tutorial and playground #277

Merged
merged 13 commits into from
Oct 7, 2024
2 changes: 1 addition & 1 deletion config/social-links.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
{
"label": "Discord",
"icon": "/img/Discord.svg",
"href": "https://discord.gg/bgysa9xjvD"
"href": "https://discord.gg/aelfblockchain"
},
{
"label": "GitHub",
Expand Down
2 changes: 1 addition & 1 deletion docs/about-aelf/community-engagement/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Joining the aelf community offers numerous benefits, including access to the lat

aelf holds regular campaigns and airdrops to distribute tokens to community members, incentivising participation and support. aelf community members can also participate in various bounty programs to earn tokens. Follow aelf official channels to get the latest campaign details!

[X](https://x.com/aelfblockchain/) | [Telegram](https://t.me/aelfblockchain) | [Discord](https://discord.gg/bgysa9xjvD) | [LinkedIn](https://www.linkedin.com/company/aelfblockchain/)
[X](https://x.com/aelfblockchain/) | [Telegram](https://t.me/aelfblockchain) | [Discord](https://discord.gg/aelfblockchain) | [LinkedIn](https://www.linkedin.com/company/aelfblockchain/)

:::

Expand Down
4 changes: 2 additions & 2 deletions docs/about-aelf/partnerships-and-ecosystem/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ After submitting your partnership application, you can expect an initial acknowl

:::faq[What are aelf's marketing channels?]

At aelf, we care about our community. We have several marketing channels for our community to reach out and interact with us. We would love builders, developers and users to join the community on [X](https://x.com/aelfblockchain/), [Telegram](https://t.me/aelfblockchain), [Discord](https://discord.gg/bgysa9xjvD) and [LinkedIn](https://www.linkedin.com/company/aelfblockchain/).
At aelf, we care about our community. We have several marketing channels for our community to reach out and interact with us. We would love builders, developers and users to join the community on [X](https://x.com/aelfblockchain/), [Telegram](https://t.me/aelfblockchain), [Discord](https://discord.gg/aelfblockchain) and [LinkedIn](https://www.linkedin.com/company/aelfblockchain/).

:::

Expand Down Expand Up @@ -129,7 +129,7 @@ Currently, we are focusing our endeavours on improving AI capabilities and integ

Recently, aelf announced its partnership with ChainGPT, a top provider of AI-powered infrastructure for the blockchain industry. This collaboration aims to accelerate aelf's transformation into an AI-enhanced blockchain with ChainGPT's advanced AI chatbots, NFT and smart-contract generators, AI trading assistants, and AI-focused launchpad. aelf is also working with other industry-leading AI innovators to explore integrating AI solutions into its blockchain.

Follow our official channels to stay updated: [X](https://x.com/aelfblockchain/), [Telegram](https://t.me/aelfblockchain), [Discord](https://discord.gg/bgysa9xjvD) and [LinkedIn](https://www.linkedin.com/company/aelfblockchain/).
Follow our official channels to stay updated: [X](https://x.com/aelfblockchain/), [Telegram](https://t.me/aelfblockchain), [Discord](https://discord.gg/aelfblockchain) and [LinkedIn](https://www.linkedin.com/company/aelfblockchain/).

:::

Expand Down
1 change: 1 addition & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ aelf is a high-performance, cloud-native, layer-1 blockchain with Mainnet nodes
- [NFT](/quick-start/developers/nft-dapp/) dApp
- [ToDo](/quick-start/developers/todo-dapp/) dApp
- [Tic-Tac-Toe](/quick-start/developers/tic-tac-toe-dapp/) dApp
- [Expense Tracker](/quick-start/developers/expense-tracker/) dApp

- For node operators
- [Simulate](/quick-start/node-operators/simulating-a-bp-node/) a BP node
Expand Down
113 changes: 113 additions & 0 deletions docs/quick-start/developers/_deploy_expense_tracker.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#### Create A Wallet

To send transactions on the aelf blockchain, you must have a wallet.

- Run this command to create aelf wallet.

```bash title="Terminal"
aelf-command create
```

![result](/img/create_wallet_output.png)

- You will be prompted to save your account, please do **save** your account as shown below:

```bash title="Terminal"
? Save account info into a file? (Y/n) Y
```

**Make sure to choose Y to save your account information.**

:::tip
ℹ️ 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.
:::

- Next, enter and confirm your password. Then export your wallet password as shown below:

```bash title="Terminal"
export WALLET_PASSWORD="YOUR_WALLET_PASSWORD"
```

#### Acquire Testnet Tokens (Faucet) for Development

To deploy smart contracts or execute on-chain transactions on aelf, you'll require testnet ELF tokens.

**Get ELF Tokens**

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cli" label="CLI" default>

**1. Get Testnet ELF Tokens:**

To receive testnet ELF tokens, run this command after replacing `$WALLET_ADDRESS` and `$WALLET_PASSWORD` with your wallet details:

```bash title="Terminal"
export WALLET_ADDRESS="YOUR_WALLET_ADDRESS"
curl -X POST "https://faucet.aelf.dev/api/claim?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d ""
```

**2. Check ELF Balance:**

To check your ELF balance, use:

```bash title="Terminal"
aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance
```

You will be prompted for the following:

```sh title="Terminal"
Enter the required param <symbol>: ELF
Enter the required param <owner>: **$WALLET_ADDRESS**
```

You should see the result displaying your wallet's ELF balance.

</TabItem>
<TabItem value="web" label="Web" default>

Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`.

![result](/img/get-token-ui.png)

</TabItem>
</Tabs>

**Deploy Smart Contract:**

The smart contract needs to be deployed on the chain before users can interact with it.

Run the following command to deploy a contract. Remember to export the path of ExpenseTracker.dll.patched to CONTRACT_PATH.

```bash title="Terminal"
export CONTRACT_PATH=$(find ~+ . -path "*patched*" | head -n 1)
```

```bash title="Terminal"
aelf-deploy -a $WALLET_ADDRESS -p $WALLET_PASSWORD -c $CONTRACT_PATH -e https://tdvw-test-node.aelf.io/
```

- Please wait for approximately 1 to 2 minutes. If the deployment is successful, it will provide you with the contract address.
![result](/img/deploy-result.png)

- Copy the smart contract address from the `address` field
![result](/img/Contract_Address.png)

- Export your smart contract address:

```bash title="Terminal"
export CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS e.g. 2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS"
```

:::tip
ℹ️ Note: You are to copy the smart contract address as we will be referencing it in the next steps!
:::

:::info
🎉 You have successfully deployed your Expense Tracker 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!
:::


113 changes: 113 additions & 0 deletions docs/quick-start/developers/_deploy_single_pool_staking.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
#### Create A Wallet

To send transactions on the aelf blockchain, you must have a wallet.

- Run this command to create aelf wallet.

```bash title="Terminal"
aelf-command create
```

![result](/img/create_wallet_output.png)

- You will be prompted to save your account, please do **save** your account as shown below:

```bash title="Terminal"
? Save account info into a file? (Y/n) Y
```

**Make sure to choose Y to save your account information.**

:::tip
ℹ️ 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.
:::

- Next, enter and confirm your password. Then export your wallet password as shown below:

```bash title="Terminal"
export WALLET_PASSWORD="YOUR_WALLET_PASSWORD"
```

#### Acquire Testnet Tokens (Faucet) for Development

To deploy smart contracts or execute on-chain transactions on aelf, you'll require testnet ELF tokens.

**Get ELF Tokens**

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';

<Tabs>
<TabItem value="cli" label="CLI" default>

**1. Get Testnet ELF Tokens:**

To receive testnet ELF tokens, run this command after replacing `$WALLET_ADDRESS` and `$WALLET_PASSWORD` with your wallet details:

```bash title="Terminal"
export WALLET_ADDRESS="YOUR_WALLET_ADDRESS"
curl -X POST "https://faucet.aelf.dev/api/claim?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d ""
```

**2. Check ELF Balance:**

To check your ELF balance, use:

```bash title="Terminal"
aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $WALLET_ADDRESS -p $WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance
```

You will be prompted for the following:

```sh title="Terminal"
Enter the required param <symbol>: ELF
Enter the required param <owner>: **$WALLET_ADDRESS**
```

You should see the result displaying your wallet's ELF balance.

</TabItem>
<TabItem value="web" label="Web" default>

Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`.

![result](/img/get-token-ui.png)

</TabItem>
</Tabs>

**Deploy Smart Contract:**

The smart contract needs to be deployed on the chain before users can interact with it.

Run the following command to deploy a contract. Remember to export the path of SinglePoolStaking.dll.patched to CONTRACT_PATH.

```bash title="Terminal"
export CONTRACT_PATH=$(find ~+ . -path "*patched*" | head -n 1)
```

```bash title="Terminal"
aelf-deploy -a $WALLET_ADDRESS -p $WALLET_PASSWORD -c $CONTRACT_PATH -e https://tdvw-test-node.aelf.io/
```

- Please wait for approximately 1 to 2 minutes. If the deployment is successful, it will provide you with the contract address.
![result](/img/deploy-result.png)

- Copy the smart contract address from the `address` field
![result](/img/Contract_Address.png)

- Export your smart contract address:

```bash title="Terminal"
export CONTRACT_ADDRESS="YOUR_SMART_CONTRACT_ADDRESS e.g. 2LUmicHyH4RXrMjG4beDwuDsiWJESyLkgkwPdGTR8kahRzq5XS"
```

:::tip
ℹ️ Note: You are to copy the smart contract address as we will be referencing it in the next steps!
:::

:::info
🎉 You have successfully deployed your Single Pool Staking 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!
:::


2 changes: 1 addition & 1 deletion docs/quick-start/developers/_setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TabItem from '@theme/TabItem';

**Install Required Packages**

- [Install dotnet 6.0 SDK](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [Install dotnet 8.0.x SDK](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- Install aelf contract templates

```bash title="Terminal"
Expand Down
Loading
Loading