Skip to content

PHP script that populates a MySQL database with Counterparty data

License

Notifications You must be signed in to change notification settings

btc-fi/counterparty2mysql

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

counterparty2mysql

counterparty2mysql is a php script which populates a mysql database with counterparty data.

counterparty2mysql loads Counterparty data by requesting 'messages' data for a block from the Counterparty API, and then processing each message. The Counterparty 'messages' table holds a list of all of the insert and update actions performed on counterparty tables.

By default counterparty2mysql starts at the first block with a Counterparty transaction (mainnet=278270, testnet=310000) and parses data for all blocks between the starting block and the current block.

If no starting block is given, counterparty2mysql will try to resume parsing at the last successfully parsed block, or use the first block with a counterparty transaction.

Database Customizations

  • Index all assets, addresses, transactions, and contracts
  • create assets table with up to date summary information
  • create balances table to track address/asset balance information
  • create blocks table and index transaction hashes
  • create index_tx table to track tx_index/type information
  • create dispenses table to track dispenser dispenses
  • create markets table to track decentralized exchange (DEX) market info

Setup

echo "CREATE DATABASE IF NOT EXISTS Counterparty" | mysql
echo "CREATE DATABASE IF NOT EXISTS Counterparty_Testnet" | mysql
cat sql/*.sql | mysql Counterparty
cat sql/*.sql | mysql Counterparty_Testnet

Bootstrap Information

Command line arguments

--testnet    Load testnet data
--regtest    Load regtest data
--block=#    Load data for given block
--single     Load single block
--rollback=# Rollback data to a given block
--silent     Fail silently on insert errors

Database Information

Counterparty tables (populated via 'messages')

EVM-related tables

Additional tables (populated by counterparty2mysql):

Helpful? Donate BTC, XCP or any Counterparty asset to 1JDogZS6tQcSxwfxhv6XKKjcyicYA4Feev

About

PHP script that populates a MySQL database with Counterparty data

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%