Hi,
With this approach in code (use getaddressbalances), we can not see the balance in non-owned wallet.
|
# Display native currency if the blockchain has one |
|
if abe.get_blockchainparams(chain).get('initial-block-reward', 0) > 0: |
|
body += ['<h3>Native Balance</h3>'] |
|
try: |
|
resp = util.jsonrpc(multichain_name, url, "getaddressbalances", address) |
|
if len(resp) is 0: |
|
body += ['None'] |
|
else: |
|
body += ['<ul>'] |
|
for balance in resp: |
|
if str(balance['assetref']) is '': |
|
body += ['<li>', str(balance['qty']), '</li>'] |
|
body += ['</ul>'] |
|
except util.JsonrpcException as e: |
|
msg= "Failed to get balance for address: JSON-RPC error({0}): {1}".format(e.code, e.message) |
|
body += ['<div class="alert alert-danger" role="warning">', msg, '</div>'] |
|
return |
|
except IOError as e: |
|
msg= "Failed to get balance for address: I/O error({0}): {1}".format(e.errno, e.strerror) |
|
body += ['<div class="alert alert-danger" role="alert">', msg, '</div>'] |
|
return |
)
Check this:
node1 (seed and with multichain explorer):
chain1: getaddressbalances 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
{"method":"getaddressbalances","params":["1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"],"id":1,"chain_name":"chain1"}
[
{
"assetref" : "",
"qty" : 0.00000000,
"raw" : 0
}
]
chain1: getaddresses
{"method":"getaddresses","params":[],"id":1,"chain_name":"chain1"}
[
"1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP"
]
chain1: getaddressbalances 1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP
{"method":"getaddressbalances","params":["1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP"],"id":1,"chain_name":"chain1"}
[
{
"assetref" : "",
"qty" : 1000015.00000000,
"raw" : 100001500000000
}
]
Explorer address 1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP

node2: with address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
chain1: getaddresses
{"method":"getaddresses","params":[],"id":1,"chain_name":"chain1"}
[
"1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"
]
chain1: getaddressbalances 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
{"method":"getaddressbalances","params":["1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7"],"id":1,"chain_name":"chain1"}
[
{
"assetref" : "",
"qty" : 12.00000000,
"raw" : 1200000000
}
]
Explorer address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7

Do you know if exists a better solution? I am starting to dig in the code to understand and try to fix it.
Regards and thanks for Multichain.
Hi,
With this approach in code (use getaddressbalances), we can not see the balance in non-owned wallet.
multichain-explorer/Mce/abe.py
Lines 1854 to 1874 in 4f0749d
Check this:
node1 (seed and with multichain explorer):
Explorer address 1DMsbx13P5iP42DLmdPiWmVCwRNQDPSo13b2PP
node2: with address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
Explorer address 1BjxiATbrwntty1PQx95kk3fcV6FKNWAq4y3e7
Do you know if exists a better solution? I am starting to dig in the code to understand and try to fix it.
Regards and thanks for Multichain.