node-binary icon indicating copy to clipboard operation
node-binary copied to clipboard

Balance differs between local node and dex.binance

Open Ilia-TheNetworkFirm opened this issue 5 years ago • 7 comments

Hey, guys recently we've fully synchronized our nodes and started receiving different balances from our node and dex.binance.

For example: Request to our node /api/v1/balances/bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0/TUSDB-888

returns

{
  "symbol": "TUSDB-888",
  "free": "524015150419574",
  "locked": "0",
  "frozen": "5004161884907847"
}

Request to dex.binance.org/api/v1/account/bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0

for TUSDB-888 from 'balances' field

returns

{
  "free": "5479263.46218574",
  "frozen": "50041618.84907847",
  "locked": "0.00000000",
  "symbol": "TUSDB-888"
}

The difference is in the free field

Here is node status:

{
  "jsonrpc": "2.0",
  "id": "",
  "result": {
    "node_info": {
      "protocol_version": {
        "p2p": "7",
        "block": "10",
        "app": "0"
      },
      "id": "1b645bd690519ace7ccdf44d496aaf7b0333c51d",
      "listen_addr": "tcp://0.0.0.0:27146",
      "network": "Binance-Chain-Tigris",
      "version": "0.32.3",
      "channels": "36402021222330380041",
      "moniker": "xxx",
      "other": {
        "tx_index": "on",
        "rpc_address": "tcp://0.0.0.0:27147"
      }
    },
    "sync_info": {
      "latest_block_hash": "D855EBC52A14DC16667A1ECB49081C633BE91C2DBFD182529045F15B65A79542",
      "latest_app_hash": "AB09208716146091B7245D74913DA846E32777C855EDD7A239E8119A6D1872C1",
      "latest_block_height": "115459928",
      "latest_block_time": "2020-09-24T08:40:37.048842768Z",
      "catching_up": false,
      "index_height": "115459928"
    },
    "validator_info": {
      "address": "77CA515DDB88A90CA36E61FD2B3AC7DBCCA1592B",
      "pub_key": {
        "type": "tendermint/PubKeyEd25519",
        "value": "1gL+WsKW6DCN4aaNEcwiPaIb63cTXSJAU+Vu9teWssA="
      },
      "voting_power": "0"
    }
  }
}

config.toml and app.toml

Ilia-TheNetworkFirm avatar Sep 24 '20 08:09 Ilia-TheNetworkFirm

Hello, @ilia-altoros

Which version of bnbcli did you use?

I tested with v0.8.0

bnbcli api-server --chain-id "Binance-Chain-Tigris" --node tcp://dataseed1.binance.org:80 --laddr tcp://127.0.0.1:8080 --trust-node

and get the following result:

{"address":"bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0","balance":{"symbol":"TUSDB-888","free":"547966269615343","locked":"0","frozen":"5004161884907847"}}

chainwhisper avatar Sep 27 '20 06:09 chainwhisper

We are running cli with the following command: /home/ec2-user/node-binary/cli/prod/0.8.0-hotfix/linux/bnbcli api-server --chain-id "Binance-Chain-Tigris" --trust-node --node tcp://localhost:27147 --laddr tcp://0.0.0.0:8080 When running bnbcli api-server --chain-id "Binance-Chain-Tigris" --node tcp://dataseed1.binance.org:80 --laddr tcp://127.0.0.1:8080 --trust-node we got the same result as you. The only difference is in the node used as API server backend. It seems that for some reason our node is seeing different data than yours. Could you please me identify the issue, please? @huangsuyu

ArseniiPetrovich avatar Sep 28 '20 13:09 ArseniiPetrovich

@ArseniiPetrovich may i ask what did you get from abci-query or query balance with bnbcli account bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0 to your local node?

curl 'tcp://localhost:27147/abci_query?path="/account/bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0"'

chainwhisper avatar Sep 29 '20 05:09 chainwhisper

Hey, @huangsuyu. Sure. Your query returns the following:

{
  "jsonrpc": "2.0",
  "id": "",
  "result": {
    "response": {
      "value": "S9xMJwrbAQoUe9phEerureYSGKIra1Ug7sfpXkgSCgoDQk5CEJzi1V4SDwoHRVRILTFDORCuvbiFCBIOCgdTTFYtOTg2EIDC1y8SEwoJVEFVREItODg4EICJqabCqQsSEwoJVENBREItODg4EIDA9MGYrwsSEwoJVEdCUEItODg4EMDP1vPmxQQSEwoJVEhLREItODg4EICA6YOx3hYSEwoJVFVTREItODg4EPbY28fY9XYaJuta6YchAqdAcbTKttD0PH3i2ffzbRtmip+ttEdaBhzKPwgNndg6IJnuBSiKAxoTCglUQVVEQi04ODgQgIDm+766BRoTCglUQ0FEQi04ODgQgIDE0tTRAxoTCglUR0JQQi04ODgQgLCdrfH9DRoTCglUSEtEQi04ODgQgIC7i5ObRBoUCglUVVNEQi04ODgQx9Kx3KPo8Qg="
    }
  }
}

ArseniiPetrovich avatar Oct 02 '20 13:10 ArseniiPetrovich

@huangsuyu Is there any updates on this issue?

ArseniiPetrovich avatar Oct 23 '20 10:10 ArseniiPetrovich

@huangsuyu Is there any updates on this issue?

Can you query your fullnode with rpc method? like this SDK function: https://github.com/binance-chain/go-sdk/blob/fdeeb97ecf528a110393c710f14a2274eaa4c5ac/client/rpc/dex_client.go#L228

If there is still an issue with consistency, we ca investigate more.

chainwhisper avatar Oct 26 '20 06:10 chainwhisper

Hi @huangsuyu, I'm not familiar with go but I did some queries from javascript-sdk

Here my code:

const { rpc } = require('@binance-chain/javascript-sdk');

(async () => {
  const rpcClient = new rpc(
    'localhost:27147'
  );
  try {
    const balance = await rpcClient.getBalance(
      'bnb100dxzy02a6k7vysc5g4kk4fqamr7jhjg4m83l0',
      'TUSDB-888'
    );
    console.info(balance);
  } catch (e) {
    console.error(e);
  }
})();

The result is undefined

I tried to use RPC URL https://dataseed1.binance.org:443 the result is the same - undefined

Ilia-TheNetworkFirm avatar Oct 26 '20 13:10 Ilia-TheNetworkFirm