How I can use it to send transaction in my altcoin
coingeek opened this issue · 7 comments
I have my private key and public key.
how i can use this library to create transaction and push it with my nodes..
Regards,
I would start at this: https://github.com/Bit-Wasp/bitcoin-lib-php/blob/master/examples/raw_transaction.php get the information about the transaction, then create/sign it.
Then do:
$rpc = new JsonRpcClient(array("url"=>"bitcoinrpc:password@127.0.0.1:port")); $sentTxid = $rpc->sendrawtransaction($transactionHex);
BTW odds are if your transaction is rejected (error code -25? but no message) you had passed a tx with an 'insanely high fee'. You can override this check by doing sendrawtransaction($transactionHex, true)
I think..
bitcoin-cli help
will probably help here, all the RPC functions are as described on that page.
thanks for reply,
I need to know, how to use this library with my own altcoin,
what the parameters i should change,
thanks, it works,
but there is another issue,
my balance: 5 coin.
when i create transaction to send for example .5 coin.
the system take fees = 4.5 the rest of my balance??
how to resolve the transaction fees problem.
@coingeek you need to add a 'change output' yourself sending the other 4.5 coin back to your own address or to a new address of yourself
Yeah you need to be explicit about the amounts that you're moving.
When you make a transaction, there is actually nothing in the tx that restricts it to a network. so to answer what parameters you need to change, just be sure you explicitly set your version bytes address/p2sh, and if you're creating a coin please stick to the convention of the private key being AddressVersion + 128. There is a reason it's done that way in bitcoin, and this library depends on that to derive the private key's WIF.
I Generate the same public key from my private key using your library, so i think it is ok,
but the problem when i generate the tx, it, the network report it as (error -22),
I'm going to close this, think the problems are mainly due to using an older altcoin.