Skip to content

Commit

Permalink
Merge branch 'main' into zkEVM-user-guides
Browse files Browse the repository at this point in the history
  • Loading branch information
meganskye committed Mar 7, 2024
2 parents 79e4a9c + 670eb07 commit 872fa1d
Show file tree
Hide file tree
Showing 22 changed files with 226 additions and 56 deletions.
37 changes: 23 additions & 14 deletions docs/build/Introduction/astar_family.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,26 +6,25 @@ sidebar_position: 5

Prior to commencing development, it's important to understand the Astar Network family, and choose an appropriate network based on what you would like to do. Currently, there are a number of networks available, including the Local network which runs exclusively within your development environment. All networks support Substrate and EVM RPCs.

![Astar networks](img/networks.png)
![Astar networks](img/fig4.jpg)

## Local Networks

### Local Node

You can clone the Astar repository and run the local node provided, or download the precompiled binary and run it, instead. Both methods are described in the [Build Environment](../environment) section.
### Substrate Node
You can clone the Astar repository and run the local node provided, or download the precompiled binary and run it, instead. Both methods are described in the [Build](/docs/build) section.

### Swanky Node

Swanky Node is a Substrate based blockchain configured to enable the smart contract module `pallet-contracts`, and other features that assist local development of Wasm smart contracts.
For more information about Swanky Node, check out the [Swanky Suite](../wasm/swanky-suite) section.
For more information about Swanky Node, check out the [Swanky Suite](https://docs.astar.network/docs/build/wasm/swanky-suite/) section.

### Zombienet

With Zombienet users can download arbitrary Relay Chain and parachain binaries (or use images) to setup a configurable local test network. Users will have access to all privileged actions on the Relay Chain and parachains, which simplifies testing. For more information about Zombienet, check out the [Build Environment](../environment/zombienet-testing) chapter.
With Zombienet users can download arbitrary Relay Chain and parachain binaries (or use images) to setup a configurable local test network. Users will have access to all privileged actions on the Relay Chain and parachains, which simplifies testing. For more information about Zombienet, check out the [Build Environment](https://docs.astar.network/docs/build/environment/zombienet-testing) chapter.

## Testnets

### Shibuya
### Shibuya (Substrate)

Shibuya has nearly the same chain specifications as Shiden & Astar, and provides an ideal environment for developers to test and debug, prior to launching their dApp on mainnet.
Shibuya is running as a parachain of the Tokio Relay Chain, which is managed internally by the Astar team, and supports Shibuya, only, as test parachain.
Expand All @@ -34,28 +33,38 @@ The Shibuya native token symbol is SBY.

To obtain test tokens from the faucet, please visit the Astar Portal and connect to Shibuya. If for any reason the faucet is empty, please contact the Astar team on Discord.

### Rocstar
### zKatana (Sepolia)

An early iteration of the zkEVM testnet that used zk rollup architecture. Now deprecated.

Rococo is a test Relay Chain used by the Polkadot & Kusama communities. Astar team has deployed a parachain to it called Rocstar, which is mainly used for cross-chain integrations with other teams in the ecosystem. To obtain test tokens for Rocstar, please contact Astar team on Discord.
### zKyoto (Sepolia)

The Rocstar native token symbol is ROC.
zKyoto is a Validium-based network connected to the Ethereum Sepolia testnet and Polygon AggLayer. It is the testing and proving ground for dApps deployed on the Astar zkEVM.

## Mainnets

Astar has two mainnets, like most parachains in the Polkadot ecosystem. One on Kusama Relay Chain, and the other on Polkadot Relay chain.
Astar has three mainnets:

1. Astar zkEVM
2. Astar Parachain
3. Shiden Parachain

### Shiden
### Shiden Parachain (Substrate)

Shiden is a parachain connected to the Kusama Relay Chain, and used to deploy and test new releases of Astar runtime in a live production (canary) environment. Shiden is not considered a testnet since SDN has its own tokenomics and value, but is used to validate and stabilize new software releases and upgrades for Astar Network.

The Shiden native token symbol is SDN.

### Astar
### Astar Parachain (Substrate)

By now you may have already guessed that Astar network is a parachain on Polkadot Relay chain.
By now you may have guessed that Astar parachain is connected to Polkadot Relay chain.

The Astar native token symbol is ASTR.

### Astar zkEVM

Astar zkEVM is an Ethereum Layer 2 network, powered by Polygon CDK. Technically referred to as Validium, it combines zk rollup technology with modular data availability, synthesizing the best features of each.

## Questions and Assignments:

1. Using the account you created in previous chapters, visit to Astar portal, connect to Shibuya testnet and claim some tokens from the faucet. You will need them later to deploy contracts on Shibuya.
Expand Down
2 changes: 1 addition & 1 deletion docs/build/Introduction/create_account.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ sidebar_position: 3
# Create Account
If you never created a native Astar account, please follow the instructions in the [User Guide](/docs/use/manage-wallets/create-wallet).

If you are building EVM smart contracts you will need Metamask. Watch this short video to learn how.
If you are building EVM smart contracts you will need MetaMask. Watch this short video to learn how.

<iframe width="560" height="315" src="https://www.youtube.com/embed/9YHmmcQI6VQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
Binary file added docs/build/Introduction/img/fig4.jpg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion docs/build/Introduction/index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Introduction
![General understanding of programming basics](/docs/build/img/introduction.png)
To make use of this documentation effectively, you should possess a general understanding of programming basics. The programming languages used throughout are mainly Rust, Solidity, and JavaScript, for which previous knowledge is not necessary, but would be highly beneficial. In conjunction with improving your understanding of the material contained within these guides, we recommend that you review supplemental material covering these languages, in order to improve your overall understanding of the topics and the practical code examples provided.

To make use of this documentation effectively, you should possess a general understanding of programming basics. The programming languages used throughout are mainly Rust and JavaScript, for which previous knowledge is not necessary, but would be highly beneficial. You should also know how to use MetaMask, manage accounts and balances, and interact with the Ethereum Virtual Machine.

In conjunction with improving your understanding of the material contained within these guides, we recommend that you review supplemental material covering these languages, in order to improve your overall understanding of the topics and the practical code examples provided.

### Do I need blockchain knowledge to follow this documentation?
Your blockchain knowledge will be useful but if you are reading this that means you are on the right track.
Expand Down
4 changes: 0 additions & 4 deletions docs/build/Introduction/node_interact.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,6 @@ Developers can interact with Polkadot and its parachains using the [Polkadot\{.j

First, visit the Polkadot apps portal, and switch to an Astar node by selecting Astar under **Polkadot & Parachains** and press Switch. You will be able to toggle network selection by clicking on the network name in the top left.





![Switch to Astar](img/switch_astar.png)

## Review Accounts and Balances
Expand Down
1 change: 0 additions & 1 deletion docs/build/environment/gas-station.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ $Tip Value=Gas Price×1000$
- Shibuya API: GET [https://gas.astar.network/api/gasnow?network=shibuya&type=tip](https://gas.astar.network/api/gasnow?network=shibuya&type=tip)
- Shiden API: GET [https://gas.astar.network/api/gasnow?network=shiden&type=tip](https://gas.astar.network/api/gasnow?network=shiden&type=tip)
- Astar API: GET [https://gas.astar.network/api/gasnow?network=astar&type=tip](https://gas.astar.network/api/gasnow?network=astar&type=tip)
- Rocstar API: GET [https://gas.astar.network/api/gasnow?network=rocstar&type=tip](https://gas.astar.network/api/gasnow?network=rocstar&type=tip)

### Example output

Expand Down
2 changes: 1 addition & 1 deletion docs/build/integrations/indexers/subsquid.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Figure from "/src/components/figure"

# Subsquid

[Subsquid](https://subsquid.io) is an indexing framework supporting both [Substrate](/docs/learn/polkadot_relay#substrate) and [EVM](/docs/learn/polkadot_relay#ethereum-virtual-machine-evm)-based chains. It is [extremely flexible and offers high syncing speeds](https://docs.subsquid.io/migrate/subsquid-vs-thegraph/).
[Subsquid](https://subsquid.io) is an indexing framework supporting both [Substrate](/docs/learn/architecture/astar-parachain.md#substrate) and [EVM](/docs/learn/architecture/astar-parachain.md#ethereum-virtual-machine-evm)-based chains. It is [extremely flexible and offers high syncing speeds](https://docs.subsquid.io/migrate/subsquid-vs-thegraph/).

Subsquid indexer projects (or "squids") can be made from templates either manually or with [squid generation tools](https://docs.subsquid.io/basics/squid-gen/). The tools make ready-to-use indexer projects out of contracts' ABIs. The generated squids decode events and transactions of user-specified contracts, then serve the data over a GraphQL API or store it as a dataset on a filesystem. At the moment EVM/Solidity contracts are supported, with WASM/ink! contracts in the pipeline. Consider this route if your use case does not require any nontrivial transformations of blockchain data.

Expand Down
1 change: 0 additions & 1 deletion docs/build/zkEVM/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import introduction from "/docs/build/img/buildZkEvm.png"

Astar zkEVM is an Ethereum Layer-2 scaling solution leveraging Polygon's Chain Development Kit and cutting edge zero-knowledge cryptography to enable off-chain transaction execution, with finality and security guarantees provided by Ethereum. In coordination with our key partners, Astar zkEVM is well-positioned to take advantage of the extensive developer base and well-established toolset existing in the Ethereum ecosystem, and boasts the following key features:

- **Higher TPS than Ethereum or Astar Substrate EVM** - Leveraging zk rollup architecture, transactions are parallelized on Layer 2 and submitted on-chain to Layer 1 in batches, supercharging web3 games and DeFi applications requiring high performance.
- **Lower Transaction Fees compared to Ethereum** - Due to the transaction batching, as explained above.
- **Full EVM-equivalence** - Not only EVM compatibility; Equivalence. Smart contracts that work on Ethereum also work on Astar zkEVM. See the [smart contract section](/docs/build/zkEVM/smart-contracts/) for more information.
- **Native Account Abstraction** - The Astar zkEVM provides native features designed to revolutionize the end-user experience, and make it seamless. See the [Account Abstraction section](/docs/build/zkEVM/integrations/account-abstraction/) to learn more about how to refine the end-user experience.
Expand Down
2 changes: 1 addition & 1 deletion docs/build/zkEVM/integrations/indexers/subsquid.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Figure from "/src/components/figure"

## Overview

[Subsquid](https://subsquid.io) is an indexing framework supporting both [Substrate](/docs/learn/polkadot_relay#substrate) and [EVM](/docs/learn/polkadot_relay#ethereum-virtual-machine-evm)-based chains. It is [extremely flexible and offers high syncing speeds](https://docs.subsquid.io/migrate/subsquid-vs-thegraph/).
[Subsquid](https://subsquid.io) is an indexing framework supporting both [Substrate](/docs/learn/architecture/astar-parachain.md#substrate) and [EVM](/docs/learn/architecture/astar-parachain.md#ethereum-virtual-machine-evm)-based chains. It is [extremely flexible and offers high syncing speeds](https://docs.subsquid.io/migrate/subsquid-vs-thegraph/).

Subsquid indexer projects (or "squids") can be made from templates either manually or with [squid generation tools](https://docs.subsquid.io/basics/squid-gen/). The tools make ready-to-use indexer projects out of contracts' ABIs. The generated squids decode events and transactions of user-specified contracts, then serve the data over a GraphQL API or store it as a dataset on a filesystem. At the moment EVM/Solidity contracts are supported, with WASM/ink! contracts in the pipeline. Consider this route if your use case does not require any nontrivial transformations of blockchain data.

Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions docs/build/zkEVM/smart-contracts/thirdweb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
sidebar_position: 5
---


### Introduction

Thirdweb is a complete web3 development framework that provides everything you need to connect your apps and games to decentralized networks. Thirdweb supports smart contract development and deployment on Astar EVM-compatible networks, including Astar zkEVM.

:::caution
API keys are required for access to thirdweb infrastructure services.

In an effort to serve our growing developer community by providing more resilient, reliable, and robust infrastructure, we have instituted a new policy requiring users of our SDK’s, Storage, CLI and Smart Accounts to include an API key for use of the following thirdweb infrastructure services:

- RPC Edge - RPC infrastructure for connecting to any EVM chain
- Storage - Service for both uploading and downloading of data to decentralized storage
- Smart Wallet Bundler/Paymaster (beta) - Our Bundler and Paymaster service for use with smart wallets (ERC-4337/6551)

For more details, FAQ and instructions on how you can get your API key and upgrade your app to work in advance of the August 1st deadline, please visit the [migration blog](https://blog.thirdweb.com/changelog/api-keys-to-access-thirdweb-infra/).
:::

### Prerequisites

1. Latest version of [Node.js](https://nodejs.org/) installed.
2. Astar network wallet set up with basic usage knowledge.
3. Sufficient funds in the wallet for contract deployment gas fees.
4. Basic knowledge of Solidity.

### Getting started

#### Creating contract

To create a new smart contract using thirdweb CLI, follow these steps:

1. In your CLI run the following command:

```
npx thirdweb create contract
```

2. Input your preferences for the command line prompts:
1. Give your project a name
2. Choose your preferred framework: Hardhat or Foundry
3. Name your smart contract
4. Choose the type of base contract: Empty, [ERC20](https://portal.thirdweb.com/solidity/base-contracts/erc20base), [ERC721](https://portal.thirdweb.com/solidity/base-contracts/erc721base), or [ERC1155](https://portal.thirdweb.com/solidity/base-contracts/erc1155base)
5. Add any desired [extensions](https://portal.thirdweb.com/solidity/extensions)
3. Once created, navigate to your project’s directory and open in your preferred code editor.
4. If you open the `contracts` folder, you will find your smart contract; this is your smart contract written in Solidity.

The following is code for an ERC721Base contract without specified extensions. It implements all of the logic inside the [`ERC721Base.sol`](https://github.com/thirdweb-dev/contracts/blob/main/contracts/base/ERC721Base.sol) contract; which implements the [`ERC721A`](https://github.com/thirdweb-dev/contracts/blob/main/contracts/eip/ERC721A.sol) standard.

```bash
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@thirdweb-dev/contracts/base/ERC721Base.sol";

contract Contract is ERC721Base {
constructor(
string memory _name,
string memory _symbol,
address _royaltyRecipient,
uint128 _royaltyBps
) ERC721Base(_name, _symbol, _royaltyRecipient, _royaltyBps) {}
}
```

This contract inherits the functionality of ERC721Base through the following steps:

- Importing the ERC721Base contract
- Inheriting the contract by declaring that our contract is an ERC721Base contract
- Implementing any required methods, such as the constructor.

5. After modifying your contract with your desired custom logic, you may deploy it to Astar using [Deploy](https://portal.thirdweb.com/deploy).

---

Alternatively, you can deploy a prebuilt contract for NFTs, tokens, or marketplace directly from the thirdweb Explore page:

1. Go to the thirdweb Explore page: https://thirdweb.com/explore

![thirdweb Explore page](./img/thirdweb-explore.png)

2. Choose the type of contract you want to deploy from the available options: NFTs, tokens, marketplace, and more.
3. Follow the on-screen prompts to configure and deploy your contract.

> For more information on different contracts available on Explore, check out [thirdweb’s documentation.](https://portal.thirdweb.com/pre-built-contracts)
#### Deploying contract

Deploy allows you to deploy a smart contract to any EVM compatible network without configuring RPC URLs, exposing your private keys, writing scripts, and other additional setup such as verifying your contract.

1. To deploy your smart contract using deploy, navigate to the root directory of your project and execute the following command:

```bash
npx thirdweb deploy
```

Executing this command will trigger the following actions:

- Compiling all the contracts in the current directory.
- Providing the option to select which contract(s) you wish to deploy.
- Uploading your contract source code (ABI) to IPFS.

2. When it is completed, it will open a dashboard interface to finish filling out the parameters.
- `_name`: contract name
- `_symbol`: symbol or "ticker"
- `_royaltyRecipient`: wallet address to receive royalties from secondary sales
- `_royaltyBps`: basis points (bps) that will be given to the royalty recipient for each secondary sale, e.g. 500 = 5%
3. Select Astar as the network
4. Manage additional settings on your contract’s dashboard as needed such as uploading NFTs, configuring permissions, and more.

For additional information on Deploy, please reference [thirdweb’s documentation](https://portal.thirdweb.com/deploy).

### Learn more

If you have any further questions or encounter any issues during the process, please [reach out to thirdweb support](https://support.thirdweb.com).
4 changes: 4 additions & 0 deletions docs/learn/architecture/_category_.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"label": "Architecture",
"position": 7
}

0 comments on commit 872fa1d

Please sign in to comment.