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

Send raw transactions to explorer API for better redundancy at tx broadcast #4932

Closed
chimp1984 opened this issue Dec 10, 2020 · 7 comments
Closed

Comments

@chimp1984
Copy link
Contributor

chimp1984 commented Dec 10, 2020

Description

As we have the unresolved issue that sometimes transactions does not get successfully broadcast and we have not managed to find out the issue which causes that (likely a bitcoinj problem as it does conceptual not support well multiple wallets as we use with BSQ and BTC) I suggest that we send the raw transcation to an explorer API for increasing the chances that the tx gets into the mempool.

A requirement is that the API is running as hidden service, so there are no privacy issues.

Bisq contributors run a few mempool space explorer nodes and we could use those as default nodes. We can add a setting that the user could define their own node as well (I guess its not needed for the first version).

Another option would be to use Electrum or send it to Bitcoin core nodes.
Requires a bit more thought and investigation whats the best option here.

We should also keep in mind that using external APIs for blockchain data can be used for further use cases like look up if a tx is in the mempool, look up if peers trade fee tx is in the mempool and confirmed, lookup miner fees used in peers txs,...
So the choosen model should be usable for those use cases as well.

@wiz Does mempool.space API support broadcast of raw txs?
@jmacxx Would you be interested to work on that?

@oscarguindzberg
Copy link
Contributor

oscarguindzberg commented Dec 10, 2020

I think the broadcasting problems we had recently are not really broadcasting problems, but a consequence of a previous problem that made bisq to create invalid txs.

In any case, it is good to be on the safe side.

Broadcasting means exposing privacy to the server.

Electrum seems a good trade-off.
Ideal solution:

  • Electrum servers provided by trustworthy persons of the bisq community
  • Electrum servers running behind tor
  • using SSL to communicate to the server

I wrote a java API to communicate to an electrum server: https://github.com/electrumj/electrumj/
This is the method for broadcasting a tx: https://github.com/electrumj/electrumj/blob/main/src/main/java/org/electrumj/ElectrumClient.java#L385

@chimp1984
Copy link
Contributor Author

FYI: https://mempool.ninja/de/api

@chimp1984
Copy link
Contributor Author

chimp1984 commented Dec 11, 2020

I discussed with @sqrrm the topic to use Eletrum or mempool.space and we got convinced its better to use mempool.space for now.
The reasons are:

  • Our use case is very simple and impl. can be done faster more robust and using patterns we already use in other cases (http request over tor)
  • The main reason why Electrum was considered was for possible future use cases which require more sophisticated features. So far we have nothing concretely planned for that. The next feature we might integrate is tx lookups but that is easily done by mempool.space as well. Migrating away from BitcoinJ will require another updated research about best alternatives (back then we ended up with Electrum, but quite some time has passed and might be Neutrino is ready now to use or there are other new candidates which follow a more decentralized model). Starting with Electurm now would be premature.
  • Adding another library comes with new dependencies. We want to avoid new dependencies as far as possible. A simple http request is much cheaper than to do it via a Electrum client supporting the Electrum protocol.
  • The use case is for getting more redundancy to mitigate proplems from a system which suffers from a too high level of complexity (BitcoinJ). Keeping newly added complexity for that "backup" solution at the minimum seems to be the better choice here.

@wiz
Copy link
Member

wiz commented Dec 11, 2020

FYI the mempool.space backend can be configured to support the electrum RPC API as well as the REST API if necessary so you can have both, just let me know if you need it

@ghost
Copy link

ghost commented Dec 13, 2020

@jmacxx Would you be interested to work on that?

Thanks for the offer but I don't currently have the bandwidth to take this task.

@wiz
Copy link
Member

wiz commented Dec 13, 2020

@jmacxx Really? should be easy, all you need to do is HTTP POST the TX in hex to a URL :)

@cd2357
Copy link
Contributor

cd2357 commented May 9, 2021

Fixed with #4943 and #4958

@cd2357 cd2357 closed this as completed May 9, 2021
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

No branches or pull requests

4 participants