Bitcore Block

Hi All.
how can I get of transactions in Blocks via bitcore-p2p and bitcore-lib?

You can listen for “inv” messages from peers and then request the data using a “getdata” command to the peer, the peer will then respond with a “block” message.

Thanks, I do it, but I can not get result transaction list in the blocks

Do you mean this?

for(var i = 0; i < block.transactions.length; i++) {
  var tx = block.transactions[i];
}

thanks, I do it.
now i have following big problem.
I have this code.

pool.on('peerinv', function (peer, message) {

//Transaction
peer.sendMessage(messages.GetData(message.inventory));
peer.on('tx', function (message) {
    //here update database  by transaction id. 
    
});

peer.on('block', function(message){
    var reversed = BufferUtil.reverse(message.block._getHash());
    var blockhash = BufferUtil.bufferToHex(reversed);
    for (var i in message.block.transactions) {
        var transaction = message.block.transactions[i];

    //here update database block hash
})

// Address
peer.on('ready', function () {
    var getAddrMessage = messages.GetAddr();
    peer.sendMessage(getAddrMessage);
});

peer.on('addr', function (message) {
    message.addresses.forEach(function (address) {
        console.log(address)
        pool._connectPeer(address);
    });
})

console.log(pool.numberConnected())

});

run app, and I have check Insight-api on my node, mempool transaction hashes in my database transaction hashes, after 10 minits I don`t find noting. on(‘tx’) and on(‘block’) eventemitter blocking. what is problem?

Spawned an issue here: https://github.com/bitpay/bitcore-p2p/issues/82 to include a more comprehensive example.

There is nothing there

It’s an issue that needs to be completed.

Formatting of the code block above is difficult to follow, as there is an issue with the closing brackets.