<p>Been thinking about this question for a while. I haven't yet found a way to decode the specific 57 byte cbor to an <strong>addr</strong>-style address, but I suspect it will involve using the above keymappings in some sort of cborHex- to ASIC converter (or something along those lines).</p>
<p>However, if all you're looking for is to extract transaction information from an Alonzo body, cardano-cli was just updated to the newest version 1.31.0 which allows you to convert Alonzo era Tx Body's into human readable format:</p>
<p>Saving the above TxBody to file <code>tx.alonzo</code>, I then run the following using cardano-cli version 1.31.0:</p>
<p><code>cardano-cli transaction view --tx-body-file tx.alonzo</code></p>
<p>which prints:</p>
<pre><code>auxiliary scripts: null
certificates: null
era: Alonzo
fee: 168185 Lovelace
inputs:
- 1db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338#0
metadata: null
mint: null
outputs:
- address: addr_test1qqp6z9xneafqp0ndrxgyjd3qecs4tf6ktqhvj2hyc5efg2gzq5lqcm6rfuv6yp0mtsgc2qxvwlwr938qk2nue0rqg6rqxewe52
  address era: Shelley
  amount:
    lovelace: 93453668
  datum: null
  network: Testnet
  payment credential:
    key hash: 03a114d3cf5200be6d1990493620ce2155a756582ec92ae4c5329429
  stake reference:
    key hash: 02053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc604686
- address: addr_test1qrxs7m67uke5ckhe4fq0ex060zyedun7ge9fd4v08efyhnjnu93a5kcawxmc8uph5az7zfgtnhey2p65llkh37l4jg5smqzhph
  address era: Shelley
  amount:
    lovelace: 1000000
  datum: null
  network: Testnet
  payment credential:
    key hash: cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce
  stake reference:
    key hash: 53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf59229
update proposal: null
validity range:
  lower bound: null
  upper bound: null
withdrawals: null
</code></pre>
<p>Sorry if this doesn't answer your question directly, but as far as extracting an address (along with all the other Tx info) from a cbor-encoded TxBody, this is the best that I could come up with.</p>

CC BY-SA 4.0
2021-11-12T16:29:03.820Z
2021-11-12T16:29:03.820Z
zhekson
<p>I am trying to sign a transaction which is built on some other place and I can see only cbor for example:</p>
<pre><code>{
    &quot;type&quot;: &quot;TxBodyAlonzo&quot;,
    &quot;description&quot;: &quot;&quot;,
    &quot;cborHex&quot;: &quot;86a500818258201db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338000d8001828258390003a114d3cf5200be6d1990493620ce2155a756582ec92ae4c532942902053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc6046861a0591fd6482583900cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf592291a000f4240021a000290f90e809fff8080f5f6&quot;
}
</code></pre>
<p>With command cardano-cli text-view decode cbor I am getting the following:</p>
<pre><code>$ cardano-cli text-view decode-cbor --in-file tx.build 
86  # list(6)
   a5  # map(5)
       # key
      00  # int(0)
       # value
      81  # list(1)
         82  # list(2)
            58 20 1d b7 31 b2 34 9b 2a 16 74 55 12 80 9c 86 
            75 6e d4 2e 25 47 f8 cf 7b 93 d8 80 3b d8 8b d6 
            83 38  # bytes(32)
            00  # int(0)
       # key
      0d  # int(13)
       # value
      80  # list(0)
       # key
      01  # int(1)
       # value
      82  # list(2)
         82  # list(2)
            58 39 00 03 a1 14 d3 cf 52 00 be 6d 19 90 49 36 
            20 ce 21 55 a7 56 58 2e c9 2a e4 c5 32 94 29 02 
            05 3e 0c 6f 43 4f 19 a2 05 fb 5c 11 85 00 cc 77 
            dc 32 c4 e0 b2 a7 cc bc 60 46 86  # bytes(57)
            1a 05 91 fd 64  # int(93453668)
         82  # list(2)
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99 
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53 
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d 
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)
            1a 00 0f 42 40  # int(1000000)
       # key
      02  # int(2)
       # value
      1a 00 02 90 f9  # int(168185)
       # key
      0e  # int(14)
       # value
      80  # list(0)
   9f  # list(*)
   ff  # break
   80  # list(0)
   80  # list(0)
   f5  # bool(true)
   f6  # null
</code></pre>
<p>From above the following represents receiving address:</p>
<pre><code>            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99 
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53 
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d 
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)
</code></pre>
<p>How I can decode this to address?</p>

<cardano-cli><cbor><decode>
How to decode cbor which is generated with cardano-cli build command?
# How to decode cbor which is generated with cardano-cli build command?

(Asked by: username_0 on 2021-11-10)

I am trying to sign a transaction which is built on some other place and I can see only cbor for example:
{
    "type": "TxBodyAlonzo",
    "description": "",
    "cborHex": "86a500818258201db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338000d8001828258390003a114d3cf5200be6d1990493620ce2155a756582ec92ae4c532942902053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc6046861a0591fd6482583900cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf592291a000f4240021a000290f90e809fff8080f5f6"
}

With command cardano-cli text-view decode cbor I am getting the following:
$ cardano-cli text-view decode-cbor --in-file tx.build 
86  # list(6)
   a5  # map(5)
       # key
      00  # int(0)
       # value
      81  # list(1)
         82  # list(2)
            58 20 1d b7 31 b2 34 9b 2a 16 74 55 12 80 9c 86 
            75 6e d4 2e 25 47 f8 cf 7b 93 d8 80 3b d8 8b d6 
            83 38  # bytes(32)
            00  # int(0)
       # key
      0d  # int(13)
       # value
      80  # list(0)
       # key
      01  # int(1)
       # value
      82  # list(2)
         82  # list(2)
            58 39 00 03 a1 14 d3 cf 52 00 be 6d 19 90 49 36 
            20 ce 21 55 a7 56 58 2e c9 2a e4 c5 32 94 29 02 
            05 3e 0c 6f 43 4f 19 a2 05 fb 5c 11 85 00 cc 77 
            dc 32 c4 e0 b2 a7 cc bc 60 46 86  # bytes(57)
            1a 05 91 fd 64  # int(93453668)
         82  # list(2)
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99 
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53 
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d 
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)
            1a 00 0f 42 40  # int(1000000)
       # key
      02  # int(2)
       # value
      1a 00 02 90 f9  # int(168185)
       # key
      0e  # int(14)
       # value
      80  # list(0)
   9f  # list(*)
   ff  # break
   80  # list(0)
   80  # list(0)
   f5  # bool(true)
   f6  # null

From above the following represents receiving address:
            58 39 00 cd 0f 6f 5e e5 b3 4c 5a f9 aa 40 fc 99 
            fa 78 89 96 f2 7e 46 4a 96 d5 8f 3e 52 4b ce 53 
            e1 63 da 5b 1d 71 b7 83 f0 37 a7 45 e1 25 0b 9d 
            f2 45 07 54 ff ed 78 fb f5 92 29  # bytes(57)

How I can decode this to address?

**Tags:** cardano-cli, cbor, decode

---

## 1 answers

### Answer by username_1 on 2021-11-12. Score: 7 | Accepted answer

Been thinking about this question for a while. I haven't yet found a way to decode the specific 57 byte cbor to an addr-style address, but I suspect it will involve using the above keymappings in some sort of cborHex- to ASIC converter (or something along those lines).
However, if all you're looking for is to extract transaction information from an Alonzo body, cardano-cli was just updated to the newest version 1.31.0 which allows you to convert Alonzo era Tx Body's into human readable format:
Saving the above TxBody to file tx.alonzo, I then run the following using cardano-cli version 1.31.0:
cardano-cli transaction view --tx-body-file tx.alonzo
which prints:
auxiliary scripts: null
certificates: null
era: Alonzo
fee: 168185 Lovelace
inputs:
- 1db731b2349b2a16745512809c86756ed42e2547f8cf7b93d8803bd88bd68338#0
metadata: null
mint: null
outputs:
- address: addr_test1qqp6z9xneafqp0ndrxgyjd3qecs4tf6ktqhvj2hyc5efg2gzq5lqcm6rfuv6yp0mtsgc2qxvwlwr938qk2nue0rqg6rqxewe52
  address era: Shelley
  amount:
    lovelace: 93453668
  datum: null
  network: Testnet
  payment credential:
    key hash: 03a114d3cf5200be6d1990493620ce2155a756582ec92ae4c5329429
  stake reference:
    key hash: 02053e0c6f434f19a205fb5c118500cc77dc32c4e0b2a7ccbc604686
- address: addr_test1qrxs7m67uke5ckhe4fq0ex060zyedun7ge9fd4v08efyhnjnu93a5kcawxmc8uph5az7zfgtnhey2p65llkh37l4jg5smqzhph
  address era: Shelley
  amount:
    lovelace: 1000000
  datum: null
  network: Testnet
  payment credential:
    key hash: cd0f6f5ee5b34c5af9aa40fc99fa788996f27e464a96d58f3e524bce
  stake reference:
    key hash: 53e163da5b1d71b783f037a745e1250b9df2450754ffed78fbf59229
update proposal: null
validity range:
  lower bound: null
  upper bound: null
withdrawals: null

Sorry if this doesn't answer your question directly, but as far as extracting an address (along with all the other Tx info) from a cbor-encoded TxBody, this is the best that I could come up with.


---

