Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activate Taproot #244

Merged
merged 2 commits into from
Nov 8, 2024
Merged

Activate Taproot #244

merged 2 commits into from
Nov 8, 2024

Conversation

SogobiNapiasi
Copy link

I propose to initiate the Taproot activation soft fork on the DigiByte blockchain. I have an innovative application to develop, and I believe DGB is the most suitable blockchain for it. Taproot is essential for building this application.

This pull request will commence the Taproot activation window from 1st August 2024 to 2026. Additionally, it will begin the testnet activation window from 20th June 2024 to 20th June 2025. Seventy percent of miners will need to agree for one week’s worth of blocks for Taproot deployment to be successful at any point.

Taproot will enable the use of Schnorr signatures on DGB, providing highly advanced smart contract capabilities as well as Tapscript functionalities.

Activate Taproot
@ycagel ycagel requested review from ycagel and gto90 June 13, 2024 03:37
ycagel
ycagel previously approved these changes Jun 13, 2024
Copy link
Member

@ycagel ycagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK. Any testing yet? What will be the process to obtain 70% consensus of miners?

@JaredTate
Copy link

Hello @SogobiNapiasi, thank you for your contribution on this to activate Taproot & welcome to the DGB Github. The activation window seems perfectly reasonable and should work.

Have you ran any test simulations of the soft fork activation on Testnet or Regtest?

Have you ran the function tests at all? I believe we still have some of the taproot python tests deactivated. Would be great to fix them and run them before an activation.

Testrunner.py was commented out here:

#'feature_taproot.py --previous_release', #Disable until path forward on taproot determined
#'feature_taproot.py', #Disable until path forward on taproot determined

The main test is here: https://github.com/DigiByte-Core/digibyte/blob/develop/test/functional/feature_taproot.py

I think we should encourage a broader community discussion on taproot, get more peoples input.

@mctrivia
Copy link

Hasn't anyone payed attention to how much of a mess taproot made for Bitcoin? Ordinals are hugely wasteful and it's just one way taproot can be exploited.

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

Hasn't anyone payed attention to how much of a mess taproot made for Bitcoin? Ordinals are hugely wasteful and it's just one way taproot can be exploited.

What about the potential use cases that would open up for DigiByte with this implemented?

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

I do share some of @mctrivia concerns about taproot. In my opinion, Taproot activation should not occur in the 8.22 final release. It should be considered after 8.22 is out by the community in another future release. There are 100s of thousands of code line changes in 8.22. It is by far the biggest release we have ever done.

In the future DGB should split up releases into smaller chunks. If there are any issues with taproot on the main net it will be very hard to troubleshoot along with all the other changes already in 8.22.

As for the merits of taproot, I think that can be debated at a later point for the pro's and cons. I think the discussion should be should taproot even be in a final 8.22 release since we are so close to the release, not necessarily if taproot should be added right now.

I want to thank everyone for their input on this & I would encourage everyone who reads this read if you haven't yet, to make a GitHub account and join the discussion. It would be great to foster a professional discussion about this here on GitHub.

@mctrivia
Copy link

mctrivia commented Jun 13, 2024

Hasn't anyone payed attention to how much of a mess taproot made for Bitcoin? Ordinals are hugely wasteful and it's just one way taproot can be exploited.

What about the potential use cases that would open up for DigiByte with this implemented?

I was bullish on taproot it has some cool use cases. However they are all things that most people will not use. And Bitcoin has proven there are some drastically detrimental ways people can abuse it.

The cons drastically out way the pros in my opinion.

That said I am not apposed if safe guards are put in place to prevent abuse. Say contract size limits. No real reason with Bitcoin script a contract needs to be more than 1k

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

Hasn't anyone payed attention to how much of a mess taproot made for Bitcoin? Ordinals are hugely wasteful and it's just one way taproot can be exploited.

What about the potential use cases that would open up for DigiByte with this implemented?

I was bullish on taproot it has some cool use cases. However they are all things that most people will not use. And Bitcoin has proven there are some drastically detrimental ways people can abuse it.

The cons drastically out way the pros in my opinion.

That said I am not apposed if safe guards are put in place to prevent abuse. Say contract size limits. No real reason with Bitcoin script a contract needs to be more than 1k

What are the pros/cons of limiting contract sizes to 1K? Where in the code would this limit be applied? Be good to share in detail what it means to apply it. In addition, define the ways people can abuse it.

@mctrivia
Copy link

Hasn't anyone payed attention to how much of a mess taproot made for Bitcoin? Ordinals are hugely wasteful and it's just one way taproot can be exploited.

What about the potential use cases that would open up for DigiByte with this implemented?

I was bullish on taproot it has some cool use cases. However they are all things that most people will not use. And Bitcoin has proven there are some drastically detrimental ways people can abuse it.
The cons drastically out way the pros in my opinion.
That said I am not apposed if safe guards are put in place to prevent abuse. Say contract size limits. No real reason with Bitcoin script a contract needs to be more than 1k

What are the pros/cons of limiting contract sizes to 1K? Where in the code would this limit be applied? Be good to share in detail what it means to apply it. In addition, define the ways people can abuse it.

There are pretty much no cons(accept for those wanting to abuse taproot to dump lots of data on to the chain). Honestly you could set the limit much lower then that and not block normal usage.

@SogobiNapiasi
Copy link
Author

cACK. Any testing yet? What will be the process to obtain 70% consensus of miners?

The testnet activation window needs to be adjusted for that to happen and for activation to occur on the testnet. You lot crack me up. I have been exploring multiple chains for my app and decided to get involved here, starting to build outside my other work. I will continue looking elsewhere if digi has no interest in supporting taproot.

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

cACK. Any testing yet? What will be the process to obtain 70% consensus of miners?

The testnet activation window needs to be adjusted for that to happen and for activation to occur on the testnet. You lot crack me up. I have been exploring multiple chains for my app and decided to get involved here, starting to build outside my other work. I will continue looking elsewhere if digi has no interest in supporting taproot.

What is the plan to obtain 70% consensus from miners when we don't even know who all the miners or can't gain access to them? Does this pose an issue?

@Sbosvk
Copy link

Sbosvk commented Jun 13, 2024

Pools and solo miners just need to use the new version..

@mctrivia
Copy link

mctrivia commented Jun 13, 2024

@SogobiNapiasi what do you need for your app? Do you need the ability to do hidden contracts until published? Or do you want NFT capability?

The first is a good use of taproot, though rarely desired by people. The second is a horrible use for it and DigiAssets already exist to allow you to have this capability and its more efficient with more features.

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

Pools and solo miners just need to use the new version..

What if a large pool is not aware of the new version and can't be contacted?

@mctrivia
Copy link

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

Taproot is a soft fork isn't it?

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

That pretty well sums it up. It's called a soft fork though because there is no hard/ set date/time and or specific block height when consensus changes happen forcing everyone to agree by a certain point in time. But a soft fork is still a hard forking of the chain when it happens.

With the soft fork process, the upgrade can happen at any point during the proposed 2-year window. As long as nRuleChangeActivationThreshold (70%) of blocks mined agree to the change during nMinerConfirmationWindow (1 week) the network adopts the new taproot rules.

// DigiByte Specific Consensus Code
consensus.nOdoShapechangeInterval = 10*24*60*60; // 10 days
consensus.nRuleChangeActivationThreshold = 28224; // 28224 - 70% of 40320 blocks
consensus.nMinerConfirmationWindow = 40320; // nPowTargetTimespan / nPowTargetSpacing 40320 blocks main net - 1 week

Every week the period starts fresh. The last time we did this was the Odo Fork and SegWit soft fork before that. You can have 40% of miners agree one week, 60% the next week, and could go back to 50% the following week period.

If I remember right the % of blocks was changed from 80% to 70% because we were stuck at like 78% for the Segwit soft fork for months. The question is what does the community believe a "majority" should be? BTC used 80%. US Congress says a super majority is 67%. 70% was used for odo fork. If you remember the groestl miners kept going on another chain for some time before it was abandoned.

This is a consensus change so anyone not upgraded will be left behind and will have issues sending/ receiving taproot enables tx's. Exchanges, wallet providers etc all need to upgrade ahead of miner consensus.

The possibility exists for miners to adopt a change before exchanges/ wallet providers etc and could cause issues.

@gto90
Copy link
Member

gto90 commented Jun 13, 2024

Thank you, @SogobiNapiasi, for suggesting this PR. I am working on drafting a more in-depth comment, but for now, I wanted to make sure that it is clear to all reviewers that taproot activation is not a hard fork. This PR represents a fully backward-compatible soft fork.

Taproot introduces new rules and features, such as Schnorr signatures and Merklized Abstract Syntax Trees (MAST), but it does so in a way that is compatible with the existing protocol. This means nodes not upgraded to support Taproot can validate blocks and transactions according to the old rules. Since non-upgraded nodes continue to see the new transactions as valid, there is no risk of a blockchain split. This preserves a single, unified DigiByte blockchain.

See: https://www.chainalysis.com/blog/bitcoin-taproot-upgrade/

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

That pretty well sums it up. It's called a soft fork though because there is no hard/ set date/time and or specific block height when consensus changes happen forcing everyone to agree by a certain point in time. But a soft fork is still a hard forking of the chain when it happens.

With the soft fork process, the upgrade can happen at any point during the proposed 2-year window. As long as nRuleChangeActivationThreshold (70%) of blocks mined agree to the change during nMinerConfirmationWindow (1 week) the network adopts the new taproot rules.

// DigiByte Specific Consensus Code
consensus.nOdoShapechangeInterval = 10*24*60*60; // 10 days
consensus.nRuleChangeActivationThreshold = 28224; // 28224 - 70% of 40320 blocks
consensus.nMinerConfirmationWindow = 40320; // nPowTargetTimespan / nPowTargetSpacing 40320 blocks main net - 1 week

Every week the period starts fresh. The last time we did this was the Odo Fork and SegWit soft fork before that. You can have 40% of miners agree one week, 60% the next week, and could go back to 50% the following week period.

If I remember right the % of blocks was changed from 80% to 70% because we were stuck at like 78% for the Segwit soft fork for months. The question is what does the community believe a "majority" should be? BTC used 80%. US Congress says a super majority is 67%. 70% was used for odo fork. If you remember the groestl miners kept going on another chain for some time before it was abandoned.

This is a consensus change so anyone not upgraded will be left behind and will have issues sending/ receiving taproot enables tx's. Exchanges, wallet providers etc all need to upgrade ahead of miner consensus.

The possibility exists for miners to adopt a change before exchanges/ wallet providers etc and cause heaps of issues.

Have we been at 70% consensus for all changes via DigiByte as a baseline? Is there any benefit to lowering that threshold to 50%-60% for Taproot?

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

That pretty well sums it up. It's called a soft fork though because there is no hard/ set date/time and or specific block height when consensus changes happen forcing everyone to agree by a certain point in time. But a soft fork is still a hard forking of the chain when it happens.

With the soft fork process, the upgrade can happen at any point during the proposed 2-year window. As long as nRuleChangeActivationThreshold (70%) of blocks mined agree to the change during nMinerConfirmationWindow (1 week) the network adopts the new taproot rules.

// DigiByte Specific Consensus Code
consensus.nOdoShapechangeInterval = 10*24*60*60; // 10 days
consensus.nRuleChangeActivationThreshold = 28224; // 28224 - 70% of 40320 blocks
consensus.nMinerConfirmationWindow = 40320; // nPowTargetTimespan / nPowTargetSpacing 40320 blocks main net - 1 week

Every week the period starts fresh. The last time we did this was the Odo Fork and SegWit soft fork before that. You can have 40% of miners agree one week, 60% the next week, and could go back to 50% the following week period.

If I remember right the % of blocks was changed from 80% to 70% because we were stuck at like 78% for the Segwit soft fork for months. The question is what does the community believe a "majority" should be? BTC used 80%. US Congress says a super majority is 67%. 70% was used for odo fork. If you remember the groestl miners kept going on another chain for some time before it was abandoned.

This is a consensus change so anyone not upgraded will be left behind and will have issues sending/ receiving taproot enables tx's. Exchanges, wallet providers etc all need to upgrade ahead of miner consensus.

The possibility exists for miners to adopt a change before exchanges/ wallet providers etc and could cause issues.

In case of taproot taproot Tx's might still be readable by non-upgraded nodes, and old nodes will still be able to send tx's and old style tx's to new taproot nodes. So in that respect it is backwards compatible. I need to fully check on this before I say more.

@mctrivia
Copy link

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

Taproot is a soft fork isn't it?

Pretty sure it's a hard fork. A simple test is can people right now publish a transaction using it's features manually. If the chain will allow it then it's a soft fork. If it won't then it's a hard fork.

@ycagel
Copy link
Member

ycagel commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

Taproot is a soft fork isn't it?

Pretty sure it's a hard fork. A simple test is can people right now publish a transaction using it's features manually. If the chain will allow it then it's a soft fork. If it won't then it's a hard fork.

It is not a hard fork. It is a soft fork and considered backwards compatible.

https://www.chainalysis.com/blog/bitcoin-taproot-upgrade/

"Taproot adoption timeline
On June 12th, 2021, these upgrade proposals reached a 90% consensus among miners, thus locking in their November activation as a soft fork to Bitcoin’s protocol. As a soft fork, the Taproot upgrade is backwards compatible with older versions of bitcoin and does not create a separate, parallel blockchain, as was the case with Bitcoin and Bitcoin Cash.

Adoption of taproot is expected to grow slowly over a period of years, just as it did with SegWit, the last major Bitcoin upgrade. Two years after SegWit’s activation, roughly 50 percent of transactions used it; today, four years after, that proportion is 80 percent. The main reason for this slow rate of adoption is that cryptocurrency wallets and service providers choose to opt-in on their own schedule."

@gto90
Copy link
Member

gto90 commented Jun 13, 2024

@ycagel that's just the way hard forks work. If you want it to go through you try to convince more then 70% to upgrade. If you don't want it to go through you try to convince more than 30% not to upgrade. If the 70% win then the left overs get discarded until they upgrade.

Taproot is a soft fork isn't it?

Pretty sure it's a hard fork. A simple test is can people right now publish a transaction using it's features manually. If the chain will allow it then it's a soft fork. If it won't then it's a hard fork.

According to the BIPs, it is a soft fork. Additionally, the activation of taproot on Bitcoin's network, which is where our code comes from, was in fact a soft fork:

  1. https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki
  2. https://github.com/bitcoin/bips/blob/master/bip-0341.mediawiki
  3. https://github.com/bitcoin/bips/blob/master/bip-0342.mediawiki

@mctrivia
Copy link

Fair in that case it can already be exploited, the transactions would just need to be manually decoded to be read.

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

I think this is a good answer found online:

Is taproot backwards compatible?

Short answer: yes

Long answer: yes, you won't drop off the network, but at some point your unupdated node will have to trust the majority of hashrate not cheating you, as it won't be able to verify the newer transaction types properly on its own (this is not specific to Taproot though, it's how softforks work in general).`

For Taproot specifically, from what I can tell in code you will not be able to send DGB to newer wallets/ services giving you a taproot address, but you could still send older style tx's to them. An old node would not be able to receive taproot coins and verify them.

This is definitely something to test, I can not find a clear answer on how "backwards" compatible taproot really is.

There are no mining consensus changes so mining stays the same.

This is a great intro article to taproot for anyone reading along here:

https://cointelegraph.com/learn/a-beginners-guide-to-the-bitcoin-taproot-upgrade

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

I also want to point out BTC went with a 90% threshold for activation with Taproot specifically. When you get 90% of any group to agree to changes the issue of backward compatibility is a lot less of an issue for the network.

@JaredTate
Copy link

JaredTate commented Jun 13, 2024

My final thought today on this is just like any other change, it will take time for any new wallets, services, etc to use DGB taproot addresses. But we do benefit from this though because BTC has had it for 3 years now, so a lot of work has been done to adopt infrastructure that supports this.

Regardless, I don't think this should be in the 8.22 final release. It should come later, if at all, after we had time to test all this thoroughly and not break anything. Just my perspective.

I Would love to get some more people's thoughts on here. A great conversation we have going on here. Informative for everyone. I could go either way on Taproot. A clear community consensus should decide on what to do with Taproot.

I would love to hear more about use cases/ apps that could be built on DGB because of Taproot @SogobiNapiasi.

Perhaps this should be set up as a feature branch for now, so the work is not wasted?

@DGBNOOB
Copy link
Member

DGBNOOB commented Jun 14, 2024

This is one of the most informative discussions I’ve seen, when it comes to DigiByte Core development. It is important weigh things out carefully with a critical eye. There was a previous community discussions on Taproot activation and it was in front of a Digiabyte community audience. The discussion ended with 8.22 should be released and taproot should be activated at a later time.

This proposal PR244 is one review from being approved, which I think is hasty.

A lot of information has been shared but mainly on the benefits, I like to think that there was a good reason the Core developers decided to delay activation. I think it was mainly due to the negative effects on Bitcoin. Mempool backlog, fee spikes, chain bloat with jpegs. Recently Ordinals were delisted from Binance but also Ordinals have been the target of MEV attacks. The only benefit I see is Bitcoin miners making a good profit.

I know Taproot, Schnorr signatures, and tapscipt bring more functionality besides ordinals, but the negative effects are what seems to standout.

I recommend the information shared in this discussion be shared by the main DigiByte accounts across all social media platforms to inform, spread awareness about the benefits but also the potential negative effects that it might have on DigiByte. If community input is wanted then this is a good approach, the alternative will look like community input wasn’t needed and it was decided by two people.

PR244 was submitted 2 days ago, one day later it received a review with approval and it seems kind of rushed in my opinion.

@jason-at-github
Copy link

My understanding of taproot is very limited but what I have read about it, it seems to be something that Digibyte may benefit from in the future but not necessarily today. I recommend wrapping up 8.22 and voting on the addition of taproot later. We do need to compete with other chains but we need to get over the 8.22 hurdle first. IMHO

@gto90
Copy link
Member

gto90 commented Jun 14, 2024

First, I agree that 8.22 should avoid activating Taproot, and we should quickly follow another release so that we can stay focused on the immediate task at hand and deal with any issues that may arise from the release of 8.22 without piling on Taproot.

That said, we may consider adjusting the activation window to a sensible period so that we don't necessarily have to do a second release. I'm still trying to think through the logistics due to how long it takes to propagate new versions through the network. If this is the general short-term consensus on Taproot activation, we could create a feature branch that this PR can target, allowing the community to build and test Taproot locally with regtest and testnet.

Addressing the chain bloat/spam concern. I used to be very concerned about the potential for chain spam and bloat due to abuse. However, the longer I have contemplated activating Taproot, the more I favor it for these reasons:

  1. The community has long worried that after the block rewards are exhausted, miners would not have much incentive to continue mining DigiByte due to our meager fees. Enabling Taproot and unlocking its capabilities would lead to more transaction fees for the miners, thus helping to mitigate this long-held community concern without destroying the deflationary property of the DigiByte blockchain.

  2. The community has long worried DigiByte was falling behind in the smart contracts domain, and Taproot unlocks this potential for the community to develop these capabilities on the world's fastest, most secure, most decentralized blockchain. The benefit of trailing Bitcoin by three years on this capability is that there are several relatively easy-to-use frameworks and tools coming out to make smart contract and asset development on DigiByte a low-effort lift while enjoying all of the benefits DigiByte offers that is superior to Bitcoin.

  3. The community has long worried that we have too many near-empty blocks with very few transactions, showing that our adoption is shallow. Activating Taproot may lead to adoption and fuller blocks, thus showing that the community is finally starting to adopt DigiByte for daily use rather than speculative holding.

Given the above three points, I have become less concerned about chain bloat and finding ways to police how the blockchain is used. Trying to apply too much control over how the world uses the network can and probably has led to low adoption of the blockchain, so this concern has become less of a problem for me.

That said, I am open to considering @mctrivia 's suggestion of adding a limit to script sizes. Still, again, I am weary of trying to police this risk at the expense of kneecapping future use cases we can not even think of today. I can't help but imagine what the world would look like if the developers of the core internet protocols applied these kinds of data caps and constraints.

In summary, I favor activating Taproot, but not before the release of 8.22 has had time to settle.

@mctrivia
Copy link

@gto90 did I miss something? I don't believe taproot adds a new scripting language to allow more complex smart contracts

@gto90
Copy link
Member

gto90 commented Jun 14, 2024

@gto90, did I miss something? I don't believe Taproot adds a new scripting language to allow more complex smart contracts

Taproot activates BIP342 which is an updated version of Bitcoin's scripting language that allows for the creation and execution of more complex smart contracts by providing a more flexible and efficient scripting environment. This does not mean it supports Turing complete ETH-style smart contracts, but it unlocks more complex contracts that were impossible with the previous Bitcoin scripting language.

Taproot also activates BIP 341, making implementing more complex contracts feasible without bloating the blockchain.

Finally, it activates BIP 340, aggregating complex multi-signature transactions more efficiently and privately, which is essential for sophisticated smart contract operations.

@mctrivia
Copy link

@gto90 just read through bip342 I don't see anything in there to allow anything more complicated than what can already be done. Just allows for efficiency gains by better key management. It also removes the current 10k script size limit which I think should not be removed.

@gto90
Copy link
Member

gto90 commented Jun 14, 2024

@gto90 just read through bip342 I don't see anything in there to allow anything more complicated than what can already be done. Just allows for efficiency gains by better key management. It also removes the current 10k script size limit which I think should not be removed.

I think the point is that the taproot BIPs enable more room for larger and more complex scripts and data, which enables use cases like the following:

  1. More efficient multi-signature wallets: Taproot allows multi-signature wallets to be more efficient and private. Instead of revealing all the public keys and the signatures required to spend funds, only a single combined Schnorr signature is shown.
  2. Escrow and Payment Channels: Contracts that require funds to be locked up until certain conditions are met (like in an escrow arrangement or payment channel) can benefit from Taproot. The final condition (i.e., the settlement transaction) must be revealed, not the entire contract.
  3. Time-Locked Contracts: Taproot can facilitate contracts that unlock funds only after a specific time. For example, a contract could release funds to a beneficiary after a specific date without revealing the entire script.
  4. Conditional Payments: Payments conditional on external events can be structured more efficiently with Taproot. For instance, a payment might be contingent on proof of a completed service. The proof condition can be kept private until it’s needed.
  5. Decentralized Finance (DeFi) Applications: Taproot can support more complex DeFi applications, like decentralized exchanges or lending platforms, by enabling more efficient and private implementation of the required smart contracts.

Examples of DeFi Applications Enabled by Taproot

1. Decentralized Exchanges (DEXs)

Scenario: Alice wants to trade DigiByte for Ether with Bob on a decentralized exchange.

  • Traditional Smart Contract Approach: Typically, this would involve a complex smart contract that handles the trade, potentially revealing all conditions and steps involved.
  • Taproot Approach:
    • A Taproot address is created where the conditions for trade (exchange rate, time limit, etc.) are hashed into a Merkle tree using MAST.
    • Only the executed branch (the actual trade condition that is met) is revealed, ensuring the privacy of other conditions.
    • Example: If the trade happens at a specific rate, only that specific condition is shown on the blockchain.

2. Lending Platforms

Scenario: Alice lends DigiByte to Bob, who must repay with interest by a certain date.

  • Traditional Smart Contract Approach: This would require a smart contract detailing the loan amount, repayment schedule, and interest, all visible on the blockchain.
  • Taproot Approach:
    • The loan agreement is hashed into a Merkle tree with different branches for conditions like early repayment, on-time repayment, and late repayment.
    • When Bob repays, only the corresponding branch is revealed.
    • Example: If Bob repays on time, only the on-time repayment condition is shown, keeping the terms for early or late repayment private.

3. Staking and Yield Farming

Scenario: Alice stakes her DigiByte in a DeFi protocol to earn interest.

  • Traditional Smart Contract Approach: The staking contract would detail how rewards are calculated and distributed, visible to all.
  • Taproot Approach:
    • The staking conditions and reward distribution are hashed into a Merkle tree.
    • Only the executed condition (e.g., the calculation and distribution of rewards for a particular period) is revealed.
    • Example: If Alice withdraws her rewards after a specific staking period, only the reward calculation for that period is shown.

4. Insurance Contracts

Scenario: Alice buys insurance against a specific event (e.g., flight delay).

  • Traditional Smart Contract Approach: The insurance contract would detail all potential payouts and conditions, visible on the blockchain.
  • Taproot Approach:
    • The insurance policy conditions (e.g., payout for different delay durations) are hashed into a Merkle tree.
    • If a claim is made, only the relevant condition (e.g., payout for a 2-hour delay) is revealed.
    • Example: If Alice’s flight is delayed by 2 hours, only the payout condition for a 2-hour delay is shown.

5. Collateralized Loans

Scenario: Alice takes out a loan using DigiByte as collateral.

  • Traditional Smart Contract Approach: The loan contract would detail collateral terms, repayment schedule, and conditions for collateral release, visible on the blockchain.
  • Taproot Approach:
    • The collateral terms and conditions are hashed into a Merkle tree.
    • When the loan is repaid or the collateral is forfeited, only the relevant branch is revealed.
    • Example: If Alice repays the loan, only the repayment condition is shown, keeping the collateral forfeiture conditions private.

Detailed Example: Collateralized Loan

Participants: Alice (borrower), Bob (lender)

  1. Initial Agreement:

    • Alice and Bob agree on loan terms: amount, interest, collateral (DigiByte), and repayment schedule.
    • Conditions are hashed into a Merkle tree:
      • Condition 1: On-time repayment by Alice.
      • Condition 2: Late repayment with penalty.
      • Condition 3: Default and collateral seizure by Bob.
  2. Taproot Address Creation:

    • A Taproot address is created using Schnorr signatures, appearing as a single-signature transaction on the blockchain.
    • The conditions are encoded into the Taproot address using MAST.
  3. Execution:

    • Alice repays on time.
    • Only the branch corresponding to on-time repayment (Condition 1) is revealed on the blockchain.
    • The other conditions (late repayment, default) remain private and undisclosed.
  4. Privacy and Efficiency:

    • The transaction looks like a regular single-signature transaction, enhancing privacy.
    • The on-chain data is minimized, improving efficiency and reducing fees.

As I shared above, I believe the benefits outweigh any negatives. I remain unmoved by chain bloat concerns but am willing to consider and understand the impacts of artificially constraining the size of the scripts. Unless I can see a compelling case, I'm weary of limiting potential use cases more than I am chain bloat.

@mctrivia
Copy link

Most of those I don't see how you would do. Multi sig definetly. Escrow is definetly doable through time locks. Time locks sure.

Proof of a completed service. How does that work? Staking can't be done, and yield farming I don't see how that can be done. The insurance example is ridiculous.

colateralized loan can be done I guess by setting up multiple pay back periods. Could be a good use and would be less desirable without taproot.

@SogobiNapiasi
Copy link
Author

@SogobiNapiasi what do you need for your app? Do you need the ability to do hidden contracts until published? Or do you want NFT capability?

The first is a good use of taproot, though rarely desired by people. The second is a horrible use for it and DigiAssets already exist to allow you to have this capability and its more efficient with more features.

Schnorr Signatures and Pay-to-Taproot scripts are indeed indispensable for the creation of a PTLC or Point Time-Locked Contract. An innovative and game-changing application, which leverages PTLC's, can be developed to create the most extraordinary use case DGB hodlers have ever encountered. It shall empower DGB on a level that will astound and captivate people's imagination, elevating it to newfound heights of utility and purpose.

One such choice became possible after the last Bitcoin soft-fork, which enabled Schnorr signatures and Pay-to-Taproot scripts, the Point Time-Locked Contract, or PTLC. These contracts rely on adaptor signatures, a variation of Schnoor signatures.

Schnoor allows more flexibility to create and use multisignatures when compared with the classic digital signature algorithm used by Bitcoin since its creation, ECDSA. It enables key aggregation, where multiple parties can combine their keys in a single key simply by adding them together. Adaptor signatures, in turn, are a mechanism that creates auxiliary signatures that commit to a hidden value. When an adaptor is combined with a corresponding signature, it reveals the hidden value. Schnorr signatures make it easy to compose those adaptor signatures with multisignatures.

Remember, the happy path of an HTLC is the one in which the receiver must reveal a secret for a hash it provided to spend the money locked in the HTLC. PTLCs replace this mechanism with adaptor signatures and combine it with clever key aggregation to create an alternate clause for redemption. They require that the receiver reveal a private key (the hidden value) to a specified public key to claim the funds. The basic idea is that each party creates a secret value that is used to generate a partial signature. These partial signatures are then exchanged between the parties, who can combine them to create a complete signature for the transaction.

Suppose Carol creates an invoice for Alice to pay. She starts by giving Alice a public key for her secret private key. Alice now requests a public key from Bob and creates an adaptor signature using the aggregation of both Carol’s public key and Bob’s public key, which she gives to Bob.

Bob knows his public key, and consequently, his private key, therefore he’s able to subtract that from the adaptor he receives from Alice, getting a new public key from the subtraction, which is now just the public key that Alice originally received from Carol, but Bob doesn’t know that.

Finally, Bob constructs an adaptor signature using the public key he generated and gives it to Carol. Carol knows the private key for the final public key and can convert Bob’s adaptor signature into a valid signature. Bob now can recover Carol’s private key from her signature and uses it with its own private key to convert Alice’s adaptor signature into a valid signature.

Source:
https://voltage.cloud/blog/lightning-network-faq/point-time-locked-contracts/

@DGBNOOB
Copy link
Member

DGBNOOB commented Jul 2, 2024

It’s been a few weeks since the last comment was made, lot of good information in the comments. I get the impression that 8.22 will be released without Taproot activation, however, it might be activated at a later date in a feature branch. Just following up to see if a decision was made.

@JaredTate
Copy link

Dear @SogobiNapiasi would you mind updating the activation dates for the taproot upgrade? I am 100% in favor in moving forward with taproot activation on the DigiByte blockchain. I believe long term it will be a win win for everyone. Thanks for taking the time to work on this. It seems there is an abundance of support in the DGB community for taproot activation as well.

@nadav32p
Copy link

nadav32p commented Nov 5, 2024 via email

@mctrivia
Copy link

mctrivia commented Nov 5, 2024

Definetly not 100% on board. I think it is a huge mistake to include taproot as it will allow huge amounts of spam to be published to the chain. This could in a few years make it to expensive to run a core wallet for most users centralizing the chain.

@nadav32p
Copy link

nadav32p commented Nov 5, 2024 via email

@mctrivia
Copy link

mctrivia commented Nov 5, 2024

I understand your concern and it's valid. However "most users" don't have a core wallet. And to be fair shouldn't. They are not built for the everyday person.

On Tue, Nov 5, 2024, 5:46 AM Matthew Cornelisse @.> wrote: Definetly not 100% on board. I think it is a huge mistake to include taproot as it will allow huge amounts of spam to be published to the chain. This could in a few years make it to expensive to run a core wallet for most users centralizing the chain. — Reply to this email directly, view it on GitHub <#244 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/BJURTIRKAESYL6O3ZVACTT3Z7DD2VAVCNFSM6AAAAABJHHUMKSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJXGIZDIMZWHA . You are receiving this because you commented.Message ID: @.>

Most should not use core wallet for holding funds. But for a strong chain as many as possible should run a core wallet to share blocks.

@gto90
Copy link
Member

gto90 commented Nov 5, 2024

I have also changed my mind and have come around to including this with 8.22. While I agree that there is a risk that our blocks will be filled with spam transactions (whether spam or productive remains a debate), I think the value in having more transactions and blockchain adoption outweighs the risks and we can work on mitigating solutions if that risk is realized.

@DGBNOOB
Copy link
Member

DGBNOOB commented Nov 5, 2024

Great to see this conversation started again, there definitely needs to be a decision made on whether to activate taproot or not in order to finalize 8.22.

I’ve been going over the economic majority referenced on the DIP and the community chat on the DIP given by @gto90 and it only seems fair to get feedback from the DigiByte economy the merchants and users.

I’m in communication with the team at Cryptwerk.com, I asked them to run an article for me and they would. Maybe we can reach out to Cryptwerk and ask if we can use their platform to gage the support for activating taproot. Maybe a one pager of risks vs benefits pros/cons. Just an idea.

@ycagel
Copy link
Member

ycagel commented Nov 5, 2024

I believe the upside of Taproot and Schnorr Signatures is there, so I would include it in the new release.

@DGBNOOB
Copy link
Member

DGBNOOB commented Nov 6, 2024

Great to see this conversation started again, there definitely needs to be a decision made on whether to activate taproot or not in order to finalize 8.22.

I’ve been going over the economic majority referenced on the DIP and the community chat on the DIP given by @gto90 and it only seems fair to get feedback from the DigiByte economy the merchants and users.

I’m in communication with the team at Cryptwerk.com, I asked them to run an article for me and they would. Maybe we can reach out to Cryptwerk and ask if we can use their platform to gage the support for activating taproot. Maybe a one pager of risks vs benefits pros/cons. Just an idea.

Quick follow up,
This is the article that was published by Cryptwerk yesterday, Empowering the DigiByte Economy: The True Power of Merchants and Users.

I wrote another article specific to Taproot activation and I’m waiting to hear back from Cryptwerk if they will publish this as well. Understanding Taproot Activation on the DigiByte Network.

Cryptwerk is an online directory of merchants who accept cryptocurrencies. DigiByte is ranked 19 out of 59 by merchant popularity. 825 companies accept DGB for services and goods compared to Bitcoin BTC 9000+. I don’t know of any other site that has this type of information, but if we want more adoption, DigiByte economy involvement, then this is a great source. At the very minimum the information will get shared across social media but best possible outcome is that we can communicate directly to the merchants and users on Cryptwerk about DigiByte.

@SogobiNapiasi
Copy link
Author

Dear @SogobiNapiasi would you mind updating the activation dates for the taproot upgrade? I am 100% in favor in moving forward with taproot activation on the DigiByte blockchain. I believe long term it will be a win win for everyone. Thanks for taking the time to work on this. It seems there is an abundance of support in the DGB community for taproot activation as well.

Pull request updated with Taproot activation threshold from 10th January 2025 to 10th January 2027.
https://github.com/SogobiNapiasi/digibyte/blob/e067e4d0d45e91a9cee9d9eff7181ec504dbcbef/src/chainparams.cpp#L108-L112

@ycagel ycagel self-requested a review November 8, 2024 18:51
Copy link
Member

@ycagel ycagel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK. Thank you @SogobiNapiasi. Taproot activation dates have been updated.

@ycagel ycagel requested a review from JaredTate November 8, 2024 18:55
Copy link

@JaredTate JaredTate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cACK. Awesome! Thank you @SogobiNapiasi. Once we get this PR merged I will work on finishing taproot tests to make sure everything is good to go there. I think Taproot will be very beneficial for the DGB blockchain long term.

Copy link
Member

@gto90 gto90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for updating these dates. This will open an exciting era of increased blockchain adoption and use!

@gto90 gto90 merged commit cca171c into DigiByte-Core:develop Nov 8, 2024
@nadav32p
Copy link

nadav32p commented Nov 9, 2024 via email

gto90 added a commit that referenced this pull request Dec 15, 2024
This commit updates the `rpc_blockchain.py` functional test to include the Taproot soft fork status in the `getblockchaininfo` RPC call. The Taproot soft fork is defined using the BIP9 activation mechanism with specific start and timeout times. The test verifies that the Taproot soft fork is correctly reported as "defined" and not yet active.

Changes include:
- Adding Taproot soft fork details to the expected `softforks` field in the `getblockchaininfo` test.
- Ensuring the test checks for the correct status, start time, timeout, and activation state of the Taproot soft fork.

This update ensures that the `getblockchaininfo` RPC call accurately reflects the status of the Taproot soft fork, which is crucial for testing and validation purposes.

Refs #244
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants