Skip to content

Commit

Permalink
Adds ChainIDE for Astar (#506)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiadd committed Nov 8, 2023
1 parent 10a9c12 commit 167a272
Show file tree
Hide file tree
Showing 8 changed files with 390 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/build/EVM/chainide-for-astar-evm/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "ChainIDE for Astar EVM",
"position": 2
}
5 changes: 5 additions & 0 deletions docs/build/EVM/chainide-for-astar-evm/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ChainIDE for Astar EVM

"ChainIDE for Astar" is the first multi-chain cloud-powered IDE and development platform for Astar WASM & EVM. Extending on top of our experience with ChainIDE, ChainIDE for Astar is packed with the tooling, pre-made templates & tutorials for kickstarting Astar dApp development in a fully cloud-based environment.

![](https://chainide.com/static/ead2903c7c2ac312b3b86ca4c8fe13ab/26ebd/astar-evm.webp)
57 changes: 57 additions & 0 deletions docs/build/EVM/chainide-for-astar-evm/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_position: 1
---

# ChainIDE for Astar Environment Setup

> This section provides a detailed explanation of the environment configuration for Astar IDE, which is essential for developing dApp on the Astar blockchain.
### 1. Create a new Astar Project

Visit [ChainIDE](chainide.com) and click the "Try Now" button on the front page as shown in the figure below.

![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FHcGG1r0m832Y05z1D7VT%2Fimage.png?alt=media&token=2ba1b1c0-7bc2-49cc-b08e-35c29934f19f)

Here, you will choose your login method, which includes two options: GitHub and Guest. In the tutorial, select GitHub login, as later on, the use of the Sandbox requires users to log in with GitHub.

Click the "New Project" button.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FFaeBrBu7u5LUAxQynl1r%2Fimage.png?alt=media&token=7a988e98-415c-442e-a137-080f2dbd0372)

A pop-up window will appear. On the left side of the pop-up, select "Astar," and on the right side, choose the corresponding smart contract environment (EVM or WASM). Then, click to create a project using a template.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FtlDKHhGPOGacmVNHCOgE%2Fimage.png?alt=media&token=92b6347b-346e-420b-92c9-7684078338cd)

### 2. Configure Wallet

Astar IDE provides support for two smart contract environments: EVM and WASM. EVM is compatible with the Metamask wallet, while WASM supports four wallets: Polkadot Wallet, Sub Wallet, Math Wallet, and Talisman Wallet.

#### 2.1 Wallets Supporting EVM

##### 2.1.1 Metamask (Recommended)

> https://metamask.io/
#### 2.2 Wallets Supporting WASM

##### 2.2.1 Polkadot Wallet (Recommended)

> https://polkadot.js.org/extension/
##### 2.2.2 Sub Wallet

> https://www.subwallet.app/
##### 2.2.3 Math Wallet

> https://mathwallet.org/
##### 2.2.4 Talisman Wallet

> https://www.talisman.xyz/
### 3. Acquiring test tokens

A faucet is the site/place where you can get test tokens. Faucets are available for all Shibuya accounts and empty Astar and Shiden accounts. Use them to make sure your wallet has enough assets to cover the cost of deployment and pay transaction gas

Tutorial on Acquiring Test Tokens: https://docs.astar.network/docs/build/environment/faucet
103 changes: 103 additions & 0 deletions docs/build/EVM/chainide-for-astar-evm/use.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
sidebar_position: 2
---

# How to Use Astar EVM IDE?

> Set the entire process of writing, compiling, deploying, interacting, and querying with Astar EVM smart contracts
<iframe width="100%" height="500" src="https://www.youtube.com/embed/5m3-Ff17mjo?si=Rf5pLIlbZ1upWh-b" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>

### 1. Write a contract

Upon entering the project, the README.md file included in the folder will be automatically previewed.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FXlOvuSg0NjRdEaR8zpad%2Fimage.png?alt=media&token=fccb3f22-8cd5-4047-bf5f-80b5cc3e21b4)

In the Explorer panel, you can create new files (or folders), refresh the directory, and download files. You can also directly click on the files that come with the template.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FE2cSwSZdbKLZK5YN7XGK%2Fimage.png?alt=media&token=47ea9493-d238-474e-ab62-17a9d1f83dd3)

Click on a contract file to edit the code.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2Fc3NCif0cmQb6idg1jY4z%2Fimage.png?alt=media&token=a3bfae68-88a5-480d-b296-de50afd1b019)

### 2. Compile the contract

Once your contract code is written, click on the "Compiler" button in the right-side menu to open the compilation module. Choose the compiler version and decide whether to enable optimization, then click "Compile \*\*\*.sol" to initiate the compilation.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FQZbNokWNSvFgonXwTbJp%2Fimage.png?alt=media&token=0e4f3887-8b97-413d-8517-fcaead085d62)

After successful compilation, the ABI and BYTE CODE will be displayed below, and you'll see a message in the console stating "Compile contract success."

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FczE48oDmrmEi2hNWpGds%2Fimage.png?alt=media&token=3f51d9b4-063e-48dd-a60e-b13b54bc0781)

### 3. Connect to Astar EVM

Before deploying the contract, you need to click on "Connect Wallet" in the upper right corner and select to connect to JavaScript VM (used for testing, implemented in JavaScript) or Metamask (for deployment on the Astar blockchain).

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FLRhasXHh6XnfX6AsxOko%2Fimage.png?alt=media&token=81c389b6-c8b0-43c2-a26e-7f5ee01d60c9)

### 4. Deploy the contract

Click the "Deploy & Interaction" button on the right-hand side, which will bring up the deployment and interaction pages. Select the compiled contract and click "Deploy" to initiate the deployment (then confirm in Metamask). After successful contract deployment, the console will display the contract deployment result and relevant information.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2Fln6jNoeLtMlVkXYdRToD%2Fimage.png?alt=media&token=f45eeeb9-5a03-4f1b-9d30-7381903497bd)

In addition, you can click "Import Deployed Contract" to import a contract that has already been deployed for contract interactions.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2Fvs7JD4L1ByOYlg609PKg%2Fimage.png?alt=media&token=492fd5a0-21d4-45d3-af3d-46a9980c6800)

### 5. Contract interaction

After a successful contract deployment, you can interact with the contract. Click on the deployed contract, choose the corresponding interface, and click "Submit" or "Get" to perform interactions.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2F2W7d4EBGj5c5cZ4DdJTH%2Fimage.png?alt=media&token=15101c1a-a115-44ba-be8f-b30621d35528)

### 6. Transaction Query

Click on the transaction hash in the Output section to view the specific details of each transaction.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FhPClEEbEHXfKlahiWt1V%2Fimage.png?alt=media&token=8f6caec5-6be4-44bb-bdc7-11dee067ee14)

### 7. Verify the contract

Click on the "Scan Verifier" plugin on the right, select the contract you want to verify, enter the deployed contract address, and click "Verify."

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FB6FyC40PqzdcwYJjWlKv%2Fimage.png?alt=media&token=b61e484d-4ced-4a1b-a58e-d28cea41d85c)

After successful verification, you can view the link to the verified contract on BlockScout scan.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FwFhSzT1bdiDYld5cWQJt%2Fimage.png?alt=media&token=a8b1cdf7-658b-43d7-8608-88fb49fe2ef7)

### 8. Astar EVM Sandbox

If you prefer using the command line for development, you can open the Astar EVM Sandbox, which comes pre-loaded with [Hardhat](https://hardhat.org/), [Truffle](https://trufflesuite.com/), [Brownie](https://eth-brownie.readthedocs.io/en/stable/) [Ganache](https://trufflesuite.com/ganache/), [Git](https://git-scm.com/) and [Node.js V16](https://nodejs.org/en).

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2F246ekmxAbc8yLacVah0J%2Fimage.png?alt=media&token=db1d1d7c-a38c-4c8c-b39a-1053eaa97787)

### 9. serve your dApp

ChainIDE Sandbox makes it easier to develop full-stack dApps by providing powerful features such as port-forwarding. This means you can build a frontend for your Astar dApps using frontend frameworks (React/Vue/VanillaJS) in the browser. To build the frontend for Astar dApps, please use Voting dApp or Hardhat dApp Wave template. Follow the steps below showcasing how the port manager can be used to access the frontend.

#### 9.1 Open Port Manager

Click on the left side's Port Manager

![image-20231026183219456](https://d3gvnlbntpm4ho.cloudfront.net/astar_evm_Ide/image-20231026183219456.png)

Click on "Add Port"

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FjsLBwBqMkYaUC6DLktk2%2Fimage.png?alt=media&token=722f87a8-4ba3-4f2a-8086-a6d1cb6ebcc9)

Select the relevant options and click "Add"

![image-20231026183248705](https://d3gvnlbntpm4ho.cloudfront.net/astar_evm_Ide/image-20231026183248705.png)

#### 10.2 Access the frontend

Click the jump button to access the corresponding port

![image-20231026183332884](https://d3gvnlbntpm4ho.cloudfront.net/astar_evm_Ide/image-20231026183332884.png)

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FvICzLC9sWXColFYm4WQg%2Fimage.png?alt=media&token=1043c42d-8c65-40b4-907d-99921105e428)
4 changes: 4 additions & 0 deletions docs/build/wasm/chainide-for-astar-wasm/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "ChainIDE for Astar WASM",
"position": 7
}
5 changes: 5 additions & 0 deletions docs/build/wasm/chainide-for-astar-wasm/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# ChainIDE for Astar WASM

"ChainIDE for Astar" is the first multi-chain cloud-powered IDE and development platform for Astar WASM & EVM. Extending on top of our experience with ChainIDE, ChainIDE for Astar is packed with the tooling, pre-made templates & tutorials for kickstarting Astar dApp development in a fully cloud-based environment.

![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FahFXXhBvi6RCafGk7gFa%2Fimg_v2_c2f3adee-2848-4a42-ae87-ab50c8efb6ah.png?alt=media&token=8d1332f8-35b1-49e2-8844-9049d538fd8c)
57 changes: 57 additions & 0 deletions docs/build/wasm/chainide-for-astar-wasm/setup.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
sidebar_position: 1
---

# ChainIDE for Astar Environment Setup

> This section provides a detailed explanation of the environment configuration for Astar IDE, which is essential for developing dApp on the Astar blockchain.
### 1. Create a new Astar project

Visit [ChainIDE](chainide.com) and click the "Try Now" button on the front page as shown in the figure below.

![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FHcGG1r0m832Y05z1D7VT%2Fimage.png?alt=media&token=2ba1b1c0-7bc2-49cc-b08e-35c29934f19f)

Here, you will choose your login method, which includes two options: GitHub and Guest. We suggest you choose login with Github as later on the use of Sandbox requires users to log in with GitHub.

Click the "New Project" button.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FFaeBrBu7u5LUAxQynl1r%2Fimage.png?alt=media&token=7a988e98-415c-442e-a137-080f2dbd0372)

A pop-up window will appear. On the left side of the pop-up, select “Astar,” and on the right side, choose the corresponding smart contract environment (EVM or WASM). Then, click to create a project using a template.

![img](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MYy-lqJKjq1m0yBAX4r%2Fuploads%2FtlDKHhGPOGacmVNHCOgE%2Fimage.png?alt=media&token=92b6347b-346e-420b-92c9-7684078338cd)

### 2. Configure Wallet

Astar IDE provides support for two smart contract environments: EVM and WASM. EVM is compatible with the Metamask wallet, while WASM supports four wallets: Polkadot Wallet, Sub Wallet, Math Wallet, and Talisman Wallet.

#### 2.1 Wallets Supporting EVM

##### 2.1.1 Metamask (Recommended)

> https://metamask.io/
#### 2.2 Wallets Supporting WASM

##### 2.2.1 Polkadot Wallet (Recommended)

> https://polkadot.js.org/extension/
##### 2.2.2 Sub Wallet

> https://www.subwallet.app/
##### 2.2.3 Math Wallet

> https://mathwallet.org/
##### 2.2.4 Talisman Wallet

> https://www.talisman.xyz/
### 3. Acquiring test tokens

A faucet is the site/place where you can get test tokens. Faucets are available for all Shibuya accounts and empty Astar and Shiden accounts. Use them to make sure your wallet has enough assets to cover the cost of deployment and pay transaction gas

Tutorial on Acquiring Test Tokens: https://docs.astar.network/docs/build/environment/faucet

0 comments on commit 167a272

Please sign in to comment.