[Error][Solved] How to send transaction on Counterparty


#1

i was following this tutorial How to create a send transaction on Counterparty?.

I created my own testnet counterwallet and created a new token has name ‘longdd’

Using public coindaddy api end point to create a new raw transaction

{
“jsonrpc”: “2.0”,
“id”: 1,
“method”: “create_send”,
“params”: {
“source”: “mypcUU2fYyJav7XUpPLtMVhuPupArLJtiM”,
“destination”: “min4TCYKofu1weFiSkgBy7MGGtMPukhuHs”,
“asset”: “LONGDD”,
“quantity”: 10000
}
}

I sent 10000 token from my adress mypcUU2fYyJav7XUpPLtMVhuPupArLJtiM to my friend address min4TCYKofu1weFiSkgBy7MGGtMPukhuHs

Response:

{
“jsonrpc”: “2.0”,
“id”: 1,
“result”: “01000000017972f79269e7b2e6643cc736c853f4d3ff5bba6b434019d11bb7fb77d8483355010000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88acffffffff020000000000000000306a2e85fa6e8ba159a1d5e5c666944fd836819499d5ff7c39fce51726a8988d1c694532451c03d09cd6284f63f352fac35d3f5805000000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac00000000”
}

(P/s: Im using ruby)
From my mnemonic_code = “word1 word2 word3… word12”.
I converted to private key base58

prv_key256 = Digest::SHA256.hexdigest(mnemonic_code)
prv_key = Bitcoin::Key.new(prv_key256).to_base58 # wallet import format

Tried to sign above raw transaction:

bitcoin-cli --testnet signrawtransaction ‘01000000017972f79269e7b2e6643cc736c853f4d3ff5bba6b434019d11bb7fb77d8483355010000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88acffffffff020000000000000000306a2e85fa6e8ba159a1d5e5c666944fd836819499d5ff7c39fce51726a8988d1c694532451c03d09cd6284f63f352fac35d3f5805000000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac00000000’ ‘[]’ '[“prv_key here”]

I got error

{
“hex”: “01000000017972f79269e7b2e6643cc736c853f4d3ff5bba6b434019d11bb7fb77d8483355010000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88acffffffff020000000000000000306a2e85fa6e8ba159a1d5e5c666944fd836819499d5ff7c39fce51726a8988d1c694532451c03d09cd6284f63f352fac35d3f5805000000001976a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac00000000”,
“complete”: false,
“errors”: [
{
“txid”: “xxxxxx”,
“vout”: 1,
“scriptSig”: “”,
“sequence”: 4294967295,
“error”: “Operation not valid with the current stack size”
}
]
}

One more point,

I tried to decode raw transaction using live.blockcypher.com/btc/decodetx/ (not sure this is correct for cp tx or not) and found a missunderstand point.

        "script": "76a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac" 

why i didnt sign yet but scriptSig is existed.

{
“addresses”: [
“mypcUU2fYyJav7XUpPLtMVhuPupArLJtiM”
],
“block_height”: -1,
“block_index”: -1,
“confirmations”: 0,
“data_protocol”: “unknown”,
“double_spend”: false,
“fees”: 6175,
“hash”: “de1b101babddd23dacb114f27e4a026e8a2181cd84dc015291367abca0805573”,
“inputs”: [
{
“addresses”: [
“mypcUU2fYyJav7XUpPLtMVhuPupArLJtiM”
],
“age”: 1261026,
“output_index”: 1,
“output_value”: 89675644,
“prev_hash”: “553348d877fbb71bd11940436bba5bffd3f453c836c73c64e6b2e76992f77279”,
“script”: “76a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac”,
“script_type”: “pay-to-pubkey-hash”,
“sequence”: 4294967295
}
],
“outputs”: [
{
“addresses”: null,
“data_hex”: “85fa6e8ba159a1d5e5c666944fd836819499d5ff7c39fce51726a8988d1c694532451c03d09cd6284f63f352fac3”,
“script”: “6a2e85fa6e8ba159a1d5e5c666944fd836819499d5ff7c39fce51726a8988d1c694532451c03d09cd6284f63f352fac3”,
“script_type”: “null-data”,
“value”: 0
},
{
“addresses”: [
“mypcUU2fYyJav7XUpPLtMVhuPupArLJtiM”
],
“script”: “76a914c8c934c4ad0fa394fd01747c375957f30752e26f88ac”,
“script_type”: “pay-to-pubkey-hash”,
“value”: 89669469
}
],
“preference”: “low”,
“received”: “2018-01-29T10:58:39.830163057Z”,
“relayed_by”: “54.166.89.207”,
“size”: 167,
“total”: 89669469,
“ver”: 1,
“vin_sz”: 1,
“vout_sz”: 2
}

Looking for any help, Thanks you so much. I was struggling with it over a week.


#2

Maybe it is that issue?


#3

thanks @foldinger let me take a look


#5

i found problem is wrong private key, thanks you everybody