Last active
April 9, 2022 01:24
-
-
Save Anderson-Juhasc/65e9e8256e5c7202a0871398162ec162 to your computer and use it in GitHub Desktop.
CriptoApp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require __DIR__ . '/vendor/autoload.php'; | |
use \Blocktrail\SDK\BlocktrailSDK; | |
$client = new BlocktrailSDK("api_key", "secret", "BTC", true /* testnet */); | |
$wallet = $client->initWallet("wallet_name", "password"); | |
$address = $wallet->getNewAddress(); | |
$btc_amount = 0.15; | |
?> | |
<p> | |
<a href="bitcoin:<?php echo $address; ?>?amount=<?php echo $btc_amount; ?>"><?php echo $address; ?></a> | |
</p> | |
<img src="https://api.qrserver.com/v1/create-qr-code/?size=180x180&data=bitcoin:<?php echo $address; ?>?amount=<?php echo $btc_amount; ?>" alt="" /> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/pusher/2.1.6/pusher.min.js"></script> | |
<script> | |
Pusher.host = 'slanger1.chain.so'; // our server | |
Pusher.ws_port = 443; // our server's port | |
Pusher.wss_port = 443; // ... | |
// create the pusher client connection | |
var pusher = new Pusher('e9f5cc20074501ca7395', { encrypted: true, disabledTransports: ['sockjs'], disableStats: true }); | |
// subscribe to the channel for address balance updates (new transactions only) | |
var ticker = pusher.subscribe('address_btctest_<?php echo $address; ?>'); | |
ticker.bind('balance_update', function(data) { | |
if (data.type == "address") { | |
console.log("Transação recebida:", data); | |
} | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
H