为什么选择P2TR作为比特币的交易脚本,它又如何助推BTC生态发展?

币界网Published on 2024-07-26Last updated on 2024-07-26

币界网报道:

比特币是最流行、普及度最广的加密货币,不过,随着比特币网络越来越受欢迎,其交易速度和费用也随之增长,相关的隐私和安全问题也愈发令人担忧。

为了提升比特币网络的私密性、可扩展性和智能合约处理能力,比特币Taproot升级于2021年底正式激活,该升级由三项主要的比特币改进提案(BIP)组成:Schnorr签名(BIP 340)、Taproot(BIP 341)和TapScript(BIP 342)。

其中,BIP 341定义了一种发送比特币的新方式——Pay-to-Taproot(P2TR),它结合了Pay-to-Public-Key(P2PK)和Pay-to-Script-Hash(P2SH)脚本的功能,为用户提供了极大的灵活性和隐私优势。

P2TR本质上是一种ScriptPubKey,它将比特币锁定在一个脚本上,允许用户向Schnorr公钥或各种其他脚本的Merkle根支付。表面上看,一个P2TR输出将比特币锁定在一个施诺尔公钥上,我们假设为Q。然而,这个公钥Q实际上是一个公钥P和一个公钥M的总和,M是由其他ScriptPubKeys列表的Merkle根计算出来的。

P2TR输出中的比特币可以通过发布公钥P的签名或满足Merkle树中包含的脚本之一来花费,前者称为密钥路径,后者则是脚本路径。虽然P2TR的输出可能有许多种方式,但只有被使用的那一种会被公开,这样可以为其他未使用的替代方案保持隐私。

此外,由于Schnorr密钥聚合特性,公钥P本身可以是一个聚合密钥,公钥P作为一个聚合密钥或单一密钥的状态永远不会被透露,因为所有的P2TR输出都是彼此相似的,这样将破坏许多链分析启发式方法,增强用户的隐私。

1.其他支付方式

在比特币网络中,除了Pay-to-Taproot (P2TR)之外,还有四种常见的支付方式:Pay-to-Public-Key-Hash (P2PKH)、Pay-to-Witness-Public-Key-Hash (P2WPKH)、Pay-to-Script-Hash (P2SH)和Pay-to-Witness-Script-Hash (P2WSH),这些支付方式各自具有不同的特点和应用场景。

P2PKH

Pay-to-Public-Key-Hash(P2PKH)是一种ScriptPubKey,它将比特币锁定在一个公钥的哈希(比特币地址)上。例如,Alice想在P2PKH交易中向Bob发送1个BTC,Bob向Alice提供他钱包中的一个地址,然后Bob的地址会被包括在交易中。当Bob试图花费他收到的比特币时,他必须用对应于公钥的私钥来签署交易,公钥的哈希值与Alice交易中提供的哈希值一致。

P2WPKH

Pay-to-Witness-Public-Key-Hash (P2WPKH) 是一种ScriptPubKey,用于将比特币锁定到SegWit地址。P2WPKH 交易在大多数方面类似于P2PKH交易,它仍然将比特币锁定到公钥的哈希值,主要区别在于P2WPKH 使用 SegWit。这意味着所有输入的ScriptSig(解锁比特币的脚本)被移出交易主体并进入见证部分,并称为脚本见证。这些数据仍然记录在区块链上,但数据产生的费用会低于常规数据,使得SegWit交易比常规交易便宜。

P2SH

Pay-to-Script-Hash (P2SH) 是一种ScriptPubKey,主要用于多重签名钱包,制作输出脚本逻辑,在接受交易之前检查多重签名。例如,如果Alice在P2SH交易中向Bob发送1 BTC,她会将花费比特币所需脚本的哈希值包含在交易中。此脚本可能需要Bob的私钥和/或许多其他人的签名。当Bob想要花费他从Alice那里收到的比特币时,他会重建Alice用来发送比特币的脚本哈希,并使用脚本所需的任何私钥对交易进行签名。P2SH非常灵活,因为它允许用户构建任意脚本。此外,交易的发送者不需要知道他们发送到什么脚本类型。在上面的示例中,Bob可以线下构建他想要的脚本,并且只向Alice发送该脚本的哈希值,从而为Bob保留更多隐私。

P2WSH

Pay-to-Witness-Script-Hash (P2WSH) 是一种在大多数方面类似于P2SH交易的交易类型,除了它使用SegWit。与P2SH交易一样,P2WSH交易将比特币锁定到脚本的哈希值。为了花费这个比特币,花费者必须出示称为 RedeemScript 的脚本和任何必需的签名。在技术层面上,P2WSH实际上描述了用于将比特币锁定到SegWit脚本哈希的ScriptPubKey。

2.P2TR优点

通过比较不同类型的签名大小,可以看出在单一签名上使用P2TR是要比同等的P2WPKH要大一点的,但仔细观察会发现,对单一签名的钱包用户和整个网络来说,使用P2TR有很多好处:

P2TR的花费更便宜

在投入层面上,花费一个单一签名的P2TR UTXO比花费一个P2WPKH UTXO要少15%左右。像上表这样过于简单的分析隐藏了一个细节,即花费者不能选择他们被要求支付的地址,所以如果你留在P2WPKH上,而其他人都升级到P2TR,你的2进2出交易的实际典型大小将是232.5vbytes,而所有P2TR交易仍然只有211.5vbytes。

P2TR的隐私性更好

虽然早期采用者改用新的脚本格式时,会失去一些隐私,但改用Taproot的用户也会立即得到隐私性的提升。你的交易将能够看起来与从事新的LN通道、更有效的DLCs、安全的多重签名、各种巧妙的钱包备份恢复方案或其他一百种开创性发展的人没有区别。现在使用P2TR进行单签名,也允许你的钱包在以后升级到多签名、Tapscripts、LN支持或其他功能,而不影响你现有用户的隐私。无论是旧版本还是新版本的软件收到 UTXO 都没有关系——两个 UTXO 在链上看起来都是一样的。

P2TR对硬件签名设备来说更方便

自重新发现费用超额支付攻击以来,一些硬件签署设备拒绝签署交易,除非该交易中花费的每个UTXO都有元数据,其中包含产生该UTXO的整个交易的重要部分的副本。而 Taproot 消除了费用超额支付攻击的潜在漏洞,因此可以显著提高硬件签名者的性能。

P2TR有更多的可预测性

P2PKH和P2WPKH UTXO的ECDSA签名可以有不同的大小,由于钱包需要在创建签名之前选择交易的费率,大多数钱包只是假设最坏情况下的签名大小,因此接受较小的签名时将略微多付一些费用。而对于P2TR,签名的大小是事先知道的,允许钱包可以选择一个精确的费率。

P2TR可帮助完整的节点

比特币系统的整体安全性取决于大部分比特币用户使用自己的节点验证每笔确认的交易,也包括验证你钱包创建的交易。Taproot的schnorr签名可以有效地进行批量验证,在同步区块的过程中,节点验证签名时需要消耗的CPU周期减少了约1/2。就算你拒绝了上述的所有优点,也要考虑一下使用Taproot去帮助运行完整节点的人。

3.支持P2TR

对于已经支持接收和花费v0 segwit P2WPKH输出的钱包来说,升级到v1 segwit P2TR进行单一签名应该很容易,以下是主要的步骤:

使用新的BIP32密钥推导路径

强烈建议为P2TR公钥使用一个新的推导路径(例如由BIP86定义的),如果你在ECDSA和schnorr签名中使用相同的密钥,可能会被攻击。

通过哈希值来调整你的公钥

虽然技术上不需要单签名,特别是当你的所有密钥都来自随机选择的BIP32种子时,BIP341建议将你的密钥提交到一个不可消耗的scripthash树。这就像使用椭圆曲线加法运算一样简单,将你的公钥与该密钥的哈希值的曲线点相加。遵守这个建议的好处就是如果你以后要增加对无脚本多签名的支持,或者增加对tr()描述符的支持,你将能够使用同样的代码。

创建你的地址并对其进行监控

使用bech32m来创建你的地址。支付将被发送到scriptPubKey OP_1 <tweaked_pubkey>。你可以使用用于扫描v0隔离见证地址(如 P2WPKH)的任何方法来扫描支付脚本的交易。

创建一个支出交易

Taproot的所有非见证字段都和P2WPKH的一样,所以你不需要担心交易序列化的变化。

创建一个签名信息

这是对支出交易的数据的承诺。大部分数据与你为P2WPKH交易所签署的数据相同,但字段的顺序被改变,还有一些额外的东西被签署。实现这一点只是一个序列化和散列各种数据的问题,所以编写代码应该很容易。

签署签名信息的哈希值

现在已经有许多不同的方法用来创建Schnorr签名了。因此当前最好的方法不是 "推出你自己的方法",而是使用你信任的、经过严格审查的库中的功能。但是,如果你由于某种原因不能这样做,BIP340提供了一种算法,如果你已经有了制作ECDSA签名的基础,那么这种算法应该很容易实现。当你有了你的签名,把它放在输入的见证数据中,然后发送你的支出交易。

 

4.总结

总体来看,P2TR不仅简化了交易过程,增强了用户隐私,还允许灵活的支付方式和更复杂的智能合约执行。比特币Layer2解决方案BEVM充分利用了这一优势,将Taproot作为其“Taproot Consensus”技术的核心架构之一,使得比特币网络的私密性、可扩展性和智能合约处理能力提升到了新的高度。

在BEVM中,所有交易均采用P2TR格式,这意味着每笔交易都受益于更低的费用、更好的隐私保护和对硬件签名设备的友好支持。此外,BEVM利用了P2TR的密钥路径和脚本路径特性,确保了交易的隐私和安全,同时提升了网络的可扩展性。通过这些技术,BEVM项目成功搭建起比特币生态内更加可靠的智能合约平台,推动了整个生态系统的进一步发展。

Trending Cryptos

Related Reads

BTC Price Forecast: BTC Bulls Regain Control as Brandt Supports Breakout Above $81K

Bitcoin is consolidating near the $80,000 level as bulls defend key technical levels and leverage returns to the market. After a strong rally, BTC faces significant resistance around $81,255. A decisive close above this level could confirm renewed upward momentum and open a path toward $83,000 and possibly $85,000. Trader Peter Brandt has shifted his technical view, now holding a long Bitcoin position following the completion of an inverse head-and-shoulders pattern. The four-hour chart shows a solid bullish structure, with Bitcoin trading above its key Exponential Moving Averages (20, 50, 100, 200-period). Immediate support is seen at the 20 EMA near $79,084, followed by $77,283 and $76,515. Market data shows a recovery in Bitcoin's open interest, rising to $56.48 billion, indicating traders are re-establishing leveraged positions alongside the price recovery. However, this also increases liquidation risks during sharp reversals. Spot flows have been inconsistent, with a recent moderate net inflow of $17.73 million on August 28, but lacking signs of aggressive accumulation. The September outlook hinges on whether buyers can defend the $79,084 support while gathering enough momentum to break the $81,255 resistance. The bullish EMA structure favors buyers, but a confirmed breakout above $81,255 is seen as critical for the next major leg up. Failure to hold $79,084 could trigger pullbacks toward $77,283 and $76,515.

cryptonews.ru6m ago

BTC Price Forecast: BTC Bulls Regain Control as Brandt Supports Breakout Above $81K

cryptonews.ru6m ago

Bitcoin Price Surge in August. A Temporary Spike or the Start of a New Cycle

"Bitcoin Price Surge in August: Temporary Spike or Start of a New Cycle?" The cryptocurrency market is ending August with a recovery attempt following a prolonged downtrend that began in October 2025. Bitcoin has seen confident growth recently, aided by macroeconomic and market factors. However, analysts agree it's too early to call a trend reversal, with bearish risks remaining and sideways price movement expected in the coming months within a wide range. Bitcoin's current dynamics fit the classic four-year cycles historically marked by alternating bull and bear trends. These cycles are linked to Bitcoin's halving events. Based on this pattern, the recent lows might indicate a local bottom and an attempt to break the October 2025 downtrend. Many key players statistically predict the cycle's bottom for autumn 2026. Analysts highlight persistent pressure from external macroeconomic factors, including high interest rates and the US Federal Reserve's firm stance, alongside geopolitical uncertainty. However, if recent positive inflation trends continue, the likelihood of Fed policy easing could increase, benefiting BTC and other risky assets. De-escalation in Iran-related tensions could also provide the Fed more room to soften its policy. Another pressure factor is competition from other asset classes, notably semiconductors and AI development. Mining companies are reportedly selling accumulated coin reserves and shifting towards providing computing power for AI, a more profitable and predictable business. This trend is mirrored by institutional investors who have seen higher returns and volatility in traditional assets, contributing to outflows from spot Bitcoin ETFs and reduced trading interest in crypto. Nonetheless, Bitcoin ETFs have attracted over $3.5 billion since early August, signaling a recovery in institutional demand. From a technical perspective, analysts do not expect explosive growth. Strong resistance is seen around $86,000, with a potential correction toward an accumulation zone near $74,000. If this support holds, a path could open toward $96,000 and then $100,000. A broader forecast suggests Bitcoin may enter a wide sideways range between $60,000 and $85,000 until Fed rhetoric softens or interest in semiconductors and AI sectors subsides.

cryptonews.ru6m ago

Bitcoin Price Surge in August. A Temporary Spike or the Start of a New Cycle

cryptonews.ru6m ago

XRP Price Forecast: Breakout to $1.50 Could Revive Bulls as Evernorth Moves Towards Nasdaq Listing

XRP Price Forecast: Break Above $1.50 Could Revive Bulls as Evernorth Moves Toward Nasdaq Listing XRP faces renewed selling pressure amid weakening technical momentum and a major corporate event involving Evernorth Holdings. The token trades near $1.415 after failing to sustain momentum above $1.50. However, derivatives positioning is rising again, creating a potentially volatile backdrop. Technical momentum is weakening, with XRP falling below the 20-period EMA at $1.4334 on the 4-hour chart. Despite this, it remains above its 50, 100, and 200 EMAs, preserving a broader constructive structure. Key resistance is at $1.4260 and $1.4334, with a move above $1.50 targeting $1.5453. Major support lies at $1.3816, with a break lower potentially opening a path to $1.3422 and $1.2852. Derivatives data shows open interest recovering to around $3.48 billion from recent lows, which could amplify price swings. Spot market flows remain bearish, with persistent net outflows, the latest being approximately -$5.74 million. In corporate news, Evernorth's registration statement for its planned business combination with Armada Acquisition Corp. II has been declared effective by the SEC. Armada shareholders will vote on the deal on September 30, 2026. If approved, the combined company expects to trade on Nasdaq under the ticker XRPN, which could serve as a significant institutional catalyst for XRP. The forecast for September hinges on whether buyers can hold the $1.3816 support and reclaim the $1.4334 level. A sustained move above $1.50 would strengthen the bullish case toward $1.5453. A failure to hold support, however, could lead to a deeper correction.

cryptonews.ru26m ago

XRP Price Forecast: Breakout to $1.50 Could Revive Bulls as Evernorth Moves Towards Nasdaq Listing

cryptonews.ru26m ago

Car Radar Chip Unicorn Rushes for IPO, BYD Is Its Largest Customer

Gateland Microelectronics (Shanghai) Co., Ltd., a Chinese unicorn in automotive radar chips, has filed for an IPO on Shanghai's STAR Market, seeking to raise approximately 3.49 billion yuan. The company, founded in 2014 by Berkeley PhD Chen Jiashu, pioneered CMOS-based millimeter-wave radar chips, significantly reducing costs and enabling wider adoption in mid-market vehicles. Its chips are used by over 30 automakers, including BYD, Geely, Nio, Volvo, and Rivian. While revenue grew rapidly from 206 million yuan in 2023 to 632 million yuan in 2025, with a CAGR exceeding 75%, the company remains unprofitable, reporting cumulative net losses of 910 million yuan over three years and one quarter. High R&D and sales expenses, with R&D intensity reaching 147.75% in 2023, have consumed its profits despite strong gross margins of around 47-49%. The IPO filing reveals significant challenges: extreme customer concentration, with BYD accounting for over 50% of terminal sales; heavy reliance on overseas suppliers for over 50% of procurement; and a singular product focus. Millimeter-wave radar chips contributed 99.93% of 2025 revenue, while its new ultra-wideband (UWB) chip line generated negligible income. The proposed IPO funds will primarily support further development of its core millimeter-wave radar business and the nascent UWB chip project. Gateland's key post-IPO tests will be diversifying its client base beyond BYD, mitigating supply chain risks, and successfully commercializing its UWB technology to build a sustainable second growth curve.

marsbit36m ago

Car Radar Chip Unicorn Rushes for IPO, BYD Is Its Largest Customer

marsbit36m ago

Trading

Spot

Hot Articles

What is $BITCOIN

DIGITAL GOLD ($BITCOIN): A Comprehensive Analysis Introduction to DIGITAL GOLD ($BITCOIN) DIGITAL GOLD ($BITCOIN) is a blockchain-based project operating on the Solana network, which aims to combine the characteristics of traditional precious metals with the innovation of decentralized technologies. While it shares a name with Bitcoin, often referred to as “digital gold” due to its perception as a store of value, DIGITAL GOLD is a separate token designed to create a unique ecosystem within the Web3 landscape. Its goal is to position itself as a viable alternative digital asset, although specifics regarding its applications and functionalities are still developing. What is DIGITAL GOLD ($BITCOIN)? DIGITAL GOLD ($BITCOIN) is a cryptocurrency token explicitly designed for use on the Solana blockchain. In contrast to Bitcoin, which provides a widely recognized value storage role, this token appears to focus on broader applications and characteristics. Notable aspects include: Blockchain Infrastructure: The token is built on the Solana blockchain, known for its capacity to handle high-speed and low-cost transactions. Supply Dynamics: DIGITAL GOLD has a maximum supply capped at 100 quadrillion tokens (100P $BITCOIN), although details regarding its circulating supply are currently undisclosed. Utility: While precise functionalities are not explicitly outlined, there are indications that the token could be utilized for various applications, potentially involving decentralized applications (dApps) or asset tokenization strategies. Who is the Creator of DIGITAL GOLD ($BITCOIN)? At present, the identity of the creators and development team behind DIGITAL GOLD ($BITCOIN) remains unknown. This situation is typical among many innovative projects within the blockchain space, particularly those aligning with decentralized finance and meme coin phenomena. While such anonymity may foster a community-driven culture, it intensifies concerns about governance and accountability. Who are the Investors of DIGITAL GOLD ($BITCOIN)? The available information indicates that DIGITAL GOLD ($BITCOIN) does not have any known institutional backers or prominent venture capital investments. The project seems to operate on a peer-to-peer model focused on community support and adoption rather than traditional funding routes. Its activity and liquidity are primarily situated on decentralized exchanges (DEXs), such as PumpSwap, rather than established centralized trading platforms, further highlighting its grassroots approach. How DIGITAL GOLD ($BITCOIN) Works The operational mechanics of DIGITAL GOLD ($BITCOIN) can be elaborated on based on its blockchain design and network attributes: Consensus Mechanism: By leveraging Solana’s unique proof-of-history (PoH) combined with a proof-of-stake (PoS) model, the project ensures efficient transaction validation contributing to the network's high performance. Tokenomics: While specific deflationary mechanisms have not been extensively detailed, the vast maximum token supply implies that it may cater to microtransactions or niche use cases that are still to be defined. Interoperability: There exists the potential for integration with Solana’s broader ecosystem, including various decentralized finance (DeFi) platforms. However, the details regarding specific integrations remain unspecified. Timeline of Key Events Here is a timeline that highlights significant milestones concerning DIGITAL GOLD ($BITCOIN): 2023: The initial deployment of the token occurs on the Solana blockchain, marked by its contract address. 2024: DIGITAL GOLD gains visibility as it becomes available for trading on decentralized exchanges like PumpSwap, allowing users to trade it against SOL. 2025: The project witnesses sporadic trading activity and potential interest in community-led engagements, although no noteworthy partnerships or technical advancements have been documented as of yet. Critical Analysis Strengths Scalability: The underlying Solana infrastructure supports high transaction volumes, which could enhance the utility of $BITCOIN in various transaction scenarios. Accessibility: The potential low trading price per token could attract retail investors, facilitating wider participation due to fractional ownership opportunities. Risks Lack of Transparency: The absence of publicly known backers, developers, or an audit process may yield skepticism regarding the project's sustainability and trustworthiness. Market Volatility: The trading activity is heavily reliant on speculative behavior, which can result in significant price volatility and uncertainty for investors. Conclusion DIGITAL GOLD ($BITCOIN) emerges as an intriguing yet ambiguous project within the rapidly evolving Solana ecosystem. While it attempts to leverage the “digital gold” narrative, its departure from Bitcoin's established role as a store of value underscores the need for a clearer differentiation of its intended utility and governance structure. Future acceptance and adoption will likely depend on addressing the current opacity and defining its operational and economic strategies more explicitly. Note: This report encompasses synthesised information available as of October 2023, and developments may have transpired beyond the research period.

2.4k Total ViewsPublished 2025.05.13Updated 2025.05.13

What is $BITCOIN

Discussions

Welcome to the HTX Community. Here, you can stay informed about the latest platform developments and gain access to professional market insights. Users' opinions on the price of BTC (BTC) are presented below.

活动图片