most basic nft minting is now failing
reitcircles opened this issue · 9 comments
Describe the bug
Standard example from tutorials fails to execute
To Reproduce
- download https://github.com/Python-Cardano/pycardano/blob/main/examples/native_token.py
- then run it first time to get the address : in my case
addr_test1vzwy2qavznsp3lgut03hp62vyde6y8ttjh3plwk6ds3y4zg37je5g - The use the faucet from cardano to transfer some tADA
- Check using cardano-cli the utxo
Logs
` TxHash TxIx Amount
a0facadf037b67622c0099de4f0828bcc81efb910efec8b73e9250044e93712f 0 10000000000 lovelace + TxOutDatumNone`
- Now that tADA is there in the wallet, try to mint the NFT
- Following error happens:
pycardano.exception.UTxOSelectionException: All UTxO selectors failed.inside the function:signed_tx = builder.build_and_sign([payment_skey, policy_skey], change_address=address) - Such a basic thing is now giving error ...something is wrong ...
Expected behavior
Should have just minted the NFT tokens
Environment and software version (please complete the following information):
- OS:
- Distributor ID: Ubuntu
- Description: Ubuntu 20.04.6 LTS
- Release: 20.04
- PyCardano Version [0.9.0]
Additional context
None
I saw a few success NFT mint transactions under your account: https://preview.cardanoscan.io/address/609c4503ac14e018fd1c5be370e94c2373a21d6b95e21fbada6c224a89
Is the issue resolved now?
I am also running into this issue. I think the problem is that it is trying to find input UTxOs for the newly minted native tokens.
edit: I am nearly certain that this is the case. We should probably consider adding in the ability to ignore certain multiassets so that newly minted assets can be ignored when trying to meet the output UTxO fulfillment requirements.
Okay, I'm going to add a mint_assets input to the coin selection algos. It will be a MultiAsset that includes the number of assets that will be minted, and will be subtracted from the total_requested component of the algos.
@cffls @nielstron Do you see any potential issues with this?
AFAIK all minted tokens are considered as inputs in the tx builder, I think there is no need for explicitly adding them to the coin selection
Agreed with @nielstron , all token minted will be provided to tx builder automatically. I am still not sure what the root cause was for this issue. The first thing came to my mind was the chain context, e.g. blockfrost, wasn't in sync with the tip of chain, so it couldn't find the utxo from the new account. If this happens in the future, please post a full log from pycardano, from which we can tell what exactly failed. For example, if UTXO selection failed, it will tell what UTXOs were provided, and what failed to fulfill, see here.
Well, I'm glad I asked first. This was super helpful. My issue is separate from what was reported here then.
I'm building pycardano into a backend application, where the frontend gives me the utxos from a wallet. Because I already have the utxos and I've almost completely removed blockfrost from the workflow, I had to create a custom utxo selection loop outside of the builder because the builder will hit blockfrost for utxos any time non-ada assets are in the outputs.
With the link provided by @nielstron, I can fix this. However, I wonder if there might be a better solution to the current build workflow so that coin selection doesn't force a context call to get utxos.
If you do not provide an input address there should be no call to fetch UTxOs from the chain? If at all that call would be triggered by fee calculation, not presence of tokens. Check out #204 if you don't want to spend all utxos of the wallet
I would like to close this issue actually because the discussion appears to diverge. @theeldermillenial please re-open a new issue with the full error log when you encounter this issue again and feel free to open an enhancement issue if you feel like the building needs some improvements.