My goal is: I would like to create a smart contract which would verify if unlocking transaction comes from the same person as the wallet address which is known before hand.

What I have tried: I have went trough https://developers.cardano.org/docs/integrate-cardano/creating-wallet-faucet/ and https://github.com/input-output-hk/Alonzo-testnet/blob/main/Alonzo-solutions/exercise3/e3SampleSolution.md exercises to understand cardano transactions and wallets better. I have also created my own Yoroi wallet and played around a bit with transactions. I have also tried looking for functions which could do verification with wallet addresses in Plutus API, but couldn't find anything.

What I got from all of this is that because cardano wallet is created with a single recovery phrase it should be possible to trace down if different wallet addresses belong to the same person.

How I think solution should work:

  1. Transaction comes in into smart contract
  2. Smart contract takes wallet address from which this transaction came
  3. Smart contract checks if already known wallet address (for sending funds to) belongs to the same person as the owner of unlocking transaction wallet

Things I don't quite get it:

  1. Can smart contract on-chain code go trough blockchain to check wallets pub-keys for validation and if so how?
  2. Is the txSignedBy :: TxInfo -> PubKeyHash -> Bool the only function which can be used on-chain to check ownership?
  3. Is it possible to get wallet address from TxInfo in smart contract?
  4. Can PubKeyHash be retrieved from wallet address on-chain and off-chain?

I don't expect an honest well though out answer to all of these questions, but if anyone could lead me a even a little bit on how to achieve my goal I would be really thankful.

  • 1
    I came accross this and was wondering how the currently held Sundaeswap vote is doing this to cast votes only once. Nothing to do with SC but with staking addresses, you might wanna check this topic, maybe it helps: cardano.stackexchange.com/questions/3786/…
    – rx2347
    Nov 15, 2021 at 2:03


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.