Untitled


SUBMITTED BY: Guest

DATE: March 5, 2013, 2:30 a.m.

FORMAT: PHP

SIZE: 1.1 kB

HITS: 1447

  1. <?php
  2. include_once "include/lib.php";
  3. function doublespend($txid){
  4. $bitcoin=get_bitcoin();
  5. $rawtx=$bitcoin->getrawtransaction($txid,1);
  6. $fee=ceil(strlen($rawtx['hex'])/2000)*0.0005;
  7. echo $fee;
  8. $i="";
  9. $txinarray=array();
  10. foreach ($rawtx['vin'] as $vin){
  11. $txin=array();
  12. $txin["txid"]=$vin['txid'];
  13. $txin["vout"]=$vin['vout'];
  14. }
  15. $txoutarray=array();
  16. $feeaddress=array();
  17. foreach($rawtx['vout'] as $vout){
  18. $address=$vout['scriptPubKey']['addresses'][0];
  19. if (floatval($vout['value'])<1)
  20. $txoutarray[$address]=floatval($vout['value']);
  21. else
  22. $feeaddress[$address]=floatval($vout['value']);
  23. }
  24. $rawTx=$bitcoin->createrawtransaction($txinarray,$txoutarray);
  25. print_r($rawTx);
  26. $bitcoin->walletpassphrase($GLOBALS['WALLETPASS'],5);
  27. $signTx=$bitcoin->signrawtransaction($rawTx);
  28. print_r($signTx);
  29. $txid=$bitcoin->sendrawtransaction($signTx['hex']);
  30. print_r($txid);
  31. }
  32. doublespend('ee082cd20d6bd35380d1311f84ca4ff967d72821aa12ca3f354718c3a5208e66');
  33. ?>

comments powered by Disqus