MultiChain / multichain-explorer

Web-based explorer for MultiChain blockchains
GNU Affero General Public License v3.0
177 stars 140 forks source link

Recent transactions does not work? #3

Closed roderik closed 7 years ago

roderik commented 8 years ago

I've created addresses, issues assets and send some of these assets around. Yet my recent transactions block stays empty. When going more into the details i do however see transactions and stuff.

screenshot 2016-02-14 14 09 07 screenshot 2016-02-14 14 08 11
bitcartel commented 8 years ago

Which version of MultiChain are you using? Please try the latest version of the explorer and let me know how things are going. Thanks.

roderik commented 8 years ago

I'm using the latest master version.

This is the series of actions i run (via the json-rpc api)

I've put everything is a little bash script and during the run i see one or two of the transactions in recent. When refreshing they disappear and sometimes others appear. A few seconds after the run they all disappear.


While writing this i noticed something, my chain description has a space in it, and the ajax call thows a 404. "http://multichain-explorer.docker:2750/recent/MultiChain%20Dockerchain" does not exist. I'll try it without a space and get back with more info.

roderik commented 8 years ago

Ok, no dice, seems like the URL is not the description field in the params.dat. Was a coincidence.

continuing on to debug :)

roderik commented 8 years ago

So, figured out python debugging, "print" style :) Please bear with me :)

Running the commands i mentioned above, refreshing the recent page manually and continuously and printing out the sorted_mempool just before this line: https://github.com/MultiChain/multichain-explorer/blob/master/Abe/abe.py#L528

172.16.141.1 - - [16/Feb/2016 16:17:06] "GET /MultiChain%20Dockerchain/recent HTTP/1.1" 200 486
[["edfad03559c64651c0b178b732cb23f01866de9778e23761b466f022b9ffbdc9", {"fee": 0.0, "startingpriority": 0.0, "height": 11, "depends": ["dda42e45bd4eba0d52e3b56d195b1e3ea836b95cb28f9350bd1187a14e014100"], "time": 1455639424, "currentpriority": 0.0, "size": 264}], ["dda42e45bd4eba0d52e3b56d195b1e3ea836b95cb28f9350bd1187a14e014100", {"fee": 0.0, "startingpriority": 0.0, "height": 11, "depends": [], "time": 1455639413, "currentpriority": 0.0, "size": 263}]]

got two, they show up nicely

172.16.141.1 - - [16/Feb/2016 16:17:07] "GET /MultiChain%20Dockerchain/recent HTTP/1.1" 200 486
2016-02-16 16:17:08,016 [38:MainThread] Abe.DataStore INFO - block_tx 15 15
2016-02-16 16:17:08,017 [38:MainThread] Abe.DataStore INFO - block_tx 15 16
2016-02-16 16:17:08,017 [38:MainThread] Abe.DataStore INFO - block_tx 15 17
2016-02-16 16:17:08,019 [38:MainThread] Abe.DataStore DEBUG - commit
[]

one second later, it loads some more transactions, but the sorted_mempool is empty

roderik commented 8 years ago

Ok, debugged a bit higher by printing out mempool.items() at https://github.com/MultiChain/multichain-explorer/blob/master/Abe/abe.py#L515 and if it goes empty, it doesn't return any for items as well. The issue is not located in the create_recent_table method but in the mempool.

bitcartel commented 8 years ago

Thanks for spotting the 404 error for the Recent page - I've fixed it now.

The recent table shows 10 items - made up of mempool tx and if required the most recent transactions (via JSON-RPC call listtransactions). Do you see these transactions with confirmation labels?

Depending on your blockchain parameters, the tx may only in be in the mempool for a few seconds before they are mined into a new block.

roderik commented 8 years ago

I'll have to verify tomorrow to be sure, but it seems a valid assumption that I only see mempool tx, and no recent transactions that have been mined in a block. I've seen the list transactions out put and as far as I can remember they all have x verifications.

roderik commented 8 years ago

Sorry it took a while, the transactions are in fact all confirmed.

 ------------------------------------------------------------------ --------------- -------------- 
  Txid                                                               Confirmations   Time          
 ------------------------------------------------------------------ --------------- -------------- 
  683b920b0d4c69703eaa67b0219d500185992fff0191350f39ef56ff22260233   3383            23 hours ago  
  9d36336232a81a20afb7f80d0246f2c074cb0676941dbd368d8a554ad31d2c9c   3387            23 hours ago  
  3280040af26a622827e6612a0775358e93847b9c3a9dc37594bd9a7a1a5c0250   3400            23 hours ago  
  b180fc7290cd3d1b0975441f18090ec1fe276ca94c93ebf0874fb7dcc3675a11   3411            23 hours ago  
  e7779b654a602e5c5b0d26587558806e0752b76229226bc6a7ae53874e483bf0   3411            23 hours ago  
  9be240ae0c63d6bb83ff70788bdd1efdd6ab0348c3e08f424aa12196119d0ae7   3488            23 hours ago  
  3010221b6ec9ca5eae31aead465065e48ffde1ae49707344d846ffdad33138fe   3488            23 hours ago  
  31df831d33b9793204204d1885354c744b06f8a60bd91c2ee03bb234f51bddd4   3488            23 hours ago  
  8ebec13b657d2d214828ec2ded22131098119aa477f6543858b80d17b5e51b3a   3489            23 hours ago  
  56450be458054bdfec1bb3439fb924cac279a9485154be6455ce5d2015cc4168   3491            23 hours ago  
  07b76395eb75be7cfc65fcf86b43fc6a906d353aee9a5e20d8625753687529c5   3494            23 hours ago  
  bdb816468c396279e9db4a916d63af77da7974ad08e1afca8165dbd2bfa28786   3495            23 hours ago  
  9be67b4a260d13beb255243f7841d94877bb7d8eed57f769ba8058651d92e59f   3504            23 hours ago  
 ------------------------------------------------------------------ --------------- -------------- 
bitcartel commented 8 years ago

Thanks.

So do you see the first 10 in your list (which are the most recent) on the main page of the explorer under 'Recent Transactions'?

If so, that is the correct behaviour (right now).

You mentioned earlier that you assumed that only mempool tx would be displayed. This is still the case -if the block interval time was not as low as the default 15 seconds and there was a steady stream of incoming transactions, the list would be full of mempool tx.

roderik commented 8 years ago

No, I see none in the explorer's "Recent Transactions" list on the homepage, they appear for a few seconds (probably until they are mined) and then they disappear.

To summarise, at the same moment in time:

bitcartel commented 8 years ago

In Abe.py, please replace the block of code at line 512 with the code below. The debug statement output should help me figure out what is going on and why the RPC tx are not showing. https://gist.github.com/bitcartel/96769cf2017e401d2015

roderik commented 8 years ago

Here is the log: https://gist.github.com/roderik/11d1d9c2f44e8d05a005

This is an empty chain, running in a docker cluster on my osx dev machine (compose file: https://github.com/Kunstmaan/docker-multichain/blob/master/docker-compose.yml)

The commands are run via a bash script, that calls a demo php script i'm making for a meetup presentation, that uses my php lib for the json rpc api (https://github.com/Kunstmaan/libphp-multichain), the commands + their nicely formatted output is also in the gist. (not public yet, but i can give you access if you want)

bitcartel commented 8 years ago

Thanks, I just pushed a fix. Please try the latest version and let me know if that resolves the issue.

roderik commented 8 years ago

Sorry, no change. I've deleted and forked the latest master and readded the debugging code. I've updated the gist: https://gist.github.com/roderik/11d1d9c2f44e8d05a005

roderik commented 8 years ago

I think i've got it, I run all these commands on one node and as such in one wallet.

bitcartel commented 8 years ago

Try setting option txindex=1 so that the node which is connected to the explorer will track all transactions it sees. This option must be set the very first time multichaind is launched, best to put it in the multichain.conf file. More info here: http://www.multichain.com/developers/runtime-parameters/

roderik commented 8 years ago

Tried it but doesn't change anything. And since the default is also 1 it's normal this doesn't change a thing.

roderik commented 8 years ago

I've captured the raw outputs from listwallettransactions and listtransactions here: https://gist.github.com/roderik/5f5928482e4d53d6ce55

bitcartel commented 8 years ago

Thanks. Please add this to Abe/datastore.py after line 3910 resp=... print "list_transactions resp = {}".format(resp) It seems from earlier debug output that we are getting an empty list instead of the output in your gist. Hopefully this will tell us why.

roderik commented 8 years ago

I guess it's a bug in alpha16 because listtransactions just returns an empty array: https://gist.github.com/roderik/38766c440ec0e2bcc5de

I start this node with "multichaind dockerchain@$ip:7447 -daemon -txindex=1" The call uses these params: (dockerchain, http://multichainrpc:FEr5sfuiXE4YMsru7jQS7kVFgjAhJWoUcKfLAbhWz6Rw@127.0.0.1:8000, listtransactions, *, 30) which seems fine Calling a similar command on the node where i execute the commands returns transactions

bitcartel commented 8 years ago

Please add this to Abe/util.py line 221 so I can see the endpoint being called and the parameters (it should match what you've written above, but I want to make sure). print "url = {}, postdata = {}".format(url, postdata)

Given that other JSON-RPC commands are working (e.g. you can bring up asset details just fine in the explorer) the current issue is perplexing. Thanks for your help and patience in trying to resolve this. Much appreciated.

roderik commented 8 years ago

Te output: https://gist.github.com/roderik/4d0427b45af6726387b9

andrewkrug commented 8 years ago

I am having the same issue with recent TX as well using latest commit. Search is also not working.

bitcartel commented 8 years ago

@andrewkrug Are you running the explorer on the same machine as multichaind? What's your system set-up? Regarding search, can you please open a new/separate issue and let me know which search terms are not working e.g. block height, first few characters of txid, address, etc. and what you see on screen instead. Thanks.

bitcartel commented 8 years ago

Hi @roderik How is the latest release with multichain alpha 18? Does the problem still exist?

roderik commented 8 years ago

@bitcartel: just tested alpha 19, no change. Only mempool transactions are shown.

All code, infrastructure and configs of my environment are available, maybe it would help to find out why this is happening?

bitcartel commented 8 years ago

Thanks, had some issues getting the docker images up and running, but will try again as the project looks interesting. Regarding the issue itself, I managed to recreate it and it should now be fixed. Please try the latest version. If you're interested, the relevant commits are: be14fb912ef57a0cff7393be3f176792a810a82d (and the one preceding it).