<?php // # Get UTXOs // Get only unspent transaction outputs. // This method allows you to retrieve details about an Address only with the unspent transactions. // // API called: '/v1/btc/main/addrs/1DEP8i3QJC...62aGvhD?unspentOnly=true' require __DIR__ . '/../bootstrap.php'; /// override default sample address with GET parameter if (isset($_GET['address'])) { $sampleAddress = filter_input(INPUT_GET, 'address', FILTER_SANITIZE_SPECIAL_CHARS); } else { $sampleAddress = '1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD'; // Default address for samples } $addressClient = new \BlockCypher\Client\AddressClient($apiContexts['BTC.main']); try { $params = array('unspentOnly' => 'true'); $address = $addressClient->get($sampleAddress, $params); } catch (Exception $ex) { ResultPrinter::printError("Get Address", "Address", $sampleAddress, null, $ex); exit(1); } ResultPrinter::printResult("Get Address", "Address", $address->getAddress(), null, $address); return $address;
<?php // # Get Address // The Address resource allows you to retrieve details about an Address. // // API called: '/v1/btc/main/addrs/1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD' require __DIR__ . '/../bootstrap.php'; /// override default sample address with GET parameter if (isset($_GET['address'])) { $sampleAddress = filter_input(INPUT_GET, 'address', FILTER_SANITIZE_SPECIAL_CHARS); } else { $sampleAddress = '1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD'; } $addressClient = new \BlockCypher\Client\AddressClient($apiContexts['BTC.main']); try { $address = $addressClient->get($sampleAddress, array(), $apiContexts['BTC.main']); } catch (Exception $ex) { ResultPrinter::printError("Get Address", "Address", $sampleAddress, null, $ex); exit(1); } ResultPrinter::printResult("Get Address", "Address", $address->getAddress(), null, $address); return $address;
<?php // # Get HDWallet as Address // The Address endpoint allows you to retrieve details about a HDWallet as Address. // // API called: '/v1/btc/main/addrs/HDWallet-Name' require __DIR__ . '/../bootstrap.php'; if (isset($_GET['wallet_name'])) { $walletName = filter_input(INPUT_GET, 'wallet_name', FILTER_SANITIZE_SPECIAL_CHARS); } else { $walletName = 'bob'; // Default hd wallet name for samples } $addressClient = new \BlockCypher\Client\AddressClient($apiContexts['BTC.main']); try { $address = $addressClient->get($walletName); } catch (Exception $ex) { ResultPrinter::printError("Get HDWallet Address", "Address", $walletName, null, $ex); exit(1); } ResultPrinter::printResult("Get HDWallet Address", "Address", $address->getAddress(), null, $address); return $address;
<?php // # Get Testnet Address // The Address resource allows you to retrieve details about an Address. // // API called: '/v1/btc/main/addrs/1DEP8i3QJCsomS4BSMY2RpU1upv62aGvhD' require __DIR__ . '/../bootstrap.php'; /// override default sample address with GET parameter if (isset($_GET['address'])) { $sampleAddress = filter_input(INPUT_GET, 'address', FILTER_SANITIZE_SPECIAL_CHARS); } else { $sampleAddress = '2N66DDrmjDCMM3yMSYtAQyAqRtasSkFhbmX'; } $addressClient = new \BlockCypher\Client\AddressClient($apiContexts['BTC.test3']); try { $address = $addressClient->get($sampleAddress); } catch (Exception $ex) { ResultPrinter::printError("Get Address BTC Test3", "Address", $sampleAddress, null, $ex); exit(1); } ResultPrinter::printResult("Get Address BTC Test3", "Address", $address->getAddress(), null, $address); return $address;