Advertisement
howtophil

Vote with Bitcoin in Javascript - Proof of Concept

Jul 30th, 2015
492
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <div id="bitvote">
  2.         <script>
  3.         var question = "Who is crazier, Nicki Minaj or Taylor Swift?";
  4.         var addpos = "13UUaxcfGVUAbNcK93PGnbwf3TLaYSymMS";
  5.         var addneg = "1Ci9SsaX5TUsmNhY34G49k1phqa8kCnKH2";
  6.         var addsnark = "1CxSMffZ4x7rP1SrpPqTZ4EMhHWX7QG2CE";
  7.         document.write("<hr><h3>Question: " + question + "</h3>");
  8.  
  9.         var xmlHttp = new XMLHttpRequest();
  10.         xmlHttp.open( "GET", "https://blockchain.info/q/getreceivedbyaddress/" + addpos, false );
  11.         xmlHttp.send( null );
  12.         document.write("Vote for Taylor Swift by sending Bitcoin to:<br><font size=2>" + addpos + "</font><br>");
  13.         document.write("<img src='https://blockchain.info/qr?data=" + addpos + "&size=100'><br>");
  14.         document.write("Satoshi Votes: ");
  15.         document.write(Number(xmlHttp.responseText).toLocaleString());
  16.         document.write("<br><br>");
  17.  
  18.         var xmlHttp = new XMLHttpRequest();
  19.         xmlHttp.open( "GET", "https://blockchain.info/q/getreceivedbyaddress/" + addneg, false );
  20.         xmlHttp.send( null );
  21.         document.write("Vote Nicki Minaj by sending Bitcoin to:<br><font size=2>" + addneg + "</font><br>");
  22.         document.write("<img src='https://blockchain.info/qr?data=" + addneg + "&size=100'><br>");
  23.         document.write("Satoshi Votes: ");
  24.         document.write(Number(xmlHttp.responseText).toLocaleString());
  25.         document.write("<br><br>");
  26.  
  27.         var xmlHttp = new XMLHttpRequest();
  28.         xmlHttp.open( "GET", "https://blockchain.info/q/getreceivedbyaddress/" + addsnark, false );
  29.         xmlHttp.send( null );
  30.         document.write("I'll Bitvote you!:<br><font size=2>" + addsnark + "</font><br>");
  31.         document.write("<img src='https://blockchain.info/qr?data=" + addsnark + "&size=100'><br>");
  32.         document.write("Satoshi Votes: ");
  33.         document.write(Number(xmlHttp.responseText).toLocaleString());
  34.         document.write("<br><br>");
  35.         </script>
  36. </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement