-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TS: Support Blockstream's Esplora/Electrs servers for electrum protoc…
…ol integration (#501) Closes: #422 In this PR we update the implementation of TypeScript Electrum integration to support Esplora/Electrs servers. As per Blockstream/electrs#36 verbose transactions are not supported by Esplora/Electrs. This affects our implementation of `getTransaction` and `getTransactionConfirmations` functions. For a consistent code in the client without alternative paths for different Electrum servers implementations I decided to not use verbose transactions at all. ### [getTransactionConfirmations](26d4f01) 1. Get the raw transaction 2. Deserialize the raw transaction 3. Find transaction block height by finding it in a history of transactions for the output script included in the transaction. 4. Get the latest block height 5. Calculate number of confirmations by subtracting the transaction block height from the latest block height and adding one. ### [getTransaction](a7aedd1) We get a raw transaction and deserialize it with `bcoin`. This lets us define a consistent type for returned transactions (093d4ec). Before these changes, I observed that Electrum server implementations are not consistent with data returned in verbose JSON. ### Electrum tests We can test electrum integration against different kinds of servers. The most popular implementations are: - ElectrumX - Fulcrum - Electrs/Esplora We can find a list of public servers here: https://1209k.com/bitcoin-eye/ele.php?chain=tbtc The electrs-esplora server seems pretty unstable, so we don't want to enable it in tests until we add retries (#485).
- Loading branch information
Showing
7 changed files
with
299 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.