diff --git a/docs/_get-testnet-token.md b/docs/_get-testnet-token.md index b62464dc..a1acceb2 100644 --- a/docs/_get-testnet-token.md +++ b/docs/_get-testnet-token.md @@ -2,36 +2,6 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -Run the following command to get testnet ELF tokens from faucet. Remember to either export your wallet address or replace $WALLET_ADDRESS with your wallet address. - -```bash title="Terminal" -curl -X POST "https://faucet.aelf.dev/api/claim?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d "" -``` -To check your wallet's current ELF balance: -```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 -Enter the required param : **ELF** -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the Result displaying your wallet's ELF balance. - - - - Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - \ No newline at end of file diff --git a/docs/about-aelf/elf-token/index.md b/docs/about-aelf/elf-token/index.md index 8417cefc..985958f4 100644 --- a/docs/about-aelf/elf-token/index.md +++ b/docs/about-aelf/elf-token/index.md @@ -14,7 +14,7 @@ description: What is ELF? ELF is the native token of the aelf blockchain, serving multiple critical functions within the ecosystem. ELF is used for paying transaction fees on the aelf blockchain. -ELF is used by developers to pay block index fees, as cross-chain transfers and verifications require the MainChain to index the SideChain's block information. +ELF is used by developers to pay block index fees, as cross-chain transfers and verifications require the MainChain to index the aelf dAppChain's block information. ELF is used by individuals or teams who are interested in becoming block producer nodes. To be one of aelf's block producers, they are required to purchase and deposit ELF tokens to participate in the block producer node election. Upon a successful election, the deposited ELF tokens are locked and will be unlocked and returned once the node steps down, provided no violations have occurred. ELF is used by voters to participate in aelf node elections, with each ELF token equating to one vote. @@ -38,9 +38,9 @@ Ethereum: `0xbf2179859fc6d5bee9bf9158632dc51678a4100e` BSC: `0xa3f020a5c92e15be13caf0ee5c95cf79585eecc9` -MainChain AELF: `ELF_JRmBduh4nXWi1aXgdUsj5gJrzeZb2LxmrAbf7W99faZSvoAaE_AELF` +aelf MainChain: `ELF_JRmBduh4nXWi1aXgdUsj5gJrzeZb2LxmrAbf7W99faZSvoAaE_AELF` -SideChain tDVV: `ELF_7RzVGiuVWkvL4VfVHdZfQF2Tri3sgLe9U991bohHFfSRZXuGX_tDVV` +aelf dAppChain: `ELF_7RzVGiuVWkvL4VfVHdZfQF2Tri3sgLe9U991bohHFfSRZXuGX_tDVV` ::: @@ -105,7 +105,7 @@ As of the latest information, here are the exchanges that support the aelf mainn Exchanges supporting aelf Mainnet include Binance, Bithumb, Upbit, HTX, OKX, Gate.io, MEXC, and these exchanges support deposits and withdrawals of Mainnet ELF tokens. -Please note that the exchanges supporting aelf Mainnet only support token deposits and withdrawals using MainChain AELF. You should never deposit or withdraw using SideChain tDVV as this may result in your tokens being lost forever. +Please note that the exchanges supporting aelf Mainnet only support token deposits and withdrawals using aelf MainChain. You should never deposit or withdraw using aelf dAppChain as this may result in your tokens being lost forever. We recommend verifying the latest information on the exchange platforms or aelf official channels. diff --git a/docs/about-aelf/introduction/index.md b/docs/about-aelf/introduction/index.md index 66e0dc18..8c1399d1 100644 --- a/docs/about-aelf/introduction/index.md +++ b/docs/about-aelf/introduction/index.md @@ -12,7 +12,7 @@ description: What is aelf? :::faq[What is aelf?] -aelf, an AI-enhanced Layer 1 blockchain network, leverages the robust C# programming language for efficiency and scalability across its sophisticated multi-layered architecture. Founded in 2017 with its global hub in Singapore, aelf is a pioneer in the industry, leading Asia in evolving blockchain with state-of-the-art AI integration and modular Layer 2 ZK Rollup technology, ensuring an efficient, low-cost, and highly secure platform that is both developer and end-user friendly. Aligned with its progressive vision, aelf is committed to fostering innovation within its ecosystem and advancing Web3 and AI technology adoption. For more information about aelf, please refer to our [Whitepaper V2.0](https://docs.aelf.com/resources/whitepaper-2/). +aelf, an AI-enhanced Layer 1 blockchain network, leverages the robust C# programming language for efficiency and scalability across its sophisticated multi-layered architecture. Founded in 2017 with its global hub in Singapore, aelf is a pioneer in the industry, leading Asia in evolving blockchain with state-of-the-art AI integration to ensure an efficient, low-cost, and highly secure platform that is both developer and end-user friendly. Aligned with its progressive vision, aelf is committed to fostering innovation within its ecosystem and advancing Web3 and AI technology adoption. For more information about aelf, please refer to our [Whitepaper V2.0](https://docs.aelf.com/resources/whitepaper-2/). ::: @@ -52,7 +52,7 @@ aelf is primarily a multi-chain parallel computing blockchain network which was :::faq[What makes aelf different from other blockchains? Why is aelf unique?] -aelf's unique strength lies in its underlying architecture, which utilises a multi-layered structure comprising a MainChain and multiple SideChains. This differs from a traditional Single Chain system in that aelf is a "Branched Ecosystem", where the MainChain works as the backbone of the system and connects to multiple SideChains. Compared with the traditional "one Chain to any type of Contract", aelf's "One Chain to one type of Contract" design allows aelf to distribute tasks efficiently and process transactions in parallel, significantly enhancing scalability and reducing congestion. At the same time, the SideChains are easier to manage and can be tailored for specific applications, enabling aelf to support a wide range of use cases without compromising performance. +aelf's unique strength lies in its underlying architecture, which utilises a multi-layered structure comprising a MainChain and multiple dAppChains. This differs from a traditional Single Chain system in that aelf is a "Branched Ecosystem", where the MainChain works as the backbone of the system and connects to multiple dAppChains. Compared with the traditional "one Chain to any type of Contract", aelf's "One Chain to one type of Contract" design allows aelf to distribute tasks efficiently and process transactions in parallel, significantly enhancing scalability and reducing congestion. At the same time, the aelf dAppChains are easier to manage and can be tailored for specific applications, enabling aelf to support a wide range of use cases without compromising performance. The [C# programming language](https://learn.microsoft.com/en-us/dotnet/csharp/tour-of-csharp/) forms the foundation of the entire aelf blockchain, which underpins aelf's ability to handle high transaction volumes and complex operations with ease. C# also offers a powerful foundation for AI integration in blockchain development, primarily due to its alignment with the [.NET ecosystem](https://dotnetfoundation.org/), which provides a wide range of libraries and tools that facilitate the development of sophisticated AI models, including the integration of machine learning algorithms, natural language processing (NLP), and data analytics. The integration of AI into the aelf ecosystem marks a significant advancement in the blockchain’s operational capabilities which not only optimises performance and security, but also plays a crucial role in transitioning mass Web2 users to Web3 by significantly improving the overall user and developer experience. @@ -126,7 +126,7 @@ Nevertheless, do continue to stay updated via our [website](https://aelf.com/), The primary cryptocurrency supported on the aelf blockchain is the ELF token. This token has several functions within the aelf ecosystem, including governance, resource allocation, and staking. -As aelf is a multi-chain network with various sidechains, users can unlock utility with other tokens specific to dApps built on the aelf ecosystem, such as [AwakenSwap](https://awaken.finance/), [Portkey](https://portkey.finance/), and [Project Schrodinger](https://schrodingernft.ai/). Here are some of the supported tokens and stablecoins: +As aelf is a multi-chain network with various dAppChains, users can unlock utility with other tokens specific to dApps built on the aelf ecosystem, such as [AwakenSwap](https://awaken.finance/), [Portkey](https://portkey.finance/), and [Project Schrodinger](https://schrodingernft.ai/). Here are some of the supported tokens and stablecoins: - ELF - USDT - BNB diff --git a/docs/about-aelf/partnerships-and-ecosystem/index.md b/docs/about-aelf/partnerships-and-ecosystem/index.md index 3b4b8010..d6e57a37 100644 --- a/docs/about-aelf/partnerships-and-ecosystem/index.md +++ b/docs/about-aelf/partnerships-and-ecosystem/index.md @@ -141,14 +141,14 @@ aelf provides a range of educational resources and developer programmes for thos ::: -### 15. Do aelf ecosystem DApps use tokens on the MainChain or SideChain? When staking and earning rewards on aelf ecosystem DApps, are these staked tokens and reward tokens on the MainChain or SideChain? If I do not have any tokens on the SideChain, do I need to transfer them from the MainChain first? +### 15. Do aelf ecosystem DApps use tokens on the MainChain or dAppChain? When staking and earning rewards on aelf ecosystem DApps, are these staked tokens and reward tokens on the MainChain or dAppChain? If I do not have any tokens on the aelf dAppChain, do I need to transfer them from the MainChain first? -:::faq[Do aelf ecosystem DApps use tokens on the MainChain or SideChain? When staking and earning rewards on aelf ecosystem DApps, are these staked tokens and reward tokens on the MainChain or SideChain? If I do not have any tokens on the SideChain, do I need to transfer them from the MainChain first?] +:::faq[Do aelf ecosystem DApps use tokens on the MainChain or dAppChain? When staking and earning rewards on aelf ecosystem DApps, are these staked tokens and reward tokens on the MainChain or dAppChain? If I do not have any tokens on the dAppChain, do I need to transfer them from the MainChain first?] -Some aelf ecosystem DApps, like Portkey Wallet, ETransfer, and eBridge, can use tokens on either the MainChain or SideChain, while other DApps, like Awaken and Forest, only support the SideChain, depending on the specific application and its design. Generally, more complex operations, such as DApp interactions, are often handled on SideChains to enhance scalability and reduce congestion on the MainChain. +Some aelf ecosystem DApps, like Portkey Wallet, ETransfer, and eBridge, can use tokens on either the MainChain or dAppChain, while other DApps, like Awaken and Forest, only support the aelf dAppChain, depending on the specific application and its design. Generally, more complex operations, such as DApp interactions, are often handled on aelf dAppChains to enhance scalability and reduce congestion on the MainChain. -Typically, when you stake tokens or earn rewards through staking and voting on aelf governance, these activities are carried out on the MainChain. However, if you stake tokens or earn rewards through ecosystem DApps, it depends on the specific rules of those DApps; most of them are carried out on the SideChain. +Typically, when you stake tokens or earn rewards through staking and voting on aelf governance, these activities are carried out on the MainChain. However, if you stake tokens or earn rewards through ecosystem DApps, it depends on the specific rules of those DApps; most of them are carried out on the aelf dAppChain. -If the DApp you are interacting with requires tokens on the SideChain, and you currently only have tokens on the MainChain, you will need to transfer those tokens from the MainChain to the SideChain first. This transfer can usually be done within your Portkey Wallet. +If the DApp you are interacting with requires tokens on the aelf dAppChain, and you currently only have tokens on the MainChain, you will need to transfer those tokens from the MainChain to the aelf dAppChain first. This transfer can usually be done within your Portkey Wallet. ::: \ No newline at end of file diff --git a/docs/about-aelf/technical-and-security/index.md b/docs/about-aelf/technical-and-security/index.md index 69b20a44..93a00c5b 100644 --- a/docs/about-aelf/technical-and-security/index.md +++ b/docs/about-aelf/technical-and-security/index.md @@ -90,12 +90,12 @@ ELF token holders would vote to elect a set of 'Core Data Centers', which are al :::faq[How are transactions processed on the aelf network?] -Transactions on the aelf blockchain are processed through a combination of its AEDPoS (aelf Delegated Proof of Stake) consensus mechanism and sidechain architecture that enables parallel processing. Here's what happens when a user initiates a transaction: -- The transaction is broadcast to the relevant network and sidechain -- The Core Data Center (also known as the miner) of that particular sidechain will validate the transaction and package it into blocks +Transactions on the aelf blockchain are processed through a combination of its AEDPoS (aelf Delegated Proof of Stake) consensus mechanism and dAppChain architecture that enables parallel processing. Here's what happens when a user initiates a transaction: +- The transaction is broadcast to the relevant network and dAppChain +- The Core Data Center (also known as the miner) of that particular dAppChain will validate the transaction and package it into blocks - Through the AEDPoS, the elected Core Data Centers take turns to produce blocks. The produced blocks are validated by other Core Data Centers to ensure accuracy and integrity. -- Once a block is validated and added to the sidechain's blockchain, the transactions are final and irreversible -- In the event a transaction requires interaction between different sidechains, aelf's interoperability ensures the transfer and synchronisation of data across chains. +- Once a block is validated and added to the dAppChain's blockchain, the transactions are final and irreversible +- In the event a transaction requires interaction between different dAppChains, aelf's interoperability ensures the transfer and synchronisation of data across chains. ::: @@ -109,7 +109,7 @@ Some common issues that users may face include network congestion, technical dif Users might experience delays during peak times. -**Solution**: aelf's multi-sidechain architecture distributes workload efficiently to minimise congestion. +**Solution**: aelf's multi-dAppChain architecture distributes workload efficiently to minimise congestion. #### Technical Difficulties Issues with wallet integration or transaction processing. @@ -126,7 +126,7 @@ Navigating the platform might be difficult for new users. **Solution**: User-friendly interfaces and tutorials are provided to ease the onboarding process. -::: + -### 10. How does aelf compare to other blockchain platforms in terms of transaction speed and scalability? +### 9. How does aelf compare to other blockchain platforms in terms of transaction speed and scalability? :::faq[How does aelf compare to other blockchain platforms in terms of transaction speed and scalability?] -aelf stands out in the blockchain landscape with its exceptional transaction speed and scalability. Its multi-sidechain architecture enables parallel processing of transactions, significantly enhancing both speed and scalability compared to traditional single-chain systems. Furthermore, aelf leverages advanced Layer 2 solutions such as ZK Rollups to further improve performance and efficiency. In terms of benchmarking, aelf consistently performs favourably against other leading blockchain platforms in transaction throughput and network efficiency. Additionally, aelf integrates artificial intelligence (AI) to optimise various aspects of its operations, including smart contract execution and network management, which further boosts its performance and scalability. This combination of multi-sidechain architecture, advanced Layer 2 solutions, and AI integration positions aelf as a superior choice in the blockchain arena. +aelf stands out in the blockchain landscape with its exceptional transaction speed and scalability. Its multi-dAppChain architecture enables parallel processing of transactions, significantly enhancing both speed and scalability compared to traditional single-chain systems. In terms of benchmarking, aelf consistently performs favourably against other leading blockchain platforms in transaction throughput and network efficiency. Additionally, aelf integrates artificial intelligence (AI) to optimise various aspects of its operations, including smart contract execution and network management, which further boosts its performance and scalability. This combination of multi-dAppChain architecture, advanced Layer 2 solutions, and AI integration positions aelf as a superior choice in the blockchain arena. ::: -### 11. What is the difference between aelf's MainChain and SideChains? +### 10. What is the difference between aelf's MainChain and dAppChains? -:::faq[What is the difference between aelf's MainChain and SideChains?] +:::faq[What is the difference between aelf's MainChain and dAppChains?] -aelf's MainChain and SideChains serve distinct but complementary roles within its blockchain architecture. The MainChain acts as the backbone of the network, responsible for overall governance, security, and coordination. It manages cross-chain interactions and ensures the integrity of the entire ecosystem. SideChains, on the other hand, are specialised chains that handle specific types of transactions or applications. They operate independently but are connected to the MainChain, allowing for parallel processing of transactions. This design significantly enhances scalability by distributing the workload across multiple SideChains, reducing congestion and improving performance. Each SideChain can be customised for different use cases, providing flexibility and efficiency in handling diverse applications. +aelf's MainChain and aelf dAppChains serve distinct but complementary roles within its blockchain architecture. The MainChain acts as the backbone of the network, responsible for overall governance, security, and coordination. It manages cross-chain interactions and ensures the integrity of the entire ecosystem. aelf dAppChains, on the other hand, are specialised chains that handle specific types of transactions or applications. They operate independently but are connected to the MainChain, allowing for parallel processing of transactions. This design significantly enhances scalability by distributing the workload across multiple aelf dAppChains, reducing congestion and improving performance. Each aelf dAppChain can be customised for different use cases, providing flexibility and efficiency in handling diverse applications. ::: -### 12. What is the transaction gas fee on the aelf blockchain? Are there any addresses that are exempt from fees? +### 11. What is the transaction gas fee on the aelf blockchain? Are there any addresses that are exempt from fees? :::faq[What is the transaction gas fee on the aelf blockchain? Are there any addresses that are exempt from fees?] @@ -183,7 +183,7 @@ If address A has a balance of 10 ELF at 1:00 UTC today but transfers out 7 ELF a ::: -### 13. At what block confirmation number on the aelf blockchain can we consider it unlikely that a chain becomes reversible? +### 12. At what block confirmation number on the aelf blockchain can we consider it unlikely that a chain becomes reversible? :::faq[At what block confirmation number on the aelf blockchain can we consider it unlikely that a chain becomes reversible?] @@ -193,27 +193,27 @@ The most accurate method is to follow the calculation based on the LIB (Last Irr ::: -### 14. What is the RPC service address for the SideChain tDVV? +### 13. What is the RPC service address for the aelf dAppChain? -:::faq[What is the RPC service address for the SideChain tDVV?] +:::faq[What is the RPC service address for the aelf dAppChain?] You can access it via the following link: https://tdvv-public-node.aelf.io/ ::: -### 15. Is a cross-chain transaction on the aelf blockchain considered a single transaction or two? Are there any examples? +### 14. Is a cross-chain transaction on the aelf blockchain considered a single transaction or two? Are there any examples? :::faq[Is a cross-chain transaction on the aelf blockchain considered a single transaction or two? Are there any examples?] -Cross-chain transactions between the MainChain and SideChain are considered two separate transactions. For example, transferring 1.5 ELF from the SideChain address ELF_75sSRT8rJqrKNF8h169qwwhiFLgXjaoLjthtA6ihnf7TnRDqB_tDVV to the MainChain address ELF_75sSRT8rJqrKNF8h169qwwhiFLgXjaoLjthtA6ihnf7TnRDqB_AELF: +Cross-chain transactions between the MainChain and dAppChain are considered two separate transactions. For example, transferring 1.5 ELF from the aelf dAppChain address ELF_75sSRT8rJqrKNF8h169qwwhiFLgXjaoLjthtA6ihnf7TnRDqB_tDVV to the MainChain address ELF_75sSRT8rJqrKNF8h169qwwhiFLgXjaoLjthtA6ihnf7TnRDqB_AELF: -First, a transaction called CrossChainTransfer is initiated on the SideChain: https://tdvv-explorer.aelf.io/tx/2b01a4cac416ae77c6f98c8a7cace66d2fb1edd565a5c0bedb9f44b395103895 +First, a transaction called CrossChainTransfer is initiated on the aelf dAppChain: https://tdvv-explorer.aelf.io/tx/2b01a4cac416ae77c6f98c8a7cace66d2fb1edd565a5c0bedb9f44b395103895 Then, a transaction called CrossChainReceiveToken is generated on the MainChain: https://explorer.aelf.io/tx/db29e36851549e3c5650ba853078ab02c6bb31c252ddfd7e0f8a7c33191ca3dd ::: -### 16. How to become a Block Producer (BP)? How to run a full node? +### 15. How to become a Block Producer (BP)? How to run a full node? :::faq[How to become a Block Producer (BP)? How to run a full node?] @@ -223,4 +223,4 @@ Here is a guide on how to apply to be a BP: https://docs.aelf.com/quick-start/no Here is a guide on how to set up a node on Mainnet: https://docs.aelf.com/quick-start/node-operators/set-up-a-node-on-mainnet/ -::: \ No newline at end of file +::: diff --git a/docs/about-aelf/wallet/index.md b/docs/about-aelf/wallet/index.md index 441b6d97..7c888cd0 100644 --- a/docs/about-aelf/wallet/index.md +++ b/docs/about-aelf/wallet/index.md @@ -37,9 +37,9 @@ We highly recommend using a supported Web3 wallet like Portkey as it provides a ::: -### 3. If I want to send ELF from a crypto exchange like Binance and OKEX to my Portkey wallet, should I select MainChain or SideChain on my Portkey wallet? +### 3. If I want to send ELF from a crypto exchange like Binance and OKEX to my Portkey wallet, should I select MainChain or dAppChain on my Portkey wallet? -:::faq[If I want to send ELF from a crypto exchange like Binance and OKEX to my Portkey wallet, should I select MainChain or SideChain on my Portkey wallet?] +:::faq[If I want to send ELF from a crypto exchange like Binance and OKEX to my Portkey wallet, should I select MainChain or dAppChain on my Portkey wallet?] When sending ELF tokens from a crypto exchange like Binance or OKEX to your Portkey wallet, you should select the MainChain address in your Portkey wallet. @@ -47,43 +47,43 @@ The MainChain is generally where the ELF tokens are held when they are on major ::: -### 4. What if I erraneously send ELF from a crypto exchange like Binance and OKEX to the SideChain in my Portkey wallet? +### 4. What if I erraneously send ELF from a crypto exchange like Binance and OKEX to the dAppChain in my Portkey wallet? -:::faq[What if I erraneously send ELF from a crypto exchange like Binance and OKEX to the SideChain in my Portkey wallet?] +:::faq[What if I erraneously send ELF from a crypto exchange like Binance and OKEX to the dAppChain in my Portkey wallet?] -This is unlikely to happen because exchanges that allow aelf chain mainnet withdrawal of ELF requires the prefix (ie. ELF) and suffix (i.e. AELF for mainchain / tDVV for sidechain) to be first excluded from your aelf chain wallet recipient address before the exchange executes the transfer. If you enter your aelf chain wallet recipient address which includes the prefix (i.e. ELF) and suffix (i.e. AELF for mainchain / tDVV for sidechain), the exchange will indicate an error in the address format and you will have to input the correct address again before the transfer can be made. +This is unlikely to happen because exchanges that allow aelf chain mainnet withdrawal of ELF requires the prefix (ie. ELF) and suffix (i.e. AELF for mainchain / tDVV for dappChain) to be first excluded from your aelf chain wallet recipient address before the exchange executes the transfer. If you enter your aelf chain wallet recipient address which includes the prefix (i.e. ELF) and suffix (i.e. AELF for mainchain / tDVV for dAppChain), the exchange will indicate an error in the address format and you will have to input the correct address again before the transfer can be made. ::: -### 5. Do MainChain and SideChain in my Portkey wallet have different addresses? +### 5. Do MainChain and dAppChain in my Portkey wallet have different addresses? -:::faq[Do MainChain and SideChain in my Portkey wallet have different addresses?] +:::faq[Do MainChain and dAppChain in my Portkey wallet have different addresses?] -In your Portkey wallet, the MainChain and SideChain typically share the same base address, but they differ by the suffix (i.e. AELF for mainchain / tDVV for sidechain). +In your Portkey wallet, the MainChain and dAppChain typically share the same base address, but they differ by the suffix (i.e. AELF for mainchain / tDVV for dAppChain). -However, if you are still using the deprecated version of Portkey Wallet, the MainChain and SideChain addresses might be different for the same account. +However, if you are still using the deprecated version of Portkey Wallet, the MainChain and dAppChain addresses might be different for the same account. ::: -### 6. Can I send ELF from the SideChain in my Portkey wallet to a crypto exchange like Binance and OKEX? +### 6. Can I send ELF from the dAppChain in my Portkey wallet to a crypto exchange like Binance and OKEX? -:::faq[Can I send ELF from the SideChain in my Portkey wallet to a crypto exchange like Binance and OKEX?] +:::faq[Can I send ELF from the dAppChain in my Portkey wallet to a crypto exchange like Binance and OKEX?] -No, you cannot directly send ELF from the SideChain in your Portkey wallet to a crypto exchange like Binance or OKEX. Most exchanges, including Binance and OKEX, only support ELF tokens on the MainChain. +No, you cannot directly send ELF from the dAppChain in your Portkey wallet to a crypto exchange like Binance or OKEX. Most exchanges, including Binance and OKEX, only support ELF tokens on the MainChain. -If you have ELF tokens on the SideChain in your Portkey wallet and wish to transfer them to an exchange, you should first transfer the tokens from the SideChain to the MainChain within your wallet. Once the tokens are on the MainChain, you can then send them to your exchange account. This ensures that the tokens are correctly received by the exchange. +If you have ELF tokens on the dAppChain in your Portkey wallet and wish to transfer them to an exchange, you should first transfer the tokens from the dAppChain to the MainChain within your wallet. Once the tokens are on the MainChain, you can then send them to your exchange account. This ensures that the tokens are correctly received by the exchange. ::: -### 7. What if I erraneously send ELF from the SideChain in my Portkey wallet to a crypto exchange like Binance and OKEX? What should I do? +### 7. What if I erraneously send ELF from the dAppChain in my Portkey wallet to a crypto exchange like Binance and OKEX? What should I do? -:::faq[What if I erraneously send ELF from the SideChain in my Portkey wallet to a crypto exchange like Binance and OKEX? What should I do?] +:::faq[What if I erraneously send ELF from the dAppChain in my Portkey wallet to a crypto exchange like Binance and OKEX? What should I do?] -If you mistakenly send ELF from the SideChain in your Portkey wallet to a crypto exchange like Binance or OKEX, the tokens will likely not be credited to your exchange account because these exchanges typically only support ELF on the MainChain. Here's what you should do: +If you mistakenly send ELF from the dAppChain in your Portkey wallet to a crypto exchange like Binance or OKEX, the tokens will likely not be credited to your exchange account because these exchanges typically only support ELF on the MainChain. Here's what you should do: #### Check the Transaction Details: -Verify the transaction on the blockchain explorer to confirm that the tokens were sent to the correct address on the exchange but from the SideChain. +Verify the transaction on the blockchain explorer to confirm that the tokens were sent to the correct address on the exchange but from the dAppChain. #### Contact the Exchange's Customer Support: @@ -101,10 +101,10 @@ By following these steps, you may be able to recover the tokens or at least unde ::: -### 8. What does tDVV or tDVW in Sidechain mean and do I need to care? +### 8. What does tDVV or tDVW in dAppChain mean and do I need to care? -:::faq[What does tDVV or tDVW in Sidechain mean and do I need to care?] +:::faq[What does tDVV or tDVW in dAppChain mean and do I need to care?] -In simpler terms, "tDVV" is just a special code that uniquely identifies the first SideChain in the aelf network. "tDVW" uniquely identifies the second SideChain. You do not need to care. +In simpler terms, "tDVV" is just a special code that uniquely identifies the first dAppChain in the aelf network. "tDVW" uniquely identifies the second dAppChain. You do not need to care. ::: \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index f6311bed..20fc2393 100644 --- a/docs/index.md +++ b/docs/index.md @@ -11,7 +11,7 @@ hide_table_of_contents: true # aelf Documentation -aelf is a high-performance, cloud-native, layer-1 blockchain with Mainnet nodes in cloud data centers. It supports parallel smart contract execution, microservices, and scalable MainChain and multi-SideChains architecture. The cross-chain design enables fast data interaction, and its hybrid SideChain model reduces costs and boosts network performance. +aelf is a high-performance, cloud-native, layer-1 blockchain with Mainnet nodes in cloud data centers. It supports parallel smart contract execution, microservices, and scalable MainChain and multi-dAppChains architecture. The cross-chain design enables fast data interaction, and its hybrid aelf dAppChain model reduces costs and boosts network performance.
diff --git a/docs/quick-start/developers/_deploy.md b/docs/quick-start/developers/_deploy.md index 61df4887..1674a1c4 100644 --- a/docs/quick-start/developers/_deploy.md +++ b/docs/quick-start/developers/_deploy.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_allowance_contract.md b/docs/quick-start/developers/_deploy_allowance_contract.md new file mode 100644 index 00000000..e00c8f4b --- /dev/null +++ b/docs/quick-start/developers/_deploy_allowance_contract.md @@ -0,0 +1,176 @@ +#### 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" +``` + + + +```bash title="Command Prompt" +$env: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'; + + + + +**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 "" +``` + + + + +```bash title="Command Prompt" +$headers = @{ + "accept" = "application/json" +} + +$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" + +Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" +``` + + + + +**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 +``` + + + +```bash title="Command Prompt" +aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance +``` + + + +You will be prompted for the following: + +```sh title="Terminal" +Enter the required param : ELF +Enter the required param : **$WALLET_ADDRESS** +``` + +You should see the result displaying your wallet's ELF balance. + + + + +Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. + +![result](/img/get-token-ui.png) + + + + +**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 AllowanceContract.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/ +``` + + + + +```bash title="Command Prompt" +$CONTRACT_PATH = Get-ChildItem -Recurse -Filter "*patched*" | Select-Object -First 1 -ExpandProperty FullName +$env:CONTRACT_PATH = $CONTRACT_PATH +``` + +```bash title="Command Prompt" +aelf-deploy -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -c $env: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" + ``` + + + + ```bash title="Command Prompt" + $env: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 Allowance 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! +::: diff --git a/docs/quick-start/developers/_deploy_dao.md b/docs/quick-start/developers/_deploy_dao.md index 5466ef8e..2e662cd6 100644 --- a/docs/quick-start/developers/_deploy_dao.md +++ b/docs/quick-start/developers/_deploy_dao.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_expense_tracker.md b/docs/quick-start/developers/_deploy_expense_tracker.md index 1b79bd66..59dbd7e0 100644 --- a/docs/quick-start/developers/_deploy_expense_tracker.md +++ b/docs/quick-start/developers/_deploy_expense_tracker.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_lottery.md b/docs/quick-start/developers/_deploy_lottery.md index 77249bbc..9148306b 100644 --- a/docs/quick-start/developers/_deploy_lottery.md +++ b/docs/quick-start/developers/_deploy_lottery.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_role_contract.md b/docs/quick-start/developers/_deploy_role_contract.md new file mode 100644 index 00000000..6a2fbff8 --- /dev/null +++ b/docs/quick-start/developers/_deploy_role_contract.md @@ -0,0 +1,176 @@ +#### 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" +``` + + + +```bash title="Command Prompt" +$env: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'; + + + + +**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 "" +``` + + + + +```bash title="Command Prompt" +$headers = @{ + "accept" = "application/json" +} + +$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" + +Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" +``` + + + + +**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 +``` + + + +```bash title="Command Prompt" +aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance +``` + + + +You will be prompted for the following: + +```sh title="Terminal" +Enter the required param : ELF +Enter the required param : **$WALLET_ADDRESS** +``` + +You should see the result displaying your wallet's ELF balance. + + + + +Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. + +![result](/img/get-token-ui.png) + + + + +**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 RoleContract.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/ +``` + + + + +```bash title="Command Prompt" +$CONTRACT_PATH = Get-ChildItem -Recurse -Filter "*patched*" | Select-Object -First 1 -ExpandProperty FullName +$env:CONTRACT_PATH = $CONTRACT_PATH +``` + +```bash title="Command Prompt" +aelf-deploy -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -c $env: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" + ``` + + + + ```bash title="Command Prompt" + $env: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 Role 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! +::: diff --git a/docs/quick-start/developers/_deploy_single_pool_staking.md b/docs/quick-start/developers/_deploy_single_pool_staking.md index a334c07c..a8fecff7 100644 --- a/docs/quick-start/developers/_deploy_single_pool_staking.md +++ b/docs/quick-start/developers/_deploy_single_pool_staking.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_tic_tac_toe.md b/docs/quick-start/developers/_deploy_tic_tac_toe.md index c560d694..5ae97f10 100644 --- a/docs/quick-start/developers/_deploy_tic_tac_toe.md +++ b/docs/quick-start/developers/_deploy_tic_tac_toe.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/_deploy_todo.md b/docs/quick-start/developers/_deploy_todo.md index a3647a9f..607ab0ca 100644 --- a/docs/quick-start/developers/_deploy_todo.md +++ b/docs/quick-start/developers/_deploy_todo.md @@ -44,76 +44,10 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** -import Tabs from '@theme/Tabs'; -import TabItem from '@theme/TabItem'; - - - - -**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 "" -``` - - - - -```bash title="Command Prompt" -$headers = @{ - "accept" = "application/json" -} - -$env:WALLET_ADDRESS = "YOUR_WALLET_ADDRESS" - -Invoke-WebRequest -Uri "https://faucet.aelf.dev/api/claim?walletAddress=$env:WALLET_ADDRESS" -Method POST -Headers $headers -Body "" -``` - - - - -**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 -``` - - - -```bash title="Command Prompt" -aelf-command call ASh2Wt7nSEmYqnGxPPzp4pnVDU4uhj1XW9Se5VeZcX2UDdyjx -a $env:WALLET_ADDRESS -p $env:WALLET_PASSWORD -e https://tdvw-test-node.aelf.io GetBalance -``` - - - -You will be prompted for the following: - -```sh title="Terminal" -Enter the required param : ELF -Enter the required param : **$WALLET_ADDRESS** -``` - -You should see the result displaying your wallet's ELF balance. - - - - Go to https://faucet-ui.aelf.dev Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - - **Deploy Smart Contract:** The smart contract needs to be deployed on the chain before users can interact with it. diff --git a/docs/quick-start/developers/allowance-dapp/index.md b/docs/quick-start/developers/allowance-dapp/index.md new file mode 100644 index 00000000..2e74270d --- /dev/null +++ b/docs/quick-start/developers/allowance-dapp/index.md @@ -0,0 +1,1481 @@ +--- +sidebar_position: 9 +title: Allowance dApp +description: Smart contracts explaining inter-contract calls +--- + +**Description**: This project demonstrates the integration of two smart contracts, RoleContract and AllowanceContract, focusing on role-based access and fund management. It highlights **inter-contract calls**, where the allowance logic depends on roles retrieved dynamically from the role contract. + +**Purpose**: The purpose of this dApp is to teach state management, access control, and inter smart contract calls on the aelf blockchain. This example models how multi-contract systems work together and call each other to securely manage roles and funds in a blockchain environment. +**Difficulty Level**: Moderate + + + +## Step 1 - Setting up your development environment + +import Setup from "../\_setup.md" + + + +## Step 2 - Develop Role Smart Contract + +### Start Your Smart Contract Project + +- Open your `Terminal`. + +- Enter the following command to generate a new RoleContract project: + +```bash title="Terminal" +mkdir role-contract +cd role-contract +dotnet new aelf -n RoleContract +``` + +### Adding Your Smart Contract Code + +Now that we have a RoleContract template, we can customize it to implement role-based permissions for various use cases. Below are the core functionalities of the RoleContract: + +1. Set Admin: Allows the current admin to assign a new admin address. +2. Set Parent/Child: Grants parent or child roles with appropriate permissions. +3. Retrieve Role Addresses: Methods to fetch the current admin, parent, and child addresses. +4. Role-based Access Control: Ensures only admins or parents can assign roles using access validation logic. + +This template provides a foundation for building secure systems where role management and hierarchical permissions are essential. + +- Enter this command in your `Terminal`. + +```bash title="Terminal" +cd src +``` + +#### Defining Methods and Messages + +- Rename the file name from `Protobuf/contract/hello_world_contract.proto` to `role_contract.proto` manually or by using the following command: + +```bash title="Terminal" +mv Protobuf/contract/hello_world_contract.proto Protobuf/contract/role_contract.proto +``` + +- Open the project with your IDE. + +The implementation of file `src/Protobuf/contract/role_contract.proto` is as follows: + +```csharp title="role_contract.proto" +syntax = "proto3"; + +import "aelf/core.proto"; + +import "google/protobuf/empty.proto"; +import "Protobuf/reference/acs12.proto"; +import "aelf/options.proto"; +import "google/protobuf/wrappers.proto"; + +// The namespace of this class +option csharp_namespace = "AElf.Contracts.RoleContract"; + +service RoleContract { + + // The name of the state class the smart contract is going to use to access blockchain state + option (aelf.csharp_state) = "AElf.Contracts.RoleContract.RoleContractState"; + option (aelf.base) = "Protobuf/reference/acs12.proto"; + + rpc Initialize (google.protobuf.Empty) returns (google.protobuf.Empty){ + + } + + rpc SetAdmin (aelf.Address) returns (google.protobuf.Empty) { + } + + rpc GetAdmin (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + rpc SetParent (aelf.Address) returns (google.protobuf.Empty) { + } + + rpc GetParent (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + + rpc SetChild (aelf.Address) returns (google.protobuf.Empty) { + } + + rpc GetChild (google.protobuf.Empty) returns (google.protobuf.StringValue) { + option (aelf.is_view) = true; + } + +} +``` + +- `rpc` methods define the callable functions within the contract, allowing external systems to interact with the contract's logic. +- `message` represent the structured data exchanged between the contract and external systems. + +#### Define Contract States + +The implementation of the role contract's state inside file `src/RoleContractState.cs` is as follows: + +```csharp title="src/RoleContractState.cs" +using AElf.Sdk.CSharp.State; +using AElf.Types; + +namespace AElf.Contracts.RoleContract +{ + public class RoleContractState : ContractState + { + public BoolState Initialized { get; set; } + + public SingletonState
AdminAddress { get; set; } + + public SingletonState
ParentAddress { get; set; } + + public SingletonState
ChildAddress { get; set; } + + } +} +``` + +- The `State.cs` file on the aelf blockchain smart contract holds the variables that store the contract's data, making sure this data is saved and accessible whenever the contract needs it. + +#### Implement Role Smart Contract + +The implementation of the role contract inside file `src/RoleContract.cs` is as follows: + +```csharp title="src/RoleContract.cs" +using AElf.Sdk.CSharp; +using AElf.Types; +using Google.Protobuf.WellKnownTypes; + +namespace AElf.Contracts.RoleContract +{ + public class RoleContract : RoleContractContainer.RoleContractBase + { + + private const string DefaultAdmin = "ENTER_YOUR_PORTKEY_ADDRESS"; + + public override Empty Initialize(Empty input) + { + if (State.Initialized.Value) + { + return new Empty(); + } + State.Initialized.Value = true; + State.AdminAddress.Value = Context.Sender; //Can set Deployer as admin + State.AdminAddress.Value = Address.FromBase58(DefaultAdmin); // Can set YOUR_PORTKEY_ADDRESS as admin + return new Empty(); + } + + public override Empty SetAdmin(Address input) + { + AssertIsAdmin(); + + // Set the new admin address + State.AdminAddress.Value = input; + + return new Empty(); + } + + public override Empty SetParent(Address input) + { + AssertIsAdminOrParent(); + + // Set the parent address + State.ParentAddress.Value = input; + + return new Empty(); + } + + public override Empty SetChild(Address input) + { + AssertIsAdminOrParent(); + + // Set the chlid address + State.ChildAddress.Value = input; + + return new Empty(); + } + + + // Get the current admin address + public override StringValue GetAdmin(Empty input) + { + return State.AdminAddress.Value == null ? new StringValue() : new StringValue {Value = State.AdminAddress.Value.ToBase58()}; + } + + // Get the current parent address + public override StringValue GetParent(Empty input) + { + return State.ParentAddress.Value == null ? new StringValue() : new StringValue {Value = State.ParentAddress.Value.ToBase58()}; + } + + // Get the current child address + public override StringValue GetChild(Empty input) + { + return State.ChildAddress.Value == null ? new StringValue() : new StringValue {Value = State.ChildAddress.Value.ToBase58()}; + } + + + private void AssertIsAdmin() + { + Assert(Context.Sender == State.AdminAddress.Value, "Unauthorized(Not Admin) to perform the action."); + } + + private void AssertIsAdminOrParent() + { + Assert(Context.Sender == State.AdminAddress.Value || Context.Sender == State.ParentAddress.Value, "Unauthorized (Not Parent or Admin) to perform the action."); + } + + + } +} +``` + +### Building Role Smart Contract + +- Build the smart contract code with the following command inside `src` folder: + +```bash title="Terminal" +dotnet build +``` + +You should see **RoleContract.dll.patched** in the directory `RoleContract/src/bin/Debug/net.6.0` + +## Step 3 - Deploy Role Smart Contract + +import DeployRoleContract from "../\_deploy_role_contract.md" + + + +## Step 4 - Develop Allowance Smart Contract + +### Start Your Smart Contract Project + +- Open your `Terminal`. + +- Enter the following command to generate a new RoleContract project: + +```bash title="Terminal" +cd ../.. +mkdir allowance-contract +cd allowance-contract +dotnet new aelf -n AllowanceContract +``` + +### Adding Your Smart Contract Code + +Now that we have an AllowanceContract template, it can be customized to manage funds with role-based permissions. Below are its core functionalities: + +1. Set Allowance: Increases the current allowance, with permissions verified through parent and child roles fetched from the RoleContract. +2. Use Funds: Allows a child role to spend funds, reducing the current allowance. +3. Get Allowance: Retrieves the remaining allowance. +4. Role-based Permissions: Ensures only authorized roles, like parent of a child can modify or the child use the allowance. + +This contract showcases **inter-contract calls** and role-based fund management, demonstrating how multiple smart contracts work together for secure, controlled financial operations on the aelf blockchain. It helps in understanding *how the AllowanceContract calls the RoleContract* to check which sender (either of Parent, Child & Admin) is calling the methods of the AllowanceContract to put control on the access of the functions. + +- Enter this command in your `Terminal`. + +```bash title="Terminal" +cd src +``` + +#### Defining Methods and Messages + +- Rename the file name from `Protobuf/contract/hello_world_contract.proto` to `allowance_contract.proto`: + +```bash title="Terminal" +mv Protobuf/contract/hello_world_contract.proto Protobuf/contract/allowance_contract.proto +``` + +- Open the project with your IDE. + +The implementation of file `src/Protobuf/contract/allowance_contract.proto` is as follows: + +```csharp title="allowance_contract.proto" +syntax = "proto3"; + +import "aelf/core.proto"; + +import "google/protobuf/empty.proto"; +import "Protobuf/reference/acs12.proto"; +import "aelf/options.proto"; +import "google/protobuf/wrappers.proto"; + +// The namespace of this class +option csharp_namespace = "AElf.Contracts.AllowanceContract"; + +service AllowanceContract { + + // The name of the state class the smart contract is going to use to access blockchain state + option (aelf.csharp_state) = "AElf.Contracts.AllowanceContract.AllowanceContractState"; + option (aelf.base) = "Protobuf/reference/acs12.proto"; + + rpc Initialize (google.protobuf.Empty) returns (google.protobuf.Empty){ + + } + + rpc SetAllowance (google.protobuf.Int64Value) returns (google.protobuf.Empty) { + } + + rpc GetAllowance (aelf.Address) returns (google.protobuf.Int64Value) { + option (aelf.is_view) = true; + } + + rpc useFunds (google.protobuf.Int64Value) returns (google.protobuf.Empty) { + } + + rpc IfInitialized (google.protobuf.Empty) returns (google.protobuf.BoolValue) { + option (aelf.is_view) = true; + } + + +} +``` + +- `rpc` methods define the callable functions within the contract, allowing external systems to interact with the contract's logic. +- `message` represent the structured data exchanged between the contract and external systems. + +#### Define Contract States + +The implementation of the allowance contract state inside file `src/AllowanceContractState.cs` is as follows: + +```csharp title="src/AllowanceContractState.cs" +using AElf.Sdk.CSharp.State; +using AElf.Types; + +namespace AElf.Contracts.AllowanceContract +{ + public partial class AllowanceContractState : ContractState + { + public BoolState Initialized { get; set; } + + public SingletonState
AdminAddress { get; set; } + + public SingletonState
ParentAddress { get; set; } + + public SingletonState
ChildAddress { get; set; } + + public Int32State CurrentAllowance { get; set; } + + } +} +``` + +- The `State.cs` file in an aelf blockchain smart contract holds the variables that store the contract's data, making sure this data is saved and accessible whenever the contract needs it. + +#### Implement Allowance Smart Contract + +The implementation of the AllowanceContract inside file `src/AllowanceContract.cs` is as follows: + +```csharp title="src/AllowanceContract.cs" +using AElf.Sdk.CSharp; +using AElf.Types; +using Google.Protobuf.WellKnownTypes; + +namespace AElf.Contracts.AllowanceContract +{ + // Contract class must inherit the base class generated from the proto file + public class AllowanceContract : AllowanceContractContainer.AllowanceContractBase + { + + private const string RoleContractAddress = "YOUR_ROLE_CONTRACT_ADDRESS"; // tDVW role contract address + + public override Empty Initialize(Empty input) + { + // Check if the contract is already initialized + Assert(State.Initialized.Value == false, "Already initialized."); + // Set the contract state + State.Initialized.Value = true; + // Set the owner address + State.AdminAddress.Value = Context.Sender; + + // Initialize the role contract + State.RoleContract.Value = Address.FromBase58(RoleContractAddress); + + return new Empty(); + } + + public override Empty SetAllowance(Int64Value input) + { + State.ParentAddress.Value = Address.FromBase58(State.RoleContract.GetParent.Call(new Empty()).Value); + + Assert(Context.Sender == State.ParentAddress.Value, "Unauthorized(Not Parent) to perform the action."); + + State.ChildAddress.Value = Address.FromBase58(State.RoleContract.GetChild.Call(new Empty()).Value); + + State.CurrentAllowance.Value = (int)(State.CurrentAllowance.Value + input.Value) ; + + return new Empty(); + } + + public override Int64Value GetAllowance(Address input) + { + + Assert(Context.Sender == State.ChildAddress.Value || Context.Sender == State.ParentAddress.Value, "Unauthorized(Not Parent or Child) to perform the action."); + + var allowance = State.CurrentAllowance.Value; + + return new Int64Value + { + Value = allowance + }; + } + + public override Empty useFunds(Int64Value input) + { + State.ChildAddress.Value = Address.FromBase58(State.RoleContract.GetChild.Call(new Empty()).Value); + + Assert(Context.Sender == State.ChildAddress.Value, "Unauthorized(Not Child) to perform the action."); + + State.CurrentAllowance.Value = (int)(State.CurrentAllowance.Value - input.Value) ; + + return new Empty(); + } + + // Function to check if the allowance contract is already initialized or not + public override BoolValue IfInitialized(Empty input) + { + return new BoolValue { Value = State.Initialized.Value }; + } + + } + +} +``` + +### Building Allowance Smart Contract + +- Build the smart contract code with the following command inside `src` folder: + +```bash title="Terminal" +dotnet build +``` + +You should see **AllowanceContract.dll.patched** in the directory `AllowanceContract/src/bin/Debug/net.6.0` + +## Step 5 - Deploy Allowance Smart Contract + +import DeployAllowanceContract from "../\_deploy_allowance_contract.md" + + + +## Step 6 - Interact with Your Deployed Smart Contract through dApp + +### Project Setup + +Let's start by cloning the frontend project repository from github. + +```bash title="Terminal" +git clone https://github.com/AElfProject/aelf-samples.git +``` + +- Next, navigate to the frontend project directory with this command: + +```bash title="Terminal" +cd aelf-samples/allowance/2-dapp +``` + +- Once you're inside the `2-dapp` directory, open the project with your preferred IDE (e.g., VSCode). You should see the project structure as shown below. + +export const tree = { +"type": "directory", +"uri": "2-dapp", +"expanded": true, +"children": [ +{ +"type": "directory", +"uri": "app" +}, +{ +"type": "directory", +"uri": "assets" +}, +{ +"type": "directory", +"uri": "public" +}, +{ +"type": "directory", +"uri": "src" +}, +{ +"type": "file", +"uri": ".gitignore" +}, +{ +"type": "file", +"uri": "components.json" +}, +{ +"type": "file", +"uri": "index.html" +}, +{ +"type": "file", +"uri": "package.json" +}, +{ +"type": "file", +"uri": "postcss.config.js" +}, +{ +"type": "file", +"uri": "README.md" +}, +{ +"type": "file", +"uri": "tailwind.config.js" +}, +{ +"type": "file", +"uri": "tsconfig.json" +}, +{ +"type": "file", +"uri": "tsconfig.node.json" +}, +{ +"type": "file", +"uri": "vite.config.ts" +} +] +} + +
+ +#### Install necessary libraries + +- Run this command in the terminal to install all necessary packages and libraries: + +```bash title="Terminal" +npm install +``` + +We are now ready to build the frontend components of our Allowance dApp. + +### Configure Portkey Provider & Write Connect Wallet Function + +Now, we'll set up our Portkey wallet provider to allow users to connect their Portkey wallets to the dApp and interact with the smart contract. We'll be interacting with the already deployed RoleContract and AllowanceContract for this tutorial. + +**Step 1: Locate the File:** + +- Go to the `src/hooks/useSmartContract.ts` file. + +**Step 2: Fetch the Smart Contract:** + +- Find the comment `//Step A - Function to fetch a smart contract based on deployed wallet address` + +- Replace the existing **`fetchContract`** function with this updated code: + +```javascript title="useSmartContract.ts" +//Step A - Function to fetch a smart contract based on deployed wallet address +const fetchContract = async (address: string) => { + if (!provider) return null; + + try { + // 1. get the dAppChain using provider.getChain + const chain = await provider?.getChain("tDVW"); + if (!chain) throw new Error("No chain"); + + // 2. return contract + return chain?.getContract(address); + } catch (error) { + console.log(error, "====error"); + return; + } +}; +``` + +- Find the comment `// Step B - fetch role-contract` + +- Replace the existing **`getRoleContract`** function with this updated code: + +```javascript title="useSmartContract.ts" +// Step B - fetch role-contract +const getRoleContract = async () => { + //Replace with Address of Deployed Role Smart Contract + const contract = await fetchContract( + "your_deployed_role_smart_contract_address" + ); + contract && setRoleContract(contract); +}; +``` + +- Find the comment `// Step C - fetch allowance-contract` + +- Replace the existing **`getAllowanceContract`** function with this updated code: + +```javascript title="useSmartContract.ts" +// Step C - fetch allowance-contract +const getAllowanceContract = async () => { + //Replace with Address of Deployed Allowance Smart Contract + const contract = await fetchContract( + "your_deployed_allowance_smart_contract_address" + ); + contract && setAllowanceContract(contract); +}; +``` + +:::tip +ℹ️ Note: You are to replace the address placeholder with your deployed Role and Allowance smart contract address from "Deploy Smart Contract" steps (Step 3 and 5)! + +example: +**"your_deployed_role_smart_contract_address"**, +**"your_deployed_allowance_smart_contract_address"** +::: + +**Explanation:** + +- **`fetchContract`** **Function**: This function fetches a smart contract based on the given chain symbol (e.g., "AELF" or "tDVW") and the contract address. + + - **Check Provider** : If no provider is available, the function returns null. + - **Fetch Chain** : The function fetches chain information using the provider. + - **Get Contract** : It retrieves the smart contract instance from the chain. + +- **`getRoleContract`** **Function**: This function fetches the *role smart contract*. +- **`getAllowanceContract`** **Function**: This function fetches the *allowance smart contract*. + +`AELF` represents the mainnet chain and `tDVW` represents the testnet chain respectively on aelf blockchain. + +**Step 3. Initialize and Fetch the Smart Contracts:** + +- Find the comment `// Step D - Effect hook to initialize and fetch the smart contract when the provider changes` + +- Replace the existing **`useEffect`** with this updated code: + +```javascript title="useSmartContract.ts" +// Step D - Effect hook to initialize and fetch the smart contract when the provider changes +useEffect(() => { + getRoleContract(); + getAllowanceContract(); +}, [provider]); // Dependency array ensures this runs when the provider changes +``` + +**Explanation:** + +- **`useEffect` Hook** : This hook initializes and fetches the smart contracts when the provider changes. + - **Check Provider** : If no provider is available, the function returns null. + - **Fetch Contracts** : It fetches and sets the smart contracts. + +By following these steps, we'll configure the Portkey provider to connect users' wallets to our dApp and interact with the Role and Allowance smart contracts including assigning specific roles and allowance related functionalities. This setup will enable our frontend components to perform actions like `Set Roles` , `Get Roles` , `Set Allowance` , `Get Allowance` and `Spend Allowed Funds`. + +### Configure Connect Wallet Function + +**Step 1: Locate the File** + +- Go to the `src/components/layout/header/index.tsx` file. + +**Step 2: Write the Connect Wallet Function** + +- The `header/index.tsx` file is the header of our allowance dApp. It allows users to connect their Portkey wallet with the allowance dApp. + +- Before users can interact with the smart contract, we need to write the `Connect Wallet` function. + +- Find the comment `// Step E - Connect Portkey Wallet`. + +- Replace the existing connect function with this code snippet: + +```javascript title="header/index.tsx" +// Step E - Connect Portkey Wallet +const connect = async (walletProvider?: IPortkeyProvider) => { + const accounts = await (walletProvider ? walletProvider : provider)?.request({ + method: MethodsBase.REQUEST_ACCOUNTS, + }); + const account = accounts?.AELF && accounts?.AELF[0]; + if (account) { + setCurrentWalletAddress(account.replace(/^ELF_/, "").replace(/_AELF$/, "")); + setIsConnected(true); + } + !walletProvider && toast.success("Successfully connected"); +}; +``` + +**Explanation:** + +- **`connect` Function** : This function connects the user's Portkey wallet with the dApp. + - **Fetch Accounts** : It fetches the wallet accounts using the provider. + - **Log Accounts** : Logs the accounts to the console for debugging. + - **Set Wallet Address** : Sets the current wallet address state variable with the fetched account. + - **Update Connection Status** : Updates the state to indicate that the wallet is connected. + - **User Notification** : Displays an alert to notify the user that their wallet is successfully connected. + +In this code, we fetch the Portkey wallet account using the provider and update the wallet address state variable. An alert notifies the user that their wallet is successfully connected. + +With the connect wallet function defined, we're ready to write the remaining functions in the next steps. + +### Configure Set Admin Role + +**Step 1: Locate the File** + +1. Go to the `src/pages/home/index.tsx` file. This file contains all the functionalities like initialize Contract, SetAdmin, GetAdmin etc. + +**Step 2: Prepare Form to set Roles** + +1. Find the comment `// Step F - Configure Role Form`. + +2. Replace the form variable with this code snippet: + +```javascript title="home/index.tsx" +// Step F - Configure Role Form +const form = useForm >{ + resolver: zodResolver(formSchema), + defaultValues: { + address: "", + }, +}; +``` + +#### Here's what the function does: + +1. Initializes a new form variable with default values needed to set roles. + +2. Field include: `address`. + +Now the form is ready for users to fill in the necessary details. + +### Initialize Contract & Set Default Admin + +- Scroll down to find the comment `// Step G - Initialize Role Contract`. + +- Replace the existing **`initializeContract`** function with this code snippet: + +```javascript title="home/index.tsx" +// Step G - Initialize Role Contract +const initializeContract = async () => { + let loadingId; + try { + // Start Loading + loadingId = toast.loading("Contract Initializing InProgress.."); + await roleContract?.callSendMethod( + "Initialize", // Function Name + currentWalletAddress as string, // User Wallet Address + {} // No Arguments + ); + // Update Loading Message with Success + toast.update(loadingId, { + render: `Contract Initialize Successful`, + type: "success", + isLoading: false, + }); + setIsContractInitialize(true); + } catch (error: any) { + // Update Loading Message with Error + toast.update(loadingId as Id, { + render: error.message, + type: "error", + isLoading: false, + }); + return "error"; + } finally { + // Remove Loading Message + removeNotification(loadingId as Id); + return; + } +}; +``` + +### Set Admin Role + +- Write the function to **`Set Users Role`** + +- Find the comment `// Step H - Set Differentt Users Role`. + +- Replace the existing **`setAuthority`** function with this code snippet: + +```javascript title="home/index.tsx" +// Step H - Set Differentt Users Role +const setAuthority = async (values: { address: string }, type: string) => { + let loadingId; + try { + // Start Loading + loadingId = toast.loading("Set Authority InProgress.."); + setFormLoading(true); + + // Prepare Arguments for set Admin + const sendData = values.address; + + // Call the appropriate smart contract method based on the type (Admin, Parent, or Child) + await roleContract?.callSendMethod( + type === ROLE.admin + ? "SetAdmin" + : type === ROLE.parent + ? "SetParent" + : "SetChild", + currentWalletAddress as string, + sendData // Pass the address as the argument + ); + + // Update Loading Message with Success + toast.update(loadingId, { + render: `Set ${type} Successful`, + type: "success", + isLoading: false, + }); + + // Fetch and update the role data from the contract after successful execution + getAuthorityData(); + return "success"; + } catch (error: any) { + // Update Loading Message with Error + toast.update(loadingId as Id, { + render: error.message, + type: "error", + isLoading: false, + }); + return "error"; + } finally { + // Close Form Modal + handleCloseModal(); + + // Remove Loading Message + removeNotification(loadingId as Id); + setFormLoading(false); + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Method** : It interacts with the blockchain smart contract to set admin, parent and child using their respective wallet address. + +Next, we'll **Handle the submit form to set the roles** function. + +### Submit Set Admin Role + +Write the function to handle the submit form to set the users' role. + +- Scroll down to find the comment `// Step I - Handle Submit Form`. + +- Replace the existing **`onSubmit`** function with this code snippet: + +```javascript title="home/index.tsx" +// Step I - Handle Submit Form +const onSubmit = async (values: { address: string }) => { + // Set form loading state + setFormLoading(true); + // Check if the contract is initialized, if not, initialize it + if (!isContractInitialize) { + await initializeContract(); // Initialize the smart contract if not already done + } + // Call the setAuthority function to set the authority (Admin/Parent/Child) based on the roleType + await setAuthority(values, roleType); // Pass the form values and role type (Admin/Parent/Child) +}; +``` + +Next, we'll write the **Get Role Details** function. + +### Get Role Details + +- Write the function to **`Get Roles Details`** + +- Find the comment `// Step J - Get Role Details`. + +- Replace the existing **`getAuthorityData`** function with this code snippet: + +```javascript title="home/index.tsx" +// Step J - Get Role Details +const getAuthorityData = async () => { + setLoading(true); + try { + // Fetch admin, parent, and child roles simultaneously using Promise.all + const [admin, parent, child] = await Promise.all([ + roleContract?.callViewMethod("GetAdmin", ""), + roleContract?.callViewMethod("GetParent", ""), + roleContract?.callViewMethod("GetChild", ""), + ]); + + // If all roles are successfully fetched + if (admin && parent && child) { + // Set the role state with the retrieved admin, parent, and child values + setRole({ + Admin: admin?.data?.value, + Parent: parent?.data?.value, + Child: child?.data?.value, + }); + } + } catch (error) { + // Log any error that occurs during the process + console.log("error======", error); + } finally { + // Stop the loading indicator, whether or not the request was successful + setLoading(false); + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Methods** : It interacts with the blockchain smart contract to get the addressess of the admin, parent and child roles respectively. Once the wallet addresses based on the roles are present, FE will display different components for each user role, like Admin, Parent, and Child. Each role has specific actions they can perform: + +- **Admin Role** : The *admin* can assign roles to both parent and child. +- **Parent Role** : The *parent* can assign the child role and set an allowance for the child. +- **Child Role** : The *child* can spend money, but only up to the allowance set by the parent. + +Now that we've finished integrating the functionality of the RoleContract, let's move on to the functions of the AllowanceContract. + +### Configure Set Allowance by Parent + +**Step 1: Locate the File** + +- Go to the `src/components/parent/index.tsx` file. This file contains functionalities like initialize contract, set allowance and get allowance. + +**Step 2: Configure form** + +Write the Function of configure the set allowance form. + +- Find the comment `// Step K - Configure Set Allowance Form`. + +- Replace the existing code snippet: + +```javascript title="parent/index.tsx" +// Step K - Configure Set Allowance Form +const form = useForm >{ + resolver: zodResolver(formSchema), + defaultValues: { + amount: "", + }, +}; +``` + +### Check Contract Initialize Status + +Write the Function to check contract initialization status of the **AllowanceContract**. + +- Scroll down to find the comment `// step L - Check if Allowance Contract is initialized or not`. + +- Replace the existing **`checkIsContractInitialized`** function with this code snippet: + +```javascript title="parent/index.tsx" +// step L - Check if Allowance Contract is initialized or not +const checkIsContractInitialized = async () => { + try { + const result = await allowanceContract?.callViewMethod("IfInitialized", ""); // Call the IfInitialized method which is present on Smart Contract + if (result?.data) { + setIsContractInitialize(true); + } + } catch (error) { + console.log("error", error); + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Methods** : It interacts with the allowance contract to get the initialization status of the allowance contract. + +### Initialize Allowance Contract + +Write the function to initialize the **AllowanceContract**. + +- Scroll down to find the comment `// Step M - Initialize Allowance Contract`. + +- Replace the existing **`initializeContract`** function with this code snippet: + +```javascript title="parent/index.tsx" +// Step M - Initialize Allowance Contract +const initializeContract = async () => { + let loadingId; + try { + // Start Loading + loadingId = toast.loading("Contract Initializing InProgress.."); + await allowanceContract?.callSendMethod( + "Initialize", // Function Name + currentWalletAddress as string, // User Wallet Address + {} // No Arguments + ); + + // Update Loading Message with Success + toast.update(loadingId, { + render: `Contract Initialize Successful`, + type: "success", + isLoading: false, + }); + setIsContractInitialize(true); + } catch (error: any) { + // Update Loading Message with Error + toast.update(loadingId as Id, { + render: error.message, + type: "error", + isLoading: false, + }); + return "error"; + } finally { + // Remove Loading Message + removeNotification(loadingId as Id); + return; + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Methods** : It call the Initialize of the allowance contract. + +Now that we've finished the initialize contract functionality. Let's move on to the *set allowance* functionality. + +### Set Allowance + +Write the function for set the allowance value for child by the parent. + +- Scroll down to find the comment `// step N - Set AllowanceValue`. + +- Replace the existing **`initializeContract`** function with this code snippet: + +```javascript title="parent/index.tsx" +// step N - Set AllowanceValue +const setAllowance = async (value: { amount: string }) => { + setFormLoading(true); + let loadingId; + try { + // Start Loading + loadingId = toast.loading("SetAllowance InProgress.."); + await allowanceContract?.callSendMethod( + "SetAllowance", // Function Name + currentWalletAddress as string, // User Wallet Address + { value: value.amount } // Allowance Amount + ); + + // fetch updated allowance value + getAllowance(); + + // Update Loading Message with Success + toast.update(loadingId, { + render: `SetAllowance Successful`, + type: "success", + isLoading: false, + }); + } catch (error: any) { + console.error(error); + // Update Loading Message with Error + toast.update(loadingId as Id, { + render: error.message, + type: "error", + isLoading: false, + }); + return "error"; + } finally { + // Close Form Modal + handleCloseModal(); + // Remove Loading Message + removeNotification(loadingId as Id); + setFormLoading(false); + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Methods** : It call the initialization method of the allowance contract. + +Let's handle the submit form for set allowance. + +### Submit Set Allowance Form (Parent) + +Write the function to handle the set allowance form. + +- Scroll down to find the comment `// Step O - Handle Set Allowance Submit Form`. + +- Replace the existing **`onSubmit`** function with this code snippet: + +```javascript title="parent/index.tsx" +// Step O - Handle Set Allowance Submit Form +const onSubmit = async (value: { amount: string }) => { + if (!isContractInitialize) { + await initializeContract(); + } + setAllowance(value); +}; +``` + +As we have completed the step of setting allowance value, now it's time to get that allowance value form the contract. + +### Get Allowance Value + +Write the function for get the allowance value. + +- Scroll down to find the comment `// step P - Get AllowanceValue`. + +- Replace the existing **`getAllowance`** function with this code snippet: + +```javascript title="parent/index.tsx" +// step P - Get AllowanceValue +const getAllowance = async () => { + try { + // Call the smart contract method "GetAllowance" for the child role + const result = await allowanceContract?.callViewMethod( + "GetAllowance", + role.Child + ); + + // If the result contains a valid allowance value, set it in the state + if (result?.data?.value) { + setAllowanceValue(result?.data?.value); + } else { + // If no valid allowance is returned, set the allowance value to null + setAllowanceValue(null); + } + } catch (error) { + // Log any errors that occur during the process + console.log("error", error); + } +}; +``` + +At this point, we have completed all the functionalities for the parent role and now it's time to prepare functionalities for the child role. + +### Configure Spend Allowance Form + +**Step 1: Locate the File** + +1. Go to the `src/components/child/index.tsx` file. This file contains functionalities like spend allowance and get allowance value. + +**Step 2: Prepare Form for Spend Allowance** + +1. Find the comment `// Step Q - Configure Spend Allowance Form`. + +2. Replace the form variable with this code snippet: + +```javascript title="child/index.tsx" +// Step Q - Configure Spend Allowance Form +const form =useForm >{ + resolver: zodResolver(formSchema), + defaultValues: { + amount: "0", + }, +}; +``` + +### Ge Allowance Value (Child) + +Write the function for get the allowance value. + +- Scroll down to find the comment `// step R - Get AllowanceValue`. + +- Replace the existing **`getAllowance`** function with this code snippet: + +```javascript title="child/index.tsx" +// step R - Get AllowanceValue +const getAllowance = async () => { + try { + // Call the smart contract method "GetAllowance" for the child role + const result = await allowanceContract?.callViewMethod( + "GetAllowance", + currentWalletAddress + ); + + // If the result contains a valid allowance value, set it in the state + if (result?.data?.value) { + setAllowanceValue(result?.data?.value); + } + } catch (error) { + // Log any errors that occur during the process + console.log("error", error); + } +}; +``` + +### Spend Funds + +Write the function to spend the funds by the child. + +- Scroll down to find the comment `// step S - Spend Allowance`. + +- Replace the existing **`spendFunds`** function with this code snippet: + +```javascript title="child/index.tsx" +// step S - Spend Funds +const spendFunds = async (value: { amount: string }) => { + if(value.amount === "0"){ + return + } + + let loadingId; + try { + if (Number(allowanceValue) < Number(value.amount)) { + toast.info("Amount should be less then or equal to Allowance value"); + return; + } + + setFormLoading(true); + + // Start Loading + loadingId = toast.loading("Spending Funds InProgress.."); + await allowanceContract?.callSendMethod( + "useFunds", // Function Name + currentWalletAddress as string, // User Wallet Address + { value: value.amount } // Allowance Amount + ); + + form.reset(); + getAllowance(); + + // Update Loading Message with Success + toast.update(loadingId, { + render: `Funds Spent Successful`, + type: "success", + isLoading: false, + }); + } catch (error: any) { + console.error(error); + // Update Loading Message with Error + toast.update(loadingId as Id, { + render: error.message, + type: "error", + isLoading: false, + }); + return "error"; + } finally { + // Remove Loading Message + removeNotification(loadingId as Id); + setFormLoading(false); + } +}; +``` + +#### What This Function Does: + +1. **Calls Smart Contract Methods** : It calls the useFunds smart contract method to spend the allowance value. + +Let's handle the submit form to spend allowance. + +### Submit Spend Funds Form (Child) + +Write the function for handle the spend Funds form. + +- Scroll down to find the comment `// Step T - Handle Spend Funds Submit Form`. + +- Replace the existing **`onSubmit`** function with this code snippet: + +```javascript title="child/index.tsx" +// Step T - Handle Spend Funds Submit Form +const onSubmit = (values: { amount: string }) => { + spendFunds(values); +}; +``` + +Now that we've written all the necessary frontend functions and components, we're ready to run the Allowance dApp application in the next step. + +### Run Application + +In this step, we will run the Allowance dApp application. + +- To begin, run the following command on your terminal. + +```bash title="Terminal" +npm run dev +``` + +:::info + +**Note**: Ensure that you are running this command under the **allowance/2-dapp** folder. + +::: + +- You should observe the following as shown below. + + ![run-app-success](/img/vote-npm-run-console.png) + +- Upon clicking on the **localhost URL**, you should be directed to the Allowance dApp landing page as shown below. + +:::tip +If you are developing and testing this with github codespace, you can use port forward to test the web server that is running in codespace, here is the link on how to use port forward for codespace https://docs.github.com/en/codespaces/developing-in-a-codespace/forwarding-ports-in-your-codespace +::: + +- Usually codespace will automatically forward port, you should see a pop-up message at the bottom right of your codespace browser window as shown in the diagram below: + + ![open-in-browser](/img/codespace-forwarded-port.png) + +- Click the link to open the Allowance dApp in the browser. + + ![allowance-home-page](/img/allowance-home-page.png) + +#### Create Portkey Wallet + +:::info +Portkey is the first AA wallet from aelf's ecosystem, migrating users, developers and projects from Web2 to Web3 with DID solution. + +Users can swiftly log into Portkey via their Web2 social info with no private keys or mnemonics required. Underpinned by social recovery and decentralized guardian design, Portkey safeguards users' assets from centralized control and theft. Portkey has a unique payment delegation mechanism which enables interested parties to function as delegatees to pay for user activities on users' behalf. This means that users can create accounts for free and fees for other usages may also be covered in Portkey. + +Portkey also provides crypto on/off-ramp services, allowing users to exchange fiat with crypto freely. It supports the storage and management of various digital assets such as tokens, NFTs, etc. The compatibility with multi-chains and seamless connection to all kinds of DApps makes Portkey a great way to enter the world of Web3. + +With DID solution as its core, Portkey provides both Portkey Wallet and Portkey SDKs. + +For more information, you may visit the official documentation for Portkey at https://doc.portkey.finance/. +::: + +- Download the Chrome extension for Portkey from https://chromewebstore.google.com/detail/portkey-wallet/iglbgmakmggfkoidiagnhknlndljlolb. + +:::info +The Portkey extension supports Chrome browser only (for now). Please ensure that you are using Chrome browser. +You may download Chrome from https://www.google.com/intl/en_sg/chrome/. +::: + +- Once you have downloaded the extension, you should see the following on your browser as shown below. + + ![welcome-to-portkey](/img/welcome-to-portkey.png) + +- Click on `Get Start` and you should see the following interface as shown below. + + ![portkey-login](/img/portkey-login.png) + +**Sign up** + +- Switch to **aelf Testnet** network by selecting it: + + ![portkey-switch-to-testnet](/img/portkey-switch-to-testnet.png) + +:::danger +Please make sure you are using `aelf Testnet` in order to be able to receive your testnet tokens from the Faucet. +::: + +- Proceed to sign up with a Google Account or your preferred login method and complete the necessary accounts creation prompts and you should observe the following interface once you have signed up. + + ![success-login](/img/success-login.png) + +With that, you have successfully created your very first Portkey wallet within seconds. How easy was that? + +:::info +It is highly recommended to pin the Portkey wallet extension for easier access and navigation to your Portkey wallet! +::: + +- Next, click on ‘Open Portkey’ and you should now observe the following as shown below. + + ![portkey-wallet-preview](/img/portkey-wallet-preview.png) + +**Connect Portkey Wallet** + +- Click on **"Connect Wallet"** to connect your Portkey wallet. + + ![connect-wallet](/img/allowance-connect-wallet.png) + +- The button will change to **"Your Wallet Address"** when the connection is successful. + + ![collect-wallet-success](/img/allowance-wallet-connect-success.png) +Now we have successfully connected our portkey wallet with Allowance dApp so let's move into set Roles functionality throgh Admin wallet. +--- + +**Set Roles** + +- Click on **"Set Admin"** button to assign the admin role. + + ![step-1-allowance](/img/step-1-allowance.png) + +- A pop-up form will appear to set the admin role. Please enter the wallet address you want to assign as admin address. You can then use this wallet to perform other admin functions. + + ![step-2-allowance](/img/step-2-allowance.png) + +- Click on the **Set Admin** button. + +- You will now receive two transaction requests in your Portkey wallet to **sign**. The first request is to initialize the role contract, and the second is to set the admin role. + +- Click on **Sign** for both the transaction. + + ![step-3-allowance](/img/step-3-allowance.png) + ![step-4-allowance](/img/step-4-allowance.png) + +- After the transaction is successfully processed, you will be able to see the wallet address of the **Admin role**. + + ![step-5-allowance](/img/step-5-allowance.png) + +- As Admin role has been assigned, Please follow same steps to assign the **Parent** and **Child** roles. + + ![step-6-allowance](/img/step-6-allowance.png) + +- After assigning the Parent and Child roles, you will be able to see the wallet addresses for each of the roles. + + ![step-7-allowance](/img/step-7-allowance.png) + +We have now assigned the role using the role contract, and as an Admin, you can update all the roles. Next, we need to work with the allowance contract. To access the parent front end components, connect the *Parent* address portkey wallet, and you will automatically switch to the Parent role. + +--- + +**Set Allowance (Parent)** + +As a Parent, you can manage child role functions, such as set a child address, edit the child's address, and set an allowance for the child. + + ![step-8-allowance](/img/step-8-allowance.png) + +- Click on **Set Allowance** button to set the allowance for child. + + ![step-9-allowance](/img/step-9-allowance.png) + +- A pop-up form will appear to set the allowance. Please enter the amount you want to set as an allowance and click on the **Set Allowance** button. + + ![step-10-allowance](/img/step-10-allowance.png) + +- You will now receive two transaction requests in your Portkey wallet to **sign** . The first request is to initialize the allowance contract, and the second is to set the allowance. + +- Click on **Sign** for both the transaction. + + ![step-11-allowance](/img/step-11-allowance.png) + ![step-12-allowance](/img/step-12-allowance.png) + +- After the transaction is successfully processed, allowance value will be appear as shown below. + + ![step-13-allowance](/img/step-13-allowance.png) + +As we hav completed **Set Allowance** functionality successfully. Let's move to the other functionalities for the child role. To access the child role's front end components, connect the assigned child's Portkey wallet, and you will automatically switch to the child role. + +--- + +**Spend Funds** + +As a Child, the allowance amount will be visible and the child can spend funds within the assigned allowance limit. + + ![step-14-allowance](/img/step-14-allowance.png) + +- Enter the amount you want to spend and click on the **Spend** button. + + ![step-15-allowance](/img/step-15-allowance.png) + +- Now, You will receive a transaction request on your portkey wallet to **Sign** the transaction. + + ![step-16-allowance](/img/step-16-allowance.png) + +- Click on **Sign** the transaction. + +- After the transaction is successfully processed, your allowance value will be updated. + + ![step-17-allowance](/img/step-17-allowance.png) + +:::success +🎉 Congratulations Learners! You have successfully built your Allowance dApp. +::: + +## 🎯 Conclusion + +🎉 Congratulations on completing the **Allowance dApp** tutorial! 🎉 You’ve taken significant steps in setting up your development environment, building and deploying two smart contracts, and creating a fully functional Allowance dApp on the aelf blockchain. 🌟 + +**📚 What You've Learned** + +Throughout this tutorial, you've mastered: + +- **🛠️ Setting Up Your Development Environment:** You prepared your workspace by installing and configuring all the necessary tools to kickstart your smart contract project. + +- **💻 Developing the Role Smart Contract:** You created a Role contract that defines roles and permissions, including Admin, Parent, and Child roles, which allow users to interact according to assigned roles. + +- **💻 Developing the Allowance Smart Contract:** You built the Allowance contract to enable Parents to set spending limits for Children, creating the foundation of a decentralized allowance management system. + +- **🚀 Deploying Both Smart Contracts:** You deployed both contracts to the aelf blockchain, enabling your dApp to use the features in a live environment. + +- **🔧 Interacting with Your Deployed Smart Contract:** You connected the dApp frontend to the blockchain, integrated Portkey for wallet connectivity, and set up functions for managing roles and allowances directly through the dApp interface. + +**🔍 Final Output** + +By now, you should have: + +- 📜 **Two deployed smart contracts** — one for managing user roles (Admin, Parent, and Child) and another for setting and managing allowances within the dApp. + +- 💻 **A fully functional Allowance dApp** — allowing users to assign roles, set allowances, and spend funds within set limits, all through a secure and intuitive interface. + +**➡️ What's Next?** + +With the foundation in place, consider exploring advanced topics: + +- **📈 Enhancing Smart Contract Logic:** Add new features, such as notifications for spending limits, allowance resets, or reports on spending habits. + +- **🔒 Improving Security:** Ensure your dApp and smart contract are secure by implementing best practices and security measures. + +- **🌍 Exploring Cross-Chain Features:** Expand your dApp’s reach by exploring aelf’s cross-chain interoperability, enabling interactions with other blockchain networks + +You’ve now acquired the tools to take your Allowance dApp to the next level! Keep building, innovating, and exploring with aelf. 🚀 + +Happy coding and growing your **Allowance dApp! 😊** diff --git a/docs/quick-start/developers/dao-dapp/index.md b/docs/quick-start/developers/dao-dapp/index.md index 3d3e3902..3070c2f7 100644 --- a/docs/quick-start/developers/dao-dapp/index.md +++ b/docs/quick-start/developers/dao-dapp/index.md @@ -339,7 +339,7 @@ namespace AElf.Contracts.BuildersDAO ``` :::danger -Aelf sidechain does not allow duplicate identical smart contracts. Hence, we will be using the author variable as the unique identifier for our voting smart contract in order to deploy the smart contract successfully. +Aelf dAppChain does not allow duplicate identical smart contracts. Hence, we will be using the author variable as the unique identifier for our voting smart contract in order to deploy the smart contract successfully. ::: #### Implementing Initialize Function @@ -552,7 +552,7 @@ public override BoolValue GetMemberExist(Address input) With that, we have implemented all the functionalities of our Voting dApp smart contract. -In the next step, we will compile our smart contract and deploy our written smart contract to the aelf sidechain. +In the next step, we will compile our smart contract and deploy our written smart contract to the aelf dAppChain. diff --git a/docs/quick-start/node-operators/apply-to-be-a-bp/index.md b/docs/quick-start/node-operators/apply-to-be-a-bp/index.md index 0060fc08..5ef637cb 100644 --- a/docs/quick-start/node-operators/apply-to-be-a-bp/index.md +++ b/docs/quick-start/node-operators/apply-to-be-a-bp/index.md @@ -28,7 +28,7 @@ description: Participate in BP election aelf doesn't have light nodes, so all nodes are full nodes. [Click here](/quick-start/node-operators/set-up-a-node-on-mainnet/) to learn how to set up a full node. -**Note:** To become a BP, you need to run individual nodes for both MainChain aelf and all the SideChains. +**Note:** To become a BP, you need to run individual nodes for both aelf MainChain and all the dAppChains. ### Participate in BP Election diff --git a/docs/quick-start/node-operators/set-up-a-node-on-mainnet/index.md b/docs/quick-start/node-operators/set-up-a-node-on-mainnet/index.md index ff76d4da..8ab4e616 100644 --- a/docs/quick-start/node-operators/set-up-a-node-on-mainnet/index.md +++ b/docs/quick-start/node-operators/set-up-a-node-on-mainnet/index.md @@ -30,7 +30,7 @@ There are two ways to run an aelf node: using Docker (recommended) or running bi **Note:** * For non-block producing nodes, there is no requirement on the number of nodes. -* To become a BP, run individual nodes for both MainChain aelf and all SideChains. +* To become a BP, run individual nodes for both aelf MainChain and all dAppChains. **Time Syncing:** Ensure your server is time-synced via NTP to avoid syncing issues. diff --git a/docs/quick-start/node-operators/set-up-a-node-on-testnet/index.md b/docs/quick-start/node-operators/set-up-a-node-on-testnet/index.md index 7c722efa..b825304f 100644 --- a/docs/quick-start/node-operators/set-up-a-node-on-testnet/index.md +++ b/docs/quick-start/node-operators/set-up-a-node-on-testnet/index.md @@ -26,7 +26,7 @@ Before starting, install the necessary tools and frameworks. Detailed instructio * c5.xlarge or N2 instance: 4 vCPU, 8GiB RAM, 800GiB storage, 100 Mbps internet bandwidth -**Note:** For testing or dApp deployment, run a SideChain node only. Use the same configuration for multiple nodes on both MainChain and SideChain. +**Note:** For testing or dApp deployment, run a dAppChain node only. Use the same configuration for multiple nodes on both MainChain and dAppChain. **Time Syncing:** Ensure your server is time-synced via NTP to avoid syncing issues. @@ -189,7 +189,7 @@ aelf-command get-blk-height -e http://your-node-ip:port ### Note -Each side chain has its own P2P network, add the mainnet sidechain nodes as peer: +Each side chain has its own P2P network, add the mainnet dAppChain nodes as peer: ```` ```sh diff --git a/docs/resources/whitepaper-2/ai-integration-points-in-the-aelf-ecosystem/operational-excellence/index.md b/docs/resources/whitepaper-2/ai-integration-points-in-the-aelf-ecosystem/operational-excellence/index.md index 8fce96ae..90935f82 100644 --- a/docs/resources/whitepaper-2/ai-integration-points-in-the-aelf-ecosystem/operational-excellence/index.md +++ b/docs/resources/whitepaper-2/ai-integration-points-in-the-aelf-ecosystem/operational-excellence/index.md @@ -106,7 +106,7 @@ Intelligent load balancing, powered by AI and machine learning, offers substanti ## iv) AI-Facilitated Cross-Chain Interoperability for aelf -Incorporating AI into aelf's cross-chain interoperability framework can significantly enhance the efficiency and security of data transfer and validation processes. By leveraging AI-driven optimisations, aelf can ensure seamless communication and robust performance within itself between MainChain and SideChains, and more importantly with various other blockchain networks. +Incorporating AI into aelf's cross-chain interoperability framework can significantly enhance the efficiency and security of data transfer and validation processes. By leveraging AI-driven optimisations, aelf can ensure seamless communication and robust performance within itself between MainChain and dAppChains, and more importantly with various other blockchain networks. ### Optimising Data Transfer diff --git a/docs/resources/whitepaper-2/background-on-aelf/index.md b/docs/resources/whitepaper-2/background-on-aelf/index.md index 9fdab792..7bd7ea0c 100644 --- a/docs/resources/whitepaper-2/background-on-aelf/index.md +++ b/docs/resources/whitepaper-2/background-on-aelf/index.md @@ -11,13 +11,13 @@ The story of aelf began on 10 December 2017, when aelf's vision and plans were i aelf is primarily a multi-chain parallel computing blockchain framework which was created to address several of the limitations of traditional blockchain systems, such as performance bottlenecks and data complexity. aelf's vision is to be a "Linux Ecosystem" equivalent for a blockchain that incorporates state of the art IT design principles, which in particular allows developers to customise Chains to meet their own needs. At its core, aelf contains the following main features: -1. MainChain and multi-layer SideChains to handle various user driven scenarios. One chain is designed for one use case, distributing different tasks on multiple chains, which improves processing efficiency. +1. MainChain and multi-layer dAppChains to handle various user driven scenarios. One chain is designed for one use case, distributing different tasks on multiple chains, which improves processing efficiency. 2. Communication with external blockchain networks, such as Bitcoin and Ethereum, via cross chain messaging protocols. 3. Parallel processing for non-competing transactions in a cloud-based environment. 4. Basic components for a minimum viable Block and Genesis Smart Contract Collection for each Chain, which reduces data complexity and allows for high customisation at the same time. -5. Permission for stakeholders to approve amendments to the protocol, including redefining the Consensus Protocol; Permission for SideChains to join or exit from MainChain dynamically based on the Consensus Protocol. +5. Permission for stakeholders to approve amendments to the protocol, including redefining the Consensus Protocol; Permission for dAppChains to join or exit from MainChain dynamically based on the Consensus Protocol. -aelf's primary strength lies in its architecture, which utilises a multi-layered structure comprising a MainChain and multiple SideChains. This differs from a traditional Single Chain system in that aelf is a "Branched Ecosystem", where the MainChain works as the backbone of the system and connects to multiple SideChains. Compared with the traditional "one Chain to any type of Contract", aelf's "One Chain to one type of Contract" design allows aelf to distribute tasks efficiently and process transactions in parallel, significantly enhancing scalability and reducing congestion. At the same time, the SideChains are easier to manage and can be tailored for specific applications, enabling aelf to support a wide range of use cases without compromising performance. +aelf's primary strength lies in its architecture, which utilises a multi-layered structure comprising a MainChain and multiple dAppChains. This differs from a traditional Single Chain system in that aelf is a "Branched Ecosystem", where the MainChain works as the backbone of the system and connects to multiple dAppChains. Compared with the traditional "one Chain to any type of Contract", aelf's "One Chain to one type of Contract" design allows aelf to distribute tasks efficiently and process transactions in parallel, significantly enhancing scalability and reducing congestion. At the same time, the dAppChains are easier to manage and can be tailored for specific applications, enabling aelf to support a wide range of use cases without compromising performance. For aelf's consensus mechanism, it utilises the Delegated Proof of Stake (DPoS) to manage overall network efficiency. DPoS is known for its speed and energy efficiency compared to other consensus mechanisms like Proof of Work (PoW). By allowing token holders to vote for delegates who validate transactions and maintain the network, aelf ensures a high level of security and decentralisation while keeping transaction times low. Additionally, aelf's dynamic indexing and comprehensive token system offer robust support for various applications, from digital asset management to DeFi platforms, making it a versatile and powerful blockchain solution for all types of developers. diff --git a/docs/resources/whitepaper-2/executive-summary/index.md b/docs/resources/whitepaper-2/executive-summary/index.md index ec68b10c..d508c2a3 100644 --- a/docs/resources/whitepaper-2/executive-summary/index.md +++ b/docs/resources/whitepaper-2/executive-summary/index.md @@ -7,12 +7,12 @@ description: "" Download our latest Whitepaper v2.0 [here](pathname:///pdf/aelf_whitepaper_v2.0.pdf). -[aelf](https://aelf.com/) is a cutting-edge multi-chain blockchain framework launched in December 2017, utilising the powerful C# programming language. Its multi-layered structure, featuring MainChain and SideChains, effectively tackles the challenges of traditional blockchain systems, such as performance bottlenecks and data complexity. This architecture improves scalability and reduces congestion by distributing tasks across multiple chains. With an emphasis on developer customisation and parallel processing, aelf's framework is versatile, supporting a wide range of applications from digital asset management to DeFi. For aelf's original technical architecture, please refer to our original Whitepaper v1.0 [here](/resources/whitepaper/). +[aelf](https://aelf.com/) is a cutting-edge multi-chain blockchain framework launched in December 2017, utilising the powerful C# programming language. Its multi-layered structure, featuring MainChain and dAppChains, effectively tackles the challenges of traditional blockchain systems, such as performance bottlenecks and data complexity. This architecture improves scalability and reduces congestion by distributing tasks across multiple chains. With an emphasis on developer customisation and parallel processing, aelf's framework is versatile, supporting a wide range of applications from digital asset management to DeFi. For aelf's original technical architecture, please refer to our original Whitepaper v1.0 [here](/resources/whitepaper/). In aelf's Whitepaper 2.0, the mission is to leverage artificial intelligence (AI) to enhance its operational efficiency. AI-driven machine learning models optimise smart contract execution and gas usage, predict network congestion, and dynamically adjust resources to ensure high performance. Additionally, AI enables intelligent load balancing and predictive scaling, ensuring efficient traffic distribution and resource utilisation throughout the network. For aelf's AI Oracle, it's aim is to implement a credible Web3 AI framework that enhances on-chain smart contracts with AI features, promoting the creation of AI-centric decentralized applications(AI-dApps). For developers, aelf provides an AI-enhanced environment that simplifies smart contract creation with Natural Language Processing (NLP) and offers real-time support through AI-powered chatbots. These tools make blockchain technology more accessible to non-technical users and streamline the development process for experienced developers. In aelf's AI-based smart contract auditing, smart contract code is input into aelf's pre-trained model to analyse syntax and logical structure, identifying security vulnerabilities and errors, and generating a detailed audit report with remediation suggestions for aelf developers before deploying their smart contracts on the aelf chain. By incorporating AI, aelf not only improves the user experience but also expands its user base, fostering adoption and innovation in the blockchain space. -Beyond AI, aelf will be introducing a new modular Layer 2 chain utilising ZK Rollup technology that would significantly enhance aelf's performance, scalability, and EVM compatibility. This approach will reduce Layer 1 gas storage costs, lower transaction costs for users, and ultimately improves privacy and the user experience. +Beyond AI, aelf will be introducing a new modular blockchain technology that would significantly enhance aelf's performance, scalability, and EVM compatibility. This approach will reduce gas storage costs, lower transaction costs for users, and ultimately improves privacy and the user experience. -Ultimately, aelf is a versatile multi-chain blockchain framework that enhances efficiency and scalability through a multi-layered architecture, AI integration, and modular Layer 2 ZK Rollup technology, making it highly efficient, secure, and developer-friendly. +Ultimately, aelf is a versatile multi-chain blockchain framework that enhances efficiency and scalability through a multi-layered architecture, AI integration, and modular structure, making it highly efficient, secure, and developer-friendly. diff --git a/docs/resources/whitepaper-2/index.md b/docs/resources/whitepaper-2/index.md index 69b6b33a..eb8ec56b 100644 --- a/docs/resources/whitepaper-2/index.md +++ b/docs/resources/whitepaper-2/index.md @@ -21,6 +21,6 @@ description: aelf's updated Whitepaper v2.0 featuring AI + Blockchain - [Enabling Non-Technical Users to Create Smart Contracts with NLP on aelf](./ai-integration-points-in-the-aelf-ecosystem/developer-and-user-experience/#i-enabling-non-technical-users-to-create-smart-contracts-with-nlp-on-aelf) - [AI based Smart Contract Audit for Developers on aelf](./ai-integration-points-in-the-aelf-ecosystem/developer-and-user-experience/#ii-ai-based-smart-contract-audit-for-developers-on-aelf) - [Enhancing User and Developer Experience with AI-Powered Chatbots on aelf](./ai-integration-points-in-the-aelf-ecosystem/developer-and-user-experience/#iii-enhancing-user-and-developer-experience-with-ai-powered-chatbots-on-aelf) -- [Beyond AI - A Modular + ZK Rollup Blockchain](./modular-blockchain/) +- [Beyond AI - A Modular Blockchain](./modular-blockchain/) - [Roadmap](./roadmap/) - [References and further readings](./references-and-further-readings/) \ No newline at end of file diff --git a/docs/resources/whitepaper-2/modular-blockchain/index.md b/docs/resources/whitepaper-2/modular-blockchain/index.md index bf9c91fe..f21777d8 100644 --- a/docs/resources/whitepaper-2/modular-blockchain/index.md +++ b/docs/resources/whitepaper-2/modular-blockchain/index.md @@ -1,6 +1,6 @@ --- sidebar_position: 9 -title: Beyond AI - A Modular + ZK Rollup Blockchain +title: An AI-enhanced Layer 1 blockchain description: "" --- # aelf as a modular blockchain @@ -21,11 +21,11 @@ By separating these tasks, a modular blockchain enables independent optimisation ## The present status of aelf -As elaborated before, aelf operates on a mainchain-sidechain architecture. Its sidechains resemble the consumer chains of Cosmos or the parachains of Polkadot. Similar to these platforms, aelf decouples functionality at the code level — a modular or deconstructed approach rooted in software engineering principles. The primary objectives of this architecture are to facilitate the development of modular plugins within the aelf ecosystem and to enable the loading of various modules in a pluggable manner, thereby enhancing aelf's scalability and flexibility. For instance, the consensus functionality can be treated as a pluggable/replaceable code package, making it convenient for developers to customise. +As elaborated before, aelf operates on a mainchain-dAppChain architecture. Its dAppChains resemble the consumer chains of Cosmos or the parachains of Polkadot. Similar to these platforms, aelf decouples functionality at the code level — a modular or deconstructed approach rooted in software engineering principles. The primary objectives of this architecture are to facilitate the development of modular plugins within the aelf ecosystem and to enable the loading of various modules in a pluggable manner, thereby enhancing aelf's scalability and flexibility. For instance, the consensus functionality can be treated as a pluggable/replaceable code package, making it convenient for developers to customise. -Notwithstanding the aforementioned points, the current mainchain-sidechain architecture of aelf experiences performance bottlenecks, particularly in terms of its TPS capacity. aelf will be introducing a new Layer 2 chain utilising [ZK Rollup technology](https://ethereum.org/en/developers/docs/scaling/zk-rollups/) that would considerably enhance aelf's performance, scalability, and compatibility with the Ethereum Virtual Machine (EVM). +Notwithstanding the aforementioned points, the current mainchain-dAppChain architecture of aelf experiences performance bottlenecks, particularly in terms of its TPS capacity. aelf will be introducing a modular chain structure that would considerably enhance aelf's performance, scalability, and compatibility with the other blockchain Virtual Machines (VMs). -Consequently, we have initiated the **Modular + ZK Rollup project** to address these challenges. +Consequently, we have initiated the **Modular Blockchain project** to address these challenges. ## The aelf solution @@ -43,7 +43,7 @@ The aelf ZK-rollup utilises Polygon CDK, an advanced open-source framework desig Operating in the validium mode while maintaining seamless interoperability with all other EVM chains, aelf ZK-rollup offers a high-performance Layer 2 scaling solution. As transaction data is not stored on the aelf mainnet but executed and stored off-chain, this significantly enhances scalability. Validium, under the premise of ensuring security, reduces L1 gas storage costs, thereby lowering transaction costs for users on Layer 2 while significantly improving user privacy and experience. -Unlike traditional rollups and sidechains, aelf ZK-rollup only shares proofs of validity, which are used to confirm transaction outcomes with Layer 1, rather than the actual executed transaction data. Its operation works as follows: A verifier smart contract is deployed on aelf Layer 1, and validium submits proofs of validity to this contract. These proofs, inherently zero-knowledge, contain transaction results without revealing specific transaction data. +Unlike traditional rollups and dAppChains, aelf ZK-rollup only shares proofs of validity, which are used to confirm transaction outcomes with Layer 1, rather than the actual executed transaction data. Its operation works as follows: A verifier smart contract is deployed on aelf Layer 1, and validium submits proofs of validity to this contract. These proofs, inherently zero-knowledge, contain transaction results without revealing specific transaction data. The verifier smart contract assesses the validity of the proofs. Should any batch submitted by validium be found invalid, it will be rejected and not stored on the aelf Layer 1. @@ -68,9 +68,9 @@ Advantages of DAC include: 1. reduce transaction fees; less computation equals lower costs. 2. state privacy; maintaining secure records of state changes for data integrity. -### aelf ZK-rollup Node + #### zkEVM / ZKProver diff --git a/docs/resources/whitepaper-2/roadmap/index.md b/docs/resources/whitepaper-2/roadmap/index.md index 15c64941..dbe18c47 100644 --- a/docs/resources/whitepaper-2/roadmap/index.md +++ b/docs/resources/whitepaper-2/roadmap/index.md @@ -7,7 +7,7 @@ description: 10 This roadmap outlines aelf's strategic integration of AI technologies, focusing on enhancing user and developer experiences, optimising smart contract operations, and ensuring robust, scalable blockchain solutions that is on par with leading technologies. -![aelf Roadmap](/img/aelf_roadmap.png "aelf Roadmap") +![aelf Roadmap](/img/aelf_roadmap_2.png "aelf Roadmap") ## Q3 2024 @@ -29,9 +29,9 @@ This roadmap outlines aelf's strategic integration of AI technologies, focusing 2. [AI Oracle on aelf](/resources/whitepaper-2/ai-integration-points-in-the-aelf-ecosystem/operational-excellence/#ii-ai-oracle-on-aelf) Deploy an AI based oracle to facilitate the development of AI-powered dApps, improve interaction capabilities, and support collaborations with AI Agent platforms on the aelf blockchain. -3. [aelf as a Modular + ZK-rollup Layer 2 Blockchain](/resources/whitepaper-2/modular-blockchain/) +3. [aelf as a Modular Blockchain](/resources/whitepaper-2/modular-blockchain/) - Advance aelf's modular architecture to allow for greater customisation and scalability, catering to diverse application needs and enhancing overall network flexibility, while implementing ZK-Rollup as a Layer 2 solution for optimal TPS, efficiency and EVM compatibility. + Advance aelf's modular architecture to allow for greater customisation and scalability, catering to diverse application needs and enhancing overall network flexibility, while implementing modular blockchain solution for optimal TPS, efficiency and EVM compatibility. ## Q1 2025 diff --git a/docs/tools/faucet/index.md b/docs/tools/faucet/index.md index da24f605..f620f2f6 100644 --- a/docs/tools/faucet/index.md +++ b/docs/tools/faucet/index.md @@ -20,33 +20,11 @@ To deploy smart contracts or execute on-chain transactions on aelf, you'll requi **Get ELF Tokens** - - - -Run the following command to get testnet ELF tokens from faucet. Remember to either export your wallet address or replace $WALLET_ADDRESS with your wallet address. - -```bash title="Terminal" -curl -X POST "https://faucet.aelf.dev/api/claim?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d "" -``` -To check your wallet's current ELF balance: -```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: -Enter the required param \: **ELF** -Enter the required param \: **$WALLET_ADDRESS** - -You should see the Result displaying your wallet's ELF balance. - - - - -Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). Enter your address and click `Get Tokens`. +- Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). +- Enter your address and click `Get Tokens`. ![result](/img/get-token-ui.png) - - ### 2.2 Getting Testnet Token Type SEED Token @@ -54,24 +32,12 @@ To acquire testnet Token type SEED for creating fungible or non-fungible tokens **Get Token Type Seed Token** - - - -Run the following command to get testnet SEED token from faucet. Remember to either export your wallet address or replace $WALLET_ADDRESS with your wallet address. - -```bash title="Terminal" -curl -X POST "https://faucet.aelf.dev/api/claim-seed?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d "" -``` - - - - -Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). Click on the dropdown to select "Token Seed". Enter your address and click `Get Seed`. +- Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). +- Click on the dropdown to select **"Token Seed"**. +- Enter your address and click `Get Seed`. ![result](/img/get-testnet-token-seed.png) - - ### 2.3 Getting Testnet NFT Type SEED Token @@ -79,21 +45,9 @@ To acquire testnet NFT type SEED for creating fungible or non-fungible tokens on **Get NFT Type Seed Token** - - - -Run this command to get testnet NFT type SEED token from faucet. Remember to either export your wallet address or replace $WALLET_ADDRESS with your wallet address. - -```bash title="Terminal" -curl -X POST "https://faucet.aelf.dev/api/claim-nft-seed?walletAddress=$WALLET_ADDRESS" -H "accept: application/json" -d "" -``` - - - - -Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). Click on the dropdown to select "NFT Seed". Enter your address and click `Get Seed`. +- Go to this url [https://faucet-ui.aelf.dev](https://faucet-ui.aelf.dev). +- Click on the dropdown to select **"NFT Seed"**. +- Enter your address and click `Get Seed`. ![result](/img/get-testnet-nft-seed.png) - - \ No newline at end of file diff --git a/docs/tools/smart-contract-templates/deploying-contracts-with-bp-approval/index.md b/docs/tools/smart-contract-templates/deploying-contracts-with-bp-approval/index.md index 8ff8ac1f..b3d881e0 100644 --- a/docs/tools/smart-contract-templates/deploying-contracts-with-bp-approval/index.md +++ b/docs/tools/smart-contract-templates/deploying-contracts-with-bp-approval/index.md @@ -13,8 +13,8 @@ Contracts can be deployed or updated via two methods: aelf explorer or aelf-comm In these cases, **BP approval is needed for contract updates:** - Upgrading system contracts on MainChain. -- Upgrading system contracts on exclusive SideChains. -- Upgrading system contracts on shared SideChains. +- Upgrading system contracts on exclusive dAppChains. +- Upgrading system contracts on shared dAppChains. System contracts can only be deployed in the Genesis block. After launch, only updates are supported. This guide focuses on contract deployment on aelf Mainnet with `ContractDeploymentAuthorityRequired` set to true. diff --git a/docs/tools/smart-contract-templates/deploying-contracts-without-bp-approval/index.md b/docs/tools/smart-contract-templates/deploying-contracts-without-bp-approval/index.md index 4e00104a..1908d073 100644 --- a/docs/tools/smart-contract-templates/deploying-contracts-without-bp-approval/index.md +++ b/docs/tools/smart-contract-templates/deploying-contracts-without-bp-approval/index.md @@ -12,11 +12,11 @@ Contracts can be deployed/updated via aelf explorer or aelf-command. Ensure npm In these 6 cases, **BP approval is not needed for contract deployment/updates:** -- Deploying user contracts on shared SideChains (initiated by users or BPs). -- Updating user contracts on shared SideChains (initiated by contract creators). -- Deploying user contracts on exclusive SideChains (initiated by SideChain creators). -- Updating user contracts on exclusive SideChains (initiated by contract creators). -- Deploying user contracts on MainChain (initiated by BPs, recommended on SideChains). +- Deploying user contracts on shared dAppChains (initiated by users or BPs). +- Updating user contracts on shared dAppChains (initiated by contract creators). +- Deploying user contracts on exclusive dAppChains (initiated by dAppChain creators). +- Updating user contracts on exclusive dAppChains (initiated by contract creators). +- Deploying user contracts on MainChain (initiated by BPs, recommended on dAppChains). - Updating user contracts on MainChain (initiated by contract creators). ![Deploying Contract without BP Approval](/img/No-BP-approval-required.webp) diff --git a/static/img/aelf_roadmap_2.png b/static/img/aelf_roadmap_2.png new file mode 100644 index 00000000..5b591a59 Binary files /dev/null and b/static/img/aelf_roadmap_2.png differ diff --git a/static/img/allowance-connect-wallet.png b/static/img/allowance-connect-wallet.png new file mode 100644 index 00000000..55cb4de8 Binary files /dev/null and b/static/img/allowance-connect-wallet.png differ diff --git a/static/img/allowance-home-page.png b/static/img/allowance-home-page.png new file mode 100644 index 00000000..ee8af331 Binary files /dev/null and b/static/img/allowance-home-page.png differ diff --git a/static/img/allowance-wallet-connect-success.png b/static/img/allowance-wallet-connect-success.png new file mode 100644 index 00000000..3f5a6c57 Binary files /dev/null and b/static/img/allowance-wallet-connect-success.png differ diff --git a/static/img/step-1-allowance.png b/static/img/step-1-allowance.png new file mode 100644 index 00000000..9c981c13 Binary files /dev/null and b/static/img/step-1-allowance.png differ diff --git a/static/img/step-10-allowance.png b/static/img/step-10-allowance.png new file mode 100644 index 00000000..24fef26f Binary files /dev/null and b/static/img/step-10-allowance.png differ diff --git a/static/img/step-11-allowance.png b/static/img/step-11-allowance.png new file mode 100644 index 00000000..3f1fc053 Binary files /dev/null and b/static/img/step-11-allowance.png differ diff --git a/static/img/step-12-allowance.png b/static/img/step-12-allowance.png new file mode 100644 index 00000000..40618c1b Binary files /dev/null and b/static/img/step-12-allowance.png differ diff --git a/static/img/step-13-allowance.png b/static/img/step-13-allowance.png new file mode 100644 index 00000000..91605081 Binary files /dev/null and b/static/img/step-13-allowance.png differ diff --git a/static/img/step-14-allowance.png b/static/img/step-14-allowance.png new file mode 100644 index 00000000..06e48ce6 Binary files /dev/null and b/static/img/step-14-allowance.png differ diff --git a/static/img/step-15-allowance.png b/static/img/step-15-allowance.png new file mode 100644 index 00000000..11fca9af Binary files /dev/null and b/static/img/step-15-allowance.png differ diff --git a/static/img/step-16-allowance.png b/static/img/step-16-allowance.png new file mode 100644 index 00000000..7bbff9d1 Binary files /dev/null and b/static/img/step-16-allowance.png differ diff --git a/static/img/step-17-allowance.png b/static/img/step-17-allowance.png new file mode 100644 index 00000000..048e48ba Binary files /dev/null and b/static/img/step-17-allowance.png differ diff --git a/static/img/step-2-allowance.png b/static/img/step-2-allowance.png new file mode 100644 index 00000000..deda9d34 Binary files /dev/null and b/static/img/step-2-allowance.png differ diff --git a/static/img/step-3-allowance.png b/static/img/step-3-allowance.png new file mode 100644 index 00000000..22e087b7 Binary files /dev/null and b/static/img/step-3-allowance.png differ diff --git a/static/img/step-4-allowance.png b/static/img/step-4-allowance.png new file mode 100644 index 00000000..742ccafb Binary files /dev/null and b/static/img/step-4-allowance.png differ diff --git a/static/img/step-5-allowance.png b/static/img/step-5-allowance.png new file mode 100644 index 00000000..45a06687 Binary files /dev/null and b/static/img/step-5-allowance.png differ diff --git a/static/img/step-6-allowance.png b/static/img/step-6-allowance.png new file mode 100644 index 00000000..b9c41842 Binary files /dev/null and b/static/img/step-6-allowance.png differ diff --git a/static/img/step-7-allowance.png b/static/img/step-7-allowance.png new file mode 100644 index 00000000..ad768c35 Binary files /dev/null and b/static/img/step-7-allowance.png differ diff --git a/static/img/step-8-allowance.png b/static/img/step-8-allowance.png new file mode 100644 index 00000000..40363cfa Binary files /dev/null and b/static/img/step-8-allowance.png differ diff --git a/static/img/step-9-allowance.png b/static/img/step-9-allowance.png new file mode 100644 index 00000000..2ba45b05 Binary files /dev/null and b/static/img/step-9-allowance.png differ diff --git a/static/pdf/aelf_whitepaper_v2.0.pdf b/static/pdf/aelf_whitepaper_v2.0.pdf index 01f5e210..7d285946 100644 Binary files a/static/pdf/aelf_whitepaper_v2.0.pdf and b/static/pdf/aelf_whitepaper_v2.0.pdf differ