dev-master
9999999-devA Bitcoin blockchain block and transaction follower.
MIT
The Requires
- php >=5.4.0
- ext-pdo *
- nbobtc/bitcoind-php dev-master
- guzzlehttp/guzzle ~4
The Development Requires
by Devon Weller
block bitcoin transaction orphans
Wallogit.com
2017 © Pedro Peláez
A Bitcoin blockchain block and transaction follower.
A Bitcoin block and transaction follower. This is a standalone component of UTipdMe., (*1)
Here's a sample, (*3)
use Utipd\NativeFollower\FollowerSetup; use Utipd\NativeFollower\Follower; use Nbobtc\Bitcoind\Bitcoind; use Nbobtc\Bitcoind\Client; // create a bitcoin RPC client $bitcoin_client = new Bitcoind(new Client("http://{$rpc_user}:{$rpc_password}@{$host}:{$port}")); // init a mysql database connection $pdo = new \PDO($db_connection_string, $db_user, $db_password); // create the MySQL tables if ($first_time) { $setup = new FollowerSetup($pdo, $db_name='bitcoin_blocks'); $stup->InitializeDatabase(); } // build the follower and start at a recent block $follower = new Follower($bitcoin_client, $pdo); $follower->setGenesisBlock(313500); // setup the handlers $follower->handleNewBlock(function($block_id) { echo "New block: $block_id\n"; }); $follower->handleNewTransaction(function($transaction, $block_id) { echo "\$transaction:\n".json_encode($transaction, 192)."\n"; }); $follower->handleOrphanedBlock(function($orphaned_block_id) { echo "Orphaned block: $orphaned_block_id\n"; }); // listen forever while (true) { $follower->processAnyNewBlocks(); sleep(10); }
BTC or Counterparty Tokens are gratefully accepted at 1HKXoNbTCFY7kKWzJ929aFU6Z42K5CdgY, (*4)
A Bitcoin blockchain block and transaction follower.
MIT
block bitcoin transaction orphans