Witness Chain
Search
K
🔑

Smart Contracts

List of Smart Contract functions
The reference smart contracts are Work in Progress
The reference smart contracts are planned to be written for Solana and any Ethereum compatible blockchain networks. It is designed for creating a proof-of-backhaul (PoB) challenge that allows provers and challengers to participate in challenges
The smart contracts should be treated as reference implementations only

Functions

start_challenge()
This function is used to initiate a PoB challenge. The caller of this function is required to provide the parameters such as bump value, amount, number of accounts, and timeout. The caller of this function is referred to as the payer and the participating users are referred to as provers & challengers. This function initiates an escrow transaction to transfer the Challenge Fee from Payer to the Smart Contract Account
Initiated by: Payer
Signers: Payer
Entities involved: Payer, Prover
Expected Parameters
  1. 1.
    Challenge fee
  2. 2.
    number of challengers involved
  3. 3.
    timeout
end_challenge()
This function is used to end the PoB challenge and distribute the fee to the challengers. The individual challenger fee is calculated based on the total amount provided by the payer and divided equally among the participating challengers.
Initiated by: Challenge Coordinator
Signers: Challenge Coordinator
Entities involved: Challenge Coordinator, Challenger
timeout()
This function is used to handle the case when the challenge times out. If the challenge times out, the total amount is transferred back to the payer's account.

Data Structures

The smart contract uses the following data structures:
  1. 1.
    Store: This structure holds the data required to manage the PoB challenge, including the amount, bump value, number of accounts, timeout, and expiration time.
  2. 2.
    AccountInfo: This structure holds the information of the accounts, including the key, balance, and data length.
This smart contract provides a reference solution for creating and managing PoB challenges on the Solana/Ethereum compatible blockchain networks. It provides a secure and transparent way for users to participate in the challenge and receive rewards.