From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 29 Apr 2025 07:15:53 -0700 Received: from mail-qt1-f191.google.com ([209.85.160.191]) by mail.fairlystable.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1u9lkW-0002cL-9s for bitcoindev@gnusha.org; Tue, 29 Apr 2025 07:15:53 -0700 Received: by mail-qt1-f191.google.com with SMTP id d75a77b69052e-4766e03b92bsf111142591cf.2 for ; Tue, 29 Apr 2025 07:15:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1745936145; cv=pass; d=google.com; s=arc-20240605; b=VIHrwNLXsRZtZ0yyY+sJv0aPelgzmoqKwh6sGHGoIIACul44o8NL7GIHNaUFKNfqeq uZoCXRO8U6QaBHbzRa+j9K0mWEFlaWgyxzD+sdf/1cGEoYSo1cpT7qBB6fl8XIYZW6WU GnxKSKHO8Am5rLEVo6Zb9m5M35/nAkdtvYU5PNIbz8pFVgceTLKhg6ILqbAAiq12VDiT BK4b2D/YXSMmWFgI6qApYRSi8Bw6zJPiKl9Qh+4xcTDha5/xqnTXD3SqPOvF5vaA6jpO ewweuanrZIeJDHMlxnBtG2NBYm0+6fcWIHWSHQC9kv6H438O2kMcPer+WY61zIuj4w5A iq2g== 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:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:sender:dkim-signature :dkim-signature; bh=wz+UHbQA04gJzqEo6QAEJboaukPyEIKc4WCRgTFtK38=; fh=ZE6CElbtNbMfhgkJQPS0HN9KG6pbMX1NDEwAYdWskrc=; b=K3OE+gDGX7Bw5FM0f7MBFYuUCkaoQLsGexVvOLtAPfjiwll2nO8eIXoO8ucdfbeVfO vd5g1gDrO+JFxms9tzMGbrhcbO61YCj2AdsOM43btCjnwrj1j/w3TGiU86uLpR+7fI3E +Uh1QkNNzis4QmDMNum/l47gthJ7p0U38oIDMyJH96dZskDBMp3pKRuq7ZMn8LkOqNYp kDjssrbSGon9GghSchpjf+qfTgZPV8Sm1MqbQZf3SWtU9XM1U4Q1RSIkvTF5OoSO9HCm FpyrRZg70vO5Xi0tQTFQnpoemFVx34MYynowYf/shqRHVT8IxdwLpk8Iz+o0bZIEhqsn j4bA==; darn=gnusha.org ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mHMmTkmh; spf=pass (google.com: domain of saintwenhao@gmail.com designates 2a00:1450:4864:20::634 as permitted sender) smtp.mailfrom=saintwenhao@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=1745936145; x=1746540945; 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:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:sender:from:to:cc:subject:date:message-id :reply-to; bh=wz+UHbQA04gJzqEo6QAEJboaukPyEIKc4WCRgTFtK38=; b=TtOXUkTuHlvu/6V8n61Syv5vUr+oLz7UPjLt4vyleAPRhOoZ8WjvH4qv4/gTPjnNW3 ID19zP7J0pAzbjqok5zxH8yu2C7KWqotA+QBJmGnijO9ioTEniSrBa5XHcE8HuhGjv+h ZE+K5Yg7gVwsfTpi1oIeHgQy8C71w1xz2EGsAl+l+ORevOR8MC+7TddcntM9ZutfaXBT Gum5cYSSeKo/CdtUZQbGhJuWLf1EEVbH2Tt266Mj8W53Iap0oJRprOAUUnyTIuF+N26k uCxYai2gvirs8/1TDQcQVwwcVb8iNMPOGmXVqsLIJOa8Y9Mnmun6BsfVNRkv3Dgxvfuc TLHw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1745936145; x=1746540945; 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:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:from:to:cc:subject:date:message-id:reply-to; bh=wz+UHbQA04gJzqEo6QAEJboaukPyEIKc4WCRgTFtK38=; b=lxdzJmiVQ9H2CURtxiAK3DCvSWXhUS0Om4Gmm/GK0fnxox0DTADzZloFDYZ89ydRDW yrJxr0rHHMYDIcjN1JzVZhfxFgKrqJ+a2rOc9hGbJCR8Tat6ryyXu+FDiobjWCBAo5c5 ddSk+gsmpKgse6zVaOAHqSPlYzgvegs8YQYE1hItisVkTBAjqzzbBx8XV809EH/UCZaV RYkurHTvAaAFaamaZFM/rAY7ckj/UWTb4ul66Fngc0+awRtAI7Ktz8g6flpuTObBBe43 ULidMl07xpVPTrzLmGMwKb9F8HB9iLTmvI1cDBYixOgB4aKMNTpmCWMISuRA+iFWYqcl 7OPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1745936145; x=1746540945; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender: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=wz+UHbQA04gJzqEo6QAEJboaukPyEIKc4WCRgTFtK38=; b=fY2i+MFW1NfoVl8HkTqcRuKkz/7/84bVww7yr9k4lfs7XF77XYvyVmUlVMaVhxpl6R 1yoBKnX+ToW5Mf5YfC9xuynFE6EEe+h3fDbKnwRMQZKhQUVqT/AQaHO7NbcvwbSybNMx hsWhRESxh6zwep88hHHt2UgezPKVfKPOnTJjGtOwvwSzKtmysnGB6t7y49OaiPOUprgB Tpl3CScT+7D8pBRoDLYIuEEIQx/sRErfJA5tpRLxOMMWXUpWT24gWeJPWNt7gALLbKYp 6tn+EbkVfuZDSJ+ZwLzHDzVqi9HzrM9FRq4y8YlfX3jtUCLqWnRG1HAllmTObW5I1xEE 4ofg== Sender: bitcoindev@googlegroups.com X-Forwarded-Encrypted: i=2; AJvYcCWHoAMdZfb8MPVDuinzygQmqTdj2wCqef39SYC8QlrOfKEpCB3wrnv2rzpnHBF9wPb35su5EiFL1tmz@gnusha.org X-Gm-Message-State: AOJu0YywXGq/NXDDS0gLIkqqkxMJ5ptDiqRv4AYvWmi3mYDzxWTlQIJI Dv/QAqZSUH6h7+3WtrXhPUsUym/H3E7IxbD0PFV0iD0gOQUYufe+ X-Google-Smtp-Source: AGHT+IGRbTZ0ehgFrvnbRCpZM7/E6Pm1VODzRuWffUxE8lDkhkJ1JIk6/bOVU5dGLzp/dcN9cKGi1g== X-Received: by 2002:a05:622a:58cd:b0:476:8521:778d with SMTP id d75a77b69052e-48874946b72mr55883631cf.50.1745936145358; Tue, 29 Apr 2025 07:15:45 -0700 (PDT) X-BeenThere: bitcoindev@googlegroups.com; h=AVT/gBHlVLRE3uqS+GU9biuJofDYBJCSPbJ8/oDPPbd4hy81uQ== Received: by 2002:ac8:65d4:0:b0:477:c8a:e60b with SMTP id d75a77b69052e-47e55f72d9bls21202931cf.1.-pod-prod-02-us; Tue, 29 Apr 2025 07:15:41 -0700 (PDT) X-Received: by 2002:a05:620a:d8a:b0:7c5:5edb:f4d5 with SMTP id af79cd13be357-7cabe740221mr367126985a.2.1745936141840; Tue, 29 Apr 2025 07:15:41 -0700 (PDT) Received: by 2002:a7b:cd93:0:b0:43c:fe31:d01d with SMTP id 5b1f17b1804b1-440a675d0dcms5e9; Mon, 28 Apr 2025 06:34:08 -0700 (PDT) X-Received: by 2002:a5d:64ce:0:b0:390:e853:85bd with SMTP id ffacd0b85a97d-3a07adb1dd6mr6347243f8f.48.1745847246176; Mon, 28 Apr 2025 06:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1745847246; cv=none; d=google.com; s=arc-20240605; b=ffK83g3BCuEbiq+5knsMF3Ul2mdfKVM6gfKalXtNSQ+yXhgvDv5e/MLTWMCuCkrM4Q YVEzpU0Bl2++gh+/dWpt45/hHHUODslSDQMJwmnS6fLu369mOHRFx1O8K55u4jHPI0vl kOTLAMJU63tXcXothyWa6n67cAvBFGLYPfCJBVRFbRHOouh5OyQkuMW/aQ3DbUwym2CK B/wEPvNmKxOMuGgWpgmRXXUmHpDABZGlKhLQNF1bhnEeLOjsKaFMucKZU9i3vaG3hqGX z9Sjmbckh41BKYrDdKruKSsDqXHvnz/yNxSnizzQaolXf3T711/SBjtpH3i8RV8/43Gq p25A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=RV0GUrh0U2LdLxinjDIbh8PLQ7lC1h0uIACWNSxDnhk=; fh=9MJLkQ3zxEFkoiQvguRR67rcpV7mF/kCp58/rUZuF44=; b=kzSs1b1B66JiMyCsLoqceHxf4r2nb7WVAaZty7/Xd3xUJ9RIn0YZWypelKFqhBHXdR fU5Ujb32zwY8EOW7OhHmUzBvNZ6D0BMSSxfEq2aMhECpR4DyIav4zCaRN2mW0WVegsZ4 k6NBwngs2J3yYNy1YTSlC8tRY1ynsxJIrKiT9Sxiifwu9b7fePH+XIYIlba6qhKsvygY oVU5Fdoxv4A47zUBTZVk7OJ0Nf9YYMdxHZG9sjDP24qqK3POIclltYm8AjKAujWucpz8 xp+FP7PfcrDdCmP7H0zWa/5wRpj2ZPhYfhPivKAs6ISt+uOgc6ZfXT4dTBQKXIxnAbDl JJRw==; dara=google.com ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mHMmTkmh; spf=pass (google.com: domain of saintwenhao@gmail.com designates 2a00:1450:4864:20::634 as permitted sender) smtp.mailfrom=saintwenhao@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com; dara=pass header.i=@googlegroups.com Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com. [2a00:1450:4864:20::634]) by gmr-mx.google.com with ESMTPS id 5b1f17b1804b1-4408e232f42si7234495e9.0.2025.04.28.06.34.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 28 Apr 2025 06:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of saintwenhao@gmail.com designates 2a00:1450:4864:20::634 as permitted sender) client-ip=2a00:1450:4864:20::634; Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-ac6ed4ab410so760294066b.1 for ; Mon, 28 Apr 2025 06:34:06 -0700 (PDT) X-Gm-Gg: ASbGncuD2V1aX5vmRGYZ1qJR5NdvAJVWI2z1J+fwgpQS8co0nplDmxS3qbxTsRHqAcG kGY5iHu/YORejdW/n0QNnWCgPwXqwd9ZFvaEhg3q5zxVK3vSnZD6Rz2El2BY85tKp1j1EK86TM0 mznesx1+YRNJhLs97mjr62 X-Received: by 2002:a17:907:da6:b0:aca:a539:be04 with SMTP id a640c23a62f3a-ace848c1fa2mr861496466b.4.1745847245239; Mon, 28 Apr 2025 06:34:05 -0700 (PDT) MIME-Version: 1.0 References: <5c13e130-aaa2-4866-be26-7498100e868b@murch.one> <7c6800f0-7b77-4aca-a4f9-2506a2410b29@murch.one> <672cb527-9005-46fc-be2c-4508d39cfd7dn@googlegroups.com> <8E819BCF-EEAE-4F10-89A1-FA3FDE0F67E3@sprovoost.nl> In-Reply-To: <8E819BCF-EEAE-4F10-89A1-FA3FDE0F67E3@sprovoost.nl> From: Saint Wenhao Date: Mon, 28 Apr 2025 15:33:53 +0200 X-Gm-Features: ATxdqUGWyuOjfAnPV9pK1psrq90twC_gtXzMIeuK1mgsY1epjqeWWFFkrcVOPts Message-ID: Subject: Re: [bitcoindev] Unbreaking testnet4 To: Sjors Provoost Cc: Bitcoin Development Mailing List , Jameson Lopp Content-Type: multipart/alternative; boundary="000000000000e27c2c0633d6bc6b" X-Original-Sender: saintwenhao@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=mHMmTkmh; spf=pass (google.com: domain of saintwenhao@gmail.com designates 2a00:1450:4864:20::634 as permitted sender) smtp.mailfrom=saintwenhao@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 (/) --000000000000e27c2c0633d6bc6b Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable > because it breaks the assumption that coins don't expire Technically, they can expire, if the client can see some chain reorganization. And it is something to think about: if the consensus will force miners to go back to some previous block height, and produce a stronger, alternative chain, then such testnet would automatically perform full chain reorganization, wired into its consensus rules. And then, coins would expire in a backward-compatible way, while also battle testing full chain reorganization (which may need testing anyway, for other reasons, like checkpoints). > This will eventually overflow, but that seems fine for a testnet. As far as I remember, there were some additional limits, introduced after Value Overflow Incident, for example that a single UTXO cannot hold more than 21 million coins: https://github.com/bitcoin/bitcoin/blob/master/src/consensus/tx_check.cpp#L= 29 ``` // Check for negative or overflow output values (see CVE-2010-5139) CAmount nValueOut =3D 0; for (const auto& txout : tx.vout) { if (txout.nValue < 0) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-negative"); if (txout.nValue > MAX_MONEY) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-vout-toolarge"); nValueOut +=3D txout.nValue; if (!MoneyRange(nValueOut)) return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-txouttotal-toolarge"); } ``` Which means that in practice, instead of seeing huge or overflowed amounts in UTXOs, we will probably see a lot of repeated entries in the UTXO set, holding MAX_MONEY each. pon., 28 kwi 2025 o 14:47 Sjors Provoost napisa=C5=82(= a): > Jameson Lopp wrote: > > > Encoding an "end of life date" into testnets is actually an interesting > idea worth discussing. As far as I'm aware it's never been done before on > any network. > > Keep in mind that testnet-specific code has to live right next to, even > inside of, mainnet consensus code. We want the change to be as simple as > possible, so as to not accidentally break mainnet. > > Unless and until coin expiration is something we're seriously considering > for mainnet, we'd rather not implement it for testnet. > > This particular idea probably requires a lot of changes all over the plac= e > (consensus, mempool, wallet) because it breaks the assumption that coins > don't expire. > > > Something I've proposed in person a few times, is to double the coins > every halving. In terms of code, it boils down to changing GetBlockSubsid= y: > > CAmount nSubsidy =3D 50 * COIN; > // Subsidy is cut in half every 210,000 blocks which will occur > approximately every 4 years. > If (consensusParams.inflation) { > // Except on testnet5 > nSubsidy <<=3D halvings; > } else { > nSubsidy >>=3D halvings; > } > > This will eventually overflow, but that seems fine for a testnet. Along > with the timewarp fix, the network might even grind to a halt in 2106, lo= ng > before we overflow 64 bit numbers. > > Rust Bitcoin [0] currently refuses amounts above 21 million BTC, but they > would have many years to fix that. > > > Strong inflation has been battle tested by governments around the world > for millennia as a way to discourage saving. > > - Sjors > > [0] https://github.com/rust-bitcoin/rust-bitcoin/issues/4273 --=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/= CACgYNOJuWPDH7n2UMwYOhOZ%3DuxD6_taagyi23iTKEw_2seGyiw%40mail.gmail.com. --000000000000e27c2c0633d6bc6b Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
> because it breaks the assumption that coins don't= expire

Technically, they can expire, if the client can see some cha= in reorganization. And it is something to think about: if the consensus wil= l force miners to go back to some previous block height, and produce a stro= nger, alternative chain, then such testnet would automatically perform full= chain reorganization, wired into its consensus rules. And then, coins woul= d expire in a backward-compatible way, while also battle testing full chain= reorganization (which may need testing anyway, for other reasons, like che= ckpoints).

> This will eventually overflow, but that seems fine f= or a testnet.

As far as I remember, there were some additional limit= s, introduced after Value Overflow Incident, for example that a single UTXO= cannot hold more than 21 million coins: https://github.com/= bitcoin/bitcoin/blob/master/src/consensus/tx_check.cpp#L29

```=C2=A0 =C2=A0 // Check for negative or overflow output values (see CVE-20= 10-5139)
=C2=A0 =C2=A0 CAmount nValueOut =3D 0;
=C2=A0 =C2=A0 for (co= nst auto& txout : tx.vout)
=C2=A0 =C2=A0 {
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 if (txout.nValue < 0)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 return state.Invalid(TxValidationResult::TX_CONSENSUS, "bad-txns-v= out-negative");
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (txout.nValue > M= AX_MONEY)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return state.Invalid= (TxValidationResult::TX_CONSENSUS, "bad-txns-vout-toolarge");
= =C2=A0 =C2=A0 =C2=A0 =C2=A0 nValueOut +=3D txout.nValue;
=C2=A0 =C2=A0 = =C2=A0 =C2=A0 if (!MoneyRange(nValueOut))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 return state.Invalid(TxValidationResult::TX_CONSENSUS, "= bad-txns-txouttotal-toolarge");
=C2=A0 =C2=A0 }
```

Which= means that in practice, instead of seeing huge or overflowed amounts in UT= XOs, we will probably see a lot of repeated entries in the UTXO set, holdin= g MAX_MONEY each.

pon., 28 kwi 2025 o 14:47=C2=A0Sjors= Provoost <sjors@sprovoost.nl&= gt; napisa=C5=82(a):
Jameson Lopp wrote:

> Encoding an "end of life date" into testnets is actually an = interesting idea worth discussing. As far as I'm aware it's never b= een done before on any network.

Keep in mind that testnet-specific code has to live right next to, even ins= ide of, mainnet consensus code. We want the change to be as simple as possi= ble, so as to not accidentally break mainnet.

Unless and until coin expiration is something we're seriously consideri= ng for mainnet, we'd rather not implement it for testnet.

This particular idea probably requires a lot of changes all over the place = (consensus, mempool, wallet) because it breaks the assumption that coins do= n't expire.


Something I've proposed in person a few times, is to double the coins e= very halving. In terms of code, it boils down to changing GetBlockSubsidy:<= br>
CAmount nSubsidy =3D 50 * COIN;
// Subsidy is cut in half every 210,000 blocks which will occur approximate= ly every 4 years.
If (consensusParams.inflation) {
=C2=A0 =C2=A0 // Except on testnet5
=C2=A0 =C2=A0 nSubsidy <<=3D halvings;
} else {
=C2=A0 nSubsidy >>=3D halvings;
}

This will eventually overflow, but that seems fine for a testnet. Along wit= h the timewarp fix, the network might even grind to a halt in 2106, long be= fore we overflow 64 bit numbers.

Rust Bitcoin [0] currently refuses amounts above 21 million BTC, but they w= ould have many years to fix that.


Strong inflation has been battle tested by governments around the world for= millennia as a way to discourage saving.

- Sjors

[0] https://github.com/rust-bitcoin/rust-bit= coin/issues/4273

--
You received this message because you are subscribed to the Google Groups &= quot;Bitcoin Development Mailing List" group.
To unsubscribe from this group and stop receiving emails from it, send an e= mail to bitcoind= ev+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/= msgid/bitcoindev/CACgYNOJuWPDH7n2UMwYOhOZ%3DuxD6_taagyi23iTKEw_2seGyiw%40ma= il.gmail.com.
--000000000000e27c2c0633d6bc6b--