Is there a way to get the data for when each block has been added to the pool and to when it has been executed in monero?
1 Answer
Firstly, blocks don't get "added to the pool". A wallet instructs a daemon to broadcast a transaction which gets added to the transaction pool. A miner constructs a block template by bunching transactions that are in the transaction pool, then mining that block template. When a miner successfully mines a block, it is broadcast to the network, and if valid, get's added to each peers blockchain.
If you need an external notification when your node adds a block to your blockchain, you can use the parameter --block-notify
when starting your node, which will instruct it to execute a program every time a block is added:
monerod --help
...
--block-notify arg Run a program for each new block, '%s'
will be replaced by the block hash
...
You can also call the daemon's RPC method get_last_block_header, which includes a timestamp field in the response. Note that this timestamp however is a miner created timestamp, not the time your node added the block to your local blockchain.
-
can we get the information for the current blocks on the chain.. when they were added to transaction pool and when they were added to the chain? Commented Apr 3, 2019 at 1:48
-
Again, blocks are not added to the tx pool. You can get the time a block was added to the chain by calling get_last_block_header, which includes a timestamp in the response. Commented Apr 3, 2019 at 1:56
-
Transactions, not blocks, are added to the txpool. A block may include transactions that were added to the txpool at different times. Commented Apr 6, 2019 at 15:06