@@ -13,12 +13,15 @@ Make sure to have the following installed:
13
13
14
14
- [ Foundry] ( https://github.com/foundry-rs/foundry )
15
15
16
- ### Installing Blobstream contracts
16
+ ### Installing Blobstream X contracts
17
17
18
- Install the Blobstream contracts repo as a dependency:
18
+ We will be using the Blobstream X implementation of
19
+ Blobstream, so we can install its repo as a dependency:
20
+
21
+ Install the Blobstream X contracts repo as a dependency:
19
22
20
23
``` sh
21
- forge install celestiaorg/blobstream-contracts --no-commit
24
+ forge install TBD --no-commit
22
25
```
23
26
24
27
Note that the minimum Solidity compiler version for using the Blobstream
@@ -27,38 +30,39 @@ contracts is `0.8.19`.
27
30
### Example usage
28
31
29
32
Example minimal Solidity contract for a stub ZK rollup that leverages the
30
- Blobstream contract to check that data has been posted to Celestia:
33
+ ` BlobstreamX.sol ` contract to check that data has been posted to Celestia:
31
34
32
35
``` solidity
33
36
// SPDX-License-Identifier: Apache-2.0
34
37
pragma solidity ^0.8.19;
35
38
39
+ TBD
36
40
import "blobstream-contracts/IDAOracle.sol";
37
41
import "blobstream-contracts/DataRootTuple.sol";
38
42
import "blobstream-contracts/lib/tree/binary/BinaryMerkleProof.sol";
39
43
40
44
contract MyRollup {
41
- IDAOracle immutable blobstream ;
45
+ IDAOracle immutable blobstreamX ;
42
46
bytes32[] public rollup_block_hashes;
43
47
44
- constructor(IDAOracle _blobstream ) {
45
- blobstream = _blobstream ;
48
+ constructor(IDAOracle _blobstreamX ) {
49
+ blobstreamX = _blobstreamX ;
46
50
}
47
51
48
52
function submitRollupBlock(
49
53
bytes32 _rollup_block_hash,
50
54
bytes calldata _zk_proof,
51
- uint256 _blobstream_nonce ,
55
+ uint256 _blobstreamX_nonce ,
52
56
DataRootTuple calldata _tuple,
53
57
BinaryMerkleProof calldata _proof
54
58
) public {
55
59
// Verify that the data root tuple (analog. block header) has been
56
60
// attested to by the Blobstream contract.
57
61
require(
58
- blobstream .verifyAttestation(_blobstream_nonce , _tuple, _proof)
62
+ blobstreamX .verifyAttestation(_blobstreamX_nonce , _tuple, _proof)
59
63
);
60
64
61
- // Verify the ZKP.
65
+ // Verify the ZKP (zero-knowledge proof) .
62
66
// _tuple.dataRoot is a public input, leaves (shares) are private inputs.
63
67
require(verifyZKP(_rollup_block_hash, _zk_proof, _tuple.dataRoot));
64
68
@@ -93,18 +97,18 @@ verifying a Merkle inclusion proof.
93
97
94
98
The [ ` IDAOracle ` ] ( https://github.com/celestiaorg/blobstream-contracts/blob/master/src/IDAOracle.sol )
95
99
(** D** ata ** A** vailability ** O** racle Interface) interface allows L2 contracts
96
- on Ethereum to query the Blobstream contract for relayed ` DataRootTuple ` s. The
97
- single interface method ` verifyAttestation ` verifies a Merkle inclusion proof
98
- that a ` DataRootTuple ` is included under a specific batch (indexed by batch
99
- nonce). In other words, analogously it verifies that a specific block header is
100
- included in the canonical Celestia chain.
100
+ on Ethereum to query the ` BlobstreamX.sol ` contract for relayed ` DataRootTuple ` s.
101
+ The single interface method ` verifyAttestation ` verifies a Merkle inclusion
102
+ proof that a ` DataRootTuple ` is included under a specific batch (indexed by
103
+ batch nonce). In other words, analogously it verifies that a specific block
104
+ header is included in the canonical Celestia chain.
101
105
102
106
## Querying the proof
103
107
104
108
To prove that the data was published to Celestia, check out the
105
- [ proof queries documentation] ( ./blobstream -proof-queries.md )
109
+ [ proof queries documentation] ( ./blobstreamx -proof-queries.md )
106
110
to understand how to query the proofs from Celestia consensus
107
- nodes and make them usable in the Blobstream verifier contract.
111
+ nodes and make them usable in the Blobstream X verifier contract.
108
112
109
113
## Verifying data inclusion for fraud proofs
110
114
@@ -119,27 +123,27 @@ against a `DataRootTuple`. The library is stateless, and allows to pass an
119
123
120
124
In the ` DAVerifier ` library, we find functions that help
121
125
with data inclusion verification and calculating the square size of a
122
- Celestia block. These functions work with the Blobstream smart contract,
126
+ Celestia block. These functions work with the Blobstream X smart contract,
123
127
using different proofs to check and confirm the data's availability. Let's
124
128
take a closer look at these functions:
125
129
126
130
- [ ` verifySharesToDataRootTupleRoot ` ] ( https://github.com/celestiaorg/blobstream-contracts/blob/3a552d8f7bfbed1f3175933260e6e440915d2da4/src/lib/verifier/DAVerifier.sol#L80-L124 ) :
127
131
This function verifies that the
128
- shares, which were posted to Celestia, were committed to by the Blobstream
132
+ shares, which were posted to Celestia, were committed to by the Blobstream X
129
133
smart contract. It checks that the data root was committed to by the
130
- Blobstream smart contract and that the shares were committed to by the
134
+ Blobstream X smart contract and that the shares were committed to by the
131
135
rows roots.
132
136
- [ ` verifyRowRootToDataRootTupleRoot ` ] ( https://github.com/celestiaorg/blobstream-contracts/blob/3a552d8f7bfbed1f3175933260e6e440915d2da4/src/lib/verifier/DAVerifier.sol#L133-L155 ) :
133
137
This function verifies that a
134
138
row/column root, from a Celestia block, was committed to by the
135
- Blobstream smart contract. It checks that the data root was committed
136
- to by the Blobstream smart contract and that the row root commits to
139
+ Blobstream X smart contract. It checks that the data root was committed
140
+ to by the Blobstream X smart contract and that the row root commits to
137
141
the data root.
138
142
- [ ` verifyMultiRowRootsToDataRootTupleRoot ` ] ( https://github.com/celestiaorg/blobstream-contracts/blob/3a552d8f7bfbed1f3175933260e6e440915d2da4/src/lib/verifier/DAVerifier.sol#L164-L194 ) :
139
143
This function verifies
140
144
that a set of rows/columns, from a Celestia block, were committed
141
- to by the Blobstream smart contract. It checks that the data root was
142
- committed to by the Blobstream smart contract and that the rows roots
145
+ to by the Blobstream X smart contract. It checks that the data root was
146
+ committed to by the Blobstream X smart contract and that the rows roots
143
147
commit to the data root.
144
148
- [ ` computeSquareSizeFromRowProof ` ] ( https://github.com/celestiaorg/blobstream-contracts/blob/3a552d8f7bfbed1f3175933260e6e440915d2da4/src/lib/verifier/DAVerifier.sol#L204-L215 ) :
145
149
This function computes the Celestia
@@ -155,4 +159,4 @@ take a closer look at these functions:
155
159
` verifySharesToDataRootTupleRoot() ` method.
156
160
157
161
For an overview of a demo rollup implementation, head to
158
- [ the next section] ( ./blobstream -offchain.md ) .
162
+ [ the next section] ( ./blobstreamx -offchain.md ) .
0 commit comments