• Forum has been upgraded, all links, images, etc are as they were. Please see Official Announcements for more information

dash-tx - error: invalid transaction encoding

calnaughtonjnr

Active member
Foundation Member
I'm trying to use this

Code:
./dash-tx -json 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee

And I'm getting

Code:
error: invalid transaction encoding

I just copied the syntax from the bitcoin example here

Can anyone tell me where I'm going wrong please?
 
You need to provide complete rawtx there and not just txid
Code:
> dash-cli getrawtransaction 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
> dash-tx -json 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
{
    "txid": "7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee",
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "coinbase": "03002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f",
            "sequence": 0
        }
    ],
    "vout": [
        {
            "value": 4.03,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 df64cd9655d46318e33d293cb83a848a2ab12ba5 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914df64cd9655d46318e33d293cb83a848a2ab12ba588ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xw43GxB6uYmGZYwV61vhf46DsPvHY4popZ"
                ]
            }
        }, 
        {
            "value": 1.0075,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 2e924d7cc4918e3046b84ffc146769890a9aa132 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xew6BNCv5bE4Yu8yiWhceNNDzw3mf29pUe"
                ]
            }
        }
    ],
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000"
}
 
You need to provide complete rawtx there and not just txid
Code:
> dash-cli getrawtransaction 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
> dash-tx -json 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
{
    "txid": "7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee",
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "coinbase": "03002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f",
            "sequence": 0
        }
    ],
    "vout": [
        {
            "value": 4.03,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 df64cd9655d46318e33d293cb83a848a2ab12ba5 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914df64cd9655d46318e33d293cb83a848a2ab12ba588ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xw43GxB6uYmGZYwV61vhf46DsPvHY4popZ"
                ]
            }
        },
        {
            "value": 1.0075,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 2e924d7cc4918e3046b84ffc146769890a9aa132 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xew6BNCv5bE4Yu8yiWhceNNDzw3mf29pUe"
                ]
            }
        }
    ],
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000"
}
What is the purpose of bitcoin-tx or dash-tx in that example ? I've read that stackexchange page several times but i still don't understand, and there's not a clear explanation anywhere i can find. Thanks, Udjin.
 
What is the purpose of bitcoin-tx or dash-tx in that example ? I've read that stackexchange page several times but i still don't understand, and there's not a clear explanation anywhere i can find. Thanks, Udjin.
well, that example is not the best one :)

somecoin-tx is a tool to construct/modify transaction raw data
Code:
> dash-tx -?
Dash Core dash-tx utility version v0.12.0.51-afa37a8

Usage:
  dash-tx [options] <hex-tx> [commands]  Update hex-encoded dash transaction
  dash-tx [options] -create [commands]   Create hex-encoded dash transaction

Options:
  -?                      This help message
  -create                 Create new, empty TX.
  -json                   Select JSON output
  -txid                   Output only the hex-encoded transaction id of the resultant transaction.
  -regtest                Enter regression test mode, which uses a special chain in which blocks can be solved instantly.
  -testnet                Use the test network

Commands:
  delin=N                Delete input N from TX
  delout=N               Delete output N from TX
  in=TXID:VOUT           Add input to TX
  locktime=N             Set TX lock time to N
  nversion=N             Set TX version to N
  outaddr=VALUE:ADDRESS  Add address-based output to TX
  outscript=VALUE:SCRIPT Add raw script output to TX
  sign=SIGHASH-FLAGS     Add zero or more signatures to transaction
      This command requires JSON registers:
      prevtxs=JSON object
      privatekeys=JSON object
      See signrawtransaction docs for format of sighash flags, JSON objects.

Register Commands:
  load=NAME:FILENAME     Load JSON file FILENAME into register NAME
  set=NAME:JSON-STRING   Set register NAME to given JSON-STRING

But if you already know txid it's easier to use "dash-cli getrawtransaction 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee 1" to get the same info, there is no need to do this in 2 steps.
 
You need to provide complete rawtx there and not just txid
Code:
> dash-cli getrawtransaction 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee
01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
> dash-tx -json 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000
{
    "txid": "7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee",
    "version": 1,
    "locktime": 0,
    "vin": [
        {
            "coinbase": "03002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f",
            "sequence": 0
        }
    ],
    "vout": [
        {
            "value": 4.03,
            "n": 0,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 df64cd9655d46318e33d293cb83a848a2ab12ba5 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a914df64cd9655d46318e33d293cb83a848a2ab12ba588ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xw43GxB6uYmGZYwV61vhf46DsPvHY4popZ"
                ]
            }
        },
        {
            "value": 1.0075,
            "n": 1,
            "scriptPubKey": {
                "asm": "OP_DUP OP_HASH160 2e924d7cc4918e3046b84ffc146769890a9aa132 OP_EQUALVERIFY OP_CHECKSIG",
                "hex": "76a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac",
                "reqSigs": 1,
                "type": "pubkeyhash",
                "addresses": [
                    "Xew6BNCv5bE4Yu8yiWhceNNDzw3mf29pUe"
                ]
            }
        }
    ],
    "hex": "01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff2703002a02062f503253482f04308d235408680001e53e0000000d2f6e6f64655374726174756d2f0000000002c04a0518000000001976a914df64cd9655d46318e33d293cb83a848a2ab12ba588acb0520106000000001976a9142e924d7cc4918e3046b84ffc146769890a9aa13288ac00000000"
}


Thanks UdjinM6 :grin:

Is there a command or option that will also output the datetime for transactions?
 
Thanks UdjinM6 :grin:

Is there a command or option that will also output the datetime for transactions?
"getrawtransaction 7be88fd06434229ab32cfeb20824f434c51884a77b4b4d068646f03dde2e23ee 1" should have a time field (unix timestamp)
or try listtransactions to get a list (should also have unix "time", use "help listtransactions" to get info about params)
use libs to convert it programmatically or some website like http://www.unixtimestamp.com/ to do it manually :smile:
 
Back
Top