hirosystems / stacks-blockchain-api

API for the Stacks blockchain
https://stacks-blockchain-api.vercel.app
GNU General Public License v3.0
170 stars 108 forks source link

Discussion: Access to mempool transaction data to create an accurate representaion of the next mempool block. Related to Issue #1492 #1500

Closed TensionCoding closed 1 year ago

TensionCoding commented 1 year ago

Feature / Question related to Issue #1492 Right now I am unable to create an accurate projection of which mempool transactions will be included in the next mined block. In the above issue we discussed how we could potentially do this. gandalf77 made the following comment:

@obycode thank you for your reply and the helpful pointers. Our project (stxmempool.space) aims to replicate mempool.space for the Stacks blockchain. And a key component of the app is to visualize the whole mempool. While the mock-mining flag solution will give us access to the next block, will it also allow us to to access the ordering of all transactions in the mempool (not just the next block)? If the answer is only the next block, can you think of any other way for us to access either the ordering or the execution_costs of all mempool transactions? We have to explore the Clarinet solution further but right now it seems unfeasible to integrate the command line tool into our web app. Thanks so much

I wanted to reopen this discussion. Currently we are syncing a full STX node and hope to start the mock mining process soon. Any further information regarding gandalf77 question would be helpful.

Thank you

obycode commented 1 year ago

I think the best option might be to add a stacks-inspect command that can generate the data you're looking for. There are various functions available to get the information, it just needs to be put together and output for this purpose. Something like a call to MemPoolDB::iterate_candidates with the todo function recording the costs.

zone117x commented 1 year ago

@obycode does this issue make sense for the API repo? Seems like there's nothing more the API can do right now.

obycode commented 1 year ago

No, you're right. I think this discussion could be moved to stacks-blockchain.

TensionCoding commented 1 year ago

@obycode I appreciate your assistance. So are you referring to writing rust code that directly interacts with the STX node?

@zone117x I agree, it seems at this point the API does not have the answers or solutions. I will re-open this discussion on the stacks-blockchain repo.

Thanks to both of you for helping us get closer to the answers

obycode commented 1 year ago

Yes, I think some Rust code that interacts with the mempool sqlite database on the node will be best the way to do this.

obycode commented 1 year ago

@TensionCoding I just made a friend request on Discord. I'd be happy to discuss further if you'd like.