I am using the function cardano.getCollateral() in the nami wallet library which gives me the utxo of a collateral, lets say it is: "8282582059aca4594629e55a25e2ef20ac8b58fe65a946f215639dbde038f598d0f25a040082583900b9e79b67bc322d4d9b0a2d5449353e58f22aeea3bd349cdd363543fc4ec0b90c580c1091a8bc26989d288402ed015c1c747d5290698a15f41a004c4b40".

How can i go get from this the utxo of the collateral or the transaction ID in cardano-client-lib?

Thank you

1 Answer 1


You need to do something like this:

     * The collateral is need for working with Plutus Scripts
     * Essentially you need to provide collateral to pay for fees if the
     * script execution fails after the script has been validated...
     * this should be an uncommon occurrence and would suggest the smart contract
     * would have been incorrectly written.
     * The amount of collateral to use is set in the wallet
     * @returns {Promise<void>}
    getCollateral = async () => {

        let CollatUtxos = [];

        try {

            let collateral = [];

            const wallet = this.state.whichWalletSelected;
            if (wallet === "nami") {
                collateral = await this.API.experimental.getCollateral();
            } else {
                collateral = await this.API.getCollateral();

            for (const x of collateral) {
                const utxo = TransactionUnspentOutput.from_bytes(Buffer.from(x, "hex"));
                // console.log(utxo)
        } catch (err) {


There is a working example in this repo: https://github.com/dynamicstrategies/cardano-wallet-connector

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.