Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Peercoin blockchain parser

Description

This program can parse the blockchain contained in a file and export some of its data to a text file, a SQL script or a database. It can also create a database using the RPC of a Peercoin daemon as source of data instead of a blockchain file.

It is written in Common Lisp.

Dependencies

Installation

  • Install quicklisp to manage the packages.
  • Install the dependencies: (ql:quickload '("cl-json" "cl-dbi" "drakma" "flexi-streams" "ironclad" "local-time"))
  • Copy the source code of the peercoin blockchain parser where you want it to be.
  • Tell your Common Lisp implementation where to find the sources:
    • (push "directory-where-the-sources-are/" asdf:*central-registry*)
    • If you don't want to type this line every time, you can add it to the initialization file (e.g.: .sbclrc, .ccl-init.lisp, .eclrc).

Configuration

Edit the configuration file (config.lisp) to indicate where to find the blockchain file, the Peercoin daemon and the database server.

Usage

First, load the parser package:

(require 'peercoin-blockchain-parser)
(in-package peercoin-blockchain-parser)

To export the data from the blockchain to a SQL script:

(sql-make-script-from-blockchain "peercoin-blockchain.sql")

To export the data from the blockchain to a text file:

(txt-make-file-from-blockchain "peercoin-blockchain.txt")

To export raw blocks from the blockchain to a file:

(raw-extract-blocks-from-blockchain '("hash1" "hash2" ...) "blocks.dat")

To create a database from scratch using a running Peercoin daemon:

(rdbms-initialize-database)
(rdbms-update-database-from-rpc)

To update a database using a running Peercoin daemon:

(rdbms-update-database-from-rpc)

To update a database using the blockchain:

(rdbms-update-database-from-blockchain)

To get the balance of an address:

(rdbms-get-balance "PWFNV1Cvq7nQBRyRueuYzwmDNXUGpgNkBC")

To get the transaction history of an address:

(rdbms-get-history "PWFNV1Cvq7nQBRyRueuYzwmDNXUGpgNkBC")

To get the list of the 20 richest addresses:

(rdbms-get-rich-addresses 20)

To get the list of the unspent transactions of an address:

(rdbms-get-unspent-transactions "PWFNV1Cvq7nQBRyRueuYzwmDNXUGpgNkBC")

To get the list of the addresses with a positive balance at block 12345:

(rdbms-get-balances-at-block 12345)

Donations

If you find this program useful and want to make a donation, you can send coins to the following Peercoin address: PWFNV1Cvq7nQBRyRueuYzwmDNXUGpgNkBC.

About

Peercoin blockchain parser

Resources

License

Releases

No releases published

Packages

No packages published