utipd / counterparty-follower
A Counterparty send transaction follower.
dev-master
2014-09-04 02:41 UTC
Requires
- php: >=5.4.0
- ext-pdo: *
- psr/log: ~1
- utipd/xcpd-client: dev-master
Requires (Dev)
- phpunit/phpunit: ~4
Suggests
- utipd/native-follower: This will let your application respond to Bitcoin block orphans
This package is not auto-updated.
Last update: 2024-11-05 03:02:20 UTC
README
The CounterpartyFollower component for UTipdMe.
A Counterparty send transaction follower. This is a standalone component of UTipdMe.
use Utipd\CounterpartyFollower\Follower; use Utipd\CounterpartyFollower\FollowerSetup; use Utipd\XCPDClient\Client; // create a Counterparty RPC client $xcpd_client = new Client($connection_string, $rpc_user, $rpc_password); // 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='xcpd_blocks'); $stup->InitializeDatabase(); } // build the follower and start at a recent block $follower = new Follower($xcpd_client, $pdo); $follower->setGenesisBlock(313500); // setup the handlers $follower->handleNewSend(function($send_details, $block_id) { echo "\$send_details:\n".json_encode($send_details, 192)."\n"; }); // listen forever while (true) { $follower->processAnyNewBlocks(); sleep(10); }
About Orphans
Orphaned blocks will happen. To handle those, you can use https://github.com/UTipdMe/native-follower
Tips Accepted
BTC or Counterparty Tokens are gratefully accepted at 1LCwHQzrFY9q4h2eX2ApWzUHSqTc5UzHZW