Delivery-date: Wed, 27 Nov 2024 14:54:52 -0800 Received: from mail-qt1-f192.google.com ([209.85.160.192]) by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1tGQvr-0007R4-0O for bitcoindev@gnusha.org; Wed, 27 Nov 2024 14:54:52 -0800 Received: by mail-qt1-f192.google.com with SMTP id d75a77b69052e-4669c1479easf4561691cf.1 for ; Wed, 27 Nov 2024 14:54:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1732748084; cv=pass; d=google.com; s=arc-20240605; b=QYF5GNFp/zFe3R9uWisOGWeUirYqNd06QXRYiu/SlWRfPmu5ZuOOAt3MgXBHCAWaHr EMRzCAWbZCXfBavoSDTAaUnKo1ldr8xHlFZLp9c2eG3yhl16hy5VFqJhHdJnUTWuUDEP t7cYxs4+QaoyXudW6vHPeVxV9hqm7ALKteFfD9LCZKNdSgKbV8HhwQeOgSg3c9zViGwx h27jFWJWjzing0Ohl4Rh9GK9OUo2TD+Uk/508DlqugDJG8hH5wtgf6Ky+3Q5m+TfTlb4 PbXwc++CyjNwns2sCN1+vGGCU0aywxAch2HL2qkRAIuv1c5JHLZ2knb4W5kWzu4U3SQ6 0mWg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:content-transfer-encoding:cc:to :subject:message-id:date:from:in-reply-to:references:mime-version :sender:dkim-signature:dkim-signature; bh=BC3M70FhMjZ/y0+OH3JpnCRwhRRDKVcUZSH7C0RCycQ=; fh=m9qDbHilUxoPLB71YGMeHBpJp7dWu1SxpoTT/Fgv0Tc=; b=EBSO7Uv+//pF18OPmpmPodN3xaajtk8yCJsFU5BmianXkwJUYO2iQINm5vh/2KUOaz jGdD2qXsWTErQNlK/g62i7R0luUUztE5TbR1Aso2jVpOe3/fzfAVw5n5jxeTshI+alHW QZdsiOGJNu1pCDJyrAOXFS0rYz3sANSEpYRHdGgE+OvzqLEZfJMFNVAcpijwGBoKN5bi YfbWZoMuA4lu/RVqzVms7LHBBHMiMK5icDD8fY7Wx6LKRpPxSkYq2EoRc4w+V3ph6CKJ OgMbuTW0qMlIBEyxoabrFXdhV/HPLEfGm78s+XW+S0A30nOqsgJjCxpRByocVqxeYTCg 7E9w==; darn=gnusha.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FtcntFoD; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1732748084; x=1733352884; darn=gnusha.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version:sender :from:to:cc:subject:date:message-id:reply-to; bh=BC3M70FhMjZ/y0+OH3JpnCRwhRRDKVcUZSH7C0RCycQ=; b=FfKJcqFNlWZK9+PoSlGIFVMyW9OHGFxFDsbNr5nDrjxGNuPpTPATRJnP9BA1NGWH4O SKxTTxUMBtcdg+1FcMkUmnE3hh7R4uMQxOiehpcQh1hYJoztFdXvkE23+u2BP3586k0U ZX9e3RpzBQcxXnxIlUKpNGQY9Ek3CP6QUDqVvI1smHYlNirxG6xKb3dofDvTxxUMIbqf BMxnmt3C/gbS07EzM9HwJGuDd9+qm0fWHUgU9wy8fsEzplpFNloGNgJc3DqCGz5Hf47u d3vuQYtno62dzvaRibOzI2TigLWJrun9hFejj96jMaUbKIB/zQV3RbyA3GrsyERMXOqV 1LBg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1732748084; x=1733352884; darn=gnusha.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version:from:to:cc :subject:date:message-id:reply-to; bh=BC3M70FhMjZ/y0+OH3JpnCRwhRRDKVcUZSH7C0RCycQ=; b=P8sQ5UJ73S4pAb7nuBpHDu5DnQJEUiyH7uQFN1boJg5+2JXCX8sWB2nuZmAsHysSnI 4F+NI4K4JFcpjAovKphL1TkZdEFSSpOC3Igz7HaNRYRHnYoS6RnOWWLb05F99P26AAcA uWz9jW/7Xn9ELcCUps6EfF/FXak3IqvgWVszkvXHSz49/jBtmB3JR8tMRV5low+35DB3 9I9hzwWg5WILRVFhk6ifT1bX4QWgKhxfbuPL3aL3qErb8cMJczfkBJJy+wcy2dFxGYQh wwhMjAjqP119d7ZshfJmq58WrtrPGVXqk3NHWRVw/OFVpj0FAIzZ7xElRKHyLG37R3jP ardg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732748084; x=1733352884; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=BC3M70FhMjZ/y0+OH3JpnCRwhRRDKVcUZSH7C0RCycQ=; b=N3wTO2pbEDceZyZj2uZ22jVHx4C4CYrkCkud92mCE1n8cdl3UdfxqfdBnaREhTkHbo XVD9XD8Z1Q/6c/bE147wWgVK69Z0L2Oy+uk6DYFm8zkDtR524Mx41FR2N6fu9bRmUctS C70k0aOzO9nr8yC6rClkJI2mehRXc4pvyEaDBBM2OF2S8Jltk3XurLKpkxD/6ED5n4OK W7dQ1xLFRElfj5zhSj5EeWLqsKZ8urI4zEX2deBgUKL83vdTziWyFMNbkriSzdNy4+Jd lCxVoHTrjjIFOzpAVKf9Z9nLPEg/Vc+wKbVBeg9F161JVwyaLejjtYUWv/cXOP2caX3/ w2FQ== Sender: bitcoindev@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCUsKUMBnaqSgRP9SXhWvd27nMsyPPwtR7anWzDb+RXfpDviOFyhMhfY3+D2K0yOHkkj0scNAdvnFchk@gnusha.org X-Gm-Message-State: AOJu0YwdIlYH+jgRolSxikStmhzmXwkHYriafl+Mwu1gZpkA8s0TDtQu 1iIMHTQoEQG8cX3YXgUdr3+6k099n3kRh/P1lpd/D9yT+3KRRHff X-Google-Smtp-Source: AGHT+IF8Sz0p7v104G3dAnmGpdFRV4/Wo1K/IGlQAE/GYIeUGcmbrPXLUE7xJG2Wb7vTzVyefplRSw== X-Received: by 2002:a05:622a:14c:b0:463:1257:86f with SMTP id d75a77b69052e-466c1c2c693mr14716191cf.28.1732748084299; Wed, 27 Nov 2024 14:54:44 -0800 (PST) X-BeenThere: bitcoindev@googlegroups.com Received: by 2002:ac8:570a:0:b0:466:a239:f7c8 with SMTP id d75a77b69052e-466c2032042ls3995451cf.2.-pod-prod-00-us; Wed, 27 Nov 2024 14:54:42 -0800 (PST) X-Received: by 2002:a05:622a:1b1f:b0:461:304:c676 with SMTP id d75a77b69052e-466c1b067f5mr21283891cf.5.1732748081899; Wed, 27 Nov 2024 14:54:41 -0800 (PST) Received: by 2002:a05:620a:4c3:b0:7a1:c409:aa2c with SMTP id af79cd13be357-7b67ba6cb97ms85a; Wed, 27 Nov 2024 14:38:18 -0800 (PST) X-Received: by 2002:a05:6512:b85:b0:53d:ed69:a593 with SMTP id 2adb3069b0e04-53df00d3c71mr2875471e87.22.1732747095869; Wed, 27 Nov 2024 14:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1732747095; cv=none; d=google.com; s=arc-20240605; b=TYwtOb0GL5TTG1QSvOuU7ANXKZeGHJNYWxzCfAKT8uXfdIXTFxDiHcFxUhUMLtLuhB ASB6Y9XFwAxqebG2ptgdhCOFkx3I3BArWN0zcn95Ov3cLKIynjh/kDN2DJIjatsz6M2x TOQ2upcNm0W/gat8TWEEIxmH8H798JnnLHEcPXHR9OczrUnvREvQEpNRKl/QfFkocKUQ UpMq5aKeMe305D9vPY++QoL33muF3EVIFV7k4rGvcwoOPvbQ0K27Ia8iiu+n1IkhRz9W LsdGyJfpHS2K/UMHMbYbJH0h7cQWFw4DD1vfOijSoUWP4YWT1n2+pQzxH5dyOaYG2coL lU+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=515AklF+jOiWOhVuYpF4L+5YnUeDGgVeepbzN+jzqkE=; fh=sapDHqhE46zLmMBeB1lkoe0zq8J9+V3Afx71/j8kvug=; b=gUc+1jrVZofiSlNJ1Ubky+p3jXdsRArjhjv1iLM7YWXv0bN3gyXfsOrbtBH4RlHiSu VakI2Ct59AB6vPvcarzOYNcYGJuwvK22K/jV1Y++tfQ3BFswvicXt9TPNckFfEtg13Jn FPLF+QUFW4bkpHtA4vELN8iNTnnZ8LGIftTWmLl7L47wsv31JqriwjTHEGLtF+EYgFxu GhLG7yqZEOcJiXmfYb1wzNuEvL4RZFzA7freFbWOXrxY/FYn6pNsG1DbmFjgYlWlOuAQ NXH7OBGhe/NupMVbfHWKuq5M7WXprq8YClxuVvKiiwMJHJSLkdQSyBh1XJhcCd9dlQJx Ldiw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FtcntFoD; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com. [2a00:1450:4864:20::633]) by gmr-mx.google.com with ESMTPS id 2adb3069b0e04-53df6496888si232e87.11.2024.11.27.14.38.15 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Nov 2024 14:38:15 -0800 (PST) Received-SPF: pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) client-ip=2a00:1450:4864:20::633; Received: by mail-ej1-x633.google.com with SMTP id a640c23a62f3a-aa54adcb894so21152166b.0 for ; Wed, 27 Nov 2024 14:38:15 -0800 (PST) X-Gm-Gg: ASbGncvYxXMfObkbWwvTTXwEh50Fr1NynoLhb+Jy4QYe2hxvWfMGcvE6zIEe04aSsAJ qocFn7wGF8NOfrR1H37WwZ8pNA7yX/00= X-Received: by 2002:a17:906:3d31:b0:a9a:61d:7084 with SMTP id a640c23a62f3a-aa581065dd5mr293283166b.50.1732747094813; Wed, 27 Nov 2024 14:38:14 -0800 (PST) MIME-Version: 1.0 References: <5b69515c-b5b1-4333-88e2-7653face1a3bn@googlegroups.com> In-Reply-To: <5b69515c-b5b1-4333-88e2-7653face1a3bn@googlegroups.com> From: Ethan Heilman Date: Wed, 27 Nov 2024 17:37:38 -0500 Message-ID: Subject: Re: [bitcoindev] Re: ColliderScript: Covenants in Bitcoin via 160-bit hash collisions To: Antoine Riard Cc: Bitcoin Development Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Original-Sender: eth3rs@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=FtcntFoD; spf=pass (google.com: domain of eth3rs@gmail.com designates 2a00:1450:4864:20::633 as permitted sender) smtp.mailfrom=eth3rs@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Precedence: list Mailing-list: list bitcoindev@googlegroups.com; contact bitcoindev+owners@googlegroups.com List-ID: X-Google-Group-Id: 786775582512 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , X-Spam-Score: -0.5 (/) > If I'm understanding correctly, the trick is about proving that y(y1 =3D = y2) both in Big Script and Small Script. Yes, the trick is about proving that y1 =3D y2 where the script has y1 and 32. > For the security definition you're giving of the equivalence check, I don= 't think it matters that a party in a multi-party colliderscript-based vaul= t protocol being honest. We don't make any honest assumptions, this is purely based on cryptographic soundness. >Do we really need to OP_DUP w and t on the script stack ? Like isn't the s= signature verified by Big Script is enough to then decompose the data payl= oad in Small Script 32-bit inputs. I was using OP_DUP here to demonstrate that we know with 100% certainty that the (w,t) that Small Script sees is the exact same value as what Big Script sees. > I don't see where w, t are formally defined in the paper, though I browse= d again the section 4. about realizing Bitcoin equivalence tester sets. w is a 33-bit stack element, e.g. the number 23412 t is a bit vector consisting of many stack elements, e.g. the bit string 1,1,0,1,0,0,1,1,0,1,01, ... They are supplied as witness stack elements by the spending transaction. See Figure 1, elements pushed on the stack from the spending transaction are colored purple. > I don't see the paper is introducing a formal notion of semantically equi= valent. Let's say two transactions, Txn1, Txn2 are the same in every bit except: Txn1's locking script does: PUSH 0x2432423423432423424 DROP Txn2 locking script does: PUSH 0x6767567567685758676 DROP Both transactions will have a different hash, but be semantically equivalen= t I'm not sure what your attack is attempting to achieve. Can you frame as Alice locks coins under covenant that does X and Eve wants to do Y On Sun, Nov 24, 2024 at 11:24=E2=80=AFPM Antoine Riard wrote: > > Hi Ethan, > > Thanks for the additional thoughts. > > > You have the basic idea correct but I think you might be missing one > > piece of this (or perhaps you just simplified some details). > > Reading again the paper, my example and your new example, I don't underst= and > yet all the details for sure, though on the fundamental trick, I believe > we're saying more or less the same thing. If I'm understanding correctly, > the trick is about proving that y(y1 =3D y2) both in Big Script and Small= Script. > > > For an honest party spending a covenant the s1 and s2 they generate > > are always equal. This means that y1 <- h_big_script(s1) and y2 <- > > h_small_script(s2) will generate the same y (y1 =3D y2). As you point > > out we can't compare y1 to y2 because they are encoded differently. > > Where s1 and s2 is the byte-for-byte equivalent spent transactions. > For the security definition you're giving of the equivalence check, > I don't think it matters that a party in a multi-party colliderscript-bas= ed > vault protocol being honest. Either, the equivalence check is sound, > and it's immutable once the UTXO's containing the lock script is > confirmed in the chain, the covenant creator cannot himself generate > not equal s1 and s2 _and_ successfully spend the coin. > > The lemma in terms of security model, I think for multi-party protocol, > is that all the participant should verify the soundness of the y(y1 =3D y= 2), > before to engage in the protocol (e.g staking more coins under the > locking script or doing a swap). > > > we know just DUP w and t for evaluation in > > small script and big script. Since dGen is deterministic it must be > > the case that dGen_big_script(w, t) always equals dGen_small_script(w, > > t). The trick is finding a w, t, s where dGen(w, t) =3D h(s) where s = =3D > > s1 =3D s2. > > Do we really need to OP_DUP w and t on the script stack ? Like isn't > the s signature verified by Big Script is enough to then decompose the > data payload in Small Script 32-bit inputs. > > I don't see where w, t are formally defined in the paper, though I > browsed again the section 4. about realizing Bitcoin equivalence tester > sets. There are just given as parameters, ||w|| =3D 33 and 35 <=3D || t |= | > <=3D 75, and it doesn't say if there are data elements or transaction > fields feeded in the signature digest. > > > If I understand what you mean by staticness, the answer is no. > > Staticness should not provide any advantage to an attacker. In fact if > > the attacker does not sufficiently randomize the sighash on each > > query, they will have more difficulty, not less, finding collisions. > > Yes, for example for staticness if you take bip143 signature digest, > the nVersion field is going to be the same for all the v2 transaction > or v3 transaction. > > I see the introduction of the randomness p in the section 3 about > equivalence check in bitcoin, though at the same time the idea is > to find a semantically equivalent transaction to get s of tx(p). > > So for a given s signature, is there an existing efficient NP algorithm, > that could find tx1 and tx2 for a same randomness p, where tx1 and > tx2 are not semantically equivalent...? I think it's an interesting > problem, and I don't see the paper is introducing a formal notion of > semantically equivalent. > > > I'm not sure what you mean here. Can you provide a concrete example of > > this attack? > > Let's recall the Schnorr signing algorithm, G^s =3D R + P^hash(R || m). > > Given m is the transaction data and G the generator, R the nonce and > P the public key point, and all of same are equivalent, can I grind > any of G, R or P to find 2 valid curve points for the same signature > s where the curve point would correspond to 2 messages m1, m2 ? > > I think it's as hard as breaking the DL problem, though I'm not > sure if they have been new cryptanalysis of the Schnorr trick, > compared to existent proofs for Schnorr under the RO / GGM models. > > Best, > Antoine > ots hash: 27b5b4bdeea168147580d96769fda7bb395619435832a2e1d0aee0f03b22f27= b > > Le mercredi 13 novembre 2024 =C3=A0 22:23:29 UTC, Ethan Heilman a =C3=A9c= rit : >> >> > If I'm understanding correctly, the goal of the equivalence check is t= o find a `y` such that `y <- h_big_script(s1)` and `y <- h_small_script(s2)= ` >> are logically equal. Once such `y` is found, the data-carrying >> transaction is grinded until s1 and s2 are equal. >> >> You have the basic idea correct but I think you might be missing one >> piece of this (or perhaps you just simplified some details). >> >> For an honest party spending a covenant the s1 and s2 they generate >> are always equal. This means that y1 <- h_big_script(s1) and y2 <- >> h_small_script(s2) will generate the same y (y1 =3D y2). As you point >> out we can't compare y1 to y2 because they are encoded differently. >> >> > The hash `y` outcome for both `h_big_script` and `h_small_script` will= be never compared themselves during the script execution, as we *cannot*. = The former is a plain data push and the remainder an array of 32-bits scrip= t elements. >> >> To show equivalence between s1 and s2, we find a value d <-- dGen(w,t) >> which is equal to y. >> >> y1 <- h_big_script(s1) >> d1 <-- dGen_big_script(w, t) >> y1 =3D=3D d1? >> >> y2 <- h_small_script(s2) >> d2 <-- dGen_small_script(w, t) >> y2 =3D=3D d2? >> >> Since the inputs to dGen are 32-bit elements in both dGen_big_script >> and dGen_small_script, we know just DUP w and t for evaluation in >> small script and big script. Since dGen is deterministic it must be >> the case that dGen_big_script(w, t) always equals dGen_small_script(w, >> t). The trick is finding a w, t, s where dGen(w, t) =3D h(s) where s =3D >> s1 =3D s2. >> >> > 1). could a 160-bit hash collision attacker leverage some staticness o= f fields in bip341 sighash to lower the hardness under 2^109 ? As analyzed = in appendix G. >> >> If I understand what you mean by staticness, the answer is no. >> Staticness should not provide any advantage to an attacker. In fact if >> the attacker does not sufficiently randomize the sighash on each >> query, they will have more difficulty, not less, finding collisions. >> >> > 2) The Schnorr trick assumes a signature where the pubkey and nonce ar= e equivalent to the generator point. I think there could be some forgery of= the covenanted transaction data, if an adversary can construct a transacti= on with still the same s1 and s2 to satisfy Big Script and Small Script. >> >> I'm not sure what you mean here. Can you provide a concrete example of >> this attack? >> >> Thanks, >> Ethan >> >> On Tue, Nov 12, 2024 at 12:41=E2=80=AFPM Antoine Riard wrote: >> > >> > Hi Ethan, >> > >> > Thanks you for this astute paper. >> > >> > The crux of the paper relies on the equivalence check, which >> > in my understanding can be described as the following (correct >> > me if the set of algorithms differs). On one side, we have our >> > old good correct signatures on the stack. A signature is a >> > commitment to the signature hash fields. This signature can be >> > verified to be valid and it can be given to one of the 160-bits >> > hash functions, i.e OP_SHA1 or OP_RIPEMD160. >> > >> > E.g: < > >> > >> > Doing the Schnorr trick, a data-carrying transaction can be >> > altered until its signature is equivalent to the SchnorrHash, >> > by selecting accordingly that pubkey P and nonce R are equal >> > to the generator. Those elements that the signature is well- >> > composed are further checked by the small script "signature >> > defragmentation" 32-bits integers opcodes. >> > >> > On the other side, we have the 32-bits integers opcodes >> > that can be used to re-implement "bitcoin script natively-ish" >> > cryptographic operations, e.g blake3. Giving the full script >> > would be too lengthy, though hash functions are just (very) >> > smart sequences of XORed seed, key, data that one can simulate >> > easy in bitcoin script. E.g to flip one bit of data. >> > >> > E.g: <<1-bit input_a> <0x1> <0x0> >> > <0x1> > >> > >> > So let's say we have some basic cryptographic operation >> > like OP_SHA1 in small script (for p2tr tapscript spend >> > the script size limit is the block size). If I'm understanding >> > correctly, the goal of the equivalence check is to find a `y` >> > such that `y <- h_big_script(s1)` and `y <- h_small_script(s2)` >> > are logically equal. Once such `y` is found, the data-carrying >> > transaction is grinded until s1 and s2 are equal. The hash `y` >> > outcome for both `h_big_script` and `h_small_script` will be >> > never compared themselves during the script execution, as >> > we *cannot*. The former is a plain data push and the remainder >> > an array of 32-bits script elements. >> > >> > Once the equivalence check has been done, the restrictions >> > on the signature construction from the Schnorr trick can >> > be checked, and then what covenant checks can be done in >> > the remainder of the 4MB weight unit can be play out. E.g >> > checking the spending transaction nAmount twice 32 bits >> > are less than a given value. >> > >> > <<32-bits> >> > <32-bits> > >> > >> > Withstanding the code proof that a OP_SHA1 or OP_RIPEMD160 >> > fips-180-1 implem in small script effectively fit in the >> > block size, I think the colliderscript equivalent check >> > construction as presented can be sound, though I have >> > few questions on the security model. >> > >> > 1) Let's say you have a 2 step smart contract as presented >> > in Figure 4. The locking script is committed in a tapscript >> > somewhere in the tree, and as such the collision `y` to found >> > cannot be observed ahead of the spending. >> > >> > Once the script is revealed and before the transaction confirms >> > every 10 block _in average_, an adversary with enormous >> > computational resources, could come to find another collision >> > (what I think you call a triple collision). While the s1 value, >> > i.e the main data fields of the data-carrying transaction >> > shouldn't be know ahead, for some use-cases they might very >> > standards. >> > >> > E.g if you take a vault protocol, only the spent outpoint and >> > pubkey might differs among vault instance belonging to different >> > users (e.g everyone use same emergency or revaulting timelocks by >> > default). So could a 160-bit hash collision attacker leverage >> > some staticness of fields in bip341 sighash to lower the >> > hardness under 2^109 ? As analyzed in appendix G. >> > >> > 2) The Schnorr trick assumes a signature where the pubkey and >> > nonce are equivalent to the generator point. I think there >> > could be some forgery of the covenanted transaction data, if >> > an adversary can construct a transaction with still the same >> > s1 and s2 to satisfy Big Script and Small Script. >> > >> > However, the transaction data would be a security downgrade >> > from the smart contract protocol. E.g a nLocktime committing >> > to a sooner chain tip than now, or even worst a malleated >> > output pubkey. I think it's easy to fix if the schnorr pubkey, >> > nonce are committed in the covenant locking script, and explicitly >> > verified as such in the small script. This is pointed out >> > in the section 2.4 about transaction grinding, but it's not >> > discussed further afaict e.g in the section 7 on the security >> > discussion. >> > >> > Best, >> > Antoine >> > ots hash: b47373e430c25a96e642ddad3cc330ee364f06c06f81a63238926a9ebbcb= 6795 >> > Le jeudi 7 novembre 2024 =C3=A0 17:48:03 UTC, Ethan Heilman a =C3=A9cr= it : >> >> >> >> We wanted to make bitcoin-dev aware of our recently published draft o= n >> >> how to create and spend covenants on Bitcoin using Tapscript. >> >> https://colliderscript.co/colliderscript.pdf >> >> >> >> Our approach does not require soft forks and should work on Bitcoin a= s >> >> it is currently deployed. While creating these covenants is as easy a= s >> >> creating a transaction with P2WSH output, spending these covenants >> >> requires substantial computation and involves creating very large >> >> bitcoin transactions. >> >> >> >> Spending such a covenant requires ~2^86 hash calls to SHA-1 and >> >> RIPEMD-160. In comparison, mining a Bitcoin block at current >> >> difficulty requires ~2^78.3 hash calls to SHA256x2. Thus, spending >> >> such a covenant would require the same number of hash queries the >> >> entire Bitcoin network does in roughly ~33 hours. Such covenants coul= d >> >> be created today, but spending them likely requires the creation of >> >> dedicated ASICs. >> >> >> >> While the computational costs limit the immediate applicability of ou= r >> >> covenants, we are optimistic that future work can significantly >> >> improve these numbers. This approach is not a replacement for a >> >> covenant opcode because: >> >> 1. High computational cost: Our approach is likely to be many orders >> >> of magnitude more computationally expensive than a covenant opcode. >> >> 2. 4Mb transactions: Transaction size, computation cost trade-off >> >> exists that reduces the computational costs of these covenants by >> >> increasing the transaction size. Due to most of the cost being >> >> computational it is likely they always be just under 4MB in size even >> >> with efficiency gain. 4MB is the limit for valid transactions. >> >> >> >> Our approach is framed around covenants, but our approach enables >> >> arbitrary computation on Bitcoin transaction data. This arbitrary >> >> computation is bounded only by the circuit size we can pack into what >> >> is left of a 4Mb Bitcoin transaction after it contains all our >> >> necessary machinery. This means, for example, we can do Tapscript >> >> lamport signatures that sign the sighash of the spending transaction. >> >> >> >> One of the authors of our paper, Andrew Poelstra, proposes in the >> >> paper a very interesting use case for lamport signatures (Section 7.2= ) >> >> which I think is worth making the list aware of. Leveraging the fact >> >> that it is very cheap for users to write and deploy our covenants, it >> >> is only expensive to spend them, the following scheme is proposed. A >> >> user could create a covenant in a tapleaf whose spending condition >> >> requires a Lamport signature over spending transaction. While the >> >> resulting script will be very large, they can hide it in a Taproot >> >> leaf where it will never be serialized on-chain unless it is used. In >> >> the case of a =E2=80=9Csurprise quantum computer=E2=80=9D which force= s Bitcoin to >> >> suddenly disable all elliptic curve cryptography including taproot ke= y >> >> spends, such users will still be able to spend their coins (though at >> >> enormous cost). If a large quantity of users do this, it may be >> >> possible for the Bitcoin chain to survive such an event, even if no >> >> better solution is found or deployed. >> >> >> >> >> >> Our Technique >> >> =3D=3D=3D=3D >> >> >> >> We will now look at how our technique works by introducing the core >> >> problem we solve and then showing how by solving this problem we can >> >> enforce covenants. >> >> >> >> >> >> Let=E2=80=99s say you want to write a Bitcoin script that checks if >> >> 12345678abcdef00 and [12345678, abcdef00] are equivalent. That is, if >> >> you treated 12345678 and abcdef00as a single element would it be >> >> equal to 12345678abcdef00? >> >> >> >> If we had OP_CAT this would be easy: >> >> 12345678abcdef00 =3D=3D CAT(12345678, abcdef00) >> >> >> >> We call checking if one element is the concatenation of a list of >> >> smaller elements, an equivalence check. We can ask is 12345678abcdef0= 0 >> >> equivalent to [12345678, abcdef00]? >> >> In Bitcoin script, checking equivalence between a single big element >> >> and a list of small elements is quite challenging, below we will show >> >> how to do it. >> >> >> >> Before getting there we need to make a short digression first. It has >> >> been part of the lore for some time that Bitcoin script can perform >> >> arbitrary computation on inputs, so long as the inputs are encoded as >> >> a list of 32-bit stack elements. This uses opcodes like OP_ADD, >> >> OP_SUB, which only accept 32-bit inputs. We call functions written >> >> using 32-bit elements Small Script. People have built all sorts of >> >> things in Small Script, for instance you can compute Blake3 in >> >> Tapscript in a bitcoin output using only 45,000 opcodes (a.k.a. 45,00= 0 >> >> bytes)! See https://bitvmx.org/knowledge/optimizing-algorithms-for-bi= tcoin-script >> >> >> >> Let=E2=80=99s say you have a Small Script implementation of SHA-1 whe= re it >> >> treats [12345678, ABCDEF00] as an Small Script encoding of >> >> 12345678abcdef00. Does the following equivalence check work? >> >> >> >> OP_SHA1(12345678abcdef00) =3D=3D smallscript_SHA1([12345678, ABCDEF00= ]) >> >> >> >> No, because OP_SHA1 will produce one big 160-bit (20 byte) stack elem= ent >> >> OP_SHA1(12345678abcdef00) =E2=86=92 a12d9ee23d07317c2d2d6887fe955819b= c2d24c5 >> >> whereas the Small Script implementation of SHA1 will produce 5 32-bit >> >> (4 Byte) stack elements >> >> smallscript_SHA1([12345678, abcdef00]) =E2=86=92 [a12d9ee2, 3d07317c, >> >> 2d2d6887, fe955819, bc2d24c5] >> >> >> >> Checking if these are the same requires the equivalence check, the >> >> very thing we were trying to build. Ok, hear me out, what if you >> >> magically discovered a value X which was 32-bits in size and just so >> >> happened to collide with 12345678abcdef00. That is, >> >> SHA1(12345678abcdef00) =3D=3D SHA1(X) is true >> >> AND >> >> 12345678abcdef00 !=3D X >> >> AND >> >> Size(X) =3D 32-bits >> >> >> >> You could do an equivalence check for 12345678abcdef00 by doing the f= ollowing: >> >> >> >> In Big Script >> >> Check OP_SHA1(12345678abcdef00) =3D=3D OP_SHA1(X) >> >> >> >> In Small Script >> >> Check smallscript_SHA1([12345678, abcdef00]) =3D=3D smallscript_SHA1(= X) >> >> >> >> If both of these return true, then we decide 12345678abcdef00 is >> >> equivalent to [12345678, abcdef00]. >> >> >> >> Put more generally: >> >> Check OP_SHA1(A) =3D=3D OP_SHA1(X) >> >> and >> >> >> >> Check smallscript_SHA1(B) =3D=3D smallscript_SHA1(X) >> >> >> >> Now if A is equivalent to B, and X collides with A, then X will >> >> collide with B in Small Script because B is just the Small Script >> >> encoding of A. However if A is not equivalent to B then this implies = a >> >> triple collision which is much more expensive to find: >> >> >> >> SHA1(A) =3D SHA1(X) =3D SHA1(B) >> >> >> >> where A !=3D B, A!=3DX, B!=3DX >> >> >> >> Given the choice between two possibles for an A and B that pass the c= heck: >> >> 1. A equivalent to B >> >> 2. A not actually equivalent to B requires a triple collision that is >> >> computationally infeasible >> >> We argue that 1 is much more likely. >> >> >> >> Ok, but as some of the cryptographers are now typing, if X is only >> >> 32-bits it is extremely unlikely to find an X that collides for any >> >> particular value. To exploit the birthday bound to find collisions >> >> with a 160-bit hash function you need the input to be >80-bit in size= . >> >> Overcoming this problem is the last trick of the paper. We introduce >> >> the function dGen(w, t) which can take any length of input and that >> >> input can be read by Small Script and Big Script. >> >> >> >> dGen(w, t): >> >> y =3D SHA1(w) >> >> for b in t: >> >> If b =3D=3D 0: >> >> y =3D SHA1(y) >> >> If b =3D=3D 1: >> >> >> >> y =3D RIPEMD160(y) >> >> return y >> >> >> >> w is a 33-bit stack element, t is a series of 32-bit stack elements >> >> which we treat as a list of bits. For instance is w=3D312a123e, t=3D0= 1101 >> >> dGen would return the value created by running >> >> SHA1(RIPEMD160(SHA1(SHA1(RIPEMD160(SHA1(312a123e)))))) >> >> >> >> dGen can be run using OP_SHA1 and OP_RIPEMD160 and can also be run in >> >> Small Script using Small Script implementations of SHA1 and RIPEMD160= . >> >> Since both sides can use the same stack elements to compute the outpu= t >> >> it lets us build our equivalence check. We just need to find a (w, t) >> >> such that: >> >> >> >> OP_SHA1(A) =3D=3D BigScript-dGen(w, t) // Big script dGen using OP_SH= A1 >> >> and OP_RIPEMD160 >> >> SHA1(B) =3D=3D SmallScript-dGen(w, t) // Small script dGen >> >> >> >> Finding (w,t) is the main computational expense of spending our >> >> covenant as our covenant depends on this equivalence check. That said >> >> finding collisions in 160-bit hash functions requires significantly >> >> less computation than the Bitcoin network regularly performs. See our >> >> paper for our collision algorithm and discussions of known weaknesses >> >> in SHA1. >> >> >> >> How do you turn this equivalence check into a covenant? >> >> >> >> Past work -- https://www.wpsoftware.net/andrew/blog/cat-and-schnorr-t= ricks-i.html >> >> -- has shown that by structuring a Schnorr signature correctly, that >> >> Schnorr signature will be the hash of the spending transaction (see >> >> our paper for how we adapt this to our setting). At very high level >> >> our covenant works as follows: >> >> >> >> 1. Get sighash of spending transaction onto stack >> >> 2. Use equivalence check to show that small script encoded sighash is >> >> the same as the sighash we have on the stack >> >> 3. Open the sighash in small script by showing bytes pushed on stack >> >> by the spending transaction hash to sighash are bytes of the spending >> >> transaction. Now we have the bytes of the spending transaction on the >> >> stack. >> >> 4. Use Small Script to enforce covenant on the bytes of the spending >> >> transaction. >> >> >> >> See paper for full details. Thanks, >> >> Ethan >> > >> > -- >> > You received this message because you are subscribed to the Google Gro= ups "Bitcoin Development Mailing List" group. >> > To unsubscribe from this group and stop receiving emails from it, send= an email to bitcoindev+...@googlegroups.com. >> > To view this discussion visit https://groups.google.com/d/msgid/bitcoi= ndev/fc031fe3-444c-446d-a5c1-f2d7a430b478n%40googlegroups.com. > > -- > You received this message because you are subscribed to the Google Groups= "Bitcoin Development Mailing List" group. > To unsubscribe from this group and stop receiving emails from it, send an= email to bitcoindev+unsubscribe@googlegroups.com. > To view this discussion visit https://groups.google.com/d/msgid/bitcoinde= v/5b69515c-b5b1-4333-88e2-7653face1a3bn%40googlegroups.com. --=20 You received this message because you are subscribed to the Google Groups "= Bitcoin Development Mailing List" group. To unsubscribe from this group and stop receiving emails from it, send an e= mail to bitcoindev+unsubscribe@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/bitcoindev/= CAEM%3Dy%2BUs1xjibAgyskvmti2GuvgNKLzPs6APUaTJZUX%2B4eQ5SA%40mail.gmail.com.