Add option for Latest Txs vs Latest Blocks on front page

As you can see, there are several same block numbers. I am very confused. Is there a solution? Any idea?
It says it's a Hash, but it's actually a TXID...
That's normal, as the table title says, it shows the latest transactions, not the latest blocks. So there is one line per tx, with the block height it's belongs to, the tx id etc..
the explorer shows Txids and the movements shows also Txids. its duplicated feature i think...🤔
Explorer shows the latest Tx Movements shows the latest Tx over a min amount defined in settings.json. Could be usefull to track big amount Txs by example. You can also defined in settings.json to not show this Movements page.
@feyrian Thanks for the answer. :smile: I can see the differences between the two. My question is, how can I make that block numbers do not duplicate? I see it's normal, but I want to show not duplicated block number.
like it:
1
2
3
4
not this
1
1
2
2
2
2
3
3
3
3
3
3
3
4
4
4
4
4
4
any idea?
i see this line blockindex
https://github.com/iquidus/explorer/blob/30f91a05c5cd1b83c721652c1807232ab9727ebc/views/index.jade#L45
You "shouldn't" with this view, as said this is a latest Tx view, not a blocks view. This explorer doesn't record the blocks in its database, so you'll have to create a new model for the blocks, all the get/set/update functions, a new route with a new view etc... That would be the correct way to do it. But if you don't care you could try this dirty "hack" of the index view, but you won't be able to control how many blocks you'll show as it is based on the index.last_txs parameter to loop over the Txs.
extends layout
block content
script.
$(document).ready(function(){
var stable = $('#block-table').dataTable( {
autoWidth: true,
searching: true,
ordering: false,
responsive: true,
lengthChange: false,
processing: true,
paging: false,
info: false,
ajax: {
url: '/ext/summary',
dataSrc: function ( json ) {
console.log(json.data);
json.data[0]['height'] = "<a href='/block/" + json.data[0]['hash'] + "'>" + json.data[0]['height'] + "</a>";
return json.data;
}
},
columns: [
//{ data: 'height', width: '8%' },
{ data: 'difficulty', width: '10%' },
//{ data: 'size', width:'10%' },
//{ data: 'txs', width: '10%' },
{ data: 'supply', width: '15%' },
//{ data: 'time', width: '20%' },
]
});
var rtable = $('#recent-table').dataTable( {
autoWidth: true,
searching: false,
ordering: false,
responsive: true,
lengthChange: true,
processing: true,
ajax: {
url: '/ext/getlasttxs/0.00000001',
dataSrc: function ( json ) {
var prevHeight = -1;
var blocks=[];
for ( var i=0;i<json.data.length; i++ ) {
if ( json.data[i]['blockindex'] != prevHeight ){
prevHeight = json.data[i]['blockindex'];
json.data[i]['timestamp'] = new Date((json.data[i]['timestamp']) * 1000).toUTCString();
// json.data[i]['txid'] = "<a href='/tx/" + json.data[i]['txid'] + "'>" + json.data[i]['txid'] + "</a>";
json.data[i]['blockindex'] = "<a href='/block/" + json.data[i]['blockhash'] + "'>" + json.data[i]['blockindex'] + "</a>";
// var amount = json.data[i]['total'] / 100000000;
// json.data[i]['total'] = amount.toFixed(8);
// json.data[i]['recipients'] = json.data[i]['vout'].length;
json.data[i]['blockhash'] = "<a href='/block/" + json.data[i]['blockhash'] + "'>" + json.data[i]['blockhash'] + "</a>";
}
}
// return json.data;
return blocks;
}
},
columns: [
{ data: 'blockindex', width: '8%' },
// { data: 'txid', width: '40%' },
{ data: 'blockhash', width: '40%' },
// { data: 'recipients', width:'5%' },
// { data: 'total', width: '15%' },
{ data: 'timestamp', width: '25%' },
]
});
setInterval( function () {
rtable.api().ajax.reload(null, false);
stable.api().ajax.reload(null, false);
}, 60000 );
});
.row
.col-md-12
if error !== null
.alert.alert-danger.alert-dismissable(role='alert')
button.close(type='button', data-dismiss='alert') ×
strong #{settings.locale.ex_error} : #{error}
if warning !== null
.alert.alert-warning.alert-dismissable(role='alert')
button.close(type='button', data-dismiss='alert') ×
strong #{settings.locale.ex_warning} #{warning}
.col-md-12
.panel.panel-default
.panel-heading
// strong #{settings.locale.ex_latest_transactions}
strong Latest blocks
table#recent-table.table.table-bordered.table-striped
thead
tr
th.text-center #{settings.locale.ex_block}
// th.hidden-xs.text-center #{settings.locale.tx_hash}
th.hidden-xs.text-center #{settings.locale.tx_block_hash}
// th.hidden-xs.text-center #{settings.locale.tx_recipients}
// th.text-center #{settings.locale.mkt_amount} (#{settings.symbol})
th.text-center #{settings.locale.timestamp}
tbody.text-center
.footer-padding
unanswered duplicate https://github.com/iquidus/explorer/issues/191
I think should be closed :)
Keeping the issue open just for now as it seems to be a confusing aspect. Perhaps the front page needs to be realigned to show the TX Hash in first column rather than the BlockHeight. Also I do like the blocks getting its own model and view, so if someone wants to create an enhancement issue and start working on that, I think that'd be a welcoming feature.
We could add an option to choose latest TXs or latest blocks
Are there any updates on this - this would be a useful feature!
On a separate note, any chance I can update something so that the explorer only displays transactions that have recipients &/or a value greater than 0?

Thanks a lot for your attention
On a separate note, any chance I can update something so that the explorer only displays transactions that have recipients &/or a value greater than 0?
Thanks a lot for your attention
Create a separate issue please. That shouldn't be hard to do but it may take a few changes.