chainwayxyz / citrea

Citrea, Bitcoin's First ZK Rollup 🍊🍋
https://citrea.xyz
GNU General Public License v3.0
92 stars 22 forks source link

Chunks for proofs #744

Closed rakanalh closed 2 weeks ago

rakanalh commented 2 months ago

TBD

eyusufatik commented 2 months ago

After #814 is impelmented, we will be able to create different types of DA transactions.

One of these types can be "chunk" transactions which would be type 1.

You simply make a type 0 transaction with a hash commitment (of data from all chunks) + the number of chunks this tx would require.

The type 1 transaction will have some extra fields right before pushing the body:

  1. 32 bytes txid of the type 0 comitment transactions txid. (assumes witness is always in the first input of the reveal transaction)
  2. single byte showing the order of the "chunk".

This way on light client proofs we can show that the prover committed to n chunks to be written to bitcoin and we can give each chunk as input to the circuit to be used inside.

eyusufatik commented 2 months ago

@ekrembal's suggestion sounds even bettter, again this also requires #814 to be implemented.

we use type 0 transactions to write "chunks" to DA.

we define a new transaction type 1, which pushes n 32 bytes (bitcoin tx ids) indicating the order of the chunks.

the light client proof is inputted with all the transactions the type 1 transaction points to, the body of the "chunks" are simply concatenated and used inside the proof.

no need for commitments etc. and this is easier to use in light cilent proofs. I also favor this option now.

ekrembal commented 2 months ago

I think it can also be improved with with the ability to type 1 transaction to add data,

For example if there is a need to write a 700kb data, instead of doing 3 transactions, we should be able to do it in 2 transactions

kpp commented 2 weeks ago

Fixed in https://github.com/chainwayxyz/citrea/pull/925