RGB-Tools / rgb-lightning-node

MIT License
17 stars 19 forks source link

send rgb asset question #16

Closed cymqqqq closed 1 month ago

cymqqqq commented 9 months ago

Hi all, I have a new question here, I execute the following steps: 1.create 4 utxo 2.get rgb invoice by asset id 3.decode the rgb invoice that obtained by step 2 4.send rgb asset, then in this step, I meet this error: "data": { "error": "Unexpected error", "code": 500 } So, do I miss any steps here?

cymqqqq commented 9 months ago

And I issued a new rgb asset, when I sent an asset, it successfully got a txid. But when I sent an asset second time, it failed. Then I check listtransfers, it prints out: 0|rgb-node | { 0|rgb-node | idx: 41, 0|rgb-node | created_at: 1702368938, 0|rgb-node | updated_at: 1702369249, 0|rgb-node | status: 'WaitingConfirmations', 0|rgb-node | amount: 10, 0|rgb-node | kind: 'ReceiveBlind', 0|rgb-node | txid: '473f9e2cbdc57fdb9814b0f0314198107168182293b64380a496648e003de441', 0|rgb-node | recipient_id: 'utxob:2Fzrnh3-3uKkDotLq-wyDmBWpxm-UoYTSsbuX-DQ8PjkvEy-15EihEp', 0|rgb-node | receive_utxo: '05bc58ee65752ccbf5af72dc9eda5cff867417024be6a77f72ef1ffb459b807a:3', 0|rgb-node | change_utxo: null, 0|rgb-node | expiration: 1702455338, 0|rgb-node | transport_endpoints: [Array] 0|rgb-node | }, 0|rgb-node | { 0|rgb-node | idx: 42, 0|rgb-node | created_at: 1702369000, 0|rgb-node | updated_at: 1702369000, 0|rgb-node | status: 'WaitingConfirmations', 0|rgb-node | amount: 10, 0|rgb-node | kind: 'Send', 0|rgb-node | txid: '473f9e2cbdc57fdb9814b0f0314198107168182293b64380a496648e003de441', 0|rgb-node | recipient_id: 'utxob:2Fzrnh3-3uKkDotLq-wyDmBWpxm-UoYTSsbuX-DQ8PjkvEy-15EihEp', 0|rgb-node | receive_utxo: null, 0|rgb-node | change_utxo: '05bc58ee65752ccbf5af72dc9eda5cff867417024be6a77f72ef1ffb459b807a:4', 0|rgb-node | expiration: 1702372600, 0|rgb-node | transport_endpoints: [Array] 0|rgb-node | }, 0|rgb-node | { 0|rgb-node | idx: 43, 0|rgb-node | created_at: 1702369148, 0|rgb-node | updated_at: 1702369148, 0|rgb-node | status: 'WaitingCounterparty', 0|rgb-node | amount: 0, 0|rgb-node | kind: 'ReceiveBlind', 0|rgb-node | txid: null, 0|rgb-node | recipient_id: 'utxob:QMzg49S-xiiQB3hPx-8qT88Uodr-MfnMtEjPZ-U539k9BSe-XWscdp', 0|rgb-node | receive_utxo: '05bc58ee65752ccbf5af72dc9eda5cff867417024be6a77f72ef1ffb459b807a:5', 0|rgb-node | change_utxo: null, 0|rgb-node | expiration: 1702455548, 0|rgb-node | transport_endpoints: [Array] 0|rgb-node | }, 0|rgb-node | { 0|rgb-node | idx: 44, 0|rgb-node | created_at: 1702369340, 0|rgb-node | updated_at: 1702369340, 0|rgb-node | status: 'WaitingCounterparty', 0|rgb-node | amount: 0, 0|rgb-node | kind: 'ReceiveBlind', 0|rgb-node | txid: null, 0|rgb-node | recipient_id: 'utxob:XHTkrEE-oaQs6me7s-tVFo3mny9-oGVanEMwr-kWBrzrPep-io6aMF', 0|rgb-node | receive_utxo: '05bc58ee65752ccbf5af72dc9eda5cff867417024be6a77f72ef1ffb459b807a:6', 0|rgb-node | change_utxo: null, 0|rgb-node | expiration: 1702455740, 0|rgb-node | transport_endpoints: [Array] 0|rgb-node | } 0|rgb-node | ] 0|rgb-node | } So, "WaitingConfirmations" need I do something? I found that I can only send rgb asset successfully just once.

zoedberg commented 9 months ago

So, do I miss any steps here?

Could you please share full commands?

So, "WaitingConfirmations" need I do something?

It depends, if you're on the receiver side it's possible that you are waiting for the sender to broadcast the TX (via a call to the refreshtransfers API) and then reach the min number of confirmations. If you're on the sender side you are waiting only for the TX to reach the min number of confirmations.

cymqqqq commented 9 months ago

full step: 1.list assets 2.create utxo 3.create rgb invoice 4.decode rgb invoice 5.send assets(first time it success, return a txid) 6.send asset again(it failed)

Yes, I called the refresh transfers, here are my params: { "peer_pubkey_and_addr": "038bb5fada0e8dd64d30990c098d6c63d4fa4c2177150534f54209db1699a45e6d@localhost:9735", "capacity_sat": 3000000, "push_msat": 1000000, "asset_amount": 10, "asset_id": "rgb:UP27HXG-wGwGbNTvW-7PGCCebX4-Y7Y2RLL8e-cEjLhNv2J-o43BdS", "public": true, "with_anchors": true } and min confirmations I set it to 1, and I refreshed it twice, but the status is still waiting for confirmation.

cymqqqq commented 9 months ago

Ok, so I found that when I set min confirmation to 0, and then refresh the transfer, it will succeed, but I don't know why.

zoedberg commented 9 months ago

full step: 1.list assets 2.create utxo 3.create rgb invoice 4.decode rgb invoice 5.send assets(first time it success, return a txid) 6.send asset again(it failed)

I meant for you to report the exact commands you executed (i.e. API name and params).

Yes, I called the refresh transfers, here are my params: { "peer_pubkey_and_addr": "038bb5fada0e8dd64d30990c098d6c63d4fa4c2177150534f54209db1699a45e6d@localhost:9735", "capacity_sat": 3000000, "push_msat": 1000000, "asset_amount": 10, "asset_id": "rgb:UP27HXG-wGwGbNTvW-7PGCCebX4-Y7Y2RLL8e-cEjLhNv2J-o43BdS", "public": true, "with_anchors": true } and min confirmations I set it to 1, and I refreshed it twice, but the status is still waiting for confirmation.

These are the params for the off-chain send, not the on-chain one. Please check the explanation I gave to you here: https://github.com/RGB-Tools/rgb-lightning-node/issues/13#issuecomment-1835776772

Ok, so I found that when I set min confirmation to 0, and then refresh the transfer, it will succeed, but I don't know why.

Please check https://github.com/RGB-Tools/rgb-lib/blob/master/docs/transfer_flows.md and https://github.com/RGB-Tools/rgb-lib/blob/master/docs/transfer_states.md, they might help you understand how an on-chain transfer works