Quickstart
Publish on chain using Move
Pre-requisite
We assume that you have installed Sui on your device and that you have an understanding of Reclaim's proofs.
In this walkthrough, we will show how you can leverage Reclaim's Move sdk in your own contracts.
You can access the code of this walkthrough on Gitlab.
Reclaim is available on:
Integrating Reclaim
Add Reclaim as a dependency.
To include the Reclaim SDK in your project, add the following to your Move.toml file. The only change needed based on the network you are targeting is the rev value:
Replace [network] with one of the following:
main for Mainnet testnet for Testnet For example, to use the Reclaim SDK on Testnet:
Build with sui move build
, you should have Reclaim sources installed.
Add handlers for Reclaim operations.
Add these functions to your designated module, they simply delegate calls to Reclaim:
Add test scenarios to confirm compatibility:
These tests show how to plug data into Reclaim's models, include them under your tests/your_tests.move
:
Running Tests
To execute the test suite and verify the functionality of the modules, use:
Publishing the Package
To publish the package on the Sui network, execute:
Interacting with the Reclaim Manager
Creating a Reclaim Manager
To create a new Reclaim Manager, use the following command:
Note: Replace $PACKAGE
with your actual package ID.
Adding a New Epoch
To add a new epoch to an existing Reclaim Manager, use the following command:
Note:
- Replace
$PACKAGE
with your package ID. - Replace
$MANAGER
with the object ID obtained from thecreate_reclaim_manager
command.
Create a Proof
Use the create_proof
function to generate a proof. This proof is based on specific parameters, context, identifier, ownership, epoch, timestamp, and a signature.
- Replace placeholders like
$PARAMETERS
,$CONTEXT
, etc., with your actual data. - This process bundles the provided information into a proof that can be stored and verified on the Sui blockchain.
Steps to Obtain Arguments from the Demo
To obtain the necessary arguments for the create_proof
function, you can use the demo available on demo.reclaimprotocol.org. This demo walks you through the process of creating a proof, which will provide you with concrete data for the function arguments.
-
Visit the Demo Site:
- Go to demo.reclaimprotocol.org. This site allows you to interactively create proofs from various providers.
-
Create a Proof:
- Select a Provider: Choose the provider you want to use to create a proof (e.g., proving ownership of an account on Steam).
- Scan the QR Code: Scan the code with your phone, which will open the Reclaim app and prompt you to log in to the provider you selected.
- Provide Required Data: Log in to your account and wait for the proof generation process to be completed.
-
Extract Data for Function Arguments:
- Parameters: Extract the parameters used in the claim, typically a JSON string that contains details like URL, HTTP method, etc.
- Context: Obtain the context string, which often includes the context address, message, and other relevant details.
- Identifier and Owner: The demo will generate an identifier for the claim, and you’ll also need to provide the owner’s address.
- Epoch and Timestamp: These are generated based on the current time and the context of the claim.
- Signature: The demo will provide a signature based on the data provided. This is crucial for the integrity of the proof.
-
Use Data in
create_proof
Function:- Once you have gathered all the necessary information from the demo, you can plug these values directly into the
create_proof
function in your code. Each piece of data corresponds to the respective argument in the function.
- Once you have gathered all the necessary information from the demo, you can plug these values directly into the
By following the above steps, the demo will give you all the concrete data required to populate the arguments for the create_proof
call, ensuring that your interaction with the Reclaim protocol is accurate and verifiable.
Verify a Proof
The verify_proof
function is used to validate a proof that was previously generated.
- Replace
$MANAGER
with your ReclaimManager object ID and$PROOF
with the proof object ID. - Upon successful verification, a confirmation event is emitted, and any associated witnesses are returned.