pybitcash / bitcash

BitCash: Python Bitcoin Cash Library (fork of ofek's Bit)
https://bitcash.dev
MIT License
97 stars 39 forks source link

Fulcrum protocol #145

Closed yashasvi-ranawat closed 3 months ago

yashasvi-ranawat commented 4 months ago

Added fulcrum protocol for additional APIs with tests and docs.

The additional APIs lead to slowing of get_sanitised_endpoints_for function. I parallelised that with threading; that puts the first hit still at 2s.

JettScythe commented 3 months ago

Feel free to add my instance here as well: fulcrum.jettscythe.xyz

You can find a full list of instances here: https://1209k.com/bitcoin-eye/ele.php?chain=bch

merc1er commented 3 months ago

Thank you for yet again another quality pull request @yashasvi-ranawat.

I have known about Fulcrum for a while but never actually used it. The Fulcrum website does not really give it a good image 😅. However I believe this is what powers Electron Cash, so I assume it is very reliable.

Do you think it is much more reliable than any of our current providers? If so, maybe the end goal would be to use Fulcrum as a default provider for every API call? Currently I don't see any code cash token related - it looks like CashToken is supported. Maybe at some point that could be integrated and Fulcrum could be the default provider once it has proven it is extremely reliable.

yashasvi-ranawat commented 3 months ago

However I believe this is what powers Electron Cash, so I assume it is very reliable.

Yes indeed. It is reliable. But I don't know if the servers are instantly synced with the blockchain.

Currently I don't see any code cash token related - it looks like CashToken is supported.

Cashtoken is supported! The protocol version 1.5.0 has token related fields in the API, and hence I chose that to as the base protocol.

Maybe at some point that could be integrated and Fulcrum could be the default provider once it has proven it is extremely reliable.

That would be ideal! We can remove the default APIs from other implementations while still keeping them. I like Chaingraph approach as it is very versatile, and pyBitcash can still support it.

The full adaption of Fulcrum will come with further design debates! Bitcash is built on the idea of a static library that only queries on demand, but other BCH tools like DSproof and address subscription, and fulcrum tools like peer discovery, might need a deviation from that idea (and better implementation of Fulcrum to not allow problems like: https://t.me/electroncashserver/4899).

Where the implementation stands right now: with some default endpoints, Fulcrum protocol is 100% usable for pybitcash!

merc1er commented 3 months ago

FYI @yashasvi-ranawat it looks like these changes are not compatible with Python 3.8: https://github.com/pybitcash/bitcash/actions/runs/9184862197/job/25257867718.

It's almost at its end of life so maybe we can drop support and replace it with 3.12 at some point. I think I'll do that unless it's a super easy fix to make it compatible with 3.8.