<p>As Byron does not change address types, we will be still referring to them as Shelley type addresses.</p>
<ol>
<li>To look at your UTXOs, using <code>cardano-cli</code>:</li>
</ol>
<pre><code>cardano-cli query utxo \
  --address $(cat payment.addr) \
  --mainnet
                            TxHash                                 TxIx        Amount
----------------------------------------------------------------------------------------
4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99     4         20000000 lovelace
</code></pre>
<ol start="2">
<li>This is more complicated, but it is well documented in the <a href="https://github.com/input-output-hk/cardano-node/blob/master/doc/stake-pool-operations/simple_transaction.md" rel="nofollow noreferrer"><code>cardano-cli</code> documentation</a>, as follows:</li>
</ol>
<p>Create a draft for the transaction and save it in tx.draft</p>
<p>Note that for <code>--tx-in</code> we use the following syntax: <code>TxHash#TxIx</code> where <code>TxHash</code> is the transaction hash and <code>TxIx</code> is the index; for <code>--tx-out</code> we use: <code>TxOut+Lovelace</code> where <code>TxOut</code> is the hex encoded address followed by the amount in <code>Lovelace</code>. For the transaction draft --tx-out, --invalid-hereafter and --fee can be set to zero.</p>
<pre><code>cardano-cli transaction build-raw \
--tx-in 4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99#4 \
--tx-out $(cat payment2.addr)+0 \
--tx-out $(cat payment.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
--out-file tx.draft
</code></pre>
<h4>Calculate the fee</h4>
<p>A simple transaction needs one input, a valid UTXO from <code>payment.addr</code>, and two outputs:</p>
<ul>
<li>Output1: The address that receives the transaction.</li>
<li>Output2: The address that receives the change of the transaction.</li>
</ul>
<p>Note that to calculate the fee you need to include the draft transaction</p>
<pre><code>cardano-cli transaction calculate-min-fee \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file protocol.json

&gt; 167965
</code></pre>
<h4>Calculate the change to send back to payment.addr,</h4>
<p>all amounts must be in Lovelace:</p>
<pre><code>expr &lt;UTXO BALANCE&gt; - &lt;AMOUNT TO SEND&gt; - &lt;TRANSACTION FEE&gt;
</code></pre>
<p>For example, if we send 10 ADA from a UTxO containing 20 ADA, the change to send back to <code>payment.addr</code> after paying the fee is: 9.832035 ADA</p>
<pre><code>expr 20000000 - 10000000 - 167965

&gt; 9832035
</code></pre>
<h4>Determine the TTL (time to Live) for the transaction</h4>
<p>To build the transaction we need to specify the <strong>TTL (Time to live)</strong>, this is the slot height limit for our transaction to be included in a block, if it is not in a block by that slot the transaction will be cancelled. So TTL = slot + N slots. Where N is the amount of slots you want to add to give the transaction a window to be included in a block.</p>
<p>Query the tip of the blockchain:</p>
<pre><code>cardano-cli query tip --mainnet
</code></pre>
<p>Look for the value of <code>slot</code></p>
<pre><code>{
    &quot;epoch&quot;: 259,
    &quot;hash&quot;: &quot;dbf5104ab91a7a0b405353ad31760b52b2703098ec17185bdd7ff1800bb61aca&quot;,
    &quot;slot&quot;: 26633911,
    &quot;block&quot;: 5580350
}
</code></pre>
<p>Calculate your <code>invalid-hereafter</code>, for example:  26633911 + 200 slots = 26634111</p>
<h4>Build the transaction</h4>
<p>We write the transaction in a file, we will name it <code>tx.raw</code>.</p>
<pre><code>cardano-cli transaction build-raw \
--tx-in 4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99#4 \
--tx-out $(cat payment2.addr)+10000000 \
--tx-out $(cat payment.addr)+9832035 \
--invalid-hereafter 26634111 \
--fee 167965 \
--out-file tx.raw
</code></pre>
<h4>Sign the transaction</h4>
<p>Sign the transaction with the signing key <strong>payment.skey</strong> and save the signed transaction in <strong>tx.signed</strong></p>
<pre><code>cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--mainnet \
--out-file tx.signed
</code></pre>
<h4>Submit the transaction</h4>
<pre><code>cardano-cli transaction submit \
--tx-file tx.signed \
--mainnet
</code></pre>

CC BY-SA 4.0
2021-08-27T05:20:13.340Z
2021-08-27T05:20:13.340Z
Marek Mahut - StakeNuts
<p>I am currently working to build a private network from Byron to Alonzo and I think I have some test-ada left in a Byron address.<br><br>
If I am in the Shelley (Alonzo) era and I am using the cli to conduct transactions, are there:<br> 1) CLI commands to look at the UTXO's at a Byron era address?<br>
2) CLI commands to move ada from the Byron era address to the Shelley era address? <br><br>
Please let me know if you need any clarification on the questions. Thank You.</p>

<testnet><address><byron>
How do you send ada from a Byron address to a Shelley address using the CLI?
# How do you send ada from a Byron address to a Shelley address using the CLI?

(Asked by: username_0 on 2021-08-26)

I am currently working to build a private network from Byron to Alonzo and I think I have some test-ada left in a Byron address.  
  
If I am in the Shelley (Alonzo) era and I am using the cli to conduct transactions, are there:  
 1) CLI commands to look at the UTXO's at a Byron era address?  
2) CLI commands to move ada from the Byron era address to the Shelley era address?   
  
Please let me know if you need any clarification on the questions. Thank You.

**Tags:** testnet, address, byron

---

## 1 answers

### Answer by username_1 on 2021-08-27. Score: 1

As Byron does not change address types, we will be still referring to them as Shelley type addresses.

To look at your UTXOs, using cardano-cli:

cardano-cli query utxo \
  --address $(cat payment.addr) \
  --mainnet
                            TxHash                                 TxIx        Amount
----------------------------------------------------------------------------------------
4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99     4         20000000 lovelace


This is more complicated, but it is well documented in the cardano-cli documentation, as follows:

Create a draft for the transaction and save it in tx.draft
Note that for --tx-in we use the following syntax: TxHash#TxIx where TxHash is the transaction hash and TxIx is the index; for --tx-out we use: TxOut+Lovelace where TxOut is the hex encoded address followed by the amount in Lovelace. For the transaction draft --tx-out, --invalid-hereafter and --fee can be set to zero.
cardano-cli transaction build-raw \
--tx-in 4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99#4 \
--tx-out $(cat payment2.addr)+0 \
--tx-out $(cat payment.addr)+0 \
--invalid-hereafter 0 \
--fee 0 \
--out-file tx.draft

Calculate the fee
A simple transaction needs one input, a valid UTXO from payment.addr, and two outputs:

Output1: The address that receives the transaction.
Output2: The address that receives the change of the transaction.

Note that to calculate the fee you need to include the draft transaction
cardano-cli transaction calculate-min-fee \
--tx-body-file tx.draft \
--tx-in-count 1 \
--tx-out-count 2 \
--witness-count 1 \
--byron-witness-count 0 \
--mainnet \
--protocol-params-file protocol.json

> 167965

Calculate the change to send back to payment.addr,
all amounts must be in Lovelace:
expr  -  - 

For example, if we send 10 ADA from a UTxO containing 20 ADA, the change to send back to payment.addr after paying the fee is: 9.832035 ADA
expr 20000000 - 10000000 - 167965

> 9832035

Determine the TTL (time to Live) for the transaction
To build the transaction we need to specify the TTL (Time to live), this is the slot height limit for our transaction to be included in a block, if it is not in a block by that slot the transaction will be cancelled. So TTL = slot + N slots. Where N is the amount of slots you want to add to give the transaction a window to be included in a block.
Query the tip of the blockchain:
cardano-cli query tip --mainnet

Look for the value of slot
{
    "epoch": 259,
    "hash": "dbf5104ab91a7a0b405353ad31760b52b2703098ec17185bdd7ff1800bb61aca",
    "slot": 26633911,
    "block": 5580350
}

Calculate your invalid-hereafter, for example:  26633911 + 200 slots = 26634111
Build the transaction
We write the transaction in a file, we will name it tx.raw.
cardano-cli transaction build-raw \
--tx-in 4e3a6e7fdcb0d0efa17bf79c13aed2b4cb9baf37fb1aa2e39553d5bd720c5c99#4 \
--tx-out $(cat payment2.addr)+10000000 \
--tx-out $(cat payment.addr)+9832035 \
--invalid-hereafter 26634111 \
--fee 167965 \
--out-file tx.raw

Sign the transaction
Sign the transaction with the signing key payment.skey and save the signed transaction in tx.signed
cardano-cli transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--mainnet \
--out-file tx.signed

Submit the transaction
cardano-cli transaction submit \
--tx-file tx.signed \
--mainnet


---

