ElementsProject / elements

Open Source implementation of advanced blockchain features extending the Bitcoin protocol
MIT License
1.05k stars 374 forks source link

wallet managed by elements-cli receives tx with tokens but doesn't process them (not in the locally parsed TX, not in the balance) #1321

Open eckelj opened 5 months ago

eckelj commented 5 months ago

I've created an asset on testnet with ID 7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9. reissued the asset several times (https://blockstream.info/liquidtestnet/asset/7add40beb27df701e02ee85089c5bc0021bc813823fedb5f1dcb5debda7f3da9). After having managed everything on a Jade, we wanted to move the assets to an elements-cli managed wallet that is protected with a secret secured by Shamirs Secret Sharing scheme (n out of m).

The network accepted the TX 875ae63b7fb1e9d029336a081eeab78754ca5ad4e914f680e7c2b9a8c023126f (see the details in this link) in Block 92e11278f6376cd000234602035ec38e4aef76535a15476ea9af82060fb25166.

However, my wallet is still empty:

➜  rddl elements-cli getbalance                                                                            
{
  "bitcoin": 0.00000000
}

The unconfidential address is owned/operated by the wallet:

➜  rddl elements-cli getaddressinfo tex1qjcnrnxsw47tyt8zwvdc2l5pgl3aq7d8g8j3gef
{
  "address": "tex1qjcnrnxsw47tyt8zwvdc2l5pgl3aq7d8g8j3gef",
  "scriptPubKey": "00149626399a0eaf96459c4e6370afd028fc7a0f34e8",
  "ismine": true,
  "solvable": true,
  "desc": "wpkh([4d30cb04/0'/0'/0']035ed6325cb546da0cdfc25b22c8a85de08592aa54ddce67c8d0bfdb006fc77a7c)#p0m9g7ey",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "-----------------------------------------------------------------------",
  "pubkey": "035ed6325cb546da0cdfc25b22c8a85de08592aa54ddce67c8d0bfdb006fc77a7c",
  "confidential": "tlq1qqt3k85mgaz3ruk8zmwv8k86w2uv6t9elt0562pp4sjtkun0e2sm9h93x8xdqatukgkwyucms4lgz3lr6pu6wsw9m2w9m3mv8z",
  "confidential_key": "",
  "unconfidential": "tex1qjcnrnxsw47tyt8zwvdc2l5pgl3aq7d8g8j3gef",
  "ischange": false,
  "timestamp": 1710839620,
  "hdkeypath": "m/0'/0'/0'",
  "hdseedid": ""-----------------------------------------------------------------------",
  "hdmasterfingerprint": "4d30cb04",
  "labels": [
    ""
  ]
}

The original TX got send to this confidential address tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9 which is not equal to the one mentioned in the unconfidential address lookup (tlq1qqt3k85mgaz3ruk8zmwv8k86w2uv6t9elt0562pp4sjtkun0e2sm9h93x8xdqatukgkwyucms4lgz3lr6pu6wsw9m2w9m3mv8z):

➜  rddl elements-cli getaddressinfo tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9
{
  "address": "tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9",
  "scriptPubKey": "00149626399a0eaf96459c4e6370afd028fc7a0f34e8",
  "ismine": false,
  "solvable": true,
  "desc": "wpkh([4d30cb04/0'/0'/0']035ed6325cb546da0cdfc25b22c8a85de08592aa54ddce67c8d0bfdb006fc77a7c)#p0m9g7ey",
  "iswatchonly": false,
  "isscript": false,
  "iswitness": true,
  "witness_version": 0,
  "witness_program": "-----------------------------------------------------------------------",
  "pubkey": "035ed6325cb546da0cdfc25b22c8a85de08592aa54ddce67c8d0bfdb006fc77a7c",
  "confidential": "tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9",
  "confidential_key": "-----------------------------------------------------------------------",
  "unconfidential": "tex1qjcnrnxsw47tyt8zwvdc2l5pgl3aq7d8g8j3gef",
  "ischange": false,
  "timestamp": 1710839620,
  "hdkeypath": "m/0'/0'/0'",
  "hdseedid": "-----------------------------------------------------------------------",
  "hdmasterfingerprint": "4d30cb04",
  "labels": [
    ""
  ]
}

So in theory, I should have received the tokens. But the wallet does not list them.

➜  rddl elements-cli -rpcwallet=dao listreceivedbyaddress                                     
[
]

It appears like I didn't receive any tokens. However, looking up the TX from the wallet I get this result:

elements-cli -rpcwallet=dao gettransaction 875ae63b7fb1e9d029336a081eeab78754ca5ad4e914f680e7c2b9a8c023126f 
{
  "amount": {
    "bitcoin": 0.00000000
  },
  "confirmations": 1083,
  "blockhash": "92e11278f6376cd000234602035ec38e4aef76535a15476ea9af82060fb25166",
  "blockheight": 1310657,
  "blockindex": 1,
  "blocktime": 1710778864,
  "txid": "875ae63b7fb1e9d029336a081eeab78754ca5ad4e914f680e7c2b9a8c023126f",
  "walletconflicts": [
  ],
  "time": 1710778864,
  "timereceived": 1710841758,
  "bip125-replaceable": "no",
  "details": [
  ],

The token that got send is missing in the wallet analysis of the tx.

So this seems to be a bug as it is parsed and shown properly on-chain.

delta1 commented 5 months ago

The original TX got send to this confidential address tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9

How did you generate the address?

which is not equal to the one mentioned in the unconfidential address lookup

Elements and Green(Jade) have different methods of deriving deterministic blinding keys for addresses

eckelj commented 5 months ago

The original TX got send to this confidential address tlq1qqw6d7sqs847cxh2mtzxgm9udntjx23c0pyxvu4uwt3a90vrgaydfm93x8xdqatukgkwyucms4lgz3lr6pu6wsxgu4a0ahpce9

How did you generate the address?

I got the address by calling elements-cli getnewaddress.

which is not equal to the one mentioned in the unconfidential address lookup

Elements and Green(Jade) have different methods of deriving deterministic blinding keys for addresses

Yes, I know this fact. However, what surprised me is that the above wallet interaction is only done on elements-cli on the same wallet. That's why I report this