Chia-Network / chia-blockchain

Chia blockchain python implementation (full node, farmer, harvester, timelord, and wallet)
Apache License 2.0
10.82k stars 2.03k forks source link

[Bug] Coin record xxx not found using the CLI for offering a NFT #16249

Closed cripsisxyz closed 1 year ago

cripsisxyz commented 1 year ago

What happened?

I'm trying to create an offer file from the CLI, offering an NFT i own:

(venv) root@galixeon/etc/chia-blockchain/chia-blockchain (main) # chia wallet nft list -i 3 |grep nft1kka00lnl4c0hsju0cgy8gxmap68r4p5l0wranqjgypdntem3fyjs9r380k NFT identifier: nft1kka00lnl4c0hsju0cgy8gxmap68r4p5l0wranqjgypdntem3fyjs9r380k

But i cannot create an offer using the CLI, I have read all the doc pages and I followed all the steps but it stills not working:

(venv) root@galixeon/etc/chia-blockchain/chia-blockchain (main) # chia wallet make_offer -o nft1kka00lnl4c0hsju0cgy8gxmap68r4p5l0wranqjgypdntem3fyjs9r380k:1 -r 1:2 -p /tmp/fanflicker_6.offer -m 0.001

Version

2.0.1b3.dev44

What platform are you using?

Linux

What ui mode are you using?

CLI

Relevant log output

Exception from 'wallet' invalid literal for int() with base 10: 'nft1kka00lnl4c0hsju0cgy8gxmap68r4p5l0wranqjgypdntem3fyjs9r380k':
Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/cmds/wallet_funcs.py", line 427, in make_offer
    b32_id = bytes32.from_hexstr(name)
             ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/util/byte_types.py", line 53, in from_hexstr
    return cls.fromhex(input_str)
           ^^^^^^^^^^^^^^^^^^^^^^
ValueError: non-hexadecimal number found in fromhex() arg at position 0

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/cmds/wallet_funcs.py", line 443, in make_offer
    info = NFTInfo.from_json_dict((await wallet_client.get_nft_info(coin_id.hex()))["nft_info"])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_client.py", line 1004, in get_nft_info
    response = await self.fetch("nft_get_info", request)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/rpc_client.py", line 61, in fetch
    raise ValueError(res_json)
ValueError: {'error': 'Coin record 0xb5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 not found', 'success': False}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/cmds/cmds_util.py", line 116, in get_any_service_client
    yield node_client, config
  File "/etc/chia-blockchain/chia-blockchain/chia/cmds/cmds_util.py", line 232, in get_wallet_client
    yield wallet_client, new_fp, config
  File "/etc/chia-blockchain/chia-blockchain/chia/cmds/wallet_funcs.py", line 479, in make_offer
    id = uint32(int(name))
                ^^^^^^^^^
ValueError: invalid literal for int() with base 10: 'nft1kka00lnl4c0hsju0cgy8gxmap68r4p5l0wranqjgypdntem3fyjs9r380k'
wjblanke commented 1 year ago

It sounds like the command line is wrong, quex what is the correct format here?

Quexington commented 1 year ago

Hey @cripsisxyz there should be another error in your log that also contains the string Coin record 0xb5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 not found which prints a different stacktrace for the backend. Can you find that log entry?

cripsisxyz commented 1 year ago

yes i found it:

2023-09-07T09:39:06.567 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 21, in inner
    res_object = await f(request_data)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 2915, in nft_get_info
    return {"success": False, "error": "Coin ID is required."}
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 292, in get_latest_singleton_coin_spend
    raise ValueError(f"Coin record 0x{coin_id.hex()} not found")
ValueError: Coin record 0xb5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 not found

no more lines

Quexington commented 1 year ago

Hey @cripsisxyz thanks! Are you running with a trusted full node or in untrusted wallet only mode?

cripsisxyz commented 1 year ago

heey, I run it on wallet only mode @Quexington

Quexington commented 1 year ago

Have you tried again recently? And are you sure you're on mainnet? It appears your peer is unable to find the launcher state for your NFT but I can see it on a block explorer so I'm not sure how they wouldn't be able to find it.

cripsisxyz commented 1 year ago

image same result :S

Quexington commented 1 year ago

Hmm would you mind trying using b5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 instead of nft1...?

cripsisxyz commented 1 year ago

ow, it works but "partially":

image

now i have this error: ValueError: {'error': "Error creating offer: ('path into atom', '80')", 'success': False}

i tried with differents output paths for the file but same error

Quexington commented 1 year ago

Interesting, could you get me the stacktrace from the logs again just like last time?

cripsisxyz commented 1 year ago

Sure:

2023-09-08T09:24:31.418 wallet chia.wallet.trade_manager  : ERROR    Error creating trade offer
Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 505, in _create_offer_for_ids
    potential_special_offer: Optional[Offer] = await self.check_for_special_offer_making(
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 819, in check_for_special_offer_making
    return await NFTWallet.make_nft1_offer(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 976, in make_nft1_offer
    txs = [tx]
          ^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 665, in generate_signed_transaction
    metadata_update=metadata_update,
               ^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 471, in sign
    synthetic_secret_key = calculate_synthetic_secret_key(private, DEFAULT_HIDDEN_PUZZLE_HASH)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/util/condition_tools.py", line 192, in conditions_dict_for_solution
    for cvp in conditions_for_solution(puzzle_reveal, solution, max_cost):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/util/condition_tools.py", line 204, in conditions_for_solution
    cost, r = puzzle_reveal.run_with_cost(max_cost, solution)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/types/blockchain_format/program.py", line 113, in run_with_cost
    cost, r = run_chia_program(self.as_bin(), prog_args.as_bin(), max_cost, flags)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
ValueError: ('path into atom', '80')
2023-09-08T09:24:31.421 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 21, in inner
    res_object = await f(request_data)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 72, in rpc_endpoint
    return await func(self, request, *args, tx_config=tx_config, extra_conditions=extra_conditions, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 1692, in create_offer_for_ids
    result = await self.service.wallet_state_manager.trade_manager.create_offer_for_ids(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 383, in create_offer_for_ids
    raise Exception(f"Error creating offer: {result[2]}")
Exception: Error creating offer: ('path into atom', '80')
Quexington commented 1 year ago

@cripsisxyz Is this an NFT1 or NFT0? Do you know?

cripsisxyz commented 1 year ago

Minted with the very last version of chia-blockchain so i think is nft1. command used:

chia wallet nft mint -f $nft_wallet_fingerprint -i $nft_wallet_id -ra $royalty_wallet_address -u $image_url -nh $local_image_hash -mu $metadata_url -mh $local_metadata_hash -rp $royalty_prcntg_converted -m $blockchain_minting_fee

Quexington commented 1 year ago

@cripsisxyz do you know how to check out a different branch and use that? I made a branch with some small debug changes so that we can log some additional information. The branch is called quex.debug.

cripsisxyz commented 1 year ago

sure, tried first with complete nft ID and next with the coin ID:

2023-09-11T16:48:19.507 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 21, in inner
    res_object = await f(request_data)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 2915, in nft_get_info
    if "coin_id" not in request:
                             ^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 292, in get_latest_singleton_coin_spend
    log.error(f"quex.debug wallet_rpc_api {coin_state_list}")
ValueError: Coin record 0xb5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 not found

---

2023-09-11T16:48:38.168 wallet chia.wallet.trade_manager  : ERROR    Error creating trade offer
Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 505, in _create_offer_for_ids
    potential_special_offer: Optional[Offer] = await self.check_for_special_offer_making(
                                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 819, in check_for_special_offer_making
    return await NFTWallet.make_nft1_offer(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 976, in make_nft1_offer
    ],

  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 665, in generate_signed_transaction
    amount=uint64(payment_sum),
           ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/nft_wallet/nft_wallet.py", line 471, in sign
    self.log.debug("Found key, signing for pk: %s", pk)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/util/condition_tools.py", line 192, in conditions_dict_for_solution
    for cvp in conditions_for_solution(puzzle_reveal, solution, max_cost):
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/util/condition_tools.py", line 204, in conditions_for_solution
    cost, r = puzzle_reveal.run_with_cost(max_cost, solution)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/types/blockchain_format/program.py", line 113, in run_with_cost
    cost, r = run_chia_program(self.as_bin(), prog_args.as_bin(), max_cost, flags)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<string>", line 1, in <module>
ValueError: ('path into atom', '80')
2023-09-11T16:48:38.171 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 21, in inner
    res_object = await f(request_data)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 72, in rpc_endpoint
    return await func(self, request, *args, tx_config=tx_config, extra_conditions=extra_conditions, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 1692, in create_offer_for_ids
    async with self.service.wallet_state_manager.lock:
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/trade_manager.py", line 383, in create_offer_for_ids
    raise Exception(f"Error creating offer: {result[2]}")
Exception: Error creating offer: ('path into atom', '80')
Quexington commented 1 year ago

Hmm not seeing my special debug statements (make sure you restart your wallet if you didn't after you change your venv). Can you search for the string quex.debug?

cripsisxyz commented 1 year ago

Retried and only have this:

ERROR quex.debug wallet_rpc_api []

and the following lines (i did a ctrl + C to cancel the offer creation because now it never ends):

2023-09-11T16:55:45.634 wallet asyncio                    : ERROR    Exception in callback Service._accept_signal(signal_number=<Signals.SIGTERM: 15>)()
handle: <Handle Service._accept_signal(signal_number=<Signals.SIGTERM: 15>)()>
Traceback (most recent call last):
  File "/usr/lib/python3.11/asyncio/events.py", line 80, in _run
    self._context.run(self._callback, *self._args)
  File "/etc/chia-blockchain/chia-blockchain/chia/server/start_service.py", line 266, in _accept_signal
  File "/etc/chia-blockchain/chia-blockchain/chia/server/start_service.py", line 283, in stop
    self._node._shut_down = True
    ^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/wallet_node.py", line 438, in _close
    if self._server is not None:
        ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/wallet/wallet_weight_proof_handler.py", line 42, in cancel_weight_proof_tasks
    self._executor_shutdown_tempfile.close()
  File "/usr/lib/python3.11/tempfile.py", line 509, in close
    self._closer.close()
  File "/usr/lib/python3.11/tempfile.py", line 446, in close
    unlink(self.name)
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/chia_wallet_weight_proof_handler_executor_shutdown_triggermien7ug4'
2023-09-11T16:57:08.845 wallet chia.rpc.wallet_rpc_api    : ERROR    quex.debug wallet_rpc_api []
2023-09-11T16:57:08.846 wallet chia.rpc.util              : WARNING  Error while handling message: Traceback (most recent call last):
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/util.py", line 21, in inner
    res_object = await f(request_data)
                 ^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 2927, in nft_get_info
    coin_spend, coin_state = await self.get_latest_singleton_coin_spend(peer, coin_id, request.get("latest", True))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/etc/chia-blockchain/chia-blockchain/chia/rpc/wallet_rpc_api.py", line 293, in get_latest_singleton_coin_spend
    raise ValueError(f"Coin record 0x{coin_id.hex()} not found")
ValueError: Coin record 0xb5baf7fe7fae1f784b8fc208741b7d0e8e3a869f7b87d98248205b35e7714925 not found

2023-09-11T16:57:10.713 wallet wallet_server              : WARNING  Cannot write to closing transport 76.211.79.191
2023-09-11T16:57:25.877 wallet chia.wallet.trade_manager  : ERROR    Error creating trade offer

...

2023-09-11T17:06:53.947 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': '0xaa66d970e31670cedec2c12356765b68d163d0815de92dbb6b60a81e1b464f05'}
2023-09-11T17:06:53.998 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': '0x55a5882830251329ca7c0806088da84852fe423e0b72908c22d0ccb7064951f0'}
2023-09-11T17:06:54.046 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': '0xe94a5ae5a7b1817b6bcff6d3f19a7d96df4b672d34bdc4e93d953a78464025de'}
2023-09-11T17:06:54.220 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 'DOUBLE_SPEND', 'status': 3, 'txid': '0x9c88e00a72cab9b7061a896e2fabae6fb2e9ad3a3a10faf1302c85de6d975435'}
2023-09-11T17:06:54.272 wallet chia.wallet.wallet_node    : WARNING  SpendBundle has been rejected by the FullNode. {'error': 
Quexington commented 1 year ago

Did you retry with the bare hex again as well?

Quexington commented 1 year ago

@cripsisxyz Any updates here?

cripsisxyz commented 1 year ago

it seems working now, i don't know the origin of the initial problem. many thanks for the support