You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current implementation of getTransactionConfirmations won't work with Electrs, as verbose transaction details are not supported there (see: Blockstream/electrs#36 (comment)).
nkuba
changed the title
tbtc.ts: getTransactionConfirmations won't work with Electrs
TS: getTransactionConfirmations won't work with Electrs
Jan 25, 2023
…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).
The current implementation of
getTransactionConfirmations
won't work with Electrs, as verbose transaction details are not supported there (see: Blockstream/electrs#36 (comment)).tbtc-v2/typescript/src/electrum.ts
Lines 190 to 205 in a9424d1
We should implement a workaround to cover Electrs.
An example workaround was implemented in the Keep Client:
https://github.com/keep-network/keep-core/blob/d69e971fc734031111699f95eccc3bbbafe4345f/pkg/bitcoin/electrum/electrum.go#L163-L206
The text was updated successfully, but these errors were encountered: