MetacoSA / NBitcoin

Comprehensive Bitcoin library for the .NET framework.
MIT License
1.86k stars 840 forks source link

Invert NetworkSets (Altcoins) by Exporting All of Them #1126

Open mishfit opened 1 year ago

mishfit commented 1 year ago

In #1121 I'm trying to invert the relationship between all Altcoins and the project.

By setting them up as Exported INetworkSets new Altcoins will no longer be the responsibility of the project to add or support.

The responsibility will now be on the Altcoin developers to create their own assembly with their own exported network set for their own coin.

No future requests to add coins would be necessary.

This does require two changes to nbxplorer and BTCPayServer (to import coins like plugins)...this change in NBitcoin is required to support that future work. Having Altcoins work like plugins makes BTCPayServer not only self-hosted and decentralized but truly permission-less.

dangershony commented 1 year ago

Having Altcoins work like plugins makes BTCPayServer not only self-hosted and decentralized but truly permission-less.

I don't understand how this is relevant? you need permission from anyone to run BTCPayServer right now?

mishfit commented 1 year ago

@dangershony you need permission from the maintainers to run new altcoins while still having the rest of the platform be supported by the maintainers.

Decoupling coins (or their NetworkSet interface) into plugins will reduce the need to fork or beg for eyes on a pull request to add coins in the future. The other updates (security, new features, etc.) just come through.

dangershony commented 1 year ago

will reduce the need to fork

I see what you mean.

This does require two changes to nbxplorer and BTCPayServer (to import coins like plugins).

Not sure what I think about this PR yet but perhaps if you had the nbxplorer and BTCPayServer PRs ready and linked here it would be easier to make a decision

I'd also wait for more comments from the maintainers before proceeding

NicolasDorier commented 1 year ago

@mishfit as far as your PR https://github.com/MetacoSA/NBitcoin/pull/1121 is concerned, do not add you own altcoins at the same time as making change to the core library, it makes it too hard to review.

I don't think altcoins should be added on separate assembly though. As it would require projects to reference not only NBitcoin.Altcoins, but also the altcoin specific library which may be compromised. (as such, I would never reference altcoin library in my own projects) The code of NBitcoin.Altcoins for each altcoin is quite easy to review, so this limit the risk considerably.

mishfit commented 1 year ago

Okay, I'll push the ecash altcoin in separately...I'll setup the 3 repos (NBitcoin, nbxplorer, and btcpayserver ) with a proof of concept for how alt coin plugins would work.

sergeibystrov commented 1 year ago

Please I know this is not the right place to ask this but I guess this discussion thread seems to be getting quick response that's why I asked this here.

I am using the latest version of NBitcoin and it seems to be different from the previous version of 4.1.1 which is easy as taking the message string parameter to sign a message and verify but it's kind of difficult to sign a message in latest version 7.* Please how do I sign a message and verify a message. Thank you. Bar m = key.privatekey.signmrssage(message.text); Above code is for NBitcoin 4.1.1.86

I am using latest stable version which is different. Don't know how