user6520: How does txInfoValidRange get set on the testnet?
I've been made aware that on the Plutus Playground
a piece of off-chain code:
"Constraints.mustValidateIn (from now)" will
set txInfoValidRange (works great).
I'm looking for the equivalent cardano-cli command
for "Constraints.mustValidateIn (from now)",
that will set the txInfoValidRange properly on
the testnet?

user4880: There are two options
--invalid-before SLOT    Time that transaction is valid from (in slots).
--invalid-hereafter SLOT Time that transaction is valid until (in slots).

In you example you would use --invalid-before $CURENT_TIME_SLOT

user6113: At the time to build a transaction with cardano-cli using the command cardano-cli transaction build, you can use the input parameters --invalid-before SLOT or --invalid-hereafter SLOT where invalid-before refers to the time that transaction is valid from (in slots), and invalid-hereafter to the time that transaction is valid until (in slots).
Notice that if you don't set a valid range the default will be "all the time".

You can get this info using cardano-cli transaction build --help
An example of this would be the following command (shown by Lars in lecture 3). Check https://github.com/kindofdev/plutus-pioneer-program-iter3/blob/main/code/week03/testnet/grab.sh
cardano-cli transaction build \
    --alonzo-era \
    --testnet-magic 1097911063 \
    --change-address $(cat 02.addr) \
    --tx-in 18cbe6cadecd3f89b60e08e68e5e6c7d72d730aaa1ad21431590f7e6643438ef#1 \
    --tx-in-script-file vesting.plutus \
    --tx-in-datum-file unit.json \
    --tx-in-redeemer-file unit.json \
    --tx-in-collateral 18e93407ea137b6be63039fd3c564d4c5233e7eb7ce4ee845bc7df12c80e4df7#1 \
    --required-signer-hash c2ff616e11299d9094ce0a7eb5b7284b705147a822f4ffbd471f971a \
    --invalid-before 48866954 \
    --protocol-params-file protocol.json \
    --out-file tx.body 

here the tx is invalid before slot 48866954. In plutus:
Constraints.mustValidateIn $ from $ slotToBeginPOSIXTime def 48866954
In your case you should use --invalid-before $CURRENT_TIME_SLOT
If you are wondering how to get a slot number for Cardano testnet given a posixtime, here you have a way to do it.
How to convert posixTime to slot number on Cardano Testnet

6520: <p>How does txInfoValidRange get set on the testnet?</p>
<p>I've been made aware that on the Plutus Playground
a piece of off-chain code:
&quot;Constraints.mustValidateIn (from now)&quot; will
set txInfoValidRange (works great).</p>
<p>I'm looking for the equivalent cardano-cli command
for &quot;Constraints.mustValidateIn (from now)&quot;,
that will set the txInfoValidRange properly on
the testnet?</p>
 4880: <p>There are two options</p>
<pre><code>--invalid-before SLOT    Time that transaction is valid from (in slots).
--invalid-hereafter SLOT Time that transaction is valid until (in slots).
</code></pre>
<p>In you example you would use <code>--invalid-before $CURENT_TIME_SLOT</code></p>
 6113: <p>At the time to build a transaction with <strong>cardano-cli</strong> using the command <strong>cardano-cli transaction build</strong>, you can use the input parameters <strong>--invalid-before SLOT</strong> or <strong>--invalid-hereafter SLOT</strong> where <strong>invalid-before refers</strong> to the time that transaction is valid from (in slots), and <strong>invalid-hereafter</strong> to the time that transaction is valid until (in slots).</p>
<p>Notice that if you don't set a valid range the default will be &quot;all the time&quot;.</p>
<p><a href="https://i.stack.imgur.com/vytnm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vytnm.png" alt="enter image description here" /></a></p>
<p>You can get this info using <code>cardano-cli transaction build --help</code></p>
<p>An example of this would be the following command (shown by Lars in lecture 3). Check <a href="https://github.com/kindofdev/plutus-pioneer-program-iter3/blob/main/code/week03/testnet/grab.sh" rel="nofollow noreferrer">https://github.com/kindofdev/plutus-pioneer-program-iter3/blob/main/code/week03/testnet/grab.sh</a></p>
<pre><code>cardano-cli transaction build \
    --alonzo-era \
    --testnet-magic 1097911063 \
    --change-address $(cat 02.addr) \
    --tx-in 18cbe6cadecd3f89b60e08e68e5e6c7d72d730aaa1ad21431590f7e6643438ef#1 \
    --tx-in-script-file vesting.plutus \
    --tx-in-datum-file unit.json \
    --tx-in-redeemer-file unit.json \
    --tx-in-collateral 18e93407ea137b6be63039fd3c564d4c5233e7eb7ce4ee845bc7df12c80e4df7#1 \
    --required-signer-hash c2ff616e11299d9094ce0a7eb5b7284b705147a822f4ffbd471f971a \
    --invalid-before 48866954 \
    --protocol-params-file protocol.json \
    --out-file tx.body 
</code></pre>
<p>here the tx is invalid before slot 48866954. In plutus:</p>
<p><code>Constraints.mustValidateIn $ from $ slotToBeginPOSIXTime def 48866954</code></p>
<p>In your case you should use <code>--invalid-before $CURRENT_TIME_SLOT</code></p>
<p>If you are wondering how to get a slot number for Cardano testnet given a <strong>posixtime</strong>, here you have a way to do it.</p>
<p><a href="https://cardano.stackexchange.com/questions/7034/how-to-convert-posixtime-to-slot-number-on-cardano-testnet">How to convert posixTime to slot number on Cardano Testnet</a></p>
