Providing/Endorsing Data

Once a user has staked their coins and the data providing period has begun, the user can provide their own data or endorse someone else’s. The endorsement model has been adopted to prevent users from having a bad experience sending in data that was “the same” as another user’s but formatted differently and getting slashed or holding up consensus accidentally. For more info on consensus, see the Algorithms section.

1. Provide Data (<DataType>)

function provide_data(
    address delegator_address,
    uint256 dataset_id,
    uint256 user_data) external;

The action that kicks off the data race. If a staked user does not see the data they wish to endorse, then they can send in the data themselves. The first person to send in the data gets a bonus since it’s cheaper to endorse than to provide data. When a user sends in data they automatically endorse their own data, so sometimes the word ‘endorsers’ is used to refer to both users who provide data and users who endorse only. If a user tries to send in data that already exists, then the contract will detect the data is the same and mark the user as an endorser rather than as the provider or unnecessarily reverting the transaction. If the data already exists on-chain a user should not intentionally send in the data again as it is a waste of gas.

2. Endorse Data (<DataType>)

function endorse_data(
    address delegator_address,
    uint256 dataset_id,
    uint256 value_index) external;

The sibling function to provide_data, this is the workhorse that will accept data endorsements and check for consensus. The user must simply indicate the data to endorse and then wait for consensus.

Last updated