I'm working through the beneficiary vesting example where we have two beneficiaries: beneficiary 2 (giver who can reclaim funds after deadline), and beneficiary 1 (must claim gift before deadline).

In the demo lucid claim function, i tried to parametrize the signer function like so

async function claimVestedFunds(beneficiary: string): Promise<TxHash> {...

But I set up the wallet from the point of view of beneficiary 2 (wallet address):

const addr: Address = await lucid.wallet.address();
const details: AddressDetails = getAddressDetails(addr);
const beneficiary2: string = details.paymentCredential.hash

Then I hard-coded beneficiary 1 PKH into the Vesting datum, but I'm not sure how to get 1 to do the signing in claimVestedFunds

      const tx = await lucid
            .collectFrom(ourUTxO, Data.void())    

I thought this would work because these two beneficiaries are actually derived from the same seed phrase (i control both accounts).

My code appears to allow beneficiary 2 to vest and reclaim, but i'm not sure how to allow beneficiary 1 to sign

1 Answer 1


The process for beneficiary 1 to reclaim the vested funds would be the same as for beneficiary 2. The only difference is that instead of passing in the seed phrase to generate the wallet, you would pass in the public key hash (PKH) of beneficiary 1.

You can create the wallet by passing in the PKH of beneficiary 1 to the selectWalletFromHash() function:


You can then construct the transaction and use the same logic used for creating the transaction for beneficiary 2, but instead of passing in the seed phrase to add the signer key, you'll pass in the PKH of beneficiary 1.

const tx = await lucid .newTx() .collectFrom(ourUTxO, Data.void())
.attachSpendingValidator(mistery1) .validFrom(Date.now()-100000) .complete();

Once you have created the transaction, you can send the transaction using the send() function.

Hope this helps!

  • unfortunately I am getting the error that "lucid.selectWalletFromHash" is not a function. do you know where it might be defined?
    – tyvan266
    Jul 7, 2023 at 0:01
  • Were you able to work this out? I believe the command you had to use is "lucid.selectWalletFromPrivateKey(beneficiary1PKH)" .
    – a_juggler
    Jan 14 at 18:21

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.