<p>@georgeos answer was correct, but from node version 1.32 there is</p>
<pre><code>--required-signer-hash HASH
                           Hash of the verification key (zero or more) whose
                           signature is required.
</code></pre>
<p>(so you don't need to know users signing key, just pass the PubKeyHash)</p>

CC BY-SA 4.0
2022-02-14T21:35:01.560Z
2022-02-14T21:35:01.560Z
Kaliman
<p><strong>------ UPDATE------</strong></p>
<p>Since version 1.31 of <code>cardano-cli</code>, there is the following option to sign the transaction when it is built, so you can avoid that error from the script:</p>
<pre><code>--required-signer FILE   Input filepath of the signing key (zero or more)
                         whose signature is required.
</code></pre>
<p><strong>-----------------------</strong></p>
<p>It's related to this bug: <a href="https://github.com/input-output-hk/cardano-node/issues/3106" rel="nofollow noreferrer">Cli to pass required signer (reqSignerHashes) to plutus script for txInfoSignatories</a></p>
<p>In a near future, there will be a <code>--required-signer</code> option in cardano-cli</p>
<p>As a workaround try to combine <code>toPubKeyHash</code> and <code>txOutAddress</code> function to get the PubKeyHash from any output.</p>
<pre><code>info :: TxInfo
info = scriptContextTxInfo ctx

txOuts :: [TxOut]
txOuts = txInfoOutputs info

outPubKeyHash :: Maybe PubKeyHash
outPubKeyHash = toPubKeyHash $ txOutAddress $ head txOuts
</code></pre>

CC BY-SA 4.0
2021-10-26T22:23:23.987Z
2021-11-12T16:25:41.707Z
2021-11-12T16:25:41.707Z
georgeos
<p>In the Plutus Pionner Lectures, Lars instructed us to use <a href="https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html#v:txSignedBy" rel="nofollow noreferrer"><code>txSignedBy</code></a> in order to ensure that a user signed the transaction. The function tries to find a public key hash in the <a href="https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Api.html#t:TxInfo" rel="nofollow noreferrer"><code>txInfoSignatories</code></a> list, if it's able to find, it returns True.</p>
<p>Everything was working in the emulator, but now, when I tried to manually build and sign the transaction with cardano-cli, the transaction doesn't appear to add the public key hash from the user who signed it to <code>txInfoSignatories</code> and the script validation fails. My question is: how do I add the user pubkeyhash to <code>txInfoSignatories</code> with cardano-cli? No information regarding the signature appears when I execute <code>cardano-cli transaction build -- help</code></p>

<plutus><wallet><cardano-cli><testnet>
Empty txInfoSignatories after building transaction with cardano-cli
# Empty txInfoSignatories after building transaction with cardano-cli

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

In the Plutus Pionner Lectures, Lars instructed us to use [`txSignedBy`](https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Contexts.html#v:txSignedBy) in order to ensure that a user signed the transaction. The function tries to find a public key hash in the [`txInfoSignatories`](https://staging.plutus.iohkdev.io/doc/haddock/plutus-ledger-api/html/Plutus-V1-Ledger-Api.html#t:TxInfo) list, if it's able to find, it returns True.

Everything was working in the emulator, but now, when I tried to manually build and sign the transaction with cardano-cli, the transaction doesn't appear to add the public key hash from the user who signed it to `txInfoSignatories` and the script validation fails. My question is: how do I add the user pubkeyhash to `txInfoSignatories` with cardano-cli? No information regarding the signature appears when I execute `cardano-cli transaction build -- help`

**Tags:** plutus, wallet, cardano-cli, testnet

---

## 2 answers

### Answer by username_2 on 2021-10-26. Score: 3 | Accepted answer

------ UPDATE------
Since version 1.31 of cardano-cli, there is the following option to sign the transaction when it is built, so you can avoid that error from the script:
--required-signer FILE   Input filepath of the signing key (zero or more)
                         whose signature is required.

-----------------------
It's related to this bug: Cli to pass required signer (reqSignerHashes) to plutus script for txInfoSignatories
In a near future, there will be a --required-signer option in cardano-cli
As a workaround try to combine toPubKeyHash and txOutAddress function to get the PubKeyHash from any output.
info :: TxInfo
info = scriptContextTxInfo ctx

txOuts :: [TxOut]
txOuts = txInfoOutputs info

outPubKeyHash :: Maybe PubKeyHash
outPubKeyHash = toPubKeyHash $ txOutAddress $ head txOuts


---

### Answer by username_1 on 2022-02-14. Score: 1

@georgeos answer was correct, but from node version 1.32 there is
--required-signer-hash HASH
                           Hash of the verification key (zero or more) whose
                           signature is required.

(so you don't need to know users signing key, just pass the PubKeyHash)


---

