-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
289 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
--- | ||
id: madara | ||
title: How to Use Madara with Avail | ||
sidebar_label: Avail-Powered Madara Validium | ||
description: 'Discover how to utilize Avail as a data availability layer to build a Substrate-based Validium with Madara.' | ||
keywords: | ||
- documentation | ||
- avail | ||
- develop | ||
- build | ||
- data availability | ||
- da | ||
image: https://docs.availproject.org/img/avail/AvailDocs.png | ||
--- | ||
|
||
## Introduction | ||
|
||
Embark on setting up your own Madara-based Validium, leveraging Avail as the data availability layer. This guide is tailored for deploying on Ethereum's Sepolia testnet and integrating with the Avail Goldberg testnet. To gain a comprehensive understanding of Madara Starknet, review the [<ins>Madara documentation</ins>](https://docs.madara.zone/). | ||
|
||
In this guide, you will conduct the following: | ||
|
||
- [Introduction](#introduction) | ||
- [Prerequisites](#prerequisites) | ||
- [Hardware Requirements](#hardware-requirements) | ||
- [Launch an Avail-Powered Madara Validium](#launch-an-avail-powered-madara-validium) | ||
- [Running a Single-Node Development Chain](#running-a-single-node-development-chain) | ||
- [Setting Up Avail as the DA Layer](#setting-up-avail-as-the-da-layer) | ||
- [Deploying an Account on Your Chain](#deploying-an-account-on-your-chain) | ||
- [Using Avail in Madara](#using-avail-in-madara) | ||
|
||
## Prerequisites | ||
|
||
Ensure you have installed the following software. | ||
|
||
> Installation commands are based on Ubuntu 20.04 LTS: | ||
<table> | ||
<tr> | ||
<td valign="top"> | ||
|
||
| Software | Version | | ||
| ------------------------------------------------------------ | ------------------------------- | | ||
| [**Rust**](https://www.rust-lang.org/) | `rustc 1.69.0-nightly` or later | | ||
| [**nvm/Node.js**](https://github.com/nvm-sh/nvm) | Latest version | | ||
| [**Cairo**](https://www.cairo-lang.org/docs/quickstart.html) | 1.0 | | ||
|
||
</td> | ||
<td valign="top"> | ||
|
||
```bash | ||
# Install Rust | ||
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh | ||
rustup toolchain install nightly | ||
|
||
# Install nvm and Node.js | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash | ||
export NVM_DIR="$([ -z "${XDG_CONFIG_HOME-}" ] && printf %s "${HOME}/.nvm" || printf %s "${XDG_CONFIG_HOME}/nvm")" | ||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm | ||
nvm install --lts | ||
|
||
# Install Cairo | ||
curl -L https://github.com/franalgaba/cairo-installer/raw/main/bin/cairo-installer | bash | ||
``` | ||
|
||
</td> | ||
</tr> | ||
</table> | ||
|
||
### Hardware Requirements | ||
|
||
The Madara stack, being a StarkNet sequencer, has specific hardware requirements for efficient operation. These requirements are particularly important when integrating Avail as the DA Layer. | ||
|
||
| Component | Minimum Requirements | Recommended Setup | Suggested AWS Instance | | ||
| -------------- | -------------------------------- | -------------------------------- | ---------------------- | | ||
| Sequencer Node | 4-core CPU, 16GB RAM, 100 GB SSD | 8-core CPU, 32GB RAM, 200 GB SSD | m5a.xlarge | | ||
| Avail Node | 4-core CPU, 8GB RAM, 50 GB SSD | 8-core CPU, 16GB RAM, 100 GB SSD | m5a.large | | ||
|
||
:::note | ||
The storage requirements can vary based on the volume of transactions and the length of the chain history you intend to maintain. For high-traffic networks, consider scaling your storage capacity accordingly. | ||
::: | ||
|
||
## Launch an Avail-Powered Madara Validium | ||
|
||
1. Clone the Madara repository: | ||
|
||
```bash | ||
git clone [email protected]:keep-starknet-strange/madara.git | ||
cd madara | ||
``` | ||
|
||
2. Build the chain in release mode: | ||
|
||
```bash | ||
cargo build --release | ||
``` | ||
|
||
### Running a Single-Node Development Chain | ||
|
||
1. Start the development chain: | ||
|
||
```bash | ||
./target/release/madara --dev | ||
``` | ||
|
||
2. Purge the chain's state: | ||
|
||
```bash | ||
./target/release/madara purge-chain --dev | ||
``` | ||
|
||
3. Start with detailed logging: | ||
|
||
```bash | ||
RUST_BACKTRACE=1 ./target/release/madara -ldebug --dev | ||
``` | ||
|
||
4. Create a plain chain spec: | ||
|
||
```bash | ||
./target/release/madara build-spec > ./infra/chain-sepcs/chain-spec-plain.json | ||
``` | ||
|
||
### Setting Up Avail as the DA Layer | ||
|
||
1. Configure Avail for Madara: | ||
|
||
```bash | ||
# Configuration for local Avail node | ||
cat > da-config.json <<EOF | ||
{ | ||
"ws_provider": "ws://127.0.0.1:9945", | ||
"app_id": 0, | ||
"validate_codegen": false, | ||
"seed": "//Alice" | ||
} | ||
EOF | ||
``` | ||
2. Start Avail Node (in another terminal): | ||
```bash | ||
./data-avail --dev --rpc-port 9945 --port 30334 | ||
``` | ||
3. Setup Madara for Avail: | ||
```bash | ||
./madara setup --chain=dev --from-remote --base-path=../.madara | ||
``` | ||
4. Launch Madara with Avail: | ||
```bash | ||
./madara --chain=dev --base-path=../.madara --da-layer=avail --force-authoring --alice | ||
``` | ||
### Deploying an Account on Your Chain | ||
- After setting up your chain, you can deploy your own account and start making transactions. | ||
### Using Avail in Madara | ||
- Specify `--da-layer avail` when launching a Madara node to use Avail for publishing the state_diff. | ||
:::tip | ||
Remember to adjust the `da-config.json` file based on your setup, whether it's a local node or using the Avail network. | ||
::: | ||
<!-- Add test transactions --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
--- | ||
id: overview | ||
title: Building on the Madara Stack with Avail | ||
sidebar_label: Overview | ||
description: 'Discover how to utilize Avail as a data availability layer.' | ||
keywords: | ||
- documentation | ||
- avail | ||
- develop | ||
- build | ||
- data availability | ||
- da | ||
image: https://docs.availproject.org/img/avail/AvailDocs.png | ||
--- | ||
|
||
The Madara stack, when integrated with Avail in a Validium setup, provides a seamless platform for scaling blockchain applications. This integration combines the customizability and Starknet compatibility of Madara with the robust data availability solutions of Avail. | ||
|
||
### Transaction Lifecycle | ||
|
||
1. **Transaction Submission** | ||
|
||
- **Process**: Users initiate transactions which are sent to the Madara-based Validium Sequencer. | ||
- **Role**: The Sequencer, leveraging the flexibility of Madara, temporarily holds these transactions. | ||
|
||
2. **Batch Processing** | ||
|
||
- **Component**: Customized within Madara's framework. | ||
- **Function**: Transactions are batched for efficient processing, leveraging Madara's modular design. | ||
|
||
3. **Data Availability with Avail** | ||
|
||
- **Component**: Custom integration within Madara's setup. | ||
- **Function**: Batches are published to Avail for data availability, ensuring transparency and accessibility. | ||
|
||
4. **State Transition and Proof Generation** | ||
|
||
- **Component**: Utilizes Madara's Starknet compatibility. | ||
- **Function**: State transitions are processed, and cryptographic proofs are generated within the Madara environment. | ||
|
||
5. **Commitment and Verification** | ||
- **Action**: Commitments, along with proofs, are anchored to a primary blockchain (e.g., Ethereum), ensuring security and finality. | ||
|
||
### Key Features | ||
|
||
- **Customizability**: Madara's Substrate-based framework allows for extensive customization to meet specific blockchain requirements. | ||
- **Starknet Compatibility**: Madara's compatibility with Starknet opens a wide array of tools and features for developers. | ||
- **Robust Data Availability**: Avail provides a decentralized solution for data availability, crucial for scalability and security in blockchain applications. | ||
- **Flexibility and Interoperability**: The combination of Madara and Avail supports a wide range of blockchain architectures and use cases. | ||
|
||
### Developer Resources | ||
|
||
To leverage Madara with Avail, developers are encouraged to refer to the [<ins>tutorial</ins>](/build/madara/madara.md) on creating an Avail-powered validium with Avail. For in-depth information on Madara's features, tools, and configurations, visit [<ins>Madara Documentation</ins>](https://docs.madara.zone/). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.