Staking (and Unstaking)

In order to provide or endorse data for a dataset, a user has to stake their coins as collateral. Some or all of these coins can be confiscated if the endorsement is (or would be) late or wrong. See below in the Algorithms section for an explanation of the conditions under which a user will lose their stake. As a bonus for active and long-standing endorsers the required stake adjusts based on the user’s reputation. The details of this will also be covered in the Algorithms section.

1. Stake For Dataset (ODDelegator)

function stake_for_dataset(uint256 dataset_id) external;

This is the function that locks a user’s stake. Once a user has staked, they have made a commitment to endorse data. Breaking the commitment will result in some sort of repercussion, not always monetary.

2. Mark Data As Unavailable (ODDelegator::mark_data_as_unavailable)

function mark_dataset_as_unavailable(uint256 dataset_id) external;

In most cases the user should be able to stake and then provide or endorse data once the data is available. To protect in case a data source goes down, however, a user can mark a dataset’s data source as unavailable and withdraw their stake. In order to deter certain actions, withdrawing from a dataset (and not restaking when the data source is back up) results in a cooldown period on the withdrawn coins. The cooldown period helps dissuade people from committing to a dataset and then jumping to a newer request if it comes up. Staking is to be seen as a commitment.

3. Withdraw Unstaked Collateral (CoinHolder)

function withdraw_unstaked_coins(
    address delegator_address,
    uint256 dataset_id) external;

While there is a cooldown period on using withdrawn coins to stake again, the user may further withdraw the coins to their wallet at any time. The ODO only holds coins that are actively being staked.

4. Make Withdrawn Coins Available (CoinHolder)

function make_withdrawn_coins_available(
    address delegator_address,
    uint256 dataset_id) external;

Once the cooldown period has elapsed the previously-withdrawn coins are eligible to use for staking. This function allows a user to consolidate their withdrawn balance with the rest of the balance available for staking.

5. Restake (ODDelegator)

function restake_for_dataset(uint256 dataset_id) external;

Ideally, when data is unavailable it is due to a server malfunction and the expected data should be available again shortly. When this is the case, the user can choose to re-stake their coins if a slot is still available. An important thing to know about restaking is that the allotted time does not reset. Currently, there is a fifteen-minute window in which to endorse data. The window is paused when a user withdraws and resumes when the user restakes. A user should not restake if there is not enough time to endorse data left on their timer.

6. Withdraw (ODDelegator)

function withdraw_from_dataset(uint256 dataset_id) external;

Sometimes things are such that a user needs to withdraw from a dataset and never return. There are two reasons for this: the dataset has been cancelled or the dataset has gone stale. Of course there’s no point in staying in a cancelled dataset, so the first case is obvious. As for the second case, a dataset is considered stale if no one has endorsed data for too long. In order to prevent holding an honest user’s coins unnecessarily long, a user who has endorsed data may withdraw their stake, leaving their endorsed value behind. In this case, since a user withdrew their stake, they cannot be slashed. However, if the dataset later finishes and the user provided or endorsed the correct data, then they will be paid for their data.

Last updated