Bitcoin Forum

Other => Archival => Topic started by: Evil-Knievel on March 15, 2014, 09:37:13 PM



Title: This message was too old and has been purged
Post by: Evil-Knievel on March 15, 2014, 09:37:13 PM
This message was too old and has been purged


Title: Re: na
Post by: roslinpl on March 15, 2014, 10:47:32 PM
1btc to create best blockchain is not a lot :)
Because there is much more work than like for 1btc.

good luck anyway!
regards!


Title: Re: na
Post by: tsume90 on March 15, 2014, 10:55:22 PM
Wouldn't mind jumping on this wagon. What language is it written in(if there's a requirement), also where's the source?


Title: Re: na
Post by: roslinpl on March 15, 2014, 11:02:12 PM
Wouldn't mind jumping on this wagon. What language is it written in(if there's a requirement), also where's the source?

cool :) seems like I was wrong about the price.
 Regards!


Title: Re: na
Post by: tsume90 on March 20, 2014, 03:31:00 PM
Wouldn't mind jumping on this wagon. What language is it written in(if there's a requirement), also where's the source?

Well, all you need is HTML and JavaScript  ;)
We just need to query the API server with javascript, and display the results in HTML.
You could check out the main page html to see that it is not that complicated.

Here is the javascript file, which displays the live block/tx info on the main page. This can be adapted/extended/etc.


Code:
(function ($) {
var defaults = {
rowSpeed: 300,
newRow: null,
addTop: true,
removeTop: true
};
var newClasses = "newRow"
var options = $.extend(defaults, options);
$.fn.addRow = function (options) {
opts = $.extend(defaults, options);
var $table = $(this);
var $tableBody = $("tbody", $table);
var t = $(opts.newRow)
console.log("ADDING: " + t);
if (opts.addTop) t.appendTo($tableBody);
else t.prependTo($tableBody);

// make sure we do not have more than x elements in table
    var rowCount = $('tbody tr', this).length;
    console.log("ROWCOUNT: " + rowCount);
    if(rowCount>10)
      $('tbody tr:last', this).remove();
  

var lin = $table.find('tbody tr:first');
lin.find("td").effect("highlight", {}, 1000);
return false;
};

$.fn.removeRow = function (options) {
opts = $.extend(defaults, options);
var $table = $(this);
var t
if (opts.removeTop) t = $table.find('tbody tr:last')
else t = $table.find('tbody tr:first');
t.find("td")
.wrapInner("<div style='DISPLAY: block'/>")
.parent().find("td div")
.slideUp(opts.rowSpeed, function () {
$(this).parent().parent().remove();
});
return false;
};
return this;
})(jQuery);

function formatLTC(Amount){
  var DecimalSeparator = Number("1.5").toLocaleString().substr(1,1);

  var AmountWithCommas = Amount.toLocaleString();
  var arParts = String(AmountWithCommas).split(DecimalSeparator);
  var intPart = arParts[0];
  var decPart = (arParts.length > 1 ? arParts[1] : '');
  decPart = (decPart + '00000').substr(0,5);

  return intPart + DecimalSeparator + decPart + " LTC";
}

function getSubscribeTX(){
  var jsonData={};
  jsonData['id']=-1;
  jsonData['method']="blockchain.tx.subscribe";
  return JSON.stringify(jsonData) + "\n";
}
function getLastTX(){
  var jsonData={};
  jsonData['id']=-1;
  jsonData['method']="blockchain.last.tx";
  return JSON.stringify(jsonData) + "\n";
}
function getLastBlocks(){
  var jsonData={};
  jsonData['id']=-1;
  jsonData['method']="blockchain.last.blocks";
  return JSON.stringify(jsonData) + "\n";
}
function getSubscribeBlocks(){
  var jsonData={};
  jsonData['id']=-1;
  jsonData['method']="blockchain.blocks.subscribe";
  return JSON.stringify(jsonData) + "\n";
}

function addTxRow(txid, amount, timestamp){
  txid=txid.substr(0,12);
  var amtLTC = amount / 100000000;
  $("#txa").addRow({
  newRow: '<tr><td><a href="/tx/' + txid + '">' + txid + '</a><font color=gray>[...]</font></td><td data-livestamp="' + timestamp + '">few seconds ago</td><td class="hidden-phone"></td><td class="right-col"><button class="btn btn-success btn-large"><span>' + formatLTC(amtLTC) + '</span></button></td></tr>',
  addTop: false,
  removeTop: false
  });
}


function addBlockRow(height, hash, numtx, amount, tmpstmp){
  amount = formatLTC(amount);
  $("#blocks").addRow({
  newRow: '<tr><td><a href="/block/' + hash + '">' + height + '</a></td><td data-livestamp="' + tmpstmp + '">few seconds ago</td><td class="hidden-phone">' + numtx + '</td><td class="hidden-phone right-col"><button class="btn btn-warning btn-large"><span>' + amount + '</span></button></td></tr>',
  addTop: false,
  removeTop: false
  });
}

$(document).ready(function() {
    var config = {
      relayURL: "wss://litemonitor.com:2109"
    };
 

   var connected = false;
 
    var socket = new WebSocket(config.relayURL, ['binary']);
 
    socket.onopen = function() {
      socket.send(getLastTX());
      socket.send(getLastBlocks());
      socket.send(getSubscribeTX());
      socket.send(getSubscribeBlocks());
    };
 
    socket.onmessage = function(event) {
      if (!connected && event.data == 'connected') {
        connected = true;
        return;
      }

      var fr = new FileReader();
      fr.onloadend = function(f){

        var mySplitResult = f.target.result.split("\n");
        
        for (ent in mySplitResult) {
          if(mySplitResult[ent].length<5) continue;
          var data = JSON.parse(mySplitResult[ent]);
          if(data['method'] == "blockchain.blocks.subscribe" || data['method'] == "blockchain.last.blocks"){
            data = data['params'][0];
              var height = data['block_height'];
              var numtx = data['num_tx'];
              var hash = data['block_hash'];
              var amount = data['sum_out'];
              var tmpstmp = data['timestamp'];
              addBlockRow(height,hash,numtx,amount,tmpstmp);
          }
          else if(data['method'] == "blockchain.tx.subscribe"){
            var hash = data['tx_id'];
            var timestamp = data['timestamp'];
            var outputs = data['params'][0]['outputs'];
            var totalOut = 0;
            for (var key in outputs) {
                totalOut += outputs[key]['value'];
            }
            addTxRow(hash,totalOut,timestamp);
          }
        }
      };
      fr.readAsBinaryString(event.data);
      

    }



  });

Most magic happens in socket.onmessage = function(event) { where the responses from the API server are handled.

I'm going to do "Block Overview Page".
Could you send me what's done so far?

Also, when you say block overview page, do you mean this? https://blockchain.info/block-index/376347/0000000000000000499aafcd5b6b4dd805576301d91e938e1d6c49bc872f7580


Title: Re: na
Post by: weex on March 20, 2014, 04:13:58 PM
This is great to see. I wonder if you all have considered using BitPay's insight explorer? http://live.bitcore.io/ I'm not sure how it gets data from the Bitcoin network but most of it should be portable to Litecoin.

By the way, I run LitecoinScout.com and have struggled majorly with Abe. The site is not functional now and I've lost patience maintaining that package. I would definitely be interested in getting it up and running with another solution. Sad thing is, I was also doing network difficulty graphs which would likely need an overhaul to work with another explorer solution but I would definitely do it.

Good luck!

Edit: Just took a look at what you have running and it looks great. It actually looks quite similar to insight. Either way, thanks for doing this and let us know how we can help.


Title: Re: na
Post by: pembo210 on January 25, 2015, 05:13:22 AM
Is this still live??

http://www.moonblocks.com:3000/

https://github.com/pembo210/Litesight

https://www.reddit.com/r/litecoin/comments/2tehxu/litesight_block_explorer_ready_to_go_full_install



Title: Re: na
Post by: b!z on January 25, 2015, 06:42:37 AM
Is this still live??

It doesn't matter because Litecoin is dead.


Title: Re: na
Post by: pembo210 on January 25, 2015, 07:40:43 AM
k


Title: Re: na
Post by: josef2000 on January 25, 2015, 11:28:40 AM
Maybe you could add AMOUNT SEARCH, no ther explorer has this feature. With this you can search transactions by amount easily!
Love the design, but cant go onto it, just saw the screenshot


Title: Re: na
Post by: AT101ET on January 27, 2015, 06:12:05 PM
This was posted almost a year ago.
Looks great. Any news with the development? This would be very handy!


Title: Re: na
Post by: guitarplinker on January 27, 2015, 07:44:40 PM
This was posted almost a year ago.
Looks great. Any news with the development? This would be very handy!
Looks like the project is dead, the site doesn't exist anymore.