Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewards & Commissions #1245

Open
itsciccio opened this issue Jan 27, 2023 · 4 comments
Open

Rewards & Commissions #1245

itsciccio opened this issue Jan 27, 2023 · 4 comments

Comments

@itsciccio
Copy link

Is it possible for one to query rewards + commissions for a validator? If so, how? If not, is there a sort of calculation I should follow?

@itsciccio itsciccio changed the title Rewards Rewards & Commissions Jan 27, 2023
@kostko
Copy link
Member

kostko commented Jan 30, 2023

To query the commission rate and schedule you can use the staking.Account query and on the resulting struct check the .Escrow.CommissionSchedule structure.

Something like (needs some adjustment, error handling, etc.):

import (
    "fmt"

    consensus "github.com/oasisprotocol/oasis-core/go/consensus/api"
    staking "github.com/oasisprotocol/oasis-core/go/staking/api"
    "github.com/oasisprotocol/oasis-sdk/client-sdk/go/config"
    "github.com/oasisprotocol/oasis-sdk/client-sdk/go/connection"
)

// ...
networkCfg := config.DefaultNetworks.All["mainnet"]
networkCfg.RPC = "unix:/path/to/internal.sock" // Use local node for RPC.
conn, err := connection.Connect(ctx, networkCfg)
account, err := conn.Consensus().Staking().Account(ctx, &staking.OwnerQuery{
    Owner: validatorAddress,
    Height: consensus.HeightLatest,
})
fmt.Printf("%+v\n", account.Escrow.CommissionSchedule)

For rewards you mean the current rewards schedule? This is currently only available by looking at the genesis file but we can add a query method to fetch the current schedule if needed in a future release.

@itsciccio
Copy link
Author

Hey @kostko, thanks for the explanation regarding the Commission Schedule.

For rewards you mean the current rewards schedule? This is currently only available by looking at the genesis file but we can add a query method to fetch the current schedule if needed in a future release.

I need to find out when a specific validator receives rewards along with the amount of ROSE received. Based on your previous answer I might need to query the commission schedule...

The way I understand Rewards and Commissions is as such: Rewards are the tokens received when delegating your nodes to a validator, whereas Commissions are the rewards that the validator receives, which is a percentage of the Rewards distributed to delegators.

In that case, how can I find out the exact commission received at each epoch? Not sure if I am making any sense here...

@atharen
Copy link

atharen commented Feb 1, 2023

Sort of like the reward values that Oasis Monitor depicts:
The value of the rewards at each epoch interval, and the reward earned from delegation commissions?

@kostko
Copy link
Member

kostko commented Feb 1, 2023

Oh I see, so you want to track the reward amounts. One way to track this is to query the following information for your own delegation for each epoch:

As you track this value over consecutive epochs the reward would be the difference between the two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants