RPC Calls to read PRV balance of Keychain?

Hello Developers, If I have PRV’s in my Keychains For Example- If I have 10 Prv’s in Anon Keychain and I want to check the PRV balance of my keychain without visiting my Incognito Wallet. Is there an RPC Call like “getbalancebyprivatekey” that can be used to check the keychain balance?

Let us assume two scenarios here

  1. Scenario A
    Where I am running an Incognito Node and generating PRV Rewards and withdrawing these rewards in my Keychain. How do I read/check my PRV balance? I do know that I can use “getbalancebyprivatekey” RPC. For this RPC to work with Incognito V2 I will have to submit the OTA key either using Default Mode(Validators/Shard) or Enhanced Mode(Full Node Owners). Depending on whether I am a Validator or Full node owner I can choose the mode.
    Let us assume I am a validator and not a full node owner, how do I get an access token in that scenario?
    Is there any other way to read the PRV balances that hit my wallet after I withdraw my rewards?

  2. Scenario B
    Here I am not running any Nodes, I just received PRVs in my incognito wallet. is there a way I can check the PRV balance of the wallet using an RPC? Because if I am not a Node owner there is no way I can get an access token and if I do not get an access token I cannot submit the OTA Key using enhanced Mode.

My goal is to be able to read the PRV balance of my Keychains using an RPC call or any other code. Please Guide me @sid @Gaurav_Saini

For RPC, you have to submit your OTAKey. Alternatively, you can consider using the go-sdk with the local cache (https://github.com/incognitochain/go-incognito-sdk-v2/blob/development/tutorials/docs/accounts/utxo_cache.md). In this way, no key submission is required.

You can use the community node (https://beta-fullnode.incognito.org/fullnode) with the following access token: 0ec910a54ffbf2a0bdfc0c8b05e8b5445e51a2ae54f659a35ac7ad9980e4fd2c

WARNING: sending your private key via an RPC is NOT RECOMMENDED unless you own a fullnode and the connection to the fullnode is secure, because the fullnode owner may log your private key and steal all of your funds.

1 Like

I missed this. Glad to share. It sparked another question in my mind: @daniel

I think listoutputcoinsfromcache and listoutputcoins RPCs have some differences :slight_smile: If I submit OTA key, I can use both of them but listoutputcoinsfromcache is much faster. If I do not submit OTA key, only listoutputcoins returns non-empty result. listoutputcoinsfromcache will return an empty result. Am I correct? If not, could you provide me with the difference?


listoutputcoins is an old RPC from Privacy V1 while listoutputcoinsfromcache was introduced along with Privacy V2 to utilize the full-node’s cache. To my knowledge, listoutputcoins is no longer maintained by the dev team.

If you do not submit OTAKey, listoutputcoins returns a list of v1 output coins, and only a partial list of v2 output coins (from the 8640 most recent blocks).

1 Like