From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 13 May 2025 04:48:07 -0700 Received: from mail-oi1-f186.google.com ([209.85.167.186]) by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1uEo7C-0000RW-7a for bitcoindev@gnusha.org; Tue, 13 May 2025 04:48:07 -0700 Received: by mail-oi1-f186.google.com with SMTP id 5614622812f47-3f7ade514c8sf1830809b6e.0 for ; Tue, 13 May 2025 04:48:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1747136879; cv=pass; d=google.com; s=arc-20240605; b=BRYlePDfcgtT3evTtl7BOrDMrEYwP1TjiUFfyzKwZ9+zyXxKb8Wzmd2b/jdazaFCCg HYB20pmYQUuLkkWvH3FTNNS1fTtewSDquHUwL4mKt4MBiJfJ26qr7naxRl8k3xxYVt6N 3MXD6pINe3ZlofSjGyzYGdVBFnV0I/klEuDaKDfqPEqQ7WqLhQDqY8JtKQPwGRqde9uN 8r7XyUJjK/aeOXxZjUlvdvkRJThaMIDHE5Hp3whgyeCINcH8NkO3j9qjuIpkx2qrrTb+ yAuL2ZqcgVOhpvtuuqS6vulN75pTRayzGEh+uNz7vTLVrDhG0P+AqVyWCQvS4S3NEfLz MYmw== 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=NcJnmvBuzU99s6P4lxHA+bJBPqlRM1DZb/rU3LEqhio=; fh=R0uIm1nKjPRqkRajLn8r8tOUEK1InH6xbwn65mA7b0g=; b=Y4N8o6NKA9XQXkVlqP82mipVRmoW945Oms69qMhxZx6NNtGD+c85hl5GqQ71veWMZ5 wDJAU8zXNoXUatqRcTBmCZ4SGP6dTAjFLN4XDkTfukTMByXUF3jMCe0Y+FqxNRsu54Ts fzvkOTNh4I5iLbeOfJdM9JjJBMvj0AkD0Uvg6e6Ug/h3bSTSZUGctG8/7dmKV/KTODI7 pmuzwsRGsm/t82INycohvPZzRVBxYwIwChRbnjzY6wDOFRATdmh+SxAzGEI74cih187e ULTvj3/Ancl2y1DuFVZw1nVzNYVBUEHEQ11FcRIYZX91pLNjG7cgEYB28Hnp5e0ntBMQ cYsw==; darn=gnusha.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bK+reNxJ; spf=pass (google.com: domain of decker.christian@gmail.com designates 2607:f8b0:4864:20::12f as permitted sender) smtp.mailfrom=decker.christian@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=1747136879; x=1747741679; 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=NcJnmvBuzU99s6P4lxHA+bJBPqlRM1DZb/rU3LEqhio=; b=I3wN45iDV/pTMGaRHU5IRJasAlZjIIl9CD+O5PNAk+CBVptmiDiDyEq0W82J147y27 QTGo04OWIhWGG2Yo+OualonsV41XHywzGFPsLO8uHQm5dNlGEYd1KJRMDAJ3X4apd5fq Ckh3WS1h5zV4gWjEzvKVlzUop1gk8R2x+GtLuJaspJh8zppZ6bJhyf4UegcPGMee0ZjV Drti7gSyhl++bttUTftkwVjHWrS2yr0KRmj+/ITwFwvg+F1QS3am0vzmwYP3JnPpQS2n Kggh6/0OvKKSfFSJivoZXGy5b4rLzyf4afCgTLlop9oQfpd8pyfZ0JMiHlIrNiyDsA5j wjXg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1747136879; x=1747741679; 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=NcJnmvBuzU99s6P4lxHA+bJBPqlRM1DZb/rU3LEqhio=; b=Uc3tiGDRwaTEI6nsQqn2dW3+JhJSpqebDc2TgM4Xr91nSsoRLVA+g9Vay16hUZwEyQ VwkNZGC60ivPRFdljZ5R5d+TXXTfamnhWj9v9RtBN5RiLq5Ze/Cp6i5Kp4PbvxXl8W0J 5y6y0r3tsp5kKtQcLoczwx4gB5HK3Rt3QDI4PAFGHm+++Q9CJFx5qSikXNeRLn8ukB64 sVDL0XA6w9u8M4h5hjESMZMADYkLRAIvs6AOQbeSt76bb91bFM7q3/i6OD0+gpHkv82t TLJ504FGECB3Hum1+rd/ZzpjoCnA4y8Av6Jq4UlXr1IV0AgUdrdQhf+tTq8VIF6y0Jvu wvOg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1747136879; x=1747741679; 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=NcJnmvBuzU99s6P4lxHA+bJBPqlRM1DZb/rU3LEqhio=; b=NS6uTQ9LIQxHbG5hs8P/2JT1mV6UnAB9ZUndNm9dcgIrQLkCTOVT5qpNLWvDU/+6Qu HXpPwBWTTvuis8Szdv88mAEZ9Jyj1gL1HqRXmKGvDjM5dszC88APBhbUSVrPg6vU1Vu4 Eo860c1pexNXkvJ74Ru5EWFFzgIYpzi0QcJrUVEIi4QoT9dSBNSYX8oFS++53doHFcbr +OU7nKyZ9rHJal0SVpTsGtm+iUIMbLSa7jeqBzjYvM5MNIRCeiP5SpC+CzHBfBNfcUZd MsEYeE0+Xj8tb4tBT/2UUl8JJ2d/++iXjiG1aZD/KGVProGrHAaR01QAV0MAqCaPL1bQ KPLQ== Sender: bitcoindev@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCVZ7XdZZjGjE21gtRWktdilKJ6b5xjmtt/n83s5ohJnpnesHL5SZ9sY5rSyrKzZZ0pzvoINF+eNHjgK@gnusha.org X-Gm-Message-State: AOJu0Yxz/rpv88U2XkUWanhJyflTU8kvVsJ1Qftwd70NMwM1G453ICbB t1P68Yq/DN+YsplmQ/7CXdCEhpIeWO5Ojz4iklaN4Rbml1L1Wczh X-Google-Smtp-Source: AGHT+IGMQW3u3pbXKK+jXw69SAaLgOpSi8MobWfjFr78Wb/WUWN33KBhi772+xo8kZWMS3e40xUmuQ== X-Received: by 2002:a05:6808:398a:b0:403:323d:3033 with SMTP id 5614622812f47-403800d517emr10048641b6e.29.1747136879075; Tue, 13 May 2025 04:47:59 -0700 (PDT) X-BeenThere: bitcoindev@googlegroups.com; h=AVT/gBH2R/uaEGjwDSzf8lCiJhx/acC5zffoklH1nr9BwSl6YQ== Received: by 2002:a4a:d442:0:b0:602:40ed:5c6f with SMTP id 006d021491bc7-60832e04367ls1093761eaf.0.-pod-prod-06-us; Tue, 13 May 2025 04:47:55 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVHYsLuO9HkHcXQiYOQTCrz+7KsFdTB7DM9+qPtRjCgt2DSQVxFNZvA8Hyus7NlBcPBqbUslz8ISB3K@googlegroups.com X-Received: by 2002:a05:6808:2382:b0:402:bb56:85ca with SMTP id 5614622812f47-403800fce6fmr9148547b6e.38.1747136875315; Tue, 13 May 2025 04:47:55 -0700 (PDT) Received: by 2002:a05:6808:2d29:b0:3fa:da36:efcd with SMTP id 5614622812f47-403800066d4msb6e; Tue, 13 May 2025 04:45:09 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCXg/bB9L2mKKt5b3HGUVWi0tcAA0rUGcELpQg/IsI9FDDpArfIfSxKJs4Yt/cB62SphXkwCpum6SaeP@googlegroups.com X-Received: by 2002:a05:6870:a550:b0:2d4:ce45:6993 with SMTP id 586e51a60fabf-2dba44c5d0dmr10617112fac.30.1747136709164; Tue, 13 May 2025 04:45:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1747136709; cv=none; d=google.com; s=arc-20240605; b=GxPEkXFG9fweDzKHHKb7Z7kiQR68YIfqe1AVT+3QYLE8gttqtyk3K12KQU5Uvz1q7J wj40MhPAvy5UaK46m+jOVQwVfIvBDcyQvk+e+7drmU76iP6nBsMWAqvOmX3FsTYNS30t YIOR5z5IMePVK9Y6XdhzUGHZCGGd1nVCxSQGa3LFaLxS2ASuQmxA/elW30wWk4aqsySt MRkSEcbiFFtoyCaVywTI4xrwfWesw+2L9MbRjH1T22m3efEPM62JGVQrGBWNBKnsih1k Nd/RcBL+c3kwAD66XgetY832/m4ap++WUYpc7X9U63ms6951X7NMljRD8ZEBaaHdUASI e0+Q== 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=ac7wIOp8Oj6Y+TOQ4FC+tw9zpf1jMyjTI3SxxuAC+Dg=; fh=P07+pLxYFEppX9CSvT3okZtr7HRo29Cx94mw9Ts37ik=; b=KuZ8t0Jn+F3PUeE61PAMMPXni98Ax8G7TYW4aiFP3DjHov9LSqJM0BOCkMqWhrTPKZ thpbX0YQQj/si7LQTQu8DO8Ikr7jUzOZcYtj+qZ49z/YKos5HcKVD6LRwD3fRO4BcKJX 1fznddCGYlfC8lEXWCvxKBNvuzQtBQzodhiJHvhvreXnHNn0EDQP+JpQ0rqsQ7i1s8HI Gewt8wAdOlLweXK4NxsPjslOLBi2Zw5sIS1bP4UnbeDPTk/+aihZGpsVEdfSneuDySSP sAhP2dPZ4jCEKq+FYG8DnXKA31fqKuOhnDRu62sbQAM+Yk8eh3yAT6IFZXUzft/QZ/B+ o81w==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bK+reNxJ; spf=pass (google.com: domain of decker.christian@gmail.com designates 2607:f8b0:4864:20::12f as permitted sender) smtp.mailfrom=decker.christian@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Received: from mail-il1-x12f.google.com (mail-il1-x12f.google.com. [2607:f8b0:4864:20::12f]) by gmr-mx.google.com with ESMTPS id 586e51a60fabf-2dba05f8bf9si77217fac.1.2025.05.13.04.45.09 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 13 May 2025 04:45:09 -0700 (PDT) Received-SPF: pass (google.com: domain of decker.christian@gmail.com designates 2607:f8b0:4864:20::12f as permitted sender) client-ip=2607:f8b0:4864:20::12f; Received: by mail-il1-x12f.google.com with SMTP id e9e14a558f8ab-3d96d16b375so25852025ab.1 for ; Tue, 13 May 2025 04:45:09 -0700 (PDT) X-Forwarded-Encrypted: i=1; AJvYcCUlAb7krsBEBRTYgXCjYl6MmttpRJD6esKLYtNYooN6fYrEj5Rm+KDP80BN0c0i6WyTQQCrl1d6mPa6@googlegroups.com X-Gm-Gg: ASbGnctB9BNtXgtif7rBOsW5XMiPPiHSampU6TY9NwmbLTc47g+oF7BSbZWawI7ZV+N TWLYyfHrqAxBhsrKmhJLEHSExSCzaNIbtb2LbQv5luvhTtS1CgBhnQmfmMiE5gD/EOomYlU+Gf4 rIA85sj16G62Q4kB4lGmq0Gm4T8MzosFQbbw== X-Received: by 2002:a05:6e02:3982:b0:3d9:24d8:8d41 with SMTP id e9e14a558f8ab-3da7e20fa95mr186782515ab.16.1747136708609; Tue, 13 May 2025 04:45:08 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Christian Decker Date: Tue, 13 May 2025 13:44:32 +0200 X-Gm-Features: AX0GCFvd5aZPUEzaYB7mc2-rdynse3pIeqtfJPWqETYh0rmWeyo5jJyDXNUtJa8 Message-ID: Subject: Re: [bitcoindev] [Proposal] 64-bit arithmetic in Script To: Chris Stewart Cc: =?UTF-8?Q?Martin_Habov=C5=A1tiak?= , Bitcoin Development Mailing List Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Original-Sender: Decker.Christian@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=bK+reNxJ; spf=pass (google.com: domain of decker.christian@gmail.com designates 2607:f8b0:4864:20::12f as permitted sender) smtp.mailfrom=decker.christian@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 (/) Hi Chris, quite an interesting proposal, but much like Martin I wonder if we shouldn't go beyond. For comparison Rusty's GSR comprises arbitrary sized integers and their associated operations, with fine-grained accounting of operations based on the operands size, so scripts stay performant and manageable. That proposal is much further along in both design and analysis, so maybe you could join that effort for your use-cases too? Cheers, Christian On Tue, May 13, 2025 at 11:06=E2=80=AFAM Chris Stewart wrote: > > Hi Martin > > Thanks for your interest in the topic. > > >It mentions upgrading existing opcodes, which is a hardfork, not soft fo= rk, at least without using a different leaf version. But it also mentions O= P_SUCCESSX which are different opcodes > > I view 64-bit arithmetic as a feature of a wider set of consensus changes= . Here is what I think the most likely deployment story is > > >This proposal could be deployed in conjunction with any of the new opcod= e proposals in the Motivation section using Tapscript's OP_SUCCESSx semanti= cs.[18] > > The opcodes mentioned in the motivation section are OP_{IN,OUT}_AMOUNT, O= P_VAULT, OP_CHECKCONTRACTVERIFY, OP_CTV > > As an example, this proposal could (hypothetically) be deployed in conjun= ction with OP_CCV. OP_CCV would take advantage of the OP_SUCCESSx semantics= allowing us to redefine existing opcode's (OP_ADD,OP_SUB, etc) semantics. > > There=E2=80=99s been some discussion around deploying OP_CTV via a NOP op= code instead of OP_SUCCESSx. I think that would be a poor choice, as it wou= ldn=E2=80=99t allow new Script features to be shipped in parallel with the = new opcode. > > I found this StackExchange post helpful in thinking through various deplo= yment strategies for new Tapscript-based consensus upgrades. > > >I'd also love to see analysis why stop at 64 bits and not go all the way= to 256 which could be useful for cryptography. > > In my view, there=E2=80=99s still a lot of uncertainty about cryptographi= c features being added to Script. There's increasing discussion around quan= tum computing, which raises the question of how much numerical precision we= may eventually need. I'm not opposed to extending precision further=E2=80= =94but if we go beyond 64 bits, why stop at 256? With OP_SUCCESSx, arbitrar= y precision becomes a real option. > > I chose 64 bits because it covers what=E2=80=99s needed for amount locks.= If someone strongly believes that 64 bits isn't enough, I=E2=80=99d welcom= e a competing BIP and would be happy to review and discuss it with the auth= or. > > >Anyway, pushing amounts on the stack would be great. Though I'm surprise= d you're only proposing the sum, not individual outputs. Why? > > Good question=E2=80=94and slightly out of scope for this BIP. Script does= n=E2=80=99t support looping, so it=E2=80=99s not straightforward to iterate= over and sum all elements unless the transaction structure (i.e., number o= f inputs or outputs) is known in advance. > You can measure the number of stack elements with OP_DEPTH, but there=E2= =80=99s no way to write something like OP_ADD [num-stack-elements-from-OP_D= EPTH] to sum them all. I=E2=80=99m definitely open to hearing other approac= hes, though. > > -Chris > > > > On Mon, May 12, 2025 at 2:32=E2=80=AFPM Martin Habov=C5=A1tiak wrote: >> >> Hi, >> >> the proposal seems to be quite confused about how it's going to do that.= It mentions upgrading existing opcodes, which is a hardfork, not soft fork= , at least without using a different leaf version. But it also mentions OP_= SUCCESSX which are different opcodes. I think it needs some analysis. (leaf= version seems better intuitively) >> >> I'd also love to see analysis why stop at 64 bits and not go all the way= to 256 which could be useful for cryptography. >> >> Anyway, pushing amounts on the stack would be great. Though I'm surprise= d you're only proposing the sum, not individual outputs. Why? >> >> Good luck! >> >> Martin >> >> D=C5=88a po 12. 5. 2025, 14:21 Chris Stewart nap=C3=ADsal(a): >>> >>> This soft fork proposal extends the range of numeric operands in Script= from -2^31+1 to 2^31-1, to -2^63+1 to 2^63-1. It further expands the resul= t range for arithmetic operations from -2^63 to 2^63-1, to -2^127 to 2^127-= 1. >>> >>> All existing opcodes[1] that interpret stack elements as numbers are up= graded to support 64-bit parameters. >>> >>> The existing number encoding format[2] and arithmetic semantics[3] from= the original Bitcoin implementation are preserved, while enhancing the sup= ported precision. >>> >>> https://github.com/Christewart/bips/blob/2025-03-17-64bit-pt2/bip-XXXX.= mediawiki >>> >>> The purpose for this BIP is to lay the groundwork for introducing amoun= ts into Script. This document takes no opinion on how this is done. >>> >>> I've prototyped a few different proposals now introducing amount locks = into Script[0][1] and feel like this proposal is stable enough for serious = review. >>> >>> -Chris >>> >>> [0] - https://delvingbitcoin.org/t/op-inout-amount/549/4?u=3Dchris_stew= art_5 >>> >>> [1] - https://delvingbitcoin.org/t/op-inout-amount/549/5?u=3Dchris_stew= art_5 >>> >>> >>> >>> -- >>> You received this message because you are subscribed to the Google Grou= ps "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/bitcoin= dev/CAGL6%2BmH%2B9iq5_SR-Fa5zVZRoTpHasX7xoprYeJZRd5D80J1GqA%40mail.gmail.co= m. > > -- > 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/CAGL6%2BmHv%2Bkn6SU9pf0Rz3FmM5OfcsmEtqGBRJ7Upb-b0MofS5A%40mail.gmail.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/= CALxbBHW8YD-F2N9PYcAii5wXfEAPratQ6i6ke-i59pdoFczSoA%40mail.gmail.com.