<?php
include_once "include/lib.php";
function doublespend($txid){
$bitcoin=get_bitcoin();
$rawtx=$bitcoin->getrawtransaction($txid,1);
$fee=ceil(strlen($rawtx['hex'])/2000)*0.0005;
echo $fee;
$i="";
$txinarray=array();
foreach ($rawtx['vin'] as $vin){
$txin=array();
$txin["txid"]=$vin['txid'];
$txin["vout"]=$vin['vout'];
}
$txoutarray=array();
$feeaddress=array();
foreach($rawtx['vout'] as $vout){
$address=$vout['scriptPubKey']['addresses'][0];
if (floatval($vout['value'])<1)
$txoutarray[$address]=floatval($vout['value']);
else
$feeaddress[$address]=floatval($vout['value']);
}
$rawTx=$bitcoin->createrawtransaction($txinarray,$txoutarray);
print_r($rawTx);
$bitcoin->walletpassphrase($GLOBALS['WALLETPASS'],5);
$signTx=$bitcoin->signrawtransaction($rawTx);
print_r($signTx);
$txid=$bitcoin->sendrawtransaction($signTx['hex']);
print_r($txid);
}
doublespend('ee082cd20d6bd35380d1311f84ca4ff967d72821aa12ca3f354718c3a5208e66');
?>