Sending and receiving transactions

What is the correct way to send and receive transactions?

My best guess is that you create a Pool object, and then

  1. to send a tx you iterate the Peers in the pool and manually send a transaction message?
    however I dont see a way to actually iterate the peers in a pool.

Would you have to keep manually rebroadcasting it if it drops out of the mempool of your peers?

  1. to receive a tx you listen for inventory message on pool with given txid. BitCoinJ has the concept of transaction confidence, which I think depends on how many of your peers presently see the tx, is there any such concept in bitcore?

You can interact with each peer this way:

for (var hash in pool._connectedPeers) {
  var peer = pool._connectedPeers[hash];
}

It may be possible to add a convenience method. And yes there could be an additional layer that could monitor status of a broadcasted transaction, however this isn’t currently included.

In overview, here are some of the current options:

1 Like