Solver DA Integration
Learn how to integrate with Crestal as a DA provider - from listening to proposal requests to submitting your DA solution.
Step 1: Install CrestalJS SDK
Install the NPM CrestalJS SDK by using one of the following commands:
In case you want to build from source:
JavaScript Projects
No additional configuration needed. You can start using the SDK package right away.
TypeScript Projects
Add these essential compiler options to your tsconfig.json
:
Import Functions
Step 2: Listen for Proposal Requests
To initiate the proposal request process, the Solver listens for RequestProposal
events on the designated networks: Berachain bArtio, Polygon Amoy, or Binance Testnet.
Read more about networks supported on our platform here.
Each network has a dedicated listener:
utils/bscTestnetEventListener
utils/beraEventListener
utils/polygonAmoyEventListener
When a RequestProposal
event is detected, you should see output similar to this:
The listener automatically decodes the base64RecParam
included in the event.
This decoded parameter, of type ChainRequestParam
, provides chain-specific metrics essential for building a proposal.
It contains the specific requirements that your DA solution needs to address. Consider these parameters as the project’s minimum requirements.
The closer your solution matches or exceeds these parameters, the higher your fit score should be.
Request Proposal Structure (GO):
Step 3: Build the Proposal
After receiving a request, the solver generates proposals by evaluating different DA solutions and submitting them in the following format:
Each proposal in the proposals array contains:
The DAProposal interface defines all metrics for a DA solution:
Calculate Your Metrics
Provide accurate data about your DA solution’s capabilities. Key metrics include the following:
Performance Metrics
max_throughput
: Maximum data processing capacity.latency
: Network response time.finality_time
: Time taken for transaction finality.send_blob_latency
: Data blob transmission time.block_time
: Average time between blocks.
Cost Structure
init_cost
: Initial setup costs.maintenance_cost
: Ongoing maintenance fees.cost_per_mb
: Data storage costs.cost_per_transaction
: Transaction fees.
Network Statistics
number_of_nodes
: Number of active nodes in the network.uptime
: Network availability.error_rate
: Measure of system reliability.
Note: Not all metrics are mandatory. Focus on the parameters that are most relevant to your DA solution and align with the specific request requirements.
Calculate Fit
After computing your metrics, calculate how well your solution matches the request parameters:
- Compare your capabilities against the request requirements to determine if your solution can meet the specified metrics.
- Calculate a fit score between 0 and 1, representing how well your DA solution aligns with the requester’s needs.
- Consider cost-effectiveness and performance trade-offs to provide an optimal solution balancing performance with cost.
By following these steps, DA providers can ensure they submit comprehensive, relevant metrics and determine the suitability of their solutions for specific requests.
Step 4: Generate SIWE Message
After preparing your proposal, you need to generate a Sign-In with Ethereum (SIWE) message. Use the generateProposalSIWE utility from the SDK:
Usage
Call the function with your proposal data:
The SIWE message expires after 10 minutes. Make sure to use it before expiration.
The function will:
- Fetch a nonce from the API
- Create a SIWE message containing your proposal
- Return the prepared message string
If the generation fails, it will return undefined
and log the error.
Step 5: Sign the SIWE Message
After generating the SIWE message, you need to sign it using your private key. Use the signMessageWithPrivateKey utility from the SDK:
Usage
Chain it with your SIWE message generation:
Step 6: Submit the Proposal
The final step is submitting your proposal using the generated SIWE message and signature.
Use the submitProposal
function from the SDK:
Usage
Here’s how to chain all the previous steps together:
The submission API handles the login request and proposal submission in one step. The API used can be found here.
The function will return:
- The response data if successful
- An error object if submission fails
The response has the following format:
After following all these steps, you’re ready to submit proposals as a DA provider on the Crestal network.
Quick Commands for Solver Integration
For a quick, command-based setup to integrate as a DA provider, follow these essential commands:
For further details on each step, including code samples, refer to our DA Solver Sample Integration Walkthrough.