DA Solver Sample Integration Walkthrough
This guide showcases sample code and testing steps for DA solver integration with Crestal. Use it to explore how to set up listeners, generate a test proposal, and submit it to understand the flow before implementing a production setup.
We provide example code in the SDK to help you quickly test the solver integration flow. You’ll find two key examples in the utils/examples
directory:
listenToBerachainBartio
: Demonstrates how to listen for proposal requests on Berachain bArtio testnet.submitProposalExample
: Shows how to submit a proposal with dummy data.
Step 1: Clone the CrestalJS SDK repository
Step 2: Start the Event listener
This will start listening for proposal requests on the Berachain bArtio testnet. When a request is detected, you’ll see the request details in your console.
Step 3: Trigger a Request Proposal
Now, let’s trigger a RequestProposal
event so the event listener can detect it, in order for us
to get the data needed for making a proposal.
- Leave the listener running
- Add Berachain bArtio Tesnet to your wallet
- Make sure you have some Berachain bArtio Tesnet tokens on your account. More details on how to get them here.
- Open the Crestal dApp and connect your wallet to it.
- Start a new project.
- Use the AI Assistant to generate a proposal request, and submit it. The submitted proposal request will show up in the event listener output.
Event Listener Output (Sensitive Data Masked):
Step 4: Fill in the details in submitProposalExample
Navigate to utils/examples/submitProposalExample
. Fill in the required fields with your own details:
const solverAddress = 'YOUR_ADDRESS'
: Your account address as a solver(not recommended to use the same one as the one at step 3).project_id: "PROJECT_ID_FROM_REQUEST"
: The project id from the event listener output (the detected proposal request).request_id: "REQUEST_ID_FROM_REQUEST"
: The request id from the event listener output (the detected proposal request).const privateKey = "YOUR_ADDRESS_PRIVATE_KEY"
the prviate key for thesolverAddress
.
Step 5: Submit the Proposal
After filling in the details, submit the proposal to the Crestal backend:
The output looks like this:
After the proposal is submitted, it shows up on the Crestal dapp, in the list of proposals:
With these steps, you can explore and test the DA solver integration flow on Crestal, gaining a practical understanding of the setup and proposal submission process. Once you’re comfortable, you’ll be ready to adapt these concepts for a full integration in a production environment.