Post
Topic
Re: Read and convert UTXO to normal view!
by
Tigr1987
on 12/02/2019, 15:12:31 UTC
I think a bit more context is needed here to make helping easier. What tool / API did you use to get this dataset?

I wrote a script for node js that pulls the entire base of the key -- value pair and saves everything to a file


Code:
var level = require('level')
const fs = require("fs");
var i=0;
var db = level('chainstate' ,{keyEncoding:'hex',valueEncoding:'hex'})
var s='';


function hextoString(str){
const buf = new Buffer(str, 'hex');
return buf.toString('utf-8');
}

db.createReadStream({ keys: true, values: true })
  .on('data', function (data) {

s='{'+data.key+'--'+data.value+'}'
console.log(s);

fs.appendFileSync("base.db", s);
i=i+1;
console.log(i);

    
 })

console.log('**************************************');