user4596: I would like to create a smartcontract which makes sure that only the same person who made specific locking transaction can unlock that same specific transaction or to put it into simpler terms if Bob locks his Ada then smartcontract must ensure that only Bob can unlock his locked Ada.
I think in TxInfo one of the txInfoInputs UTxO should contain information about locking transaction. But from data definition of txInfoInputs :: [TxInInfo] field:
data TxInInfo = TxInInfo
    { txInInfoOutRef   :: TxOutRef
    , txInInfoResolved :: TxOut
    } deiriving stock (Generic, Haskell.Show, Haskell.Eq)

I can't tell how exactly could I get public key hash of source address or something else which could give me information for validation if unlocking transaction is being made by the same person who made locking transaction.
Another way I can think of is to add sender address into Datum but I can't think of a way how to ensure secure Datum creation process so that for example when Bob is creating transaction to luck funds in smartcontract Alices address as a receiver doesn't appear in Datum
So is it even possible, to create such smartcontract which would take information of locking transaction and by using that information validate if smartcontract funds can be unlocked?

user2537: In TxOut you have a field txOutAddress that you can use for this:
data TxOut = TxOut {
  txOutAddress   :: Address,
  txOutValue     :: Value,
  txOutDatumHash :: Maybe DatumHash
}

Use it to extract the pubkeyhash:
pkh = toPubKeyHash $ txOutAddress txOut

And then in the smart contract check if the transaction is signed by it:
txSignedBy (scriptContextTxInfo ctx) pkh


4596: <p>I would like to create a smartcontract which makes sure that only the same person who made specific locking transaction can unlock that same specific transaction or to put it into simpler terms if Bob locks his Ada then smartcontract must ensure that only Bob can unlock his locked Ada.</p>
<p>I think in <strong>TxInfo</strong> one of the <strong>txInfoInputs</strong> UTxO should contain information about locking transaction. But from data definition of <code>txInfoInputs :: [TxInInfo]</code> field:</p>
<pre><code>data TxInInfo = TxInInfo
    { txInInfoOutRef   :: TxOutRef
    , txInInfoResolved :: TxOut
    } deiriving stock (Generic, Haskell.Show, Haskell.Eq)
</code></pre>
<p>I can't tell how exactly could I get public key hash of source address or something else which could give me information for validation if unlocking transaction is being made by the same person who made locking transaction.</p>
<p>Another way I can think of is to add sender address into <em>Datum</em> but I can't think of a way how to ensure secure <em>Datum</em> creation process so that for example when Bob is creating transaction to luck funds in smartcontract Alices address as a receiver doesn't appear in <em>Datum</em></p>
<p>So is it even possible, to create such smartcontract which would take information of locking transaction and by using that information validate if smartcontract funds can be unlocked?</p>
 2537: <p>In <code>TxOut</code> you have a field <code>txOutAddress</code> that you can use for this:</p>
<pre><code>data TxOut = TxOut {
  txOutAddress   :: Address,
  txOutValue     :: Value,
  txOutDatumHash :: Maybe DatumHash
}
</code></pre>
<p>Use it to extract the pubkeyhash:</p>
<pre><code>pkh = toPubKeyHash $ txOutAddress txOut
</code></pre>
<p>And then in the smart contract check if the transaction is signed by it:</p>
<pre><code>txSignedBy (scriptContextTxInfo ctx) pkh
</code></pre>
