Skip to content

Commit

Permalink
Update dStorage docs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xblobs committed Jan 19, 2024
1 parent fb071e9 commit e5c8ccc
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 18 deletions.
38 changes: 38 additions & 0 deletions docs/developers/how-to/using-ethda-as-dstorage.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,41 @@ title: ''
hide_table_of_contents: false
---

Developers could use [@ethda/blobs](https://www.npmjs.com/package/@ethda/blobs) NPM package to upload Blobs to EthDA and download from it. Currently only NodeJS environment is supported.

## Install

```sh
$ npm install @ethda/blobs
```

## Upload Blobs

```Javascript
import {BlobClient, EncodeBlobs} from '@ethda/blobs';
import {ethers} from "ethers";

const content = 'abc....';
const blobs = EncodeBlobs(Buffer.from(content, 'utf-8'));

const signer = new ethers.Wallet('<private_key>', new ethers.providers.JsonRpcProvider("https://rpc.ethda.io"));
const blobClient = new BlobClient(signer);
const hash = await blobClient.sendTx(blobs)
const receipt = await blobClient.getTxReceipt(hash)
```

## Download Blobs

```Javascript
import { BlobClient, EncodeBlobs } from '@ethda/blobs';

const txHash = '...';
const blobClient = new BlobClient(new ethers.providers.JsonRpcProvider("https://rpc.ethda.io"));
const result = await blobTrans.downloadBlobs(txHash)
/**
** result: {
blob_hashes: ['0x01853e6b060f5b155f406a7ca3f912df5f93873d9df56ad31904db846565dbd2'],
sidecar: { blobs: [ [Array] ], commitments: [ [Array] ], proofs: [ [Array] ] }}
**
*/
```
4 changes: 2 additions & 2 deletions docs/overview/blobsphere.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import useBaseUrl from '@docusaurus/useBaseUrl';

## Overview

Blobsphere is the Alt-DA solution for Ethereum L2s, with seemless DA interface defined by [EIP-4844](https://www.eip4844.com). It accepts transaction data from L2s via blob-carrying transactions (Blob TX), stores it in a *Data Availability Layer*, and relays commitments of storage to *Blobsphere DA Contract* deployed on Ethereum L1, which could then be checked and verified by L2's contract on L1.
Blobsphere is the Alt-DA solution for Ethereum L2s, with seemless DA interface defined by [EIP-4844](https://www.eip4844.com). It accepts transaction data from L2s via blob-carrying transactions (Blob TX), stores it in a *Data Availability Layer*, and relays commitments of storage to *Blobsphere DA Contract* deployed on Ethereum L1, which could then be checked and verified by L2's contracts on L1.

<img src={useBaseUrl('/img/overview/blobsphere/blobsphere.png')} style={{width: 660}} />

## How Blobsphere works

EthDA by itself is an Ethereum validium with an off-chain *Data Availability Layer* which stores transaction data posted to it. But unlike other validiums which usually accepts legacy transactions, EthDA is specially catered for blob transactions, and *Blobsphere* is the protocol we defined for L2s using EthDA as an Alt-DA.
EthDA by itself is an Ethereum validium with an off-chain *Data Availability Layer* which stores transaction data posted to it. But unlike other validiums which usually accepts legacy transactions, EthDA is specially catered for blob transactions, and *Blobsphere* is the protocol for L2s to use EthDA as an Alt-DA.
12 changes: 6 additions & 6 deletions docs/overview/technologies.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Blob Transaction (Blob TX) is the so-called DA Interface that rollups are suppos
}
```

Where blobs is an encoded polynomial per [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) specification, kzgCommitments is the KZG commitment of blobs, kzgProofs is the KZG proof that is used to verify against the commitment, and blobVersionedHashes is used as references to Blobs in Ethereum execution layer to ensure forward compatibility with future changes.
Where `blobs` is an encoded polynomial per [EIP-4844](https://eips.ethereum.org/EIPS/eip-4844) specification, `kzgCommitments` is the KZG commitment of blobs, `kzgProofs` is the KZG proof that is used to verify against the commitment, and `blobVersionedHashes` is used as references to Blobs in Ethereum execution layer to ensure forward compatibility with future changes.

Blob TX support is crucial to enable rollups to seamlessly switch their DA layer between L1 and EthDA.

Expand All @@ -43,25 +43,25 @@ EthDA does not introduce any new EVM RPC interfaces. Instead, we extend existing

## Data Availability Sampling (DAS)

So, how are Blobs stored on EthDA? EthDA employs a set of decentralized sequencers, and uses DAS scheme to ensure Blob sharding and storage.
So, how are Blobs stored on EthDA? EthDA employs a set of *decentralized Data Availability Nodes*, and uses DAS scheme to ensure Blob sharding and storage.

DAS on EthDA is an extended implementation of DAS on Ethereum beacon layer. In addition to that, EthDA is able to support permanent Blob storage instead of a short period of storage like 4 weeks.

Similar to L1, sequencers are randomly shuffled and split into N subnets. Each Blob is published to a subnet based on their index, and that subnet will be responsible for storing the Blob and ensuring its availability as a whole.
Similar to L1, DA nodes are randomly shuffled and split into N subnets. Each Blob is published to a subnet based on their index, and that subnet will be responsible for storing the Blob and ensuring its availability as a whole.

Sequencer node, however, does not need to store the whole Blob assigned to the subnet it belongs to. Instead, a Blob is split into multiple slices and sequencers will randomly sample each other to make sure the Blob is stored by the whole subnet.
DA node, however, does not need to store the whole Blob assigned to the subnet it belongs to. Instead, a Blob is split into multiple slices and DA nodes will randomly sample each other to make sure the Blob is stored by the whole subnet.
The whole subnet architecture is a grid structure of N horizontal subnets and M vertical subnets.

<div style={{textAlign: 'center'}}>
<img src={useBaseUrl('/img/overview/technologies/das.png')} style={{width: 560}} />
</div>

## Blobweave
<!-- ## Blobweave
There is a soft consensus mechanism among EthDA's sequencer network to produce L2 blocks (aka transaction bundles, or sequences) and submit ZK proofs to L1. To support Blob permanent storage by the sequencer network, EthDA uses a scheme called Blobweave similar to Arweave's Blockweave.
Basically, the sequencer network maintains the L2 block hash list, a list of the hashes of all previous L2 blocks. The L2 block hash is calculated based on transaction data bundled into the block, including the carried Blobs. Moreover, a historical block with Blob TX is randomly selected to be the recall block. Transactions of the recall block are hashed alongside to generate the new block hash, thus forming a weave of blobs which we call Blobweave.
<div style={{textAlign: 'center'}}>
<img src={useBaseUrl('/img/overview/technologies/blobweave.png')} style={{width: 560}} />
</div>
</div> -->
20 changes: 10 additions & 10 deletions sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,23 +116,23 @@ const sidebars = {
id: 'developers/quick-start/using-ethda-faucet',
label: 'Using EthDA Faucet'
},
{
type: 'doc',
id: 'developers/quick-start/bridging-assets-to-ethda',
label: 'Bridging Assets to EthDA'
}
// {
// type: 'doc',
// id: 'developers/quick-start/bridging-assets-to-ethda',
// label: 'Bridging Assets to EthDA'
// }
]
},
{
type: 'category',
label: 'How To',
collapsed: false,
items: [
{
type: 'doc',
id: 'developers/how-to/using-ethda-as-altda',
label: 'L2 - Use EthDA as Alt-DA'
},
// {
// type: 'doc',
// id: 'developers/how-to/using-ethda-as-altda',
// label: 'L2 - Use EthDA as Alt-DA'
// },
{
type: 'doc',
id: 'developers/how-to/using-ethda-as-dstorage',
Expand Down

0 comments on commit e5c8ccc

Please sign in to comment.