According to the Plutus team, the standard way of generating signed transactions containing smart contracts is to have the off-chain code generate a so called unbalanced transaction that is then, in a second step, balanced and signed by the user's wallet. The newest Nami-demo of the PAB repository follows this spirit and makes the observation that this balanceTx method is currently missing in the Nami API. The demo implements a work around method for balancing and comments that this method could be deleted once Nami implements a proper API analog (see line 71 here).

I asked on the Nami repository if we could expect a method for balancing transactions soon: see-here. The answer was that such a method would be difficult to implement as smart contract execution costs —which are affected by the balancing— need to be factored into the fees and that this calculation needs the availability of Plutus Core (which I guess is not easily achievable for web extensions).

The only way left for implementing smart contracts is to hand over a fully built transaction to the wallet. When using the PAB, the Contract instance would need to build it using the wallet address (and optionally a pre-defined UTxO for the collateral) of the user. I haven't seen any code showing how to achieve this in the GitHub repository. How can this be done ?

1 Answer 1


You cannot. If you want to use the PAB, you need to send the necessary information from the wallet (utxos, pkh, whatever your script needs) in the frontend and then yield the unbalancedTx back to the frontend, and then balance it there. Alternatively, you could implement your own balancing function in Haskell and do it there. Aiken, Lucid, and Martify Mesh are all examples of front-end transaction building libraries that support transaction balancing. In-fact, you can use any one of those entirely without using the PAB at all.

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.