Sunday 30 June 2019

Create ExclusiveCoin rawtransaction

This post will assume certain knowledge and will skip some steps.
We will work with the windows-qt, but the process is basically similar across platform/builds.

It is possible to create rawtransations that are invalid, or from any input not mine, this article will use currently available inputs.

NOTE:
I successfully created and sent a 2 in 1 out rawtransaction using zero fee.
however attempting a 2 in 2 out resulted in fails while using up to 1 EXCL in fee, I did not test any higher and have no idea about any other variations.



there are three basic steps,
1) createrawtransaction
2) signrawtransaction
3) sendrawtransaction

Using listunspent will give you a current list of available inputs,


1)                                    
I will use the last two. All we need is the txid, vout and value.
        "txid" : "fe59b03a782aa6a393f2a5d7fa58df0a431644ad3edecac14ae05ffa838948b6",
        "vout" : 1,
        "amount" : 44.25000000,

        "txid" : "fe7eba5f0d567accd27fdca08f3f83724f5143b3fb46cdd915819bbc2438c030",
        "vout" : 1,
        "amount" : 28.08000000,

entering createrawsation in the console gives the basic format as
[{"txid":txid,"vout":n},...] {address:amount,...}
now you will actually find this doesnt work as the " are special characters and will need some extra fuckery.
there are a couple ways of handling the fuckery both of these should work ok
'[{"txid":txid,"vout":n},...]' '{"address":amount,...}'
"[{\"txid\":txid,\"vout\":n},...]" "{\"address\":amount,...}"


filling in the input data gives
'[{"txid":"fe59b03a782aa6a393f2a5d7fa58df0a431644ad3edecac14ae05ffa838948b6","vout":1,"txid":"fe7eba5f0d567accd27fdca08f3f83724f5143b3fb46cdd915819bbc2438c030","vout":1}]' {address:amount,...}

the two inputs give a total value of 72.33 EXCL
any amount that is not sent in the next section will become the transaction fee
so if I only sent 42 to myself 
example
'{"EZYdgoGwqhvGxKZuWRRZjEzfQS7oi2H6YE":42}'
then the remaining 30.33 EXCL will go to the miner.

so I will include most of the coins instead and enter into rpc console

createrawtransaction '[{"txid":"fe59b03a782aa6a393f2a5d7fa58df0a431644ad3edecac14ae05ffa838948b6","vout":1,"txid":"fe7eba5f0d567accd27fdca08f3f83724f5143b3fb46cdd915819bbc2438c030","vout":1}]' '{"EZYdgoGwqhvGxKZuWRRZjEzfQS7oi2H6YE":42,"EcArdpTnA47ZSNM2TLELFPUXsJkiy63Gyk":30.33}'

response
010000009f99195d01b6488983fa5fe04ac1cade3ead4416430adf58fad7a5f293a3a62a783ab059fe0100000000ffffffff0200ea56fa000000001976a914b3ce628b3a22911b42d3a33b50eba720dab8252988ac40e8c7b4000000001976a914d0986b8ba8854573452664eb4ba0850dfb2ce24e88ac00000000

2)                                    
signrawtransaction 010000009f99195d01b6488983fa5fe04ac1cade3ead4416430adf58fad7a5f293a3a62a783ab059fe0100000000ffffffff0200ea56fa000000001976a914b3ce628b3a22911b42d3a33b50eba720dab8252988ac40e8c7b4000000001976a914d0986b8ba8854573452664eb4ba0850dfb2ce24e88ac00000000

response
{
    "hex" : "010000009f99195d01b6488983fa5fe04ac1cade3ead4416430adf58fad7a5f293a3a62a783ab059fe0100000049483045022100d937eec63ec6939ed2f5cd4f26c7d1dff3badf28baa0bb50cc2c94aeb4869eb002207d36a7d518e81b83fd6940813b829f737551e38968cb188b81b1dd0e7633134b01ffffffff0200ea56fa000000001976a914b3ce628b3a22911b42d3a33b50eba720dab8252988ac40e8c7b4000000001976a914d0986b8ba8854573452664eb4ba0850dfb2ce24e88ac00000000",
    "complete" : true
}
3)                                   
sendrawtransaction 010000009f99195d01b6488983fa5fe04ac1cade3ead4416430adf58fad7a5f293a3a62a783ab059fe0100000049483045022100d937eec63ec6939ed2f5cd4f26c7d1dff3badf28baa0bb50cc2c94aeb4869eb002207d36a7d518e81b83fd6940813b829f737551e38968cb188b81b1dd0e7633134b01ffffffff0200ea56fa000000001976a914b3ce628b3a22911b42d3a33b50eba720dab8252988ac40e8c7b4000000001976a914d0986b8ba8854573452664eb4ba0850dfb2ce24e88ac00000000

response
TX rejected (code -22)

lol. it's cos of the tx fee.
using a single output allows a zero EXCL fee,

createrawtransaction '[{"txid":"fe7eba5f0d567accd27fdca08f3f83724f5143b3fb46cdd915819bbc2438c030","vout":1}]' '{"EZYdgoGwqhvGxKZuWRRZjEzfQS7oi2H6YE":28.08000000}'

but with the above 2 in 2out tx I tested up to 1 EXCL and it's still being rejected.
so
the outcome is the method above works but you will need to include a correct txfee for it to work.




ALSO
it's possible to create an invalid or otherwise rejected transaction.
possible reasons may be, input is already spent, value out exceeds value in, not enough fees.




1 comment:

  1. Mohegan Sun's new online sports betting app is now live! - KTM
    Mohegan Sun's new online sports betting app 상주 출장샵 is now live! · Get into 상주 출장샵 the 상주 출장샵 action with our new interactive app, 상주 출장샵 which can be used on 보령 출장마사지

    ReplyDelete