upgrade and approve transaction

+4 votes

Dear Team,

today I upgraded my node from ver 2.0.1 up to 2.3.3 in order touse the APIs.

After download and installing the latest MC software,I realized that I need to upgrade the protocol version too.
I tried to build directly the raw transaction in order to have full control on it and to sign off line with the admin private key but I didnt' succeded.

1. Could you explain how to build the raw transaction for upgrading and approving ?

As alternative solution, I connected my laptop where I install a new node and the admin priv key.
I typed the following:
multichain-cli chainName createfrom <admin address> upgrade protocol_upgrade false '{"protocol-version":20013}

and then
multichain-cli.exe chainName approvefrom <admin address> "protocol_upgrade" true
        "name" : "protocol_upgrade",
        "createtxid" : "92d851ffe1ecd1988ce8722c4aef5b144527fc68995e9247ccb61229e4a1da59",
        "params" : {
            "protocol-version" : 20013
        "startblock" : 0,
        "approved" : true,
        "appliedblock" : 17907,
        "appliedparams" : {
            "protocol-version" : 20013
        "skippedparams" : {
        "admins" : [
        "required" : 0

Everything is ok and I got the following txid

I tried to decode the txid with
decoderawtransaction d4b39e2dee8517de28b6162ba0f61e91c46470dd2761bdcb63b8daa602b345be

But I got the error

error code: -22
error message:
TX decode failed

2. Could you explain me the reason why I cannot decode them?



asked May 21, 2023 by fabio_test

1 Answer

0 votes

To decode a transaction using its txid you should use getrawtransaction with verbose=true rather than decoderawtransaction.

Apart from that, you can see how to build upgrade transactions using the raw transaction interface by using help data-all in the command line or seeing how it's done in the examples for one of the 3 languages here:


answered May 22, 2023 by MultiChain
Thanks for you help. I succeded in build the upgrade tx using raw data. Here are my 2 cents in order to share it with the community.

1. Select one UTXO
listunspent 0 99999 '["1Jrw7s9wbRSUzH1StqvVbfDTM2qQLNk3ts"]'
        "txid" : "f52568403e0620a649db70e5257c4be2db767785c9a153ff8a500f1cd065947a",
        "vout" : 50,
        "address" : "1Jrw7s9wbRSUzH1StqvVbfDTM2qQLNk3ts",
        "account" : "",
        "scriptPubKey" : "76a914c3ebb238f4d0633e5a40593113b45265f40ef36788ac",
        "amount" : 0.19383,
        "confirmations" : 62,
        "cansend" : true,
        "spendable" : false,
        "assets" : [
        "permissions" : [

2. Build the raw tx
createrawtransaction '[{"txid":"f52568403e0620a649db70e5257c4be2db767785c9a153ff8a500f1cd065947a","vout":50}]' '{}'


3. Add upgrade details
appendrawdata  01000000017a9465d01c0f508aff53a1c9857776dbe24b7c25e570db49a620063e406825f53200000000ffffffff0000000000 '{"create": "upgrade","name" : "test-upgrade","details" :{"protocol-version": 20013}}'

4. Offline signing
signrawtransaction  01000000017a9465d01c0f508aff53a1c9857776dbe24b7c25e570db49a620063e406825f53200000000ffffffff0100000000000000001e1b73706b6e1000010c746573742d757067726164650042042d4e0000756a00000000 '[{"txid\":"f52568403e0620a649db70e5257c4be2db767785c9a153ff8a500f1cd065947a","vout":50,"scriptPubKey":"76a914c3ebb238f4d0633e5a40593113b45265f40ef36788ac"}]' '["PRIV_KEY"]" ALL

    "hex" : "01000000017a9465d01c0f508aff53a1c9857776dbe24b7c25e570db49a620063e406825f5320000006b48304502210083eaf8cbdc5eb022456d83431d2d355b0d6a8edf6de18021bf2e9aa119a2bc39022077e20106f712c724acc7f936b5648ca1e7751f02d2de4aeba1a064f55ca44bd50121030e1c5a502c8d7f53ea6a0551a125ca0a4f500689d59031a9c41fce1c9fe2070fffffffff0100000000000000001e1b73706b6e1000010c746573742d757067726164650042042d4e0000756a00000000",
    "complete" : true

Done !

I hope it can help.
Great, thanks for sharing!