Citrea 백서

Citrea

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 6쪽 중 4쪽

nd prevent them from claiming any reimbursement. – Reimburse Link Connector : Links the KickOff to its respective Reimburse transaction. – Disprove Connector : This outputs allows to execute on-chain one step of the bridge program. There are two different types of disprove script: the Groth16 and the Clementine. The bridge program is split into nb steps, while the Clementine program is split into as many steps as the number of Watchtowers, i.e.,m. The Clementine scripts ensure that the inputs given to the bridge zkSNARK contain the contributions of all the Watchtowers that provided a commitment to the chain and that these commitments are correct, i.e., the signature of the Watchtower over the commitment is verified. The disprove connector can be spent by a Challenger posting theDisprove 17 transaction: this happens when a Challenger does not agree with the output of (one of the steps of) the Operator’s off-chain execution of the bridge or Clementine programs. Otherwise, it can be spent by the Operator by posting the DisproveTimeout transaction, thus finalizing the KickOff transaction. We expand on the disprove scripts in Section 6.2. – Latest Blockhash Connector : This connector, if spent by the BlockHash transaction, allows the Operator to post a recent commitment to the chain. This is necessary because 2 weeks pass by between the Operator’s and the Watchtowers’ commitments, and a malicious Watchtower with < 50% computational power can leverage this advantage and win an invalid challenge. With the latest blockchain connector, the Operator can post a new commitment 2.1 weeks after its last one, being therefore safe as long as the blockchain has an honest computational power. If the Operator does not post BlockHash after 2.1 weeks, a Challenger can post BlockHashTimeout transaction. – Assert Connectors: This set of outputs are spent by the Operator via an Assert transaction. In practice, due to limits in the Bitcoin stack [4] and limits of Child-Pays-For-Parent (CPFP) trans- actions [9], we use ns mini-Assert transactions. When posting these transactions, the Operator reveals (Winternitz commitments to) the final result of the execution of the off-chain program, as well as the intermediary results thereof. If an Operator does not post theAssert transaction within the available time window, a Challenger can post the AssertTimeout transaction, which spends the finalizer and burn connectors, finalizing the KickOff and taking the Operator’s collateral. – Watchtower Challenge Connectors : Each KickOff transaction has m of these connectors, one for each Watchtower. These outputs are spent by Watchtowers by posting a WatchtowerChallenge transaction and revealing a commitment to the chain. A total of 144 bytes are committed, split into 3 outputs, one OP RETURN with 80 bytes of data and two taproot outputs with their script pubkey as the 32 byte data, making these outputs unspendable. Script pubkey of a taproot output is used to write arbitrary data because of the Bitcoin’s limit of only one OP RETURN allowed per standard transaction and 80 bytes limit of OP RETURN data. 128 of these bytes represent the Groth16 proof required to verify the exclusion of the blockhash signed by Operator as the unlocking Witness of the KickOff transaction and validity of chain in the Bridge Circuit, while the remaining 16 bytes, used for the public input of the proof, represent the total work of the chain. When a challenge is raised and no Watchtower posts theWatchtowerChallengetransaction, the Operator can post the WatchtowerChallengeTimeouttransaction after some time, preventing Watchtowers to post a late commitment. – Acknowledge Connectors : Each KickOff transaction has m of these connectors, one for each Watchtower. When the Operator sees a WatchtowerChallenge transaction on-chain, it posts a OperatorChallengeACK transaction, revealing the secret preimage si,j,k that is sampled uni- formly during peg in. If the Operator fails to do so, a Challenger can take the Operator’s collateral by posting the OperatorChallengeNACK transaction. The secret si,j,k must be given on input to the Clementine disprove script, ensuring that the contributions of all the watchtowers have been considered (no censorship). – Output ns+2m+5: This last output of the KickOff transaction includes the Operator’s identifier as well as the identifier of the MoveToVaulttransaction the KickOff refers to. We note that the KickOff transaction cannot be used to spend a reimburse connector because its nSequence field is set to 0; should the Operator set it to a value other than 0, it would be unable to post the subsequent transactions since, due to covenants, they spend from a KickOff with nSequence = 0. 18 KickOffi,j Input Tx Index Tapleaf Witness 0 Roundi j 0 WinCom(bhi,j),σO Output Value Script 0 ϵB “Challenge Connector”CheckCovenant∨ (CheckSig(pkO)∧ OP CSV(t5 blocks)) 1 ϵB “Finalizer Connector”CheckCovenant 2 ϵB “Reimburse Link Connector”CheckCovenant 3 ϵB “Disprove Connector” (CheckSig(pkO)∧ OP CSV(t8 blocks))∨ BridgeDisproveScript1∨ BridgeDisproveScript2∨... BridgeDisproveScriptnb∨ ClementineDisproveScript1∨ ClementineDisproveScript2∨..., ClementineDisproveScriptm 4 ϵB “Latest Blockhash Connector”(CheckCovenant∧ OP CSV(t7 blocks))∨ CheckWintSig(lbhi,j) 5 ϵB “Assert Connector”(CheckCovenant∧ OP CSV(t6 blocks))∨ CheckWintSig(zi,j,1,..., zi,j,100) ... ... ... ns+4 ϵB “Assert Connector”(CheckCovenant∧ OP CSV(t6 blocks))∨ CheckWintSig(zi,j,100(ns−1)+1,..., zi,j,100ns) ns+5 ϵB “Watchtower Challenge Connector”(CheckCovenant∧ OP CSV(t3 blocks))∨ (CheckSig(pkW1)) ns+6 ϵB “Acknowledge Connector”(CheckCovenant∧ OP CSV(t4 blocks))∨ (CheckCovenant∧ OP CSV(t3 blocks))∨ (H(si,j,1)) ... ... ... ns+2m+3 ϵB “Watchtower Challenge Connector”(CheckCovenant∧ OP CSV(t3 blocks))∨ (CheckSig(pkWm)) ns+2m+4 ϵB “Acknowledge Connector”(CheckCovenant∧ OP CSV(t4 blocks))∨ (CheckCovenant∧ OP CSV(t3 blocks))∨ (H(si,j,m)) ns+2m+5 0 OP RETURN(move to vault txid, operator idx) Challengei,j Input Tx Index Tapleaf Witness 0 KickOff i,j 0 0 Covenant(SINGLE|ANYONE) 1 ⋆ ⋆ N/A σC Output Value Script 0 cB CheckSig(pkO) 1 0 OP RETURN(evm addr) NoChallengei,j Input Tx Index Tapleaf Witness 0 KickOff i,j 0 1 σO 1 KickOff i,j 1 0 Covenant Output Value Script 0 ϵB ⋆ Disprovei,j,h Input Tx Index Tapleaf Witness 0 KickOff i,j 3 h DisproveWitnessh 1 Roundi 0 0 σO Output Value Script 0 dB ⋆ DisproveTimeouti,j Input Tx Index Tapleaf Witness 0 KickOff i,j 3 0 Covenant 1 KickOff i,j 1 0 Covenant Output Value Script 0 ϵB ⋆ 6.2 Disprove Scripts Notation. LetO be an Operator in the set O of Operators, and W be a Watchtower in the setW of Watchtowers. Within the disprove script connector of the KickOff transaction, two types of disprove scripts are used. These scripts aim to synchronize the bridge with the canonical chain (i.e. the one with the most Proof-of-Work) and to verify that it meets the necessary conditions. 19 BlockHashi,j Input Tx Index Tapleaf Witness 0 KickOff i,j 4 1 WinCom(lbhi,j) Output Value Script 0 ϵB ⋆ BlockHashTimeouti,j Input Tx Index Tapleaf Witness 0 KickOff i,j 4 0 Covenant 1 KickOff i,j 1 0 Covenant 2 Roundi 0 0 σO Output Value Script 0 ϵB ⋆ Asserti,j,l Input Tx Index Tapleaf Witness 0 KickOff i,j 4+l 1 WinCom(zi,j,100·(l−1)+1,.., zi,j,100·l) Output Value Script 0 ϵB ⋆ AssertTimeouti,j,l Input Tx Index Tapleaf Witness 0 KickOff i,j 4+l 0 Covenant 1 KickOff i,j 1 0 Covenant 2 Roundi 0 0 σO Output Value Script 0 dB ⋆ To obtain the canonical chain, Watchtowers and the Operator are asked to commit to a chain. While the Operator’s chain is handled discretely, Watchtowers provide a Groth16 zero-knowledge proof [25], generated using the Watchtower Circuit (Figure 6). More formally, we define our SNARG instance (via SNARG.Setup) over the relation RW :={(ϕ,w ) :ΠW (ϕ,w ) = 1}, where ΠW ,w, and the public input ϕ are defined in Figure 6. It proves that they have a valid chain with a certain amount of total work (given as ϕ) and that it does not contain the blockhash signed by the Operator as the unlocking Witness of the KickOff transaction. The BridgeDisproveScript consists of a BitVM script split into chunks, verifying the Bridge Circuit (Figure 7) using a recursive Groth16 zero-knowledge proof [17, 25]. More formally, we define our SNARG instance (via SNARG.Setup) over the relation RB :={(ϕ,w ) :ΠB(ϕ,w ) = 1}, where ΠB, w, and the public input ϕ are defined in Figure 7. Intermediary steps between chunks are committed via the Assert transaction (cf. Section 3.5), and collectively, they verify that: – The latest blockhash of the Operator’s chain is equal to the blockhash signed by O as the input Witness of the BlockHash transaction. – The Operator has a valid chain with the most Proof-of-Work compared to the Watchtowers’ chal- lenges with correct proofs. – The blockhash signed by the Operator as the unlocking Witness of the KickOff transaction contains the Payout transaction. – The Operator’s chain includes the blockhash signed by the Operator as the unlocking Witness of the KickOff transaction. – cBTC are burnt on Citrea through a withdrawal request, and the Payout transaction is derived from the endpoint of that request. The ClementineDisproveScript (Figure 8) consists of m subroutines and verifies that the list of challenge-sending Watchtowers on-chain is consistent with the Bridge Circuit Groth16 inputs. WatchtowerChallengei,j,k Input Tx Index Tapleaf Witness 0 KickOff i,j ns+2k+5 1 σWk 1 ⋆ ⋆ N/A σWk Output Value Script 0 ϵB DATA(cp[: 32bytes]) 1 ϵB DATA(cp[32bytes : 64bytes]) 2 0 OP RETURN(cp[64bytes : 144bytes]) WatchtowerChallengeTimeouti,j,k Input Tx Index Tapleaf Witness 0 KickOff i,j ns+2k+5 0 Covenant 1 KickOff i,j ns+2k+6 1 Covenant Output Value Script 0 ϵB ⋆ 20 OperatorChallengeNACKi,j,k Input Tx Index Tapleaf Witness 0 KickOff i,j ns+2k+6 0 Covenant 1 KickOff i,j 1 0 Covenant 2 Roundi 0 0 σO Output Value Script 0 dB ⋆ OperatorChallengeACKi,j,k Input Tx Index Tapleaf Witness 0 KickOff i,j ns+2k+6 2 si,j,k Output Value Script 0 ϵB ⋆ m: Number of Watchtowers (we index this with k) nr: Number of Round transactions (we index this with i) no: Max. number of peg-outs that can be served by a single Round transaction (we index this with j) ns: Number of chunks BitVM intermediary states are split into (we index this with l) nb: Number of sub-programs a BitVM program is split into f: Fee the Operator gets for the peg out v: Denomination pegged into Citrea (10 BTC in Section 5.1) d: Operator collateral to prevent cheating + fee for the disprove transaction c: Challenge amount ϵ: 0-value if Round and KickOff txs are non-standard, 330 sats if they are standard Table 1: Protocol parameters. 7 Protocol Pseudocode We now present the pseudocodes of the setup, peg in, and peg out phases. The transactions appearing in the pseudocodes are constructed as shown in Section 6. Notation and Parameters. Let O be an Operator in the set O of Operators, S be a Signer in the setS of Signers, and W be a Watchtower in the setW of Watchtowers. When a message is sent toP (the set of all parties), we mean that it becomes public knowledge, and it is shared to all parties. We denote withT a set of transactions. We denote with uc the liveness parameter of the Citrea rollup. Table 1 summarizes the protocol parameters. 7.1 Setup Phase The Setup phase includes the actions that Operators and Signers need to perform at the beginning, when bootstrapping the bridge. We observe that the setup of the bridge is secure given a signer committee with existential honesty. In this phase, transactions such asRound, ReadyToReimburse, and UnspentKickOff need to be created and signed by the designated parties. Figure 9 shows the pseudocode of the Setup phase. 7.2 Peg In Phase The peg in phase includes the actions that users, watchtowers, and signers need to perform when a user wants to move funds from Bitcoin to Citrea. During peg in, the Deposit and MoveToVault transactions are posted on Bitcoin, and the Mint transaction is posted on Citrea. Importantly, in this phase, the Operator creates transactions that will make the bridge secure at peg out, and it shares them with the Signers to establish the covenants. We observe that Signers hold two different types of keys: they have a generic key pair (pkS,pid, skS,pid) that does not change over time and that is used to sign all MoveToVault transactions (of all peg ins), and they have a key pair ( pk, sk) which, on the contrary, is created anew at every peg in and that they are used for the covenants. Figure 10 showcases the pseudocode of the peg in phase. 21 7.3 Peg Out Phase The peg out phase includes the actions that users, Operators, Watchtowers, and Challengers need to perform to securely move funds from Citrea to Bitcoin. When a user issues a peg out request on Citrea by posting a Burn transaction, an Operator fronts the money to the user and then asks for a reimbursement to the bridge. The bridge logic comprises of several transactions which can be posted by Watchtowers, Challengers, and the Operator to guarantee a secure execution. Figure 11 presents the pseudocode of the peg out mechanism. 8 Discussion In this section, we discuss some features and optimizations of Clementine. Optimistic Payout. The protocol we described above guarantees that any peg out is completed even if all Signers are offline and all but one are malicious. However, if all Signers are honest and online, they have some time (in Clementine, it is ≃ 1 hour) to sign an issue a user’s peg out by posting an OptimisticPayout transaction. This transaction resembles the Payout transaction, with only two differences: (i) it spends the output of the MoveToVault transaction, so that the funds given to the user do not come from the Operator, and (ii) there is no OP RETURN output. If no OptimisticPayout transaction appears on-chain within some time, the peg out request is picked up by the Operator and the Clementine continue as described in Section 5. To enable the optimistic payout, Signers must not erase their keys, making the protocol secure against anon-adaptive adversary. Minimizing Collateral. To enable Clementine to facilitate enough (e.g., 100k) withdrawals, we can set the protocol parameters as follows: Operator’s collateral d = 2 BTC, number of peg outs served by a round transaction no = 500, weeks in 12 years 11 divided by 2 weeks n3 = 300, number of splits of the BitVM program ns = 42, m = 100 Watchtowers. This means that the initial capital to be locked for the Round in the setup phase is given by d +n3· 2no(ns + 2m + 5)ϵ. If ϵ = 330 sats, then the initial capital requirement is extremely high, i.e., approximately 250 BTC. Instead, by setting ϵ = 0, the initial capital requirement drops to d = 2 BTC—a 125× reduction. This significantly lowers Clementine’s collateral demands. In this scenario, the Round and KickOff transactions become non-standard due to their 0-sat outputs. However, the remaining transactions (with the exception of Disprove, which is non-standard due to large BitVM scripts) remain standard. Thanks to Ephemeral Anchors [6], these transactions can carry a 0-fee and still enter the mempool as part of a package where their child transactions pay the fees. The Round and KickOff transactions are not time-critical, meaning that the Operators can ask a miner to include these transactions in a block. Optimize Communication. The Clementine protocol assumes that each party communicates to all other parties (all-to-all communication). In practice, this can lead to high bandwidth requirements for participants and it can result in increased network latency. Communication can be optimized by introducing an untrusted Aggregator that orchestrates the communication between the different parties of the protocol. Should the Aggregator be down, anyone can take over and act as an Aggregator. Rotating Committees. First, we observe that the sets of Watchtowers, Signers, and Operators, albeit permissioned, can change and evolve over time. Citrea hosts a contract that defines the Signers in the committee and it has a mechanism in place that monitors the Signers’ behavior: if a Signer does not respond, it is removed within a time window to avoid denial of service. Similarly, new Watchtowers and Operators can be add, if all Signers agree. Optimizing the Round Transaction. For real use cases, the Round transaction described in Section 6 would have a high number of reimburse connector and kickoff connector outputs (e.g., 1000 for each connector). This results in large transactions and higher on-chain fees. To reduce the size of these transactions and minimize fees, one could use techniques that allow to add extra connectors on- demand, depending on the current load of the bridge. For instance, one could haveRound transactions with just a few connectors for each type and then one extra, new output that can be spent by a transaction that adds more of these connectors whenever necessary. 11Planned lifetime of the bridge. 22 Watchtower Circuit WatchtowerW∈W , Operator O∈O In order to challenge the O, W prepares a chain, encoded with Header Chain Proof as Groth16 input ( w). We call it watchtower chain. Blockhash signed by O as the input Witness of KickOff transaction is assumed to be accessible by the Watchtower Circuit, given as the Groth16 public input ( ϕ). We call it payout tx blockhash. Necessary restrictions are checked: 1. Verify that the watchtower chain is valid with Header Chain Proof 2. Verify that watchtower chain does not contain the block with payout tx blockhash. Fig. 6: Pseudocode of the Watchtower Circuit used to compute the proofs ΠW in the WatchtowerChallenge transactions. This circuit defines the relation R over which we define the SNARG. Bridge Circuit Operator O∈O with Payout transaction T Note that in order to do equivalency checks over private inputs ( w) with Winternitz signed values or to extract them for more complicated uses, we can turn them into public ones ( ϕ) in specific conditions. This is possible due to the fact that the O is forced to commit to the public inputs with Winternitz signatures in the Assert transaction with the intermediary steps, which allows us to use same key pairs in other scripts for further verifications. We call it public input extraction. In order to make the explanations more concise and clear, instead of giving these additional scripts separate names, we integrate their functionality into the Bridge Circuit and specify the parts we use this technique, in addition to the inputs we maintain. The following variables are accessible in the Bridge Circuit: – Schnorr public keys of Watchtowers, used for signingWatchtowerChallengetransaction, since they are constants during the setup – payout tx blockhash, blockhash signed by O as the input Witness of the KickOff transaction, possible due to public input extraction – latest blockhash, blockhash signed by O as the input Witness of the BlockHash transaction, possible due to public input extraction After Watchtower challenges are revealed,O prepares the following variables as Groth16 inputs ( w): – A chain operator chain, expected to represent the actual Bitcoin chain in the honest case, encoded with a Header Chain Proof – Payout transactionT and a Bitcoin block payout block, expected to contain T and to be equal to the block with blockhash committed in the KickOff transaction – Citrea components citrea vault tx and citrea light client proof, representing the state written on-chain to Bitcoin – Schnorr signatures of Watchtowerswatchtower signatures, each containing a Groth16 proof with the Watchtower Circuit, providing a chain with a certain amount of total work – A boolean array watchtower sent challenge[] indicating whether each corresponding Watchtower has sent a challenge, this value will be maintained with public input extraction, to be used in ClementineDisproveScript (Figure 8) Necessary restrictions are checked with the algorithm: 1. Verify tha
프로젝트로 돌아가기