This guide describes the steps to create a Liquid wallet in Elements and enable it to track the balance of an address owned by another wallet.
In order to watch a confidential address from another wallet, you will need to import the address’ blinding keys, as well as the address.
Assumptions
1.
You have a wallet (W1) that owns an address (A). In this example, A is the confidential address: tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58. W1 has the private keys for A.
2.
You wish to determine the balance for address A using another wallet (W2) that does not have the private keys for A.
3.
You can run RPC commands on both wallets W1 and W2.
Steps
1.
Create a new, full Elements node, and enable indexing with the txindex=1 configuration option. Allow the node to sync completely.
2.
Create wallet W2 on the new Elements node.
3.
Export the blinding key (K) for A from W1, using the dumpblindingkey RPC API (syntax: elements-cli dumpblindingkey "address"):
$ elements-cli dumpblindingkey tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58 e95297b532ff8c2ad267122a04c3809ac4749bd29e090f69e8a56413d5966deb
4.
Import the blinding key K into W2 using the importblindingkey RPC API (syntax: importblindingkey "address" "hexkey"):
$ elements-cli importblindingkey tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58 e95297b532ff8c2ad267122a04c3809ac47 49bd29e090f69e8a56413d5966deb
5.
Import the address A into W2 using the importaddress RPC API (syntax: importaddress "address"), and enable a rescan. This operation will take many minutes.
$ elements-cli importaddress tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58
6.
Verify that ‘iswatchonly’ is now true for address A in W2 using the getaddressinfo RPC API (syntax: getaddressinfo "address"):
$ elements-cli getaddressinfo tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58
{
"address": "tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58",
"scriptPubKey": "00146ba45b38ffcb55285bad546b5e2728ffec6d12da",
"ismine": false,
"solvable": false,
"iswatchonly": true,
"isscript": false,
"iswitness": true,
"witness_version": 0,
"witness_program": "6ba45b38ffcb55285bad546b5e2728ffec6d12da",
"confidential": "tlq1qq2ftgvjum6hvjzz4aavzhqq3r0kzuv3qeglvaqcc8v9w34l2umtwc6aytvu0lj649pd664rttcnj3llvd5fd524uyn8ccjp58",
"confidential_key": "0292b4325cdeaec90855ef582b80111bec2e3220ca3ece83183b0ae8d7eae6d6ec",
"unconfidential": "tex1qdwj9kw8led2jskad2344ufegllkx6yk6re6lez",
"ischange": false,
"timestamp": 1,
"labels": [
""
]
}
7.
You can now view the balance for A using the listreceivedbyaddress RPC API. Set true for the include_empty and include_watchonly parameters.
$ elements-cli listreceivedbyaddress 1 true true
[
{
"involvesWatchonly": true,
"address": "tex1qdwj9kw8led2jskad2344ufegllkx6yk6re6lez",
"amount": {
"bitcoin": 0.00100000,
"38fca2d939696061a8f76d4e6b5eecd54e3b4221c846f24a6b279e79952850a5": 0.00005000
},
"confirmations": 2,
"label": "",
"txids": [
"a19bb672e9092294dfd068aa2ab73d4b886d8d9e82cb0e00c0ce3eea7946da00",
"3427e7d3fb51b912a1950abaae7d2ac584e932da7c29c71f293644ea24f86f54"
]
}
]
8.
You can also view the balance for A in the elements-qt UI. Here 0.001 L-BTC and one asset were sent to the original wallet W1, and we are watching from W2.
Note: This procedure was executed on liquidtestnet, and the blinding key and addresses are real. If you want to test exactly the same commands on your liquidtestnet wallet, you will get the same results.