Giter Site home page Giter Site logo

Comments (9)

34r7h avatar 34r7h commented on July 30, 2024

blockfrost has had some hiccups recently.. not getting 'some' balances updated and such. this might be the issue as well. i made a ticket with them and they responded that they knew the issue and it should be solved but i didn't ask about the indexing issue.

from pycardano.

34r7h avatar 34r7h commented on July 30, 2024

Details of failing tx build:

Available UTXOs:

utxos [
{'input': {'index': 0,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 1379280,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}}, 

{'input': {'index': 1,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 7228558, 'multi_asset': {}},
 'datum_hash': None}}, 

{'input': {'index': 0,
 'transaction_id': TransactionId(hex='233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5639430, 'multi_asset': {}},
 'datum_hash': None}}] 

Builder:

TransactionBuilder(context=<pycardano.backend.blockfrost.BlockFrostChainContext object at 0x10f447e80>, utxo_selectors=[<pycardano.coinselection.RandomImproveMultiAsset object at 0x110e87a90>, <pycardano.coinselection.LargestFirstSelector object at 0x110e87ac0>], execution_memory_buffer=0.2, execution_step_buffer=0.2, ttl=None, validity_start=None, auxiliary_data=None, native_scripts=None, mint=None, required_signers=None, collaterals=[], certificates=None, withdrawals=None, _inputs=[{'input': {'index': 0,
 'transaction_id': TransactionId(hex='233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5639430, 'multi_asset': {}},
 'datum_hash': None}}, {'input': {'index': 0,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 1379280,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}}], _excluded_inputs=[], _input_addresses=[addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr], _outputs=[{'address': addr1qxx7lc2kyrjp4qf3gkpezp24ugu35em2f5h05apejzzy73c7yf794gk9yzhngdse36rae52c7a6rv5seku25cd8ntves7f5fe4,
 'amount': {'coin': 1000000,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}, {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5847225, 'multi_asset': {}},
 'datum_hash': None}], _fee=171485, _datums={}, _inputs_to_redeemers={}, _minting_script_to_redeemers=[], _inputs_to_scripts={}, _should_estimate_execution_units=None) 

from pycardano.

cffls avatar cffls commented on July 30, 2024

It seems to me that the failed transaction pasted above doesn't satisfy the minimum lovelace amount.
See this output:

_outputs=[{'address': addr1qxx7lc2kyrjp4qf3gkpezp24ugu35em2f5h05apejzzy73c7yf794gk9yzhngdse36rae52c7a6rv5seku25cd8ntves7f5fe4,
 'amount': {'coin': 1000000,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}

You attached a NFT to it, but it only has 1ADA, which can't hold any multi-asset. If you try 1.5 ADA, it may work.

from pycardano.

34r7h avatar 34r7h commented on July 30, 2024

from pycardano.

cffls avatar cffls commented on July 30, 2024

I think the problem you posted is not caused by utxo selection. UTxO selection doesn't necessary select all available UTxOs. Instead, the problem might be that you were trying to send an asset with only 1ADA, which is insufficient according to the min lovelace rule. Also, could you please post the entire log, including the actually exception being thrown and the Transaction input and output. It is not easy for me to guess what the real problem is without complete information. Thank you!

from pycardano.

34r7h avatar 34r7h commented on July 30, 2024

Sure, stout for utxos, builder, and error message below. I upped the lovelace to 3,000,000 in this example.

Notice the input holding the nft has only 1.3 ada but there's more than sufficient amounts of lovelace in the following 2 utxos to cover the 3 ada + tx fee. The builder is only taking the first utxo as an input which does not have a sufficient amount to cover the total tx amount.

utxos

[{'input': {'index': 0,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 1379280,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}}, 

{'input': {'index': 1,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 7228558, 'multi_asset': {}},
 'datum_hash': None}}, 

{'input': {'index': 0,
 'transaction_id': TransactionId(hex='233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5639430, 'multi_asset': {}},
 'datum_hash': None}}] 

Builder

TransactionBuilder(context=<pycardano.backend.blockfrost.BlockFrostChainContext object at 0x10965be80>, utxo_selectors=[<pycardano.coinselection.RandomImproveMultiAsset object at 0x10b0a3a90>, <pycardano.coinselection.LargestFirstSelector object at 0x10b0a3ac0>], execution_memory_buffer=0.2, execution_step_buffer=0.2, ttl=None, validity_start=None, auxiliary_data=None, native_scripts=None, mint=None, required_signers=None, collaterals=[], certificates=None, withdrawals=None, _inputs=[{'input': {'index': 0,
 'transaction_id': TransactionId(hex='233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5639430, 'multi_asset': {}},
 'datum_hash': None}}, {'input': {'index': 0,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 1379280,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}}], _excluded_inputs=[], _input_addresses=[addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr], _outputs=[{'address': addr1qxx7lc2kyrjp4qf3gkpezp24ugu35em2f5h05apejzzy73c7yf794gk9yzhngdse36rae52c7a6rv5seku25cd8ntves7f5fe4,
 'amount': {'coin': 3000000,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}, {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 3847225, 'multi_asset': {}},
 'datum_hash': None}], _fee=171485, _datums={}, _inputs_to_redeemers={}, _minting_script_to_redeemers=[], _inputs_to_scripts={}, _should_estimate_execution_units=None) 

Error Traceback

Traceback (most recent call last):
  File "/Users/34r7h/a/cardano-python-js/python/createtx.py", line 97, in <module>
    signed_tx = builder.build_and_sign([sk], change_address=address)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 929, in build_and_sign
    tx_body = self.build(change_address=change_address, merge_change=merge_change)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 865, in build
    self._add_change_and_fee(change_address, merge_change=merge_change)
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 422, in _add_change_and_fee
    changes = self._calc_change(
  File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pycardano/txbuilder.py", line 336, in _calc_change
    raise InvalidTransactionException(
pycardano.exception.InvalidTransactionException: The input UTxOs cannot cover the transaction outputs and tx fee. 
Inputs: [{'input': {'index': 0,
 'transaction_id': TransactionId(hex='233a835316f4c27bceafdd190639c9c7b834224a7ab7fce13330495437d977fa')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 5639430, 'multi_asset': {}},
 'datum_hash': None}}, {'input': {'index': 0,
 'transaction_id': TransactionId(hex='cb00474e85a32a9cda5d5b53d0705abec9c1b7b27836331fd00c689c79988639')},
 'output': {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 1379280,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}}] 
Outputs: [{'address': addr1qxx7lc2kyrjp4qf3gkpezp24ugu35em2f5h05apejzzy73c7yf794gk9yzhngdse36rae52c7a6rv5seku25cd8ntves7f5fe4,
 'amount': {'coin': 3000000,
 'multi_asset': {ScriptHash(hex='c4d5ae259e40eb7830df9de67b0a6a536b7e3ed645de2a13eedc7ece'): {AssetName(b'x your eyes'): 1}}},
 'datum_hash': None}, {'address': addr1q872eujv4xcuckfarjklttdfep7224gjt7wrxkpu8ve3v6g4x2yx743payyucr327fz0dkdwkj9yc8gemtctgmzpjd8qcdw8qr,
 'amount': {'coin': 3847225, 'multi_asset': {}},
 'datum_hash': None}] 

from pycardano.

34r7h avatar 34r7h commented on July 30, 2024

btw, pip is still serving pycardano version 0.5.0 which I don't think contains your latest commits. Is there a chance that this issue is already fixed in your recent work?

from pycardano.

cffls avatar cffls commented on July 30, 2024

I added the example you provided as a unit test in this example here, which has passed. At the moment, I don't know how to reproduce the issue you encountered. I will look further if you could provide a runnable python script that can reproduce the issue you described.

from pycardano.

cffls avatar cffls commented on July 30, 2024

Closing this issue as there is no update for a month. Please feel free to reopen this if you could provide a runnable python script that can reproduce the issue. Thanks!

from pycardano.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.