There's really no need for PHP, you could do it client-side with javascript and websocket. In fact I just did a blog post for blockchain.info on how to do this. https://blog.blockchain.com/2017/01/04/intro-to-bitcoin-development/However if you really want PHP it's easy enough, but new donations won't show up LIVE unless you use something like websocket or AJAX. <?php $address = "YOUR_BTC_ADDRESS";
$qrurl = "http://chart.googleapis.com/chart?chs=125x125&cht=qr&chl=".$address; $qrcode = "<img src='".$qrurl."'>"; //this is just an image created using google charts API
//get JSON data on address using blockchain.info free public API $url = "https://blockchain.info/address/".$address."?format=json"; $json = json_decode(file_get_contents($url), true);
?> <html> <body> Bitcoin Donations Accepted <br> <?php echo $qrcode; ?> <br> <table> <tr> <td>Received From</td> <td>Amount</td> </tr> <?php //loop through the last 4 received donations for($i=0;$i<5;$i++){ $outputs = count($json["txs"][$i]["out"]); //loop through each output of the tx for($ii=0;$ii<$outputs;$ii++){ //check if output addy matches our donation addy $outaddy = $json["txs"][$i]["out"][$ii]["addr"]; $value = $json["txs"][$i]["out"][$ii]["value"]; $value = $value / 100000000; if($outaddy == $address){ echo "<tr><td>".$json['txs'][$i]['inputs'][0]['prev_out']['addr']."</td><td>".$value."BTC</td></tr>"; } } } ?> </table> </body> </html>
Example output:
|
|
|
for (var i=1;i<5;i--) { ... }
This is an infinite loop, not good. Create a div that takes up the whole page with CSS and give it an overflow-wrap property of break-word <head> <style> #numbers{ width: 100%; height: 900px; background-color: #aeaeae; overflow-wrap: break-word; } </style> </head> <div id="numbers"></div>
Then write a simple loop that adds each new random number to the end of the string enough times to fill the page, but not infinitely. var filler = ""; for(i=0;i<3500;i++){ var num = Math.floor(Math.random() * 9) + 1; filler += num; } document.getElementById("numbers").innerHTML = filler;
https://jsfiddle.net/4qwercqu/
|
|
|
It used to be really easy to get an API key. Over the past year or so they've been tightening up on who they will give an API key. It needs to be a legitimate use case. Like you said this makes it difficult to test it out. I recommend you try applying again and provide as much info as you can, or contact their support or twitter that you are looking to get an API key for testing their service. My suspicion is that they are trying to prevent people from using their free service to create gambling sites, or predatory sites to steal others bitcoins.
Also there are other API services you could try or use bitcoind JSON-RPC. Good luck!
|
|
|
Aye boys, happy new year! Came here expecting this thread would be bumped, was not disappointed.
|
|
|
You're looking to build an app similar to blockchain.info / Block.io or a site using blockchain.info / Block.io?
Either way you should be prepared to spend some money. You're right, Block.io is only 100 addresses for free, but they have one of the easiest APIs out there. As others suggested you can just use a library and build and broadcast transactions yourself, or you can run bitcoind and use the built-in JSON-RPC.
|
|
|
My question is, if I wanted someone to build a platform like this for me, how in the heck would I describe it to them?
You could say that you are looking for a user login system that integrates bitcoin payments with it's users.
|
|
|
Back up your private keys or secret seed on both a USB and paper in different places. Practice importing and exporting keys from your USB and from paper until you are comfortable that you 100% know how it works and how to recover your funds if you computer blows up tomorrow.
|
|
|
Have you tried using blocktrail's web hook notifications? It's insanely easy to setup, even has a UI. Fill out a form and then if you want provide a callback URL to run a url or fire off some code on notification. https://youtu.be/UJtszjNh0nk?t=30sOr you could even subscribe to a websocket like blockchain.info's to monitor for transactions on the network without having to run a node. Their websocket API doesn't require an API key.
|
|
|
Is there any info on accepting bitcoin payments for forum subscriptions? via MyBB?
Not that I'm aware of. If you can sort out the MyBB code well enough where you can customize it along with adding a new database table for addresses where you can correlate them with the userids and how much they've paid, time since paid, etc. Should be do-able. Owesome!!!! Bookmarked
Anyway... didn't you interested to translate into another languages? Maybe I can help to translated into Indonesian. Please let me know.
Absolutely, feel free to re-use and translate.
|
|
|
Soon.
It's Loaded... The legend is true. EDIT: For those unfamiliar it is rumored that he has over 100K coins and he called the last bubble. he also showed up in april 2014 when the bear market really started going for it. i am still burnt from that tbh edit: btw it's not a rumor. this is crypto we're talking about! check his signed message, i clicked through twice and found 40,000 coins: https://blockchain.info/address/19Mz2o9RDABT74SA9njZqMtJXKEzj2qUoHYea I remember that, I don't remember if he signed proof for 100K though?
|
|
|
Soon.
It's Loaded... The legend is true. EDIT: For those unfamiliar it is rumored that he has over 100K coins and he called the last bubble.
|
|
|
where are lambi, tarmi and the other bearfarts? remember how they wrote "bulltards" nearly every minute in this thread as we went from 200 to 220? Wow I forgot about lambchop ... does that troll still troll?
|
|
|
I only come to this thread now during bull runs. I see it's still a fun place!
|
|
|
Thanks! Most people wouldn't really want to make how to's unless money is involved.
Yes, I do try to provide as much free information as possible to help others and support the ecosystem. Technically there is money involved though, I do get paid by youtube for letting them play ads. I also have a book for sale. But I do believe it's very important to have this information available for free. We need more of it. To anyone out there that might be a dev -- and I know there are a bunch of good ones in bitcoin -- feel free to post your stuff on this thread and I can add it to the main post. It would be nice to have a mega thread of community created bitcoin web dev guides. Doesn't have to be a video, it can be a blog post instead.
|
|
|
It's unable to connect to the websocket, because it's not using https. socket.io.js:2919 GET http://socket.moneypot.com/socket.io/?EIO=3&transport=polling&t=1480788720215-8 net::ERR_CONNECTION_REFUSED Alter your script back to https, and change your host to support https (or just use cloudflare free https cert)
|
|
|
my site: opdice.com is working perfectly except for 1 part. The chat. It seems to be stuck on loading forever. I really need this to work, if anyone could help, that would be great
if you didn't change anything on the script except on the first 10 lines on the app.js it is on moneypot side's problem. try to visit other app if their chat is working I followed a tutorial on youtube. and 0ther sites using his script have the chat working It's moneypot, they're down currently. {"error":"INTERNAL_ERROR"}
|
|
|
Really sorry for the trouble. I believe this should now work. Thank you again. -----BEGIN BITCOIN SIGNED MESSAGE----- Today is December 3 2016 and this is neochiny signing this address for reference -----BEGIN BITCOIN SIGNATURE----- 1N2mG4fgTCn5fUgPEKUJQEYBXAoBU1MBjd IBvFD4Zns/BlZJRwxT3/AjXAr4HfxP1xl4RyMKqAjaUKpgQcR5dcxP3Tx93DsJjGObqgSziKBAwMOp2xJIMGPIs= -----END BITCOIN SIGNATURE----- Quoted, and signed message verifies to 1N2mG4fgTCn5fUgPEKUJQEYBXAoBU1MBjd
|
|
|
|