⚠️ This section may change without prior notice
Critical information in this section may be subject to change as the network is in early stages.
🔒 Repo not publicly available — please reach out to us if you would like to run this code.
Minimum System Requirements
Setting up a challenger
Prerequisite
- Pull the
develop branch of the moca-challenger repository.
- The deployment of
moca-challenger relies on validator binding initialization. If you want to deploy your own moca-challenger, you need to join as a new validator.
Challenger Introduction
Moca ensures data integrity by regularly issuing challenge events to storage providers to prove that stored data has not been tampered with. This service allows end-users to monitor challenge events in the blockchain and perform verification.
Moca-challenger main components
moca-challenger includes 7 main goroutines: Monitor, Verifier, Vote Collector, Vote Broadcaster, Vote Collator, Tx Submitter, and Attest Monitor.
- Monitor: Polls the Moca blockchain to obtain new blocks, parse challenge events, and add them to the local database.
- Verifier: Verifies the integrity of the stored data by comparing root hashes.
- Vote Broadcaster: Broadcasts a signed vote on the blockchain for events that failed verification.
- Vote Collector: Polls the blockchain for votes broadcast by other Challenger services.
- Vote Collator: Collates votes to achieve a 2/3 consensus.
- Tx Submitter: Sends a
MsgAttest to the blockchain after enough consensus votes are received.
- Attest Monitor: Polls the blockchain for successfully attested challenges and updates the database.
Deploy moca-challenger
Configuration file
Set your private key, deployment environment, and gas limit. The private_key and bls_private_key can be obtained as described in the next section.
Run locally
Running MySQL in Docker
Create a database
Get validator BLS key and challenger key
Compile and launch moca-challenger
Assuming you have a validator running, compile and start the process.
Test and Verification
Create your own SP
The process is similar to creating a validator.
- Authorization: Grant spending limits.
- Submit a proposal: Use a JSON template to create a storage provider.
Tampering with data stored on SP
- Create a bucket and upload a file.
- Find the storage directory on your SP and modify the content of the data chunk file.
Challenge the data chunk of the object
- Regular challenge: Moca automatically generates random data availability challenges. The
moca-challenger monitors these events. If data has been tampered with, the root hashes will not match, and the challenge will be successful. The validator will vote, and if 2/3 consensus is reached, the SP will be slashed.
- Manual challenge: Anyone can submit a transaction to challenge data availability.
Data recovery
Data recovery ensures that original data can be restored if lost on SPs.
- Data is automatically recovered after a successful data challenge.
- Data is automatically recovered when users find that the data is unreadable.
- SPs can selectively recover lost data through tools.
When a challenge succeeds, the tampered data chunk file will be restored to the original file after a while.