├── .github └── workflows │ └── trigger-auth-sdk.yml ├── .gitignore ├── LICENSE ├── README.md └── mintlify-docs ├── README.md ├── api-reference ├── accept-a-list-of-proposals-from-solvers.mdx ├── accept-an-list-of-proposal-from-solvers.mdx ├── api-health-status-check.mdx ├── api.yaml ├── auth-user-request-by-bearer-token.mdx ├── authenticate-and-obtain-session-cookie.mdx ├── authenticate-bearer-token.mdx ├── authenticate-user-session.mdx ├── authenticate-user.mdx ├── cancel-a-project.mdx ├── cancel-an-active-project.mdx ├── cancel-project.mdx ├── check-system-health.mdx ├── check-user-login_nonce-linked-privyid.mdx ├── check-whitelist-status.mdx ├── claim-a-referral-code.mdx ├── claim-refer-code.mdx ├── create-a-new-proposal.mdx ├── create-a-worker-deployment-info.mdx ├── create-an-project-info.mdx ├── create-da-dynamic-data.mdx ├── create-da-metrics-record.mdx ├── create-deployment-information.mdx ├── create-new-project-information.mdx ├── create-new-project.mdx ├── create-project-record.mdx ├── create-worker-deployment-information.mdx ├── create-worker-deployment.mdx ├── fetch-legacy-da-information.mdx ├── fetch-referral-information.mdx ├── fetch-solver-details.mdx ├── fetch-static-configuration-for-da.mdx ├── fetch-user-profile.mdx ├── fetch-worker-deployment-status.mdx ├── generate-authentication-nonce.mdx ├── get-a-a-list-of-worker.mdx ├── get-a-deployment-info.mdx ├── get-a-list-of-da-graph-info.mdx ├── get-a-list-of-project-info.mdx ├── get-a-proposal-by-id.mdx ├── get-a-solver.mdx ├── get-a-worker.mdx ├── get-all-quests.mdx ├── get-all-user-quests.mdx ├── get-an-project-info.mdx ├── get-auth-nonce.mdx ├── get-chat-history.mdx ├── get-da-static-info-will-remove-later.mdx ├── get-da-static-info.mdx ├── get-deployments-based-on-user_address-or-deployed-proposal-id-or-hash.mdx ├── get-deployments-via-request-id.mdx ├── get-health_check.mdx ├── get-nonce-for-auth-purpose.mdx ├── get-project-details.mdx ├── get-recommend-proposals-from-solvers.mdx ├── get-top-x-scores.mdx ├── get-user-info-by-user-address.mdx ├── get-user-referral.mdx ├── get-user-whitelist-for-some-features.mdx ├── get-weekly-quests-for-all-user.mdx ├── initialize-worker-deployment.mdx ├── interact-with-dashboard.mdx ├── link-external-accounts.mdx ├── link-external-web2-accounts.mdx ├── link-web2-external-accounts-into-web3-via-privy.mdx ├── list-active-workers.mdx ├── list-available-quests.mdx ├── list-da-dynamic-data.mdx ├── list-data-availability-da-dynamic-data.mdx ├── list-deployments.mdx ├── list-project-information.mdx ├── list-user-projects.mdx ├── login-to-get-session-cookie.mdx ├── metadata │ ├── get-all-metadata-metrics.mdx │ ├── retrieve-comprehensive-system-metrics.mdx │ └── retrieve-system-metrics.mdx ├── process-referral-code-claim.mdx ├── query-deployment-records.mdx ├── query-worker-deployment-status.mdx ├── record-dashboard-interaction.mdx ├── record-node-da-metrics.mdx ├── record-user-activity.mdx ├── refresh-auth-token.mdx ├── refresh-authentication-token.mdx ├── refresh-user-token.mdx ├── retrieve-a-list-of-user-projects.mdx ├── retrieve-a-list-of-workers.mdx ├── retrieve-a-proposal-by-id.mdx ├── retrieve-available-quests.mdx ├── retrieve-chat-history.mdx ├── retrieve-da-graph-information.mdx ├── retrieve-da-performance-history.mdx ├── retrieve-da-static-information-temporary-endpoint.mdx ├── retrieve-da-static-information.mdx ├── retrieve-da-system-configuration.mdx ├── retrieve-da-system-metrics.mdx ├── retrieve-deployment-information.mdx ├── retrieve-deployments-based-on-various-parameters.mdx ├── retrieve-historical-performance-metrics-for-da.mdx ├── retrieve-legacy-da-information.mdx ├── retrieve-nonce-for-authentication.mdx ├── retrieve-project-details.mdx ├── retrieve-project-information.mdx ├── retrieve-proposal-details.mdx ├── retrieve-recommended-proposals-from-solvers-1.mdx ├── retrieve-recommended-proposals-from-solvers.mdx ├── retrieve-referral-information.mdx ├── retrieve-solver-details-by-uuid.mdx ├── retrieve-solver-details.mdx ├── retrieve-solver-proposal-recommendations.mdx ├── retrieve-solver-recommendations.mdx ├── retrieve-system-metrics-for-da.mdx ├── retrieve-top-user-scores.mdx ├── retrieve-user-information.mdx ├── retrieve-user-leaderboard-rankings.mdx ├── retrieve-user-quest-progress.mdx ├── retrieve-user-referral-information.mdx ├── retrieve-weekly-quest-status.mdx ├── retrieve-weekly-quests-for-all-users.mdx ├── retrieve-whitelist-status.mdx ├── retrieve-worker-deployments-by-request-id.mdx ├── retrieve-worker-details-by-uuid.mdx ├── retrieve-worker-details.mdx ├── send-a-chat-message.mdx ├── send-a-chat-to-chat-server.mdx ├── send-chat-message.mdx ├── store-da-dynamic-data.mdx ├── submit-interaction-report.mdx ├── submit-solver-proposals.mdx ├── terminate-a-project.mdx ├── terminate-project.mdx ├── unlink-external-accounts.mdx ├── unlink-external-web2-accounts.mdx ├── unlink-web2-external-accounts.mdx ├── update-a-project-info.mdx ├── update-a-project-status-into-cancelled.mdx ├── update-a-project-status-into-terminated.mdx ├── update-a-worker-deployment-status.mdx ├── update-project-details.mdx ├── update-project-information.mdx ├── update-worker-deployment-status.mdx ├── validate-authentication-token.mdx ├── verify-user-authentication-status.mdx └── verify-user-status.mdx ├── build └── rollup-avail-op-stack.mdx ├── favicon.svg ├── guides ├── quests.mdx ├── referrals.mdx └── testnet.mdx ├── images ├── avail-opstack │ ├── avail1.png │ └── avail2.png ├── incentives-program-guide │ ├── incentives1.png │ ├── incentives2.png │ └── incentives3.png ├── referrals │ ├── referrals1.png │ ├── referrals2.png │ ├── referrals3.png │ └── referrals4.png ├── solver-guide │ ├── solver1.gif │ ├── solver2.gif │ ├── solver3.gif │ ├── solver4.gif │ ├── solver5.gif │ └── solver6.png ├── testnet-guide │ ├── testnet2.png │ ├── testnet3.gif │ ├── testnet4.gif │ ├── testnet5.gif │ └── testnet6.gif └── worker-guide │ ├── worker1.png │ ├── worker10.png │ ├── worker11.png │ ├── worker2 .gif │ ├── worker3.png │ ├── worker4.gif │ ├── worker5.gif │ ├── worker6.gif │ ├── worker7.png │ ├── worker8.gif │ └── worker9.png ├── intentkit ├── agent-guide.mdx ├── api-reference.mdx ├── api.yaml ├── chat-with-an-ai-agent.mdx ├── check-api-health.mdx ├── create-or-update-an-agent.mdx ├── get-all-agents.mdx ├── overview.mdx ├── quickstart.mdx ├── skills-guide.mdx └── twitter-integration.mdx ├── introduction.mdx ├── logo ├── dark.svg └── light.svg ├── mint.json ├── networks └── supported-networks.mdx └── solvers ├── solver-integration-quick-guide.mdx ├── solver-worker-integration.mdx ├── worker-guide.mdx └── worker.mdx /.github/workflows/trigger-auth-sdk.yml: -------------------------------------------------------------------------------- 1 | name: Notify Auth SDK on API Change 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | paths: 8 | - "mintlify-docs/api-reference/api.yaml" 9 | jobs: 10 | trigger_update: 11 | runs-on: ubuntu-latest 12 | 13 | steps: 14 | - name: Trigger Update SDK Workflow in Auth SDK 15 | run: | 16 | curl -X POST -H "Accept: application/vnd.github.v3+json" \ 17 | -H "Authorization: token ${{ secrets.AUTOGEN_GITHUB_TOKEN }}" \ 18 | https://api.github.com/repos/crestalnetwork/crestal-js-sdk/dispatches \ 19 | -d '{"event_type":"update-api-file"}' 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | **/.DS_Store 2 | **/node_modules/ 3 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Crestal Network 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Welcome to the **Crestal Docs** repository! This documentation hub is designed to guide developers in integrating with Crestal's tools and APIs. 2 | 3 | ## Getting Started 4 | 5 | ### Prerequisites 6 | 7 | To run this documentation locally, ensure you have the following: 8 | 9 | 1. **Node.js** - [Download here](https://nodejs.org/en/download/) 10 | 2. **Yarn** - [Install Yarn](https://yarnpkg.com/getting-started/install) 11 | 3. **Mintlify CLI** - Install Mintlify via npm: 12 | ```bash 13 | npm install -g mintlify 14 | ``` 15 | 16 | ### Local Setup 17 | 18 | To set up and run the Crestal Docs locally using Mintlify, follow these steps: 19 | 20 | **1. Clone the Repository** 21 | 22 | Clone the Crestal Docs repository and navigate to the project directory: 23 | 24 | ```bash 25 | git clone https://github.com/crestalnetwork/docs.git 26 | cd docs 27 | cd mintlify-docs 28 | ``` 29 | 30 | **2. Install Dependencies** 31 | 32 | Use Yarn to install the project's dependencies: 33 | 34 | ```bash 35 | yarn install 36 | ``` 37 | 38 | **4. Run the Mintlify Development Server*** 39 | 40 | Use the Mintlify CLI to run the documentation server locally: 41 | 42 | ```bash 43 | mintlify dev 44 | ``` 45 | 46 | The server will be available at `http://localhost:3000`, where you can view and edit the documentation in real-time. 47 | 48 | **5. Build for Production (Optional)** 49 | 50 | If you need to generate a production-ready build, use: 51 | 52 | ```bash 53 | mintlify build 54 | ``` 55 | 56 | This command will create a static output of your documentation in the `dist` folder, ready for deployment. 57 | 58 | ## Contributing 59 | 60 | We welcome contributions! To get started: 61 | 62 | 1. **Fork the Repo**: Fork `https://github.com/crestalnetwork/docs.git` and clone it locally. 63 | 64 | 2. **Create a Branch**: Create a new branch for your changes: 65 | ```bash 66 | git checkout -b feature/your-feature-name 67 | ``` 68 | 69 | 3. **Make Changes**: Edit the documentation and preview using: 70 | ```bash 71 | mintlify dev 72 | ``` 73 | 74 | 4. **Commit and Push**: Commit your changes and push to your fork: 75 | ```bash 76 | git add . 77 | git commit -m "Brief description of your changes" 78 | git push origin feature/your-feature-name 79 | ``` 80 | 81 | 5. **Open a Pull Request**: Submit a pull request to the main branch of the original repository. 82 | 83 | Thanks for contributing! 84 | 85 | -------------------------------------------------------------------------------- /mintlify-docs/README.md: -------------------------------------------------------------------------------- 1 | # docs -------------------------------------------------------------------------------- /mintlify-docs/api-reference/accept-a-list-of-proposals-from-solvers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/accept-an-list-of-proposal-from-solvers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/api-health-status-check.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /health_check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/auth-user-request-by-bearer-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/auth 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/authenticate-and-obtain-session-cookie.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /login 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/authenticate-bearer-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/auth 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/authenticate-user-session.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /login 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/authenticate-user.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /login 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/cancel-a-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/cancelled 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/cancel-an-active-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/cancelled 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/cancel-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/cancelled 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/check-system-health.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /health_check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/check-user-login_nonce-linked-privyid.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/check-whitelist-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /whitelists 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/claim-a-referral-code.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /referral/{code}/claim 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/claim-refer-code.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /referral/{code}/claim 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-a-new-proposal.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /proposals 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-a-worker-deployment-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-an-project-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-da-dynamic-data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-da-metrics-record.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-deployment-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-new-project-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-new-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-project-record.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-worker-deployment-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/create-worker-deployment.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-legacy-da-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /das 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-referral-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /referral 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-solver-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /solvers/{solver_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-static-configuration-for-da.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/static 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-user-profile.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/{user_address} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/fetch-worker-deployment-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/generate-authentication-nonce.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /nonce 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-a-list-of-worker.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-deployment-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/{deployment_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-list-of-da-graph-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/graph 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-list-of-project-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-proposal-by-id.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/{proposal_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-solver.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /solvers/{solver_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-a-worker.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers/{worker_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-all-quests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-all-user-quests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /user/quests 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-an-project-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-auth-nonce.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /nonce 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-chat-history.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-da-static-info-will-remove-later.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /das 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-da-static-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/static 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-deployments-based-on-user_address-or-deployed-proposal-id-or-hash.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-deployments-via-request-id.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-health_check.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /health_check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-nonce-for-auth-purpose.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /nonce 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-project-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-recommend-proposals-from-solvers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-top-x-scores.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /scores 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-user-info-by-user-address.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/{user_address} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-user-referral.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /referral 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-user-whitelist-for-some-features.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /whitelists 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/get-weekly-quests-for-all-user.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests/weekly 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/initialize-worker-deployment.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/interact-with-dashboard.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /report 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/link-external-accounts.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/link 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/link-external-web2-accounts.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/link 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/link-web2-external-accounts-into-web3-via-privy.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/link 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-active-workers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-available-quests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-da-dynamic-data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-data-availability-da-dynamic-data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-deployments.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-project-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/list-user-projects.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/login-to-get-session-cookie.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /login 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/metadata/get-all-metadata-metrics.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /metadata/metrics 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/metadata/retrieve-comprehensive-system-metrics.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /metadata/metrics 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/metadata/retrieve-system-metrics.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /metadata/metrics 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/process-referral-code-claim.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /referral/{code}/claim 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/query-deployment-records.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/query-worker-deployment-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/record-dashboard-interaction.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /report 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/record-node-da-metrics.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /node/info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/record-user-activity.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /report 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/refresh-auth-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /token 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/refresh-authentication-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /token 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/refresh-user-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /token 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-a-list-of-user-projects.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-a-list-of-workers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-a-proposal-by-id.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/{proposal_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-available-quests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-chat-history.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-graph-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/graph 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-performance-history.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/graph 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-static-information-temporary-endpoint.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /das 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-static-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/static 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-system-configuration.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/static 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-da-system-metrics.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-deployment-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/{deployment_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-deployments-based-on-various-parameters.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-historical-performance-metrics-for-da.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da/graph 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-legacy-da-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /das 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-nonce-for-authentication.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /nonce 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-project-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-project-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-proposal-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/{proposal_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-recommended-proposals-from-solvers-1.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-recommended-proposals-from-solvers.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/recommendation 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-referral-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /referral 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-solver-details-by-uuid.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /solvers/{solver_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-solver-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /solvers/{solver_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-solver-proposal-recommendations.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-solver-recommendations.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-system-metrics-for-da.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-top-user-scores.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /scores 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-user-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/{user_address} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-user-leaderboard-rankings.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /scores 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-user-quest-progress.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /user/quests 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-user-referral-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /referral 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-weekly-quest-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests/weekly 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-weekly-quests-for-all-users.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /quests/weekly 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-whitelist-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /whitelists 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-worker-deployments-by-request-id.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /deployments/worker 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-worker-details-by-uuid.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers/{worker_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/retrieve-worker-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /workers/{worker_uuid} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/send-a-chat-message.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/send-a-chat-to-chat-server.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/send-chat-message.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/store-da-dynamic-data.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /node/info/da 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/submit-interaction-report.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /report 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/submit-solver-proposals.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /proposals/solver 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/terminate-a-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/stop 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/terminate-project.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/stop 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/unlink-external-accounts.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/unlink 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/unlink-external-web2-accounts.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/unlink 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/unlink-web2-external-accounts.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/accounts/unlink 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-a-project-info.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: patch /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-a-project-status-into-cancelled.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/cancelled 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-a-project-status-into-terminated.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /projects/{project_id}/stop 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-a-worker-deployment-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker/status 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-project-details.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: patch /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-project-information.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: patch /projects/{project_id} 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/update-worker-deployment-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /deployments/worker/status 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/validate-authentication-token.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /users/auth 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/verify-user-authentication-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/api-reference/verify-user-status.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /users/check 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/build/rollup-avail-op-stack.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Build a Rollup with Avail DA and OP Stack 3 | description: Learn how to build a rollup with Avail, including setting up the Avail Alt DA server, configuring the OP Stack, and deploying contracts. 4 | --- 5 | 6 | ## Prerequisites 7 | 8 | For **macOS**, the installation commands below use **Homebrew**. If you don’t have Homebrew installed, you can install it by running the following command in your terminal: 9 | 10 | ```bash 11 | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" 12 | ``` 13 | 14 | For **Ubuntu**, the installation commands below use `apt` to install the required software. 15 | 16 | Once Homebrew or `apt` is set up, you can use the commands in the table below to install the required software. 17 | 18 | | Software | Version | macOS (Homebrew) | Ubuntu | 19 | |----------|-----------|-------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 20 | | Git | OS default | `brew install git` | `sudo apt install -y git curl make jq` | 21 | | Go | 1.21 | `brew install go@1.21` | `wget https://go.dev/dl/go1.21.linux-amd64.tar.gz && tar xvzf go1.21.linux-amd64.tar.gz && sudo cp go/bin/go /usr/bin/go && sudo mv go /usr/lib && echo export GOROOT=/usr/lib/go >> ~/.bashrc` | 22 | | Node.js | ^20 | `brew install node` | `curl -fsSL https://deb.nodesource.com/setup_16.x \| sudo -E bash - && sudo apt-get install -y nodejs npm` | 23 | | Pnpm | 8.5.6 | `npm install -g pnpm` | `sudo npm install -g pnpm` | 24 | | Make | OS default | `xcode-select --install` | `sudo apt install -y make` | 25 | | jq | OS default | `brew install jq` | `sudo apt install -y jq` | 26 | | direnv | Latest | `brew install direnv` | `sudo apt install -y direnv` | 27 | | Foundry | ^0.2.0 | `curl -L https://foundry.paradigm.xyz \| bash` | `curl -L https://foundry.paradigm.xyz \| bash` | 28 | 29 | ## Step 1: Get Your Avail Node with Crestal 30 | 31 | **Crestal** provides the Avail node for you, so you don’t need to set it up from scratch. 32 | This node is essential for your rollup because it guarantees that all transaction data is properly stored and easily accessible. This Data Availability (DA) is critical for rollups to verify and confirm transactions. 33 | 34 | Here’s a short summary of how to get a deployed node using the Crestal Carbon testnet: 35 | 36 | 1. Connect to Crestal: Visit the **[Crestal Carbon Testnet](https://app.testnet.crestal.xyz/dashboard)** and connect your EVM-compatible wallet. 37 | 2. Get Test Tokens: Obtain testnet tokens from the Polygon Amoy or Berachain bArtio faucet. 38 | 3. Use the AI Design Assistant: Define your infrastructure needs, such as DA services and execution stacks, with Crestal's AI. 39 | 4. Submit to the Marketplace: Submit your design to the Crestal Intent-Based Marketplace for solver proposals. 40 | 5. Deploy Node: Once a proposal is selected, Crestal will handle the deployment, and you’ll receive the necessary node parameters for integration. 41 | 42 | Please follow [this guide](/guides/testnet) for more detailed steps on how to get your own node. 43 | 44 | After the node is deployed, the node details will look like the ones bellow. The **WSS URL** will be needed to start the server on the next step, 45 | as it allows your rollup to communicate securely and in real-time with the Data Availability layer provided by Crestal’s Avail node 46 | 47 | 48 | ```json 49 | { 50 | "token": "bea08b5e5ad9938ccd5be3a6379c294dbac724e772c58e9c2e2165ceb92218c0", 51 | "access_url": "https://avail-turing.service.testnet.crestal.xyz/bea08b5e5ad9938ccd5be3a6379c294dbac724e772c58e9c2e2165ceb92218c0", 52 | "server_https_url": "https://avail-turing.service.testnet.crestal.xyz", 53 | "server_web_socket_url": "wss://avail-turing.service.testnet.crestal.xyz" 54 | } 55 | ``` 56 | 57 | ## Step 2: Set Up Your Avail Alt DA Server 58 | 59 | Before we even touch the OP Stack, we need to get the Avail Alt DA server up and running. This server is the key connection point to Avail’s Data Availability (DA) layer, which Crestal provides for you. Let’s set this up first. 60 | 61 | ### 2.1 Create a New Wallet for Avail DA and Get Test Tokens 62 | 63 | If you don’t have a wallet for Avail DA yet, no worries—we’ll get you started right here. 64 | 65 | - **Install a Wallet Extension:** We recommend [Subwallet](https://www.subwallet.app/download.html) to manage your Avail account. 66 | - **Create a New Wallet:** Open the wallet extension and create a new account. Make sure to save that seed phrase somewhere safe. 67 | - Example Avail Address: `5E1qtvznhpcCoPzigNFqS5sqMHxo1VTXmX4YSR9yqCiqWrEg` 68 | - **Get Avail Test Tokens:** Go to the [Avail Faucet](https://faucet.avail.tools/) and paste your new address to get some test tokens. 69 | - **Verify Your Tokens:** Head over to the [Avail Explorer](https://explorer.avail.so), make sure your wallet is connected, and confirm you’ve received the test tokens. 70 | 71 | ### 2.2 Generate Your Own Avail DA App ID 72 | 73 | Next, let’s register your app on Avail DA using an App ID. This ID is like your app’s unique identifier when interacting with the DA layer. 74 | 75 | - **Go to the Chainstate Explorer:** Visit [Avail explorer](https://explorer.avail.so/#/chainstate), uncheck the "Include Option" toggle, and click the "+" next to the method name to fetch all registered App IDs. 76 | - **Register Your Own App ID:** Follow the [official guide](https://docs.availproject.org/docs/end-user-guide/app-id#how-to-register-my-own-appid) to create an App ID for your app. 77 | - Example App ID: 78 | - **owner:** `5E1qtvznhpcCoPzigNFqS5sqMHxo1VTXmX4YSR9yqCiqWrEg` 79 | - **id:** `135` 80 | 81 | ### 2.3 Set Up the Avail Alt DA Server with Crestal's node 82 | 83 | This server will handle all of your rollup’s data availability. You will need the Avail node provided by Crestal at (step 1)[#step-1-get-your-avail-node-with-crestal]for this. 84 | 85 | - **Clone the Server Repository:** 86 | ```bash 87 | git clone https://github.com/availproject/avail-alt-da-server.git 88 | ``` 89 | 90 | - **Start the Server:** 91 | 92 | Firstly, make sure you have the WSS URL for your node. You can always find the node details by navigating to 93 | the **Deploy** section on the **[Crestal Carbon Testnet](https://app.testnet.crestal.xyz/dashboard)**, select 94 | your project, and click on **View Details** at the bottom-right corner of the page. 95 | 96 | ![Node Details](../images/testnet-guide/testnet5.gif) 97 | 98 | Then navigate to the `avail-alt-da-server` directory and run the following command: 99 | 100 | ```bash 101 | ./bin/avail-da-server --addr=localhost --port=8000 \ 102 | --avail.rpc=wss://avail-turing.service.testnet.crestal.xyz/bea08b5e5ad9938ccd5be3a6379c294dbac724e772c58e9c2e2165ceb92218c0 \ 103 | --avail.seed="YOUR_WALLET_SEED_PHRASE_HERE" \ 104 | --avail.appid=135 105 | ``` 106 | 107 | Here’s a breakdown of the command: 108 | - `--addr=localhost --port=8000`: Runs the server locally on port 8000. 109 | - `--avail.rpc`: This is the WSS URL of the Avail node provided by Crestal. 110 | - `--avail.seed`: Use your wallet’s seed phrase here. 111 | - `--avail.appid=135`: Replace `135` with your own App ID. 112 | 113 | ### 2.4 Verify the DA Server is Running 114 | 115 | After starting the DA server, you should see logs confirming that it’s connected to the Avail network: 116 | 117 | ```text 118 | INFO [10-17|22:59:06.934] Initializing Alt DA DA server... 119 | INFO [10-17|22:59:06.935] Connecting to wss://avail-turing.service.testnet.crestal.xyz/... 120 | INFO [10-17|22:59:09.534] Started DA Server 121 | ``` 122 | 123 | ## Step 3: Create an Infura Account for the Ethereum Sepolia Node 124 | 125 | Now that the DA server is running, you’ll need an Infura account to interact with Ethereum’s Sepolia testnet. 126 | 127 | 1. **Sign Up for Infura:** Go to [Infura](https://infura.io) and sign up for a free account. 128 | 2. **Create a New Project:** Select Sepolia as the network. 129 | 3. **Note Project Details:** Note down the Project ID and API Key—you’ll need these to connect your rollup to Sepolia. 130 | 131 | Your Sepolia node URL will look like this: 132 | 133 | ``` 134 | https://sepolia.infura.io/v3/your-infura-project-id 135 | ``` 136 | 137 | ## Step 4: Building the Optimism Adapter Source 138 | 139 | Now that the DA server is running, let’s build the adapter source for Optimism. Clone the Optimism repo and build the required components. 140 | 141 | ```bash 142 | git clone https://github.com/ethereum-optimism/optimism.git 143 | cd optimism 144 | git fetch --tag --all 145 | git checkout v1.9.1 146 | git submodule update --init --recursive 147 | pnpm install 148 | make op-node op-batcher op-proposer 149 | make build 150 | ``` 151 | 152 | With these commands, you’ll have the OP stack components (node, batcher, proposer) ready to go for your rollup. 153 | 154 | ## Step 5: Building Geth 155 | 156 | This will help with syncing your rollup chain. 157 | 158 | ```bash 159 | git clone https://github.com/ethereum-optimism/op-geth.git 160 | cd op-geth 161 | git fetch --tag --all 162 | git checkout v1.101408.0 163 | make geth 164 | ``` 165 | 166 | If you’re using brew to install Go, you’ll want to update the `GORUN` variable in the Makefile: 167 | 168 | ``` 169 | GORUN = /opt/homebrew/opt/go@1.22/bin/go run 170 | ``` 171 | 172 | This ensures your Go environment is properly set up. 173 | 174 | ## Step 6: Generating and Securing Keys 175 | 176 | Generate the keys for your rollup roles: Admin, Proposer, Batcher, and Sequencer. 177 | 178 | ```bash 179 | cd packages/contracts-bedrock 180 | echo "Admin:"; cast wallet new 181 | echo "Proposer:"; cast wallet new 182 | echo "Batcher:"; cast wallet new 183 | echo "Sequencer:"; cast wallet new 184 | ``` 185 | 186 | Example output for the Admin key: 187 | 188 | ``` 189 | Address: 0x879b4D04927304A3D383fC4F7b6Fe139053660dA 190 | Private key: 0x9ef007ab575cd12aaeac661fb6f2c7b36a33a7e6a174f3f038015b76e58063bd 191 | ``` 192 | 193 | Make sure to save all the keys somewhere safe. 194 | 195 | ## Step 7: Network Configuration and Setup 196 | 197 | After building the necessary repositories, the next step is to configure your chain settings. Create a `.envrc` file and add these variables: 198 | 199 | ```bash 200 | # Admin account 201 | export GS_ADMIN_ADDRESS=0xF5E8ce0C00F09Dd70Da27D0e9705E37A56c0d99F 202 | export GS_ADMIN_PRIVATE_KEY=0x929de22a260c8ad100a054b2caf4e5f95f16c13cb5489a7b69f5c96caf1c9205 203 | 204 | # Batcher account 205 | export GS_BATCHER_ADDRESS=0x0b31383D636a965878E144b92Da1559d27D26b10 206 | export GS_BATCHER_PRIVATE_KEY=0x292fb38aaa0ffc6e45494242406270e2f90827da170b27657e0df1edd888d211 207 | 208 | # Proposer account 209 | export GS_PROPOSER_ADDRESS=0x7Eca23cA2800A3F3D04232d6DA9F091e892C7D1F 210 | export GS_PROPOSER_PRIVATE_KEY=0x0380b7e2b073bc8ce0a070d10b8d5e4a910514b43be2678d3b1c83d21a67f8a8 211 | 212 | # Sequencer account 213 | export GS_SEQUENCER_ADDRESS=0x40D1B9CC808Fd2142Ec995dE199879e84fD684DE 214 | export GS_SEQUENCER_PRIVATE_KEY=0x67bdf03337224ccd1aaaa325a1ae407252fd551058e55188a5c7cfbcf8f18cbd 215 | 216 | # L1 chain information 217 | export L1_CHAIN_ID=11155111 218 | export L1_BLOCK_TIME=12 219 | 220 | # L2 chain information 221 | export L2_CHAIN_ID=42069 222 | export L2_BLOCK_TIME=2 223 | export L1_RPC_KIND=infura 224 | 225 | export L1_RPC_URL=wss://sepolia.infura.io/ws/v3/e4603e373f8a4a828a3b9b000f632a78 226 | ``` 227 | 228 | Activate the environment: 229 | 230 | ```bash 231 | direnv allow . 232 | ``` 233 | 234 | ## Step 8: Deploying Contracts 235 | 236 | ### 8.1 Generate Deployment Config 237 | 238 | Head over to the `packages/contracts-bedrock` directory and run: 239 | 240 | ```bash 241 | ./scripts/getting-started/config.sh 242 | ``` 243 | 244 | This generates a file called `getting_started.json` in the `deploy-config` folder. 245 | 246 | ### 8.2 Update the Configuration 247 | 248 | Open the `getting_started.json` file and add this at the bottom: 249 | 250 | ```json 251 | { 252 | "useAltDA": true, 253 | "daCommitmentType": "GenericCommitment", 254 | "daChallengeWindow": 160, 255 | "daResolveWindow": 160, 256 | "daBondSize": 1000000, 257 | "daResolverRefundPercentage": 0 258 | } 259 | ``` 260 | 261 | ### 8.3 Deploy Your Contracts 262 | 263 | Run the following command in the `packages/contracts-bedrock` directory: 264 | 265 | ```bash 266 | DEPLOYMENT_OUTFILE=deployments/artifact.json \ 267 | DEPLOY_CONFIG_PATH=deploy-config/getting-started.json \ 268 | forge script scripts/deploy/Deploy.s.sol:Deploy --broadcast --private-key $GS_ADMIN_PRIVATE_KEY --rpc-url $L1_RPC_URL --slow 269 | ``` 270 | 271 | ## Step 9: Running the Rollup Components 272 | 273 | ### 9.1 Run Geth 274 | 275 | ```bash 276 | cd ~/Desktop/op-geth 277 | mkdir datadir 278 | build/bin/geth init --datadir=datadir --state.scheme=hash genesis.json 279 | ./build/bin/geth \ 280 | --datadir ./datadir \ 281 | --http \ 282 | --http.corsdomain="*" \ 283 | --http.vhosts="*" \ 284 | --http.addr=0.0.0.0 \ 285 | --http.port=9545 \ 286 | --http.api=web3,debug,eth,txpool,net,engine \ 287 | --ws \ 288 | --ws.addr=0.0.0.0 \ 289 | --ws.port=9546 \ 290 | --ws.origins="*" \ 291 | --ws.api=debug,eth,txpool,net,engine \ 292 | --syncmode=full \ 293 | --nodiscover \ 294 | --maxpeers=0 \ 295 | --networkid=42069 \ 296 | --authrpc.vhosts="*" \ 297 | --authrpc.addr=0.0.0.0 \ 298 | --authrpc.port=9551 \ 299 | --authrpc.jwtsecret=./jwt.txt \ 300 | --rollup.disabletxpoolgossip=true \ 301 | --state.scheme=hash \ 302 | --cache=2048 303 | ``` 304 | 305 | ### 9.2 Run the OP Node 306 | 307 | ```bash 308 | cd ~/Desktop/optimism/op-node 309 | ./bin/op-node \ 310 | --l2=http://localhost:9551 \ 311 | --l2.jwt-secret=./jwt.txt \ 312 | --sequencer.enabled \ 313 | --sequencer.l1-confs=5 \ 314 | --verifier.l1-confs=4 \ 315 | --rollup.config=./rollup.json \ 316 | --rpc.addr=0.0.0.0 \ 317 | --rpc.port=8547 \ 318 | --p2p.disable \ 319 | --rpc.enable-admin \ 320 | --l1=$L1_RPC_URL \ 321 | --altda.enabled=true \ 322 | --altda.da-server=http://localhost:8000 323 | ``` 324 | 325 | ### 9.3 Run the OP Batcher 326 | 327 | ```bash 328 | cd ~/Desktop/optimism/op-batcher 329 | ./bin/op-batcher \ 330 | --l2-eth-rpc=http://localhost:9545 \ 331 | --rollup-rpc=http://localhost:8547 \ 332 | --poll-interval=1s \ 333 | --private-key=$GS_BATCHER_PRIVATE_KEY \ 334 | --altda.enabled=true \ 335 | --altda.da-server=http://localhost:8000 336 | ``` 337 | 338 | ### 9.4 Run the OP Proposer 339 | 340 | Grab the `L2OutputOracleProxy` address from your `[chain-id]-deploy.json` file, located at `packages/contracts-bedrock/deployments`. 341 | 342 | ![L2OutputOracleProxy](../images/avail-opstack/avail1.png) 343 | 344 | Now run the OP Proposer: 345 | 346 | ```bash 347 | cd ~/Desktop/optimism/op-proposer 348 | ./bin/op-proposer \ 349 | --rollup-rpc=http://localhost:8547 \ 350 | --l2oo-address=0xb7236d31C0819DA796AD106e0A85922F20Dd5b53 \ 351 | --private-key=$GS_PROPOSER_PRIVATE_KEY \ 352 | --l1-eth-rpc=$L1_RPC_URL 353 | ``` 354 | 355 | ## Step 10: Adding Your Rollup Network to the Wallet 356 | 357 | Finally, add your custom rollup to a wallet like MetaMask and start playing with your new network! 358 | 359 | ![Add rollup to Metamask](../images/avail-opstack/avail2.png) 360 | -------------------------------------------------------------------------------- /mintlify-docs/favicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /mintlify-docs/guides/quests.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Incentives Program Guide 3 | description: Learn how to participate in Crestal Carbon’s Testnet Incentives Program and earn Crestal Rocks. 4 | --- 5 | 6 | We’re excited to launch Crestal Carbon’s Testnet Incentives Program, where your participation shapes the future of our platform and rewards you with Crestal Rocks. Whether you’re a developer, tester, or Web3 enthusiast, this is your chance to get involved, earn exclusive rewards, and secure a spot on the leaderboard! 7 | 8 | ![Rocks](../images/incentives-program-guide/incentives1.png) 9 | 10 | ## How the Program Works 11 | 12 | The program is simple: complete quests, track your progress, invite friends, and collect Crestal Rocks to climb the leaderboard. Top contributors can unlock special recognition, bragging rights, and even future perks within the Crestal ecosystem. With weekly quests and new challenges, there’s always a way to get involved and make your mark! 13 | 14 | ## Getting Started: Setting Up Your Profile 15 | 16 | To kick things off, make sure you’ve connected your wallet to our Testnet App. This will give you access to our newly launched Profile Page, where you can: 17 | 18 | - **View your current rank** on the leaderboard. 19 | - **Track the number of Rocks** you’ve collected so far. 20 | - **See how many quests you’ve completed** and what’s still available. 21 | - **Check your referral codes** and referral boosters (coming soon!). 22 | 23 | ![Board](../images/incentives-program-guide/incentives2.png) 24 | 25 | 26 | Crestal testnet quests can be completed on either Berachain testnet (bArtio) or Polygon testnet (Amoy). You will need test gas tokens for each option. 27 | * **Polygon Amoy faucet**: [Option 1](https://faucet.polygon.technology/), [Option 2](https://www.alchemy.com/faucets/polygon-amoy), [Option 3](https://faucets.chain.link/polygon-amoy) 28 | * **Berachain bArtio faucet**: [Option 1](https://bArtio.faucet.berachain.com/), [Option 2](https://faucet.trade/berachain-testnet-bera-faucet) 29 | 30 | 31 | 32 | ## Completing Quests: Step-by-Step Instructions 33 | 34 | Each quest in the Crestal Carbon testnet is designed to engage you with our platform, explore our capabilities, and help us gather crucial feedback. As our platform evolves, new quests may be released and covered in future articles. 35 | This quests list is valid as of Oct 1, 2024. 36 | 37 | ![Weekly Quests](../images/incentives-program-guide/incentives3.png) 38 | 39 | #### 1. Daily User 40 | **Description**: Explore the Crestal Carbon testnet app, connect your wallet, and dive into the dApps modules. 41 | 42 | 43 | 44 | Go to [https://app.testnet.crestal.xyz/](https://app.testnet.crestal.xyz/). 45 | 46 | 47 | Connect your wallet to the testnet. 48 | 49 | 50 | Navigate through the app and explore different modules at least once a day for a week. 51 | 52 | 53 | 54 | **Repeatable**: Each connection and navigation counts as 1 completion. The more completions, the larger the share of the Rocks distributed at the end of the week. 55 | 56 |
57 | 67 |
68 | 69 | #### 2. Corner Dealer 70 | **Description**: Create interesting X posts about Crestal and link your wallet to earn Rocks. 71 | 72 | 73 | 74 | Compose a tweet about your experience or learnings with Crestal Carbon using #CrestalClear, #CrestalMath, or #CrestalCarbon. 75 | 76 | 77 | Ensure your tweet highlights a unique insight, feature, or suggestion. 78 | 79 | 80 | Complete the quest by submitting the form with your tweet information. 81 | 82 | 83 | 84 | **Repeatable**: Each unique, original post counts as 1 completion. 85 | 86 |
87 | 97 |
98 | 99 | #### 3. CrestHAL9000 BFF 100 | **Description**: Collaborate with the Crestal AI9000 to design a project architecture and submit it to the marketplace. 101 | 102 | 103 | 104 | Click “New Project” to start designing. 105 | 106 | 107 | Chat with CrestHAL9000 to design a project architecture. 108 | 109 | 110 | Submit the design to the Crestal marketplace for custom deployment proposals. 111 | 112 | 113 | 114 | **Repeatable**: Each unique proposal request counts as 1 completion. 115 | 116 |
117 | 127 |
128 | 129 | #### 4. Window Shopper 130 | **Description**: Receive proposals on the Crestal marketplace, select one, and deploy it. 131 | 132 | 133 | 134 | Submit a request for proposals to the marketplace. 135 | 136 | 137 | Browse the received proposals. 138 | 139 | 140 | Select and approve a proposal for deployment. 141 | 142 | 143 | 144 | **Repeatable**: Each deployment counts as 1 completion. 145 | 146 |
147 | 157 |
158 | 159 | #### 5. Purity Control 160 | **Description**: Test new features, provide feedback, and report any bugs. 161 | 162 | 163 | 164 | Explore recently released features in the Crestal Carbon testnet. 165 | 166 | 167 | Write a short report on what you liked, improvements, and issues. 168 | 169 | 170 | Complete the quest by submitting the feedback form. 171 | 172 | 173 | 174 | **Repeatable**: Each helpful feedback submission counts as 1 completion. 175 | 176 |
177 | 187 |
188 | 189 | #### 6. Early Adopter 190 | **Description**: Use deployed infra Legos in your projects to complete this quest. 191 | 192 | 193 | 194 | Deploy an infra module using Crestal. 195 | 196 | 197 | Integrate the module into your project. 198 | 199 | 200 | Use the Crestal module regularly in your project. 201 | 202 | 203 | 204 | **Repeatable**: Each read/write request sent to the infra module counts as 1 completion. 205 | 206 |
207 | 217 |
218 | 219 | ## How Rocks Are Distributed 220 | 221 | At the end of each week (Monday 00:00:00 UTC), we calculate the number of quests completed by each user, divide it by the total completions for each quest, and apply the ratio to the Rocks bag allocated to that quest. 222 | 223 | 224 | **Example** 225 | 226 | During the week, 3 users complete the Corner Dealer quest. 227 | 228 | The quest has a bag of 7,000 Rocks to be distributed at the end of the week. 229 | 230 | **User Completions**: 231 | - User 1: completed the Corner Dealer quest 4 times 232 | - User 2: completed the Corner Dealer quest 2 times 233 | - User 3: completed the Corner Dealer quest 1 time 234 | 235 | **Total Completions**: 7 236 | 237 | **Rock Distribution**: 238 | - User 1: 7000 × (4/7) = 4000 Rocks 239 | - User 2: 7000 × (2/7) = 2000 Rocks 240 | - User 3: 7000 × (1/7) = 1000 Rocks 241 | 242 | 243 | ## Tracking Your Progress 244 | 245 | The Profile Page includes two key sections to keep track of your achievements: 246 | 247 | - **Leaderboard Tab**: See how you stack up against other users and challenge yourself to climb higher. 248 | - **History Tab**: View a detailed log of each week you participated in and the corresponding Rocks earned. 249 | 250 | Use these tools to strategize and set new goals each week! 251 | 252 | ## Referral Program Coming Soon 253 | 254 | A Referral Program is on its way! Soon you’ll be able to invite friends, earn additional Rocks, and secure more rewards for growing the Crestal community. This guide will be updated as soon as the feature is released. 255 | 256 | ## FAQ 257 | 258 | Completing all the quests will solidify your position on the leaderboard and earn you recognition within the Crestal community. Many quests are repeatable! 259 | 260 | 261 | Rocks are updated weekly. If there’s a delay, don’t worry — your participation is always recorded. 262 | 263 | 264 | For more answers, check out our complete FAQ section at the bottom of your profile page. -------------------------------------------------------------------------------- /mintlify-docs/guides/referrals.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Referral Program Guide 3 | description: Guide to earning rewards in Crestal Carbon’s referral program. 4 | --- 5 | 6 | The Crestal referral program enables users to unlock referral codes by completing quests on the Crestal dApp. These codes can be shared with friends to earn **Rock Boosters**, which increase rewards for both referrers and referred friends. 7 | 8 | ## How It Works 9 | 10 | ### 1. Earn Referral Codes 11 | - Complete quests on the Crestal dApp to unlock referral codes. 12 | - If you have used Crestal Carbon before, you will receive 5 referral codes visible under your profile. 13 | 14 | ### 2. Share Referral Codes 15 | - Share your referral codes with friends. 16 | - Friends can claim and use the code to join the platform and start completing quests. 17 | 18 | ### 3. Earn Rock Boosters 19 | - As your friends complete quests using your referral code, both you and your friends earn **Rock Boosters** based on quest completion and streaks. 20 | 21 | ## Referral Benefits 22 | 23 | - **Up to 3x Rock Boost**: During the first 4 weeks, both referrers and referred friends can earn up to a 3x Rock Boost. 24 | - **Tier-Based Scaling**: Increase your referrer tier by inviting more friends: 25 | - **Tier 1**: 1-3 friends = 10% Rock Booster. 26 | - **Tier 2**: 4-10 friends = 15% Rock Booster. 27 | - **Tier 3**: 11+ friends = 20% Rock Booster. 28 | - **Quest Streak Rewards**: Earn a 5% Rock Boost each time your friends complete a 3-week quest streak. This booster stacks with every additional streak. 29 | 30 | ![Referral Benefits](../images/referrals/referrals1.png) 31 | 32 | ## Getting Started 33 | 34 | If you have used Crestal Carbon in the past, you will automatically receive 5 referral codes. These codes are available under your profile. 35 | 36 | ![Getting Started](../images/referrals/referrals2.png) 37 | 38 | If you need a referral code, you can claim one from a friend. 39 | 40 | ![Getting Started](../images/referrals/referrals3.png) 41 | 42 | ## Maximizing Your Rewards 43 | 44 | ### New User Booster 45 | New users receive a quest multiplier during their first 12 weeks on Crestal Carbon: 46 | 47 | - **Weeks 1-4**: Each quest your friend completes counts as 3 quests for both of you. 48 | - **Weeks 5-8**: Each quest counts as 2 quests. 49 | - **Weeks 9-12**: Each quest counts as 1.1 quests. 50 | 51 | 52 | Consistency is rewarded! If your friend completes one quest per week for 3 consecutive weeks, you'll receive a 5% Rock Booster. This booster stacks for every additional 3-week streak. 53 | 54 | 55 | ### Multiple Referrals Booster 56 | Unlock more potential as you refer additional friends! Each week, you have the opportunity to earn new referral codes. Use them wisely to scale your referrer tier and unlock bigger rewards: 57 | 58 | - **Tier 1**: 1–3 friends referred = 10% Rock Booster. 59 | - **Tier 2**: 4–10 friends referred = 15% Rock Booster. 60 | - **Tier 3**: 11+ friends referred = 20% Rock Booster. 61 | 62 | ## Tracking Your Referrals 63 | You can easily track your referral activity in the new **History** tab under your profile. This section provides: 64 | 65 | - Your weekly Rock collection. 66 | - The number of Rocks you’re earning from your referrals. 67 | 68 | ![Track Referrals](../images/referrals/referrals4.png) 69 | -------------------------------------------------------------------------------- /mintlify-docs/guides/testnet.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Testnet Guide 3 | description: Guide for getting started with Crestal Carbon testnet. 4 | --- 5 | 6 | Welcome to Crestal Carbon, our public testnet designed to empower Web3 developers to explore, design, and deploy optimal Web3 infrastructure services. This guide will help you get started with Crestal Carbon and navigate its key features. 7 | 8 | ## Connect to Crestal Carbon 9 | 10 | To begin, visit the [Crestal Carbon Testnet](https://app.testnet.crestal.xyz/) on your laptop browser and connect your EVM-compatible wallet (such as MetaMask) to the platform. You will also need testnet gas tokens, which can be obtained from the appropriate faucet: 11 | 12 | * **Polygon Amoy faucet**: [Option 1](https://faucet.polygon.technology/), [Option 2](https://www.alchemy.com/faucets/polygon-amoy), [Option 3](https://faucets.chain.link/polygon-amoy) 13 | * **Berachain bArtio faucet**: [Option 1](https://bArtio.faucet.berachain.com/), [Option 2](https://faucet.trade/berachain-testnet-bera-faucet) 14 | 15 | ## Explore Crestal Analytics 16 | 17 | Crestal Analytics lets you compare performance metrics from various infrastructure providers, including Avail, Celestia, and EigenDA. Use the [Crestal Analytics Dashboard](https://app.testnet.crestal.xyz/dashboard) to explore metrics such as cost per block and time to finality, providing you with a comprehensive view of the data availability landscape. Additional infrastructure categories will be released soon. 18 | 19 | ![Crestal Analytics](../images/testnet-guide/testnet2.png) 20 | 21 | ## Use Crestal AI Design Assistant 22 | 23 | Crestal's AI-powered Design Assistant helps you build decentralized applications by breaking down your project requirements. Note that this feature is only available if you’re building an L2, an Appchain, or require Data Availability. 24 | 25 | To start, connect your wallet and visit the [AI assistant page](https://app.testnet.crestal.xyz/assistant). The Design Assistant will guide you through the process of specifying components like execution stacks, DA services, indexers, and oracles. Once complete, your requirements are summarized in a requirement table for submission to the Crestal marketplace. 26 | 27 | For example, if you’re building a DEX AppChain, the Design Assistant will guide you through specifying the necessary components, such as execution stacks, data availability (DA) services, indexers, oracles, and more. The AI then summarizes these requirements into a detailed requirement table, which can be submitted to the Crestal marketplace for further deployment proposals. 28 | 29 | ![AI Assitant](../images/testnet-guide/testnet3.gif) 30 | 31 | ## Deploy with Crestal Intent-Based Marketplace 32 | 33 | After specifying your infrastructure needs, submit them to the [Crestal Intent-Based Marketplace](https://app.testnet.crestal.xyz/designs). Here, expert solvers will propose infrastructure solutions tailored to your requirements. Please note that at this stage, solvers will only include Data Availability in their proposals. 34 | 35 | You will receive multiple proposals with information about the technologies used, costs, and solver reputation. Once you choose a proposal, a worker agent will deploy the infrastructure according to the solver’s blueprint. 36 | 37 | ![Deploy](../images/testnet-guide/testnet4.gif) 38 | 39 | ## Monitor Deployment and Get Node Parameters 40 | 41 | During the deployment process, you can track progress in real-time. After setup is complete (usually within a few minutes), you will receive all parameters needed to integrate the deployed infrastructure node into your project. 42 | 43 | ![Monitor deployment](../images/testnet-guide/testnet5.gif) 44 | 45 | ## Monitor and Incentivize Performance 46 | 47 | Crestal’s **Proof of Performance (PoP™)** mechanism continuously monitors the deployed infrastructure to ensure it meets promised standards. Track these metrics via the [Crestal Deploy Dashboard](https://app.testnet.crestal.xyz/deployments) to ensure your infrastructure is performing as expected. 48 | 49 | 50 | ## Earn Rewards with Quests 51 | 52 | Participate in quests to earn Rocks, Crestal Carbon’s testnet points. You can earn rewards by exploring metrics, interacting with the AI, and deploying services. Visit the [Dashboard page](https://app.testnet.crestal.xyz/dashboard) to track your progress, and keep an eye on quests, where new challenges are regularly added. More information about quests and how to complete them can be found [here](./quests). 53 | 54 | ![Quests](../images/testnet-guide/testnet6.gif) 55 | 56 | ## Provide Feedback 57 | 58 | Your feedback is crucial for improving Crestal. Report bugs, share suggestions, or offer your thoughts via the platform, or connect with us on [Discord](https://discord.com/invite/crestal) or [X](https://x.com/crestalnetwork). 59 | -------------------------------------------------------------------------------- /mintlify-docs/images/avail-opstack/avail1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/avail-opstack/avail1.png -------------------------------------------------------------------------------- /mintlify-docs/images/avail-opstack/avail2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/avail-opstack/avail2.png -------------------------------------------------------------------------------- /mintlify-docs/images/incentives-program-guide/incentives1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/incentives-program-guide/incentives1.png -------------------------------------------------------------------------------- /mintlify-docs/images/incentives-program-guide/incentives2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/incentives-program-guide/incentives2.png -------------------------------------------------------------------------------- /mintlify-docs/images/incentives-program-guide/incentives3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/incentives-program-guide/incentives3.png -------------------------------------------------------------------------------- /mintlify-docs/images/referrals/referrals1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/referrals/referrals1.png -------------------------------------------------------------------------------- /mintlify-docs/images/referrals/referrals2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/referrals/referrals2.png -------------------------------------------------------------------------------- /mintlify-docs/images/referrals/referrals3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/referrals/referrals3.png -------------------------------------------------------------------------------- /mintlify-docs/images/referrals/referrals4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/referrals/referrals4.png -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver1.gif -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver2.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver2.gif -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver3.gif -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver4.gif -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver5.gif -------------------------------------------------------------------------------- /mintlify-docs/images/solver-guide/solver6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/solver-guide/solver6.png -------------------------------------------------------------------------------- /mintlify-docs/images/testnet-guide/testnet2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/testnet-guide/testnet2.png -------------------------------------------------------------------------------- /mintlify-docs/images/testnet-guide/testnet3.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/testnet-guide/testnet3.gif -------------------------------------------------------------------------------- /mintlify-docs/images/testnet-guide/testnet4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/testnet-guide/testnet4.gif -------------------------------------------------------------------------------- /mintlify-docs/images/testnet-guide/testnet5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/testnet-guide/testnet5.gif -------------------------------------------------------------------------------- /mintlify-docs/images/testnet-guide/testnet6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/testnet-guide/testnet6.gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker1.png -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker10.png -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker11.png -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker2 .gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker2 .gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker3.png -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker4.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker4.gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker5.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker5.gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker6.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker6.gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker7.png -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker8.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker8.gif -------------------------------------------------------------------------------- /mintlify-docs/images/worker-guide/worker9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Motaman-M/docs/21aae2f717c7e69f72ed9ac87652b4cdb67ceade/mintlify-docs/images/worker-guide/worker9.png -------------------------------------------------------------------------------- /mintlify-docs/intentkit/agent-guide.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Agent Setup: Creation and Configuration' 3 | description: 'Create and manage IntentKit agents' 4 | --- 5 | 6 | # Understanding Agents 7 | 8 | IntentKit agents are AI assistants that can be customized with specific roles and behaviors. Each agent can be configured to handle different tasks autonomously. 9 | 10 | ```mermaid 11 | graph TD 12 | A[Agent] --> B[Core Components] 13 | A --> C[Skills] 14 | A --> D[Configuration] 15 | 16 | B --> B1[Core Model] 17 | B --> B2[Behavioral Prompt] 18 | 19 | C --> C1[Pre-built Skills] 20 | C --> C2[Custom Skills] 21 | 22 | D --> D1[Autonomous Tasks] 23 | D --> D2[Third-party Integrations] 24 | 25 | class A fill:#4CAF50,stroke:#388E3C,color:#FFFFFF 26 | class B,C,D fill:#8BC34A,stroke:#7B9A3A,color:#FFFFFF 27 | class B1,B2,C1,C2,D1,D2 fill:#CDDC39,stroke:#8B9A30,color:#000000 28 | ``` 29 | 30 | ## Creating Agents 31 | 32 | Basic agent creation: 33 | 34 | ```bash 35 | curl -X POST http://127.0.0.1:8000/agents \ 36 | -H "Content-Type: application/json" \ 37 | -d '{ 38 | "id": "test-bot", 39 | "name": "Test Bot", 40 | "model": "gpt-4", 41 | "prompt": "You are a helpful AI assistant." 42 | }' 43 | ``` 44 | 45 | ## Quick Testing 46 | 47 | Test your agent: 48 | 49 | ```bash 50 | # Basic chat test 51 | curl "http://127.0.0.1:8000/agents/test-bot/chat?q=Hello" 52 | 53 | # Browser testing 54 | http://127.0.0.1:8000/agents/test-bot/chat?q=Hello 55 | ``` 56 | 57 | ## Agent Configuration 58 | 59 | ```json 60 | { 61 | "id": "trading-bot", 62 | "name": "Trading Assistant", 63 | "model": "gpt-4", 64 | "prompt": "You are a crypto trading assistant with expertise in market analysis.", 65 | "autonomous_enabled": false, 66 | "autonomous_minutes": null, 67 | "autonomous_prompt": null, 68 | "integrations": { 69 | "cdp": true, 70 | "twitter": false 71 | } 72 | } 73 | ``` 74 | 75 | ### Core Settings 76 | - `id`: Unique identifier 77 | - `name`: Display name 78 | - `model`: AI model selection 79 | - `prompt`: Base instructions 80 | 81 | ### Autonomous Mode 82 | 83 | ```mermaid 84 | stateDiagram-v2 85 | [*] --> Idle 86 | Idle --> Active: Schedule 87 | Active --> Processing: Task 88 | Processing --> Idle: Complete 89 | Processing --> Alert: Issue 90 | Alert --> Idle 91 | ``` 92 | 93 | Enable autonomous execution: 94 | 95 | ```json 96 | { 97 | "autonomous_enabled": true, 98 | "autonomous_minutes": 60, 99 | "autonomous_prompt": "1. Monitor market conditions 100 | 2. Alert on significant changes 101 | 3. Execute predefined strategies" 102 | } 103 | ``` 104 | 105 | ## Adding Skills 106 | 107 | Agents can use various skills. See [Skills Guide](/intentkit/skills-guide) for details. 108 | 109 | ```json 110 | { 111 | "skills": { 112 | "built_in": ["market_analysis", "risk_management"], 113 | "custom": ["my_trading_strategy"] 114 | } 115 | } 116 | ``` 117 | 118 | ## Quotas 119 | 120 | Monitor usage via headers: 121 | ``` 122 | X-RateLimit-Remaining: 985 123 | X-RateLimit-Reset: 3600 124 | ``` 125 | 126 | ## Error Handling 127 | 128 | Common status codes: 129 | - `404`: Agent not found 130 | - `429`: Quota exceeded 131 | - `500`: Internal error 132 | 133 | Error format: 134 | ```json 135 | { 136 | "error": { 137 | "code": "quota_exceeded", 138 | "message": "Daily limit reached", 139 | "reset_time": "2024-01-01T00:00:00Z" 140 | } 141 | } 142 | ``` 143 | 144 | ## Best Practices 145 | 146 | 1. **Agent Design** 147 | - Clear, specific prompts 148 | - Focused responsibility 149 | - Appropriate skills 150 | 151 | 2. **Configuration** 152 | - Test manually first 153 | - Start simple 154 | - Monitor performance 155 | 156 | 3. **Production Use** 157 | - Implement rate limiting 158 | - Monitor quotas 159 | - Regular log reviews -------------------------------------------------------------------------------- /mintlify-docs/intentkit/api-reference.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'API Overview' 3 | description: 'This API enables interaction with agents, their creation and management, and health monitoring of the API server.' 4 | --- 5 | 6 | ## **Endpoints** 7 | 8 | ### **Health Monitoring** 9 | 10 | #### **GET `/health`** 11 | Check the health status of the API server. 12 | 13 | - **Description**: This endpoint provides a simple status check for the server. 14 | - **Response**: 15 | ```json 16 | { 17 | "status": "healthy" 18 | } 19 | ``` 20 | - **Example**: 21 | ```bash 22 | curl -X GET https://your-api-url.com/health 23 | ``` 24 | 25 | --- 26 | 27 | ### **Agent Chat Interaction** 28 | 29 | #### **GET `/{aid}/chat`** 30 | Chat with an AI agent. 31 | 32 | - **Description**: Sends a query to a specific agent and receives its response. 33 | - **Parameters**: 34 | - `aid` (path, string): The unique identifier for the agent. 35 | - `q` (query, string): The user’s query message. 36 | - **Responses**: 37 | - **200 OK**: 38 | ```text 39 | [ You: ] 40 | 41 | your message 42 | 43 | ------------------- 44 | [ Agent: ] 45 | 46 | agent response 47 | 48 | ------------------- 49 | agent cost: 0.123 seconds 50 | ``` 51 | - **404 Not Found**: Agent not found. 52 | - **429 Too Many Requests**: Message quota exceeded. 53 | - **500 Internal Server Error**: An unexpected error occurred. 54 | - **Example**: 55 | ```bash 56 | curl -X GET "https://your-api-url.com/{aid}/chat?q=Hello" 57 | ``` 58 | 59 | --- 60 | 61 | ### **Agent Management** 62 | 63 | #### **POST `/agents`** 64 | Create or update an agent. 65 | 66 | - **Description**: Allows the creation or update of an agent’s configuration. 67 | - **Request Body**: 68 | ```json 69 | { 70 | "id": "my-agent", 71 | "name": "My Agent", 72 | "model": "gpt-4", 73 | "prompt": "You are a helpful assistant", 74 | "autonomous_enabled": false, 75 | "autonomous_minutes": null, 76 | "autonomous_prompt": null, 77 | "cdp_enabled": false, 78 | "twitter_enabled": false, 79 | "crestal_skills": ["skill1", "skill2"], 80 | "common_skills": ["skill3"], 81 | "skill_sets": { 82 | "set1": { 83 | "option1": "value1" 84 | } 85 | } 86 | } 87 | ``` 88 | - **Response**: 89 | ```json 90 | { 91 | "id": "my-agent", 92 | "name": "My Agent", 93 | ... 94 | } 95 | ``` 96 | - **Error Responses**: 97 | - **400 Bad Request**: Invalid agent ID format. 98 | - **500 Internal Server Error**: Database error or other internal issue. 99 | - **Example**: 100 | ```bash 101 | curl -X POST https://your-api-url.com/agents \ 102 | -H "Content-Type: application/json" \ 103 | -d '{ 104 | "id": "my-agent", 105 | "name": "My Agent", 106 | "model": "gpt-4", 107 | "prompt": "You are a helpful assistant", 108 | "autonomous_enabled": false 109 | }' 110 | ``` 111 | 112 | --- 113 | 114 | #### **GET `/agents`** 115 | Retrieve all agents. 116 | 117 | - **Description**: Lists all agents along with their quota information. 118 | - **Response**: 119 | ```json 120 | [ 121 | { 122 | "id": "agent-1", 123 | "name": "Agent One", 124 | "quota": { 125 | "plan": "free", 126 | "message_count_total": 50, 127 | "message_limit_total": 100, 128 | "last_message_time": "2024-12-01T10:00:00Z", 129 | "last_autonomous_time": null 130 | } 131 | }, 132 | { 133 | "id": "agent-2", 134 | "name": "Agent Two", 135 | "quota": { 136 | "plan": "premium", 137 | "message_count_total": 500, 138 | "message_limit_total": 1000, 139 | "last_message_time": "2024-12-01T11:00:00Z", 140 | "last_autonomous_time": "2024-12-01T09:30:00Z" 141 | } 142 | } 143 | ] 144 | ``` 145 | - **Example**: 146 | ```bash 147 | curl -X GET https://your-api-url.com/agents 148 | ``` 149 | 150 | --- 151 | 152 | ### **Autonomous Agent Configuration** 153 | 154 | Autonomous agents can be configured with the following parameters: 155 | 156 | - **Parameters**: 157 | - `autonomous_enabled` (boolean): Enable or disable autonomous execution. 158 | - `autonomous_minutes` (integer): Interval (in minutes) between executions. 159 | - `autonomous_prompt` (string): Instruction for autonomous actions. 160 | 161 | - **Example Configuration**: 162 | ```json 163 | { 164 | "id": "auto-agent", 165 | "autonomous_enabled": true, 166 | "autonomous_minutes": 60, 167 | "autonomous_prompt": "Check for new updates and summarize them" 168 | } 169 | ``` 170 | 171 | --- 172 | 173 | ### **Quota Management** 174 | 175 | Each agent has quota limits that include: 176 | - Total messages 177 | - Monthly messages 178 | - Daily messages 179 | - Total autonomous executions 180 | - Monthly autonomous executions 181 | 182 | #### **Quota Error Example**: 183 | ```json 184 | { 185 | "detail": "Message quota exceeded. Please upgrade your plan. Daily: 50/100, Monthly: 500/1000, Total: 5000/10000." 186 | } 187 | ``` 188 | 189 | --- 190 | -------------------------------------------------------------------------------- /mintlify-docs/intentkit/api.yaml: -------------------------------------------------------------------------------- 1 | openapi: 3.0.3 2 | info: 3 | title: IntentKit REST API 4 | description: > 5 | API documentation for IntentKit, providing agent interactions, management, and health monitoring. 6 | **Note**: This API playground is designed to work only with local servers. Ensure you are using one of the specified server URLs below for testing. 7 | version: 1.0.0 8 | servers: 9 | - url: "http://localhost:3000" 10 | description: Local development server (port 3000) 11 | - url: "http://127.0.0.1:5000" 12 | description: Local server (port 5000) 13 | - url: "http://localhost:8000" 14 | description: Local server (port 8000) 15 | - url: "http://localhost:4000" 16 | description: Local development server (port 4000) 17 | paths: 18 | /health: 19 | get: 20 | summary: Check API health 21 | description: Check the health status of the API server. 22 | responses: 23 | '200': 24 | description: Server is healthy 25 | content: 26 | application/json: 27 | example: 28 | status: healthy 29 | /{aid}/chat: 30 | get: 31 | summary: Chat with an AI agent 32 | description: Sends a query to a specific agent and receives its response. 33 | parameters: 34 | - name: aid 35 | in: path 36 | required: true 37 | description: The unique identifier for the agent. 38 | schema: 39 | type: string 40 | - name: q 41 | in: query 42 | required: false 43 | description: The user’s query message. 44 | schema: 45 | type: string 46 | responses: 47 | '200': 48 | description: Agent response. 49 | content: 50 | text/plain: 51 | example: | 52 | [ You: ] 53 | your message 54 | ------------------- 55 | [ Agent: ] 56 | agent response 57 | ------------------- 58 | agent cost: 0.123 seconds 59 | '404': 60 | description: Agent not found. 61 | '429': 62 | description: Message quota exceeded. 63 | '500': 64 | description: Internal server error. 65 | /agents: 66 | get: 67 | summary: Get all agents 68 | description: Retrieve a list of all agents along with their quota information. 69 | responses: 70 | '200': 71 | description: List of agents with quota information. 72 | content: 73 | application/json: 74 | example: 75 | - id: agent-1 76 | name: Agent One 77 | quota: 78 | plan: free 79 | message_count_total: 50 80 | message_limit_total: 100 81 | last_message_time: 2024-12-01T10:00:00Z 82 | last_autonomous_time: null 83 | - id: agent-2 84 | name: Agent Two 85 | quota: 86 | plan: premium 87 | message_count_total: 500 88 | message_limit_total: 1000 89 | last_message_time: 2024-12-01T11:00:00Z 90 | last_autonomous_time: 2024-12-01T09:30:00Z 91 | post: 92 | summary: Create or update an agent 93 | description: Allows the creation or update of an agent’s configuration. 94 | requestBody: 95 | required: true 96 | content: 97 | application/json: 98 | schema: 99 | type: object 100 | properties: 101 | id: 102 | type: string 103 | name: 104 | type: string 105 | model: 106 | type: string 107 | prompt: 108 | type: string 109 | autonomous_enabled: 110 | type: boolean 111 | autonomous_minutes: 112 | type: integer 113 | nullable: true 114 | autonomous_prompt: 115 | type: string 116 | nullable: true 117 | cdp_enabled: 118 | type: boolean 119 | twitter_enabled: 120 | type: boolean 121 | crestal_skills: 122 | type: array 123 | items: 124 | type: string 125 | common_skills: 126 | type: array 127 | items: 128 | type: string 129 | skill_sets: 130 | type: object 131 | additionalProperties: 132 | type: object 133 | responses: 134 | '201': 135 | description: Agent created or updated successfully. 136 | content: 137 | application/json: 138 | example: 139 | id: my-agent 140 | name: My Agent 141 | '400': 142 | description: Invalid agent ID format. 143 | '500': 144 | description: Internal server error. 145 | -------------------------------------------------------------------------------- /mintlify-docs/intentkit/chat-with-an-ai-agent.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /{aid}/chat 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/intentkit/check-api-health.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /health 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/intentkit/create-or-update-an-agent.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: post /agents 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/intentkit/get-all-agents.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | openapi: get /agents 3 | --- -------------------------------------------------------------------------------- /mintlify-docs/intentkit/overview.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Overview' 3 | description: 'Build and manage AI agents with powerful capabilities' 4 | --- 5 | 6 | **Currently in alpha stage. Not recommended for production use.** 7 | 8 | # What is IntentKit? 9 | 10 | Imagine you have a helpful robot friend. This robot can do many things for you: 11 | - Talk to people on social media 12 | - Keep track of your digital money 13 | - Learn new tricks that you teach it 14 | - Work by itself when you're busy 15 | 16 | IntentKit helps you create and train these robot friends. Think of it like a workshop where you can build different robots for different jobs. 17 | 18 | ## Features: 19 | 20 | ### 🤖 Multiple Agent Support 21 | 22 | Create different AI agents for specific tasks - like having a social media manager, a crypto analyst, and a customer support agent all working together. 23 | 24 | ```mermaid 25 | graph TD 26 | subgraph Social Agent 27 | A[Social Media Manager] --> |Posts & Replies| B[Twitter] 28 | A --> |Messaging| C[Telegram] 29 | end 30 | 31 | subgraph Finance Agent 32 | D[Crypto Analyst] --> |Monitors| E[CDP] 33 | D --> |Alerts| F[Portfolio] 34 | end 35 | 36 | subgraph Support Agent 37 | G[Customer Support] --> |Handles| H[Queries] 38 | G --> |Manages| I[Tickets] 39 | end 40 | ``` 41 | 42 | ### 🔄 Autonomous Agent Management 43 | 44 | Your agents can work independently on scheduled tasks. Set them up once, and they'll handle repetitive work automatically. 45 | 46 | ```mermaid 47 | stateDiagram-v2 48 | [*] --> Schedule 49 | Schedule --> Execute 50 | Execute --> Monitor 51 | Monitor --> Log 52 | Log --> Schedule 53 | 54 | Monitor --> Alert: Issues Found 55 | Alert --> Schedule 56 | ``` 57 | 58 | ### 🔗 Blockchain Integration (CDP) 59 | 60 | Connect with Coinbase Developer Platform to monitor crypto prices, track portfolios, and manage digital assets. 61 | 62 | ### 🐦 Social Media Integration 63 | 64 | Agents can manage Twitter and Telegram accounts - posting updates, responding to messages, and monitoring mentions. 65 | 66 | ### 🛠️ Extensible Skill System 67 | 68 | Teach your agents new tricks by creating custom skills. Add any capability you need. 69 | 70 | ```mermaid 71 | flowchart LR 72 | A[Base Agent] --> B[Core Skills] 73 | B --> C[Twitter Skills] 74 | B --> D[CDP Skills] 75 | B --> E[Custom Skills] 76 | 77 | subgraph Custom Skills 78 | E --> F[Weather] 79 | E --> G[Calendar] 80 | E --> H[Email] 81 | end 82 | ``` 83 | 84 | ### 🔌 Plugin System 85 | 86 | Easily add new platforms and tools without changing the core system. 87 | 88 | ## Architecture 89 | 90 | IntentKit uses a modular architecture with distinct components: 91 | 92 | ```python 93 | # Core Stack 94 | fastapi # API Layer 95 | langchain # Agent Engine 96 | postgresql # Database 97 | pydantic # Validation 98 | ``` 99 | 100 | ### Component Overview 101 | 102 | **1. Main System Components** 103 | 104 | ```mermaid 105 | sequenceDiagram 106 | participant Client 107 | participant FastAPI 108 | participant Engine as Agent Engine 109 | participant Skills as Skills/Tools 110 | 111 | Client->>FastAPI: Client Request 112 | FastAPI->>Engine: Process Request 113 | Engine->>Skills: Execute Skills/Tools 114 | Skills->>Engine: Return Result 115 | Engine->>FastAPI: Format Response 116 | FastAPI->>Client: Send Response 117 | ``` 118 | 119 | This sequence diagram illustrates how a typical request flows through the system: 120 | 121 | - The Client sends a request to the FastAPI layer. 122 | - FastAPI processes the request and forwards it to the Agent Engine (responsible for processing the business logic). 123 | - The Agent Engine calls Skills/Tools to perform the necessary task (e.g., external API interaction or complex computation). 124 | - Once the task is completed, Skills/Tools returns the result to the Agent Engine. 125 | - The Agent Engine formats the response and sends it back to FastAPI. 126 | - Finally, FastAPI sends the formatted response to the Client. 127 | 128 | 129 | **2. FastAPI Layer Functions:** 130 | 131 | ```mermaid 132 | graph TD 133 | API[FastAPI REST API] --> Requests[HTTP Requests] 134 | API --> AgentMgmt[Agent Management] 135 | API --> QuotaMgmt[Quota Management] 136 | API --> Health[Health Checks] 137 | 138 | class API fill:#38bdf8,stroke:#0ea5e9,color:#000000 139 | class Requests,AgentMgmt,QuotaMgmt,Health fill:#93c5fd,stroke:#60a5fa,color:#000000 140 | ``` 141 | 142 | This diagram represents the functions provided by the FastAPI layer: 143 | 144 | - Requests: Handles incoming HTTP requests from the client. 145 | - Agent Management: Manages the creation, configuration, and lifecycle of AI agents. 146 | - Quota Management: Ensures that the usage of resources, such as API calls, is within predefined limits to avoid overuse. 147 | - Health Checks: Monitors the health of the system and ensures everything is working as expected. 148 | 149 | ___ 150 | 151 | ### Data Flows 152 | 153 | ```mermaid 154 | sequenceDiagram 155 | participant Client 156 | participant API 157 | participant Engine 158 | participant Skills 159 | participant DB 160 | 161 | %% API Flow 162 | Note over Client,DB: API Request Flow 163 | Client->>API: Request 164 | API->>Engine: Process 165 | Engine->>Skills: Execute 166 | Skills->>Client: Response 167 | 168 | %% Autonomous Flow 169 | Note over Client,DB: Autonomous Flow 170 | activate Engine 171 | Engine->>Skills: Schedule Task 172 | Skills->>DB: Update State 173 | deactivate Engine 174 | 175 | %% Initialize Flow 176 | Note over Client,DB: Agent Init Flow 177 | Client->>API: Create Agent 178 | API->>DB: Load Config 179 | DB->>Engine: Initialize LLM 180 | Engine->>Skills: Load Tools 181 | ``` 182 | 183 | This diagram shows three key flows in the system: 184 | 185 | **API Request Flow** 186 | 187 | The request comes from the Client, is processed by FastAPI, and passed to the Agent Engine. The Engine then calls Skills to perform the necessary tasks, which in turn returns the result to the client. 188 | 189 | **Autonomous Flow** 190 | 191 | In the autonomous flow, the Agent Engine schedules tasks that are handled by Skills. Once the task is completed, Skills updates the Database (DB) with the relevant state, and the engine becomes inactive until the next task is scheduled. 192 | 193 | **Agent Initialization Flow** 194 | 195 | When a new Agent is created by the Client, FastAPI loads the configuration from the Database, initializes the Agent Engine, and then loads the required tools or skills. 196 | ___ 197 | 198 | ### Key Features 199 | 200 | 1. **Caching System** 201 | ```python 202 | # Agent caching for performance 203 | agents = { 204 | 'id': AgentInstance, 205 | 'invalidate_at': timestamp 206 | } 207 | ``` 208 | 209 | 2. **Tool Management** 210 | ```python 211 | # Dynamic skill loading 212 | def load_tools(config: AgentConfig): 213 | return [ 214 | get_skill(name) 215 | for name in config.skills 216 | ] 217 | ``` 218 | 219 | 3. **Error Handling** 220 | ```python 221 | try: 222 | result = await agent.execute(task) 223 | except QuotaExceeded: 224 | log_and_notify() 225 | return graceful_degradation() 226 | ``` 227 | 228 | 4. **State Management** 229 | ```sql 230 | -- Transaction management 231 | BEGIN; 232 | UPDATE agent_state 233 | SET status = 'running'; 234 | 235 | INSERT INTO logs 236 | (agent_id, action, timestamp); 237 | COMMIT; 238 | ``` 239 | -------------------------------------------------------------------------------- /mintlify-docs/intentkit/quickstart.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'IntentKit Setup: Docker and Local Development' 3 | description: This guide will help you set up IntentKit quickly, whether you prefer using Docker for a streamlined installation or setting up a local development environment for customization and coding. 4 | --- 5 | 6 | ## Docker (Recommended) 7 | 8 | Docker is the fastest and easiest way to set up IntentKit with minimal configuration. It creates a containerized environment that isolates dependencies and configurations. 9 | 10 | 1. **Create a new directory:** 11 | ```bash 12 | mkdir intentkit && cd intentkit 13 | ``` 14 | 15 | 2. **Download the required files:** 16 | ```bash 17 | # Download docker-compose.yml 18 | curl -O https://raw.githubusercontent.com/crestalnetwork/intentkit/main/docker-compose.yml 19 | 20 | # Download example environment file 21 | curl -O https://raw.githubusercontent.com/crestalnetwork/intentkit/main/example.env 22 | ``` 23 | 24 | 3. **Set up your environment:** 25 | ```bash 26 | # Rename example.env to .env 27 | mv example.env .env 28 | 29 | # Edit the .env file to add your configuration 30 | nano .env 31 | ``` 32 | > Ensure you add your `OPENAI_API_KEY` in the `.env` file. This is required for the AI capabilities of IntentKit. Full guide on how to generate an OpenAI API key can be found [here](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key). 33 | 34 | 4. **Start the services:** 35 | ```bash 36 | docker compose up 37 | ``` 38 | 39 | This will launch all necessary services, including the API server and autonomous agent scheduler. 40 | 41 | 5. After installation, you'll want to create your first agent. Head over to our [Agent Creation and Configuration](./agent-guide) guide to learn how to create and configure agents. 42 | 43 | --- 44 | 45 | ## Local Development 46 | 47 | For developers who want to customize or extend IntentKit, setting up a local development environment provides more control and flexibility. 48 | 49 | 1. **Clone the repository:** 50 | ```bash 51 | git clone https://github.com/crestalnetwork/intentkit.git 52 | cd intentkit 53 | ``` 54 | 55 | 2. **Install dependencies:** 56 | Ensure you have Python 3.10-3.12 installed (3.12 is recommended). If you don’t have `poetry` installed, do so first: 57 | ```bash 58 | pip install poetry 59 | ``` 60 | 61 | Then, install the project dependencies: 62 | ```bash 63 | poetry install --with dev 64 | poetry shell 65 | ``` 66 | 67 | 3. **Set up your environment:** 68 | ```bash 69 | cp example.env .env 70 | nano .env 71 | ``` 72 | 73 | Configure the `.env` file with your settings, including the required `OPENAI_API_KEY`. Full guide on how to generate an OpenAI API key can be found [here](https://platform.openai.com/docs/quickstart#create-and-export-an-api-key). 74 | 75 | 76 | 4. **Run the application:** 77 | - **Start the API server:** 78 | ```bash 79 | uvicorn app.entrypoints.api:app --reload 80 | ``` 81 | - **Start the autonomous agent scheduler:** 82 | ```bash 83 | python -m app.entrypoints.autonomous 84 | ``` 85 | 86 | Both services are now running locally and ready for use. 87 | 88 | 5. **Creating Your First Agent** 89 | 90 | After installation, you'll want to create your first agent. Head over to our [Agent Creation and Configuration](./agent-guide) guide to learn how to create and configure agents. 91 | 92 | --- 93 | -------------------------------------------------------------------------------- /mintlify-docs/intentkit/skills-guide.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Skills Setup: Creation and Customization' 3 | description: 'Create and manage custom skills for IntentKit agents' 4 | --- 5 | 6 | # Understanding Skills 7 | 8 | Skills are the building blocks of agent capabilities, implemented as Python modules that extend agent functionality through LangChain tools. 9 | 10 | ## Basic Structure 11 | 12 | ```python 13 | from langchain_core.tools import BaseTool 14 | from pydantic import BaseModel, Field 15 | 16 | class WeatherInput(BaseModel): 17 | """Input schema for weather skill.""" 18 | location: str = Field(..., description="City name") 19 | unit: str = Field("celsius", description="Temperature unit") 20 | 21 | class WeatherSkill(BaseTool): 22 | name = "get_weather" 23 | description = "Get current weather for a location" 24 | args_schema = WeatherInput 25 | 26 | def _run(self, location: str, unit: str = "celsius") -> str: 27 | """Get weather data.""" 28 | return f"Weather in {location}: 20°{unit[0].upper()}" 29 | ``` 30 | 31 | ## Skill Registration 32 | 33 | Register your skill in `skill/__init__.py`: 34 | 35 | ```python 36 | from .weather import WeatherSkill 37 | 38 | def get_crestal_skill(name: str) -> BaseTool: 39 | skills = { 40 | "weather": WeatherSkill() 41 | } 42 | return skills.get(name) 43 | ``` 44 | 45 | ## Common Skill Sets 46 | 47 | ```json 48 | { 49 | "cdp": { 50 | "monitor_prices": { 51 | "pairs": ["BTC-USD", "ETH-USD"], 52 | "interval": 300 53 | } 54 | }, 55 | "social": { 56 | "twitter": { 57 | "auto_reply": true, 58 | "sentiment_analysis": true 59 | } 60 | } 61 | } 62 | ``` 63 | 64 | ## Examples 65 | 66 | ### Price Monitoring Skill 67 | 68 | ```python 69 | class PriceMonitorInput(BaseModel): 70 | pair: str = Field(..., description="Trading pair (e.g., BTC-USD)") 71 | threshold: float = Field(5.0, description="Alert threshold percentage") 72 | 73 | class PriceMonitorSkill(BaseTool): 74 | name = "monitor_prices" 75 | description = "Monitor crypto price movements" 76 | args_schema = PriceMonitorInput 77 | 78 | def _run(self, pair: str, threshold: float = 5.0) -> str: 79 | # Implementation 80 | return f"Monitoring {pair} for {threshold}% changes" 81 | 82 | async def _arun(self, pair: str, threshold: float = 5.0) -> str: 83 | # Async implementation 84 | pass 85 | ``` 86 | 87 | ### Twitter Integration Skill 88 | 89 | ```python 90 | class TwitterSkill(BaseTool): 91 | name = "twitter_post" 92 | description = "Post updates to Twitter" 93 | 94 | def _run(self, text: str) -> str: 95 | # Post to Twitter 96 | return f"Posted: {text}" 97 | 98 | def validate_length(self, text: str) -> bool: 99 | return len(text) <= 280 100 | ``` 101 | 102 | ## Best Practices 103 | 104 | 1. **Input Validation** 105 | ```python 106 | class TransactionInput(BaseModel): 107 | amount: float = Field(..., gt=0, description="Transaction amount") 108 | pair: str = Field(..., pattern="^[A-Z]+-[A-Z]+$") 109 | ``` 110 | 111 | 2. **Error Handling** 112 | ```python 113 | try: 114 | response = await self.api_call() 115 | except RateLimitError: 116 | return "Rate limit exceeded. Try again in 60 seconds." 117 | except ApiError as e: 118 | return f"API Error: {str(e)}" 119 | ``` 120 | 121 | 3. **Async Support** 122 | ```python 123 | async def _arun(self, **kwargs): 124 | async with aiohttp.ClientSession() as session: 125 | result = await self.process(session, **kwargs) 126 | return result 127 | ``` 128 | 129 | 4. **Testing** 130 | ```python 131 | def test_skill(): 132 | skill = CustomSkill() 133 | result = skill.run(input="test") 134 | assert result.status == "success" 135 | ``` 136 | 137 | ## Example: Complete Trading Skill Set 138 | 139 | ```python 140 | # skill_sets/trading.py 141 | from typing import List 142 | from pydantic import BaseModel, Field 143 | from langchain_core.tools import BaseTool 144 | 145 | class Order(BaseModel): 146 | pair: str 147 | side: str 148 | amount: float 149 | type: str = "market" 150 | 151 | class TradingSkill(BaseTool): 152 | name = "execute_trade" 153 | description = "Execute crypto trades" 154 | 155 | def __init__(self, api_key: str, pairs: List[str]): 156 | self.api_key = api_key 157 | self.allowed_pairs = pairs 158 | super().__init__() 159 | 160 | def _run(self, order: Order) -> str: 161 | if order.pair not in self.allowed_pairs: 162 | return f"Unsupported pair: {order.pair}" 163 | # Execute trade 164 | return f"Executed {order.side} {order.amount} {order.pair}" 165 | ``` 166 | 167 | Enable in agent configuration: 168 | ```json 169 | { 170 | "skill_sets": { 171 | "trading": { 172 | "pairs": ["BTC-USD", "ETH-USD"], 173 | "api_key": "your-api-key" 174 | } 175 | } 176 | } 177 | ``` -------------------------------------------------------------------------------- /mintlify-docs/intentkit/twitter-integration.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: 'Twitter Integration' 3 | description: 'Guide to integrating Twitter with IntentKit agents.' 4 | --- 5 | 6 | IntentKit provides two ways to integrate with Twitter: using it as an entrypoint for your agent, or incorporating Twitter-specific skills into your agent's capabilities. 7 | 8 | ## Twitter as an Entrypoint 9 | 10 | Entrypoint is a type of conversational interface. 11 | 12 | The Twitter entrypoint allows your agent to automatically respond to Twitter mentions. When enabled, the agent will monitor mentions every 15 minutes and respond to them all. 13 | 14 | #### Configuration 15 | 16 | 1. **Enable Twitter Entrypoint for your agent:** 17 | ```python 18 | agent.twitter_enabled = True 19 | ``` 20 | 21 | 2. **Configure Twitter credentials in your agent's config:** 22 | Get your Twitter credentials from your [Twitter developer portal](https://developer.x.com/en/portal/dashboard). 23 | > Notice: Free accounts can only use post_tweet skill, if you want to use other skills, you need to upgrade your account. 24 | ```python 25 | agent.twitter_config = { 26 | "bearer_token": "your_bearer_token", 27 | "consumer_key": "your_consumer_key", 28 | "consumer_secret": "your_consumer_secret", 29 | "access_token": "your_access_token", 30 | "access_token_secret": "your_access_token_secret" 31 | } 32 | ``` 33 | 34 | 3. **Run the Twitter entrypoint:** 35 | If you have used the docker-compose, it already runs automatically. 36 | ```bash 37 | python -m app.entrypoints.twitter 38 | ``` 39 | 40 | #### How it Works 41 | 42 | The Twitter entrypoint: 43 | - Polls for new mentions every 15 minutes 44 | - Uses both `since_id` and `start_time` for reliable mention tracking 45 | - Maintains the last processed tweet ID in the agent's plugin data 46 | - Automatically manages API rate limits and quotas 47 | - Responds to mentions as threaded replies 48 | 49 | --- 50 | 51 | ## Twitter Skills 52 | 53 | IntentKit provides a set of Twitter-specific skills that can be added to your agent's toolkit. All skills are built on top of the `TwitterBaseTool` base class which handles authentication and client initialization. 54 | 55 | ### Available Skills 56 | 57 | 1. `TwitterGetMentions` 58 | - Retrieves mentions of the authenticated user 59 | - Uses both `since_id` and `start_time` for reliable mention tracking 60 | - Always looks back 24 hours for safety 61 | - No additional parameters required 62 | 63 | 2. `TwitterGetTimeline` 64 | - Retrieves tweets from the authenticated user's timeline 65 | - Tracks the last retrieved tweet using timestamp 66 | - Returns formatted timeline data 67 | - No additional parameters required 68 | 69 | 3. `TwitterPostTweet` 70 | - Posts new tweets to Twitter 71 | - Parameters: 72 | - `text`: Tweet content (max 280 characters) 73 | 74 | 4. `TwitterReplyTweet` 75 | - Posts reply tweets to existing tweets 76 | - Parameters: 77 | - `tweet_id`: ID of the tweet to reply to 78 | - `text`: Reply content (max 280 characters) 79 | 80 | #### Using Twitter Skills 81 | 82 | Add Twitter skills to your agent: 83 | Just configure the skills you need in your agent's config, the credentials also required. 84 | ```python 85 | agent.twitter_skills = ["get_mentions", "get_timeline", "post_tweet", "reply_tweet"] 86 | agent.twitter_config = { 87 | "bearer_token": "your_bearer_token", 88 | "consumer_key": "your_consumer_key", 89 | "consumer_secret": "your_consumer_secret", 90 | "access_token": "your_access_token", 91 | "access_token_secret": "your_access_token_secret" 92 | } 93 | ``` 94 | 95 | --- 96 | 97 | ## Rate Limits and Quotas 98 | 99 | #### Twitter side 100 | 101 | Rate limits on the Twitter side can be found [here](https://developer.x.com/en/docs/x-api/rate-limits). 102 | 103 | #### IntentKit 104 | IntentKit can help you manage Twitter API rate limits and quotas. This feature is not released yet. 105 | 106 | --- 107 | 108 | ## Best Practices 109 | 110 | 1. **Error Handling** 111 | - Always handle Twitter API errors gracefully 112 | - Implement exponential backoff for rate limits 113 | - Log failed interactions for debugging 114 | 115 | 2. **Content Guidelines** 116 | - Keep responses within Twitter's character limit 117 | - Handle thread creation for longer responses 118 | - Consider Twitter's content policies 119 | 120 | 3. **Security** 121 | - Store Twitter credentials securely 122 | - Use environment variables for sensitive data 123 | - Regularly rotate access tokens 124 | 125 | --- 126 | 127 | ### Example Use Cases 128 | 129 | 1. **Social Media Manager Bot** 130 | ```python 131 | from app.models.agent import Agent 132 | 133 | # Create an agent with Twitter skills 134 | agent = Agent( 135 | name="Social Media Manager", 136 | twitter_enabled=True, 137 | twitter_skills=["get_mentions", "post_tweet", "reply_tweet"], 138 | twitter_config={ 139 | "bearer_token": "your_bearer_token", 140 | "consumer_key": "your_consumer_key", 141 | "consumer_secret": "your_consumer_secret", 142 | "access_token": "your_access_token", 143 | "access_token_secret": "your_access_token_secret" 144 | }, 145 | prompt="You are a helpful social media manager. Monitor mentions and engage with users professionally." 146 | ) 147 | ``` 148 | 149 | 2. **Content Aggregator with Timeline Analysis** 150 | ```python 151 | # Create an agent that analyzes timeline content 152 | agent = Agent( 153 | name="Content Analyzer", 154 | twitter_enabled=True, 155 | twitter_skills=["get_timeline", "post_tweet"], 156 | twitter_config={...}, # Twitter credentials 157 | prompt="""You are a content analyzer. Monitor the timeline for trending topics and provide insights. 158 | When you find interesting patterns, share them as tweets.""" 159 | ) 160 | ``` 161 | 162 | 3. **Interactive Support Assistant** 163 | ```python 164 | # Create a support agent that handles user queries 165 | agent = Agent( 166 | name="Support Assistant", 167 | twitter_enabled=True, 168 | twitter_skills=["get_mentions", "reply_tweet"], 169 | twitter_config={...}, # Twitter credentials 170 | prompt="""You are a support assistant. Monitor mentions for support queries. 171 | Respond helpfully and professionally to user questions. 172 | If you can't help, politely explain why and suggest alternatives.""" 173 | ) 174 | ``` 175 | 176 | --- 177 | 178 | ### Troubleshooting 179 | 180 | Common issues and solutions: 181 | 182 | 1. **Rate Limit Exceeded** 183 | - Check your quota settings 184 | - Implement proper waiting periods 185 | - Use the built-in quota management 186 | 187 | 2. **Authentication Errors** 188 | - Verify credential configuration 189 | - Check token expiration 190 | - Ensure proper permission scopes 191 | 192 | 3. **Missing Mentions** 193 | - Verify `since_id` tracking 194 | - Check `start_time` configuration 195 | - Monitor the Twitter entrypoint logs 196 | -------------------------------------------------------------------------------- /mintlify-docs/introduction.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Introduction 3 | description: Discover, Design, Deploy. Crestal is the Web3 Infrastructure Lego Platform. Build optimized architecture for your app, from 0 to Mainnet. 4 | --- 5 | 6 |
7 |

8 | Welcome to Crestal Docs 9 |

10 |
11 | 12 | 13 | Learn how to connect to the Crestal testnet, set up your wallet, and start exploring the platform. 14 | 15 | 16 | 17 | Access detailed API documentation to integrate Crestal’s services, authenticate securely, and interact with various endpoints. 18 | 19 | 20 | -------------------------------------------------------------------------------- /mintlify-docs/logo/dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mintlify-docs/logo/light.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /mintlify-docs/mint.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "https://mintlify.com/schema.json", 3 | "name": "Crestal Documentation", 4 | "logo": { 5 | "dark": "/logo/dark.svg", 6 | "light": "/logo/light.svg" 7 | }, 8 | "favicon": "./favicon.svg", 9 | "colors": { 10 | "primary": "#7AB800", 11 | "light": "#B4E034", 12 | "dark": "#B4E034", 13 | "anchors": { 14 | "from": "#7AB800", 15 | "to": "#5A8600" 16 | } 17 | }, 18 | "navigation": [ 19 | { 20 | "group": "", 21 | "pages": ["introduction"] 22 | }, 23 | { 24 | "group": "🚀 Getting Started", 25 | "pages": ["guides/testnet", "guides/quests", "guides/referrals"] 26 | }, 27 | { 28 | "group": "🌐 Networks", 29 | "pages": [ 30 | "networks/supported-networks" 31 | ] 32 | }, 33 | { 34 | "group": "🛠️ Build", 35 | "pages": [ 36 | "build/rollup-avail-op-stack" 37 | ] 38 | }, 39 | { 40 | "group": "🤖 IntentKit", 41 | "pages": [ 42 | "intentkit/overview", 43 | "intentkit/quickstart", 44 | "intentkit/agent-guide", 45 | "intentkit/skills-guide", 46 | "intentkit/twitter-integration", 47 | { 48 | "group": "API Reference", 49 | "pages": [ 50 | "intentkit/api-reference", 51 | "intentkit/check-api-health", 52 | "intentkit/chat-with-an-ai-agent", 53 | "intentkit/get-all-agents", 54 | "intentkit/create-or-update-an-agent" 55 | ] 56 | } 57 | ] 58 | }, 59 | { 60 | "group": "🧠 Integrations", 61 | "pages": [ 62 | "solvers/solver-worker-integration", 63 | "solvers/solver-integration-quick-guide", 64 | "solvers/worker", 65 | "solvers/worker-guide" 66 | ] 67 | }, 68 | 69 | 70 | { 71 | "group": "🔐 API Reference", 72 | "pages": [ 73 | { 74 | "group": "Authentication APIs", 75 | "pages": [ 76 | "api-reference/check-system-health", 77 | "api-reference/get-auth-nonce", 78 | "api-reference/authenticate-user", 79 | "api-reference/refresh-auth-token" 80 | ] 81 | }, 82 | { 83 | "group": "Project Management APIs", 84 | "pages": [ 85 | "api-reference/list-user-projects", 86 | "api-reference/create-new-project", 87 | "api-reference/terminate-a-project", 88 | "api-reference/cancel-an-active-project", 89 | "api-reference/get-project-details", 90 | "api-reference/update-project-details" 91 | ] 92 | }, 93 | { 94 | "group": "Deployment APIs", 95 | "pages": [ 96 | "api-reference/retrieve-deployment-information", 97 | "api-reference/list-deployments", 98 | "api-reference/fetch-worker-deployment-status", 99 | "api-reference/create-worker-deployment", 100 | "api-reference/update-worker-deployment-status" 101 | ] 102 | }, 103 | { 104 | "group": "Data Availability APIs", 105 | "pages": [ 106 | "api-reference/record-node-da-metrics", 107 | "api-reference/retrieve-system-metrics-for-da", 108 | "api-reference/create-da-metrics-record", 109 | "api-reference/fetch-legacy-da-information", 110 | "api-reference/fetch-static-configuration-for-da", 111 | "api-reference/retrieve-historical-performance-metrics-for-da" 112 | ] 113 | }, 114 | { 115 | "group": "Proposals APIs", 116 | "pages": [ 117 | "api-reference/retrieve-proposal-details", 118 | "api-reference/retrieve-solver-proposal-recommendations", 119 | "api-reference/submit-solver-proposals" 120 | ] 121 | }, 122 | { 123 | "group": "Worker and Solver APIs", 124 | "pages": [ 125 | "api-reference/list-active-workers", 126 | "api-reference/retrieve-worker-details", 127 | "api-reference/fetch-solver-details" 128 | ] 129 | }, 130 | { 131 | "group": "Chat APIs", 132 | "pages": [ 133 | "api-reference/retrieve-chat-history", 134 | "api-reference/send-chat-message" 135 | ] 136 | }, 137 | { 138 | "group": "Quest APIs", 139 | "pages": [ 140 | "api-reference/list-available-quests", 141 | "api-reference/retrieve-user-quest-progress", 142 | "api-reference/retrieve-weekly-quest-status" 143 | ] 144 | }, 145 | { 146 | "group": "Referral APIs", 147 | "pages": [ 148 | "api-reference/fetch-referral-information", 149 | "api-reference/process-referral-code-claim" 150 | ] 151 | }, 152 | { 153 | "group": "Whitelist APIs", 154 | "pages": [ 155 | "api-reference/check-whitelist-status" 156 | ] 157 | } 158 | ] 159 | }, 160 | { 161 | "group": "Metadata", 162 | "pages": [ 163 | { 164 | "group": "System Metrics", 165 | "pages": [ 166 | "api-reference/metadata/retrieve-comprehensive-system-metrics" 167 | ] 168 | } 169 | ] 170 | } 171 | ] 172 | 173 | , 174 | "footerSocials": { 175 | "twitter": "https://x.com/crestalnetwork", 176 | "youtube": "https://www.youtube.com/@Crestalnetwork", 177 | "github": "https://github.com/crestalnetwork", 178 | "linkedin": "https://www.linkedin.com/company/crestal" 179 | }, 180 | "analytics": { 181 | "ga4": { 182 | "measurementId": "G-SH3W021CDQ" 183 | } 184 | } 185 | 186 | } 187 | -------------------------------------------------------------------------------- /mintlify-docs/networks/supported-networks.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: Supported Networks 3 | description: Overview of supported networks in Crestal, including RPC endpoints, network details, and faucet options. 4 | --- 5 | 6 | Crestal currently supports three networks: **Polygon Amoy Testnet**, **Berachain bArtio Testnet**, and **Binance Smart Chain (BSC) Testnet**. 7 | Below, you’ll find details for each network, including RPC URLs for direct API calls, faucet options, and instructions on adding these networks to your wallet. 8 | 9 | ## Polygon Amoy Testnet 10 | 11 | ### Public RPC Node 12 | 13 | ```bash 14 | https://rpc-amoy.polygon.io/ 15 | ``` 16 | ### Network Details 17 | - **Network Name**: Polygon Amoy Testnet 18 | - **RPC URL**: `https://rpc-amoy.polygon.io/` 19 | - **Chain ID**: 80002 20 | - **Currency Symbol**: POL 21 | - **Block Explorer URL**: [Polygon Amoy Explorer](https://explorer.amoy.polygon.io/) 22 | 23 | ### Faucet Options 24 | To get test MATIC for the Polygon Amoy testnet, you can use any of the following faucets: 25 | * **[Option 1](https://faucet.polygon.technology/)** 26 | * **[Option 2](https://www.alchemy.com/faucets/polygon-amoy)** 27 | * **[Option 3](https://faucets.chain.link/polygon-amoy)** 28 | 29 | ### Adding to Wallet via Chainlist 30 | 1. Go to [Chainlist](https://chainlist.org/). 31 | 2. Search for **Polygon Amoy Testnet**. 32 | 3. Click on **Add to Wallet** and confirm the addition in your wallet. 33 | 34 | ## Berachain bArtio Testnet 35 | 36 | ### Public RPC Node 37 | 38 | ```bash 39 | https://rpc-testnet.berachain.io/ 40 | ``` 41 | 42 | ### Network Details 43 | - **Network Name**: Berachain bArtio Testnet 44 | - **RPC URL**: `https://rpc-testnet.berachain.io/` 45 | - **Chain ID**: 80084 46 | - **Currency Symbol**: BERA 47 | - **Block Explorer URL**: [Berachain bArtio Testnet Explorer](https://explorer.berachain.io/) 48 | 49 | ### Faucet Options 50 | To get test BERA for the Berachain bArtio Testnet, use any of the following faucets: 51 | * **[Option 1](https://bArtio.faucet.berachain.com/)** 52 | * **[Option 2](https://faucet.trade/berachain-testnet-bera-faucet)** 53 | 54 | ### Adding to Wallet via Chainlist 55 | 1. Go to [Chainlist](https://chainlist.org/). 56 | 2. Search for **Berachain bArtio Testnet**. 57 | 3. Click on **Add to Wallet** and confirm the addition in your wallet. 58 | 59 | ## Binance Smart Chain (BSC) Testnet 60 | 61 | ### Public RPC Node 62 | 63 | ```bash 64 | https://data-seed-prebsc-1-s1.binance.org:8545/ 65 | ``` 66 | 67 | ### Network Details 68 | - **Network Name**: BSC Testnet 69 | - **RPC URL**: `https://data-seed-prebsc-1-s1.binance.org:8545/` 70 | - **Chain ID**: 97 71 | - **Currency Symbol**: BNB 72 | - **Block Explorer URL**: [BSC Testnet Explorer](https://testnet.bscscan.com/) 73 | 74 | ### Faucet 75 | To get test BNB for the Binance Smart Chain (BSC) Testnet, use the following faucet: 76 | * **[BSC Testnet Faucet](https://testnet.binance.org/faucet-smart)** 77 | 78 | ### Adding to Wallet via Chainlist 79 | 1. Visit [Chainlist](https://chainlist.org/). 80 | 2. Search for **BSC Testnet**. 81 | 3. Click on "Add to Wallet" and confirm in your wallet. 82 | -------------------------------------------------------------------------------- /mintlify-docs/solvers/solver-integration-quick-guide.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Solver Integration: Data Availability Sample Integration" 3 | description: "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." 4 | --- 5 | 6 | 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: 7 | 8 | - `listenToBerachainBartio`: Demonstrates how to listen for proposal requests on Berachain bArtio testnet. 9 | - `submitProposalExample`: Shows how to submit a proposal with dummy data. 10 | 11 | 12 | 13 | ## Step 1: Clone the CrestalJS SDK repository 14 | 15 | ```bash 16 | # Clone the SDK 17 | git clone https://github.com/crestalnetwork/crestal-js-sdk.git 18 | 19 | # Install and build 20 | cd crestal-js-sdk 21 | npm install # or yarn 22 | npm run build # or yarn build 23 | ``` 24 | 25 | ![Install](../images/solver-guide/solver1.gif) 26 | 27 | ## Step 2: Start the Event listener 28 | 29 | This will start listening for proposal requests on the Berachain bArtio testnet. 30 | When a request is detected, you'll see the request details in your console. 31 | 32 | ```bash 33 | # From the crestal-js-sdk directory 34 | npx ts-node utils/examples/listenToBerachainBartio.ts 35 | ``` 36 | 37 | ![Start Listener](../images/solver-guide/solver2.gif) 38 | 39 | ## Step 3: Trigger a Request Proposal 40 | 41 | Now, let's trigger a `RequestProposal` event so the event listener can detect it, in order for us 42 | to get the data needed for making a proposal. 43 | 44 | 1. Leave the listener running 45 | 2. [Add](/networks/supported-networks#adding-to-wallet-via-chainlist-2) Berachain bArtio Tesnet to your wallet 46 | 3. Make sure you have some Berachain bArtio Tesnet tokens on your account. 47 | More details on how to get them [here](/networks/supported-networks#faucet-options-2). 48 | 4. Open the [Crestal dApp](https://app.testnet.crestal.xyz/dashboard) and connect your wallet to it. 49 | 5. Start a new project. 50 | 51 | ![Connect to Crestal](../images/solver-guide/solver3.gif) 52 | 53 | 6. Use the AI Assistant to generate a proposal request, and submit it. The submitted proposal request will show up 54 | in the event listener output. 55 | 56 | ![Event Detected](../images/solver-guide/solver4.gif) 57 | 58 | 59 | Event Listener Output (Sensitive Data Masked): 60 | 61 | ```bash 62 | Listening for RequestProposal events... 63 | Event listener started successfully. 64 | RequestProposal Event Detected 65 | { 66 | projectID: '0x474595b51a7ab07b3745193c91f2c0708b0b26095a660b82d3******d3c64868', 67 | walletAddress: '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 68 | requestID: '0x57de6a6bd64d3423ee07c73f6f08479b**********abead57f0f7ad3d66fcae', 69 | chainRequestParam: { 70 | project_id: '0x474595b51a7ab07b3745193c91f2c0708b0b26095a660b82d3******d3c64868', 71 | types: [ 'DA' ], 72 | cost_per_mb: 0.1, 73 | max_throughput: 100, 74 | number_of_nodes: 100, 75 | send_blob_latency: 1, 76 | finality_time: 10, 77 | latency: 0, 78 | block_time: 0, 79 | first_category: 'Layer 2', 80 | second_category: 'General' 81 | }, 82 | serverURL: 'https://api.service.testnet.crestal.xyz', 83 | raw: ContractEventPayload { 84 | filter: 'RequestProposal', 85 | emitter: Contract { 86 | target: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 87 | interface: [Interface], 88 | runner: JsonRpcProvider {}, 89 | filters: {}, 90 | fallback: null, 91 | [Symbol(_ethersInternal_contract)]: {} 92 | }, 93 | log: EventLog { 94 | provider: JsonRpcProvider {}, 95 | transactionHash: '0xdf0bdaf657f5f25ded42ff3f7061915********4255648e9db8f7b184f308bc8', 96 | blockHash: '0x52958efaebf687be7303862182f735d8456c4b903655b2d277d507a75c2a9c00', 97 | blockNumber: 6245816, 98 | removed: false, 99 | address: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 100 | data: '0x000000000000000000000000bb900bbe1a20da4d474666***********62973300000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000017865794a77636d39715a574e3058326c6b496a6f694d4867304e7a51314f5456694e5446684e3246694d4464694d7a63304e5445354d324d354d575979597a41334d4468694d4749794e6a41354e5745324e6a42694f444a6b4d7a59344f444d7a5a6d517a597a59304f4459344969776964486c775a584d694f6c736952454569585377695932397a644639775a584a66625749694f6a41754d537769625746345833526f636d39315a326877645851694f6a45774d437769626e5674596d56795832396d583235765a47567a496a6f784d444173496e4e6c626d5266596d7876596c39735958526c626d4e35496a6f784c434a6d6157356862476c30655639306157316c496a6f784d437769624746305a57356a655349364d437769596d78765932746664476c745a5349364d4377695a6d6c7963335266593246305a576476636e6b694f694a4d59586c6c63694179496977696332566a6232356b58324e686447566e62334a35496a6f69523256755a584a6862434a390000000000000000000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f6170692e736572766963652e746573746e65742e6372657374616c2e78797a00000000000000000000000000000000000000000000000000', 101 | topics: [Array], 102 | index: 442, 103 | transactionIndex: 44, 104 | interface: [Interface], 105 | fragment: [EventFragment], 106 | args: [Result] 107 | }, 108 | args: Result(5) [ 109 | '0x474595b51a7ab07b3745193c91f2c0708b0b26095a660b82d368833fd3c64868', 110 | '0xBB900BbE1A20dA4d474666B7********CE12629733', 111 | '0x57de6a6bd64d3423ee07c73f6f08479b**********abead57f0f7ad3d66fcae', 112 | 'eyJwcm9qZWN0X2lkIjoiMHg0NzQ1OTViNTFhN2FiMDdiMzc0NTE5M2M5MWYyYzA3MDhiMGIyNjA5NWE2NjBiODJkMzY4ODMzZmQzYzY0ODY4IiwidHlwZXMiOlsiREEiXSwiY29zdF9wZXJfbWIiOjAuMSwibWF4X3Rocm91Z2hwdXQiOjEwMCwibnVtYmVyX29mX25vZGVzIjoxMDAsInNlbmRfYmxvYl9sYXRlbmN5IjoxLCJmaW5hbGl0eV90aW1lIjoxMCwibGF0ZW5jeSI6MCwiYmxvY2tfdGltZSI6MCwiZmlyc3RfY2F0ZWdvcnkiOiJMYXllciAyIiwic2Vjb25kX2NhdGVnb3J5IjoiR2VuZXJhbCJ9', 113 | 'https://api.service.testnet.crestal.xyz' 114 | ], 115 | fragment: EventFragment { 116 | type: 'event', 117 | inputs: [Array], 118 | name: 'RequestProposal', 119 | anonymous: false 120 | } 121 | } 122 | } 123 | ``` 124 | 125 | ## Step 4: Fill in the details in [`submitProposalExample`](https://github.com/crestalnetwork/crestal-js-sdk/blob/main/utils/examples/submitProposalExample.ts) 126 | 127 | Navigate to `utils/examples/submitProposalExample`. Fill in the required fields with your own details: 128 | - `const solverAddress = 'YOUR_ADDRESS'`: Your account address as a solver(not recommended to use 129 | the same one as the one at step 3). 130 | - `project_id: "PROJECT_ID_FROM_REQUEST"`: The project id from the event listener output (the detected proposal request). 131 | - `request_id: "REQUEST_ID_FROM_REQUEST"`: The request id from the event listener output (the detected proposal request). 132 | - `const privateKey = "YOUR_ADDRESS_PRIVATE_KEY"` the prviate key for the `solverAddress`. 133 | 134 | 135 | 136 | ```typescript 137 | import { generateProposalSIWE } from "../generateProposalSIWE"; 138 | import { signMessageWithPrivateKey } from "../signMessage"; 139 | import { submitProposal } from "../submitProposal"; 140 | 141 | 142 | async function main() { 143 | const solverAddress = '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8'; 144 | const chainId = 80084; // Berachain bArtio testnet chain id 145 | const postSolverProposal = { 146 | project_id: "0x474595b51a7ab07b3745193c91f2c0708b0b26095a660b82d3******d3c64868", 147 | request_id: "0x57de6a6bd64d3423ee07c73f6f08479b**********abead57f0f7ad3d66fcae", 148 | //Dummy values for these parameters 149 | target_performance: 10, 150 | solver_address: solverAddress, 151 | proposals: [ 152 | { 153 | fit: 0.9, 154 | rank: 1, 155 | type: "public", 156 | da: { 157 | chain_id: 80084, 158 | da_name: "Avail", 159 | network_type: "Testnet", 160 | gas_token: "ETH", 161 | avg_cost: 3.2, 162 | max_throughput: 10.5, 163 | latency: 0.3, 164 | finality_time: 2.0, 165 | geo_coverage: 8, 166 | grants_available: false, 167 | number_of_projects: 1, 168 | uptime: 10, 169 | block_time: 10, 170 | total_transactions: 1000000002, 171 | total_blocks: 1000000003, 172 | number_of_nodes: 5000, 173 | cost_per_transaction: 0.3, 174 | cost_per_mb: 0.2, 175 | error_rate: 0.02, 176 | init_cost: 100, 177 | maintenance_cost: 20 178 | } 179 | } 180 | ] 181 | }; 182 | 183 | // Generate the SIWE message and signature 184 | try { 185 | const siweMessage = await generateProposalSIWE(postSolverProposal, solverAddress, chainId); 186 | 187 | if (siweMessage) { 188 | const privateKey = "469f21a9bf88257a595177*****************3a8fbf15ca1d3a0"; 189 | const signature = await signMessageWithPrivateKey(siweMessage, privateKey); 190 | 191 | 192 | 193 | // Submit the proposal using the generated SIWE message and signature 194 | const response = await submitProposal(solverAddress, siweMessage, signature); 195 | console.log("response:", response); 196 | 197 | 198 | } else { 199 | console.log('Failed to generate SIWE message.'); 200 | } 201 | } catch (error) { 202 | console.error('An error occurred:', error); 203 | } 204 | } 205 | 206 | // Run the main function 207 | main(); 208 | ``` 209 | 210 | 211 | 212 | ## Step 5: Submit the Proposal 213 | 214 | After filling in the details, submit the proposal to the Crestal backend: 215 | 216 | ```bash 217 | npx ts-node utils/examples/submitProposalExample.ts 218 | ``` 219 | 220 | ![Submit Proposal](../images/solver-guide/solver5.gif) 221 | 222 | The output looks like this: 223 | 224 | ```bash 225 | laviniatalpas@Lavinias-MacBook-Pro crestal-js-sdk % npx ts-node utils/examples/submitProposalExample.ts 226 | Full Response: { 227 | "proposals": [ 228 | { 229 | "solverAddress": "0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8", 230 | "da": { 231 | "initCost": 100, 232 | "maintenanceCost": 20, 233 | "errorRate": 0.02 234 | }, 235 | "indexing": {}, 236 | "compute": {}, 237 | "storage": {} 238 | } 239 | ], 240 | "solverAddress": "0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8", 241 | "requestId": "0x57de6a6bd64d3423ee07c73f6f08479bb5ac5ed1cdfab**********d3d66fcae" 242 | } 243 | DA Proposal Details: { 244 | "initCost": 100, 245 | "maintenanceCost": 20, 246 | "errorRate": 0.02 247 | } 248 | ``` 249 | After the proposal is submitted, it shows up on the Crestal dapp, in the list of proposals: 250 | 251 | ![Listed Proposal](../images/solver-guide/solver6.png) 252 | 253 | With these steps, you can explore and test the DA solver integration flow on Crestal, gaining a practical understanding of 254 | 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. 255 | 256 | -------------------------------------------------------------------------------- /mintlify-docs/solvers/solver-worker-integration.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Solver Integration: Data Availability" 3 | description: "Learn how to integrate with Crestal as a DA provider - from listening to proposal requests to submitting your DA solution." 4 | --- 5 | 6 | ## Step 1: Install CrestalJS SDK 7 | 8 | Install the NPM CrestalJS SDK by using one of the following commands: 9 | 10 | ```bash 11 | // NPM 12 | npm install crestal-js-sdk 13 | 14 | // YARN 15 | yarn add crestal-js-sdk 16 | ``` 17 | 18 | In case you want to build from source: 19 | 20 | ```bash 21 | git clone https://github.com/crestalnetwork/crestal-js-sdk.git 22 | npm install 23 | npm run build 24 | ``` 25 | 26 | ### JavaScript Projects 27 | 28 | No additional configuration needed. You can start using the SDK package right away. 29 | 30 | ### TypeScript Projects 31 | 32 | Add these essential compiler options to your `tsconfig.json`: 33 | 34 | ```typescript 35 | { 36 | "compilerOptions": { 37 | "moduleResolution": "node", 38 | "module": "ESNext", 39 | "esModuleInterop": true, 40 | "paths": { 41 | "crestal-js-sdk/*": [ 42 | "./node_modules/crestal-js-sdk/dist/types/*" 43 | ] 44 | } 45 | } 46 | } 47 | ``` 48 | 49 | ### Import Functions 50 | 51 | ```JavaScript 52 | // Using ESM (import) 53 | import { SOME_FUNCTION } from 'crestal-js-sdk/utils'; 54 | 55 | // OR using CommonJS (require) 56 | const { SOME_FUNCTION } = require('crestal-js-sdk/utils'); 57 | ``` 58 | 59 | 60 | ## Step 2: Listen for Proposal Requests 61 | 62 | To initiate the proposal request process, the Solver listens for `RequestProposal` events on the designated networks: **Berachain bArtio**, **Polygon Amoy**, or **Binance Testnet**. 63 | Read more about networks supported on our platform [here](/networks/supported-networks). 64 | 65 | Each network has a dedicated listener: 66 | 67 | - `utils/bscTestnetEventListener` 68 | - `utils/beraEventListener` 69 | - `utils/polygonAmoyEventListener` 70 | 71 | When a `RequestProposal` event is detected, you should see output similar to this: 72 | 73 | ```bash 74 | Listening for RequestProposal events... 75 | RequestProposal Event Detected 76 | { 77 | projectID: '0x******92c7e6242fa5ac445f9059178', 78 | walletAddress: '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 79 | requestID: '0xaf4c******8dd5aa458391ff6b29e62b2', 80 | chainRequestParam: { 81 | project_id: '0x******92c7e6242fa5ac445f9059178', 82 | types: [ 'DA' ], 83 | cost_per_mb: 0.5, 84 | max_throughput: 500, 85 | number_of_nodes: 750, 86 | send_blob_latency: 1.5, 87 | finality_time: 15, 88 | latency: 0, 89 | block_time: 0, 90 | first_category: 'Layer_2', 91 | second_category: 'General' 92 | }, 93 | serverURL: 'https://api.service.testnet.crestal.xyz', 94 | raw: { 95 | filter: 'RequestProposal', 96 | emitter: Contract { 97 | target: '0x******11AA5516d7', 98 | ... 99 | }, 100 | log: { 101 | transactionHash: '0xc15******d24233b4b561e', 102 | blockHash: '0xdea******268d5e2c75b', 103 | blockNumber: 6016102, 104 | ... 105 | }, 106 | args: [ 107 | '0x******92c7e6242fa5ac445f9059178', 108 | '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 109 | '0xaf4c******8dd5aa458391ff6b29e62b2', 110 | 'eyJ******ZW5lcmFsIn0=', 111 | 'https://api.service.testnet.crestal.xyz' 112 | ] 113 | } 114 | } 115 | ``` 116 | The listener automatically decodes the `base64RecParam` included in the event. 117 | This decoded parameter, of type `ChainRequestParam`, provides chain-specific metrics essential for building a proposal. 118 | It contains the specific requirements that your DA solution needs to address. Consider these parameters as the project's minimum requirements. 119 | The closer your solution matches or exceeds these parameters, the higher your fit score should be. 120 | 121 | 122 | Request Proposal Structure (GO): 123 | 124 | ```bash 125 | type SolverRequestProposal struct { 126 | ProjectID [32]byte // Unique identifier for the project 127 | WalletAddress common.Address // Ethereum wallet address of the requester 128 | RequestID [32]byte // Unique request identifier 129 | Base64RecParam string // Encoded parameters for request 130 | ServerURL string // URL of the server for handling requests 131 | Raw types.Log // Blockchain-specific contextual information 132 | } 133 | ``` 134 | 135 | 136 | ## Step 3: Build the Proposal 137 | 138 | After receiving a request, the solver generates proposals by evaluating different DA solutions and submitting them in the following format: 139 | ```typescript 140 | interface PostProposal { 141 | project_id?: string; // Project identifier from the request 142 | request_id?: string; // Request identifier from the event 143 | solver_address?: string; // Solver's wallet address 144 | proposals?: Proposal[]; // Array of ranked proposals 145 | } 146 | ``` 147 | 148 | Each proposal in the proposals array contains: 149 | 150 | ```typescript 151 | interface Proposal { 152 | fit?: number; // Calculated fitness score (0-1) 153 | rank?: number; // Proposal rank based on fit 154 | type?: string; // 'private' or 'public', if 'public' no need to mention worker address 155 | da?: DAProposal; // DA solution details 156 | } 157 | ``` 158 | 159 | The DAProposal interface defines all metrics for a DA solution: 160 | 161 | ```typescript 162 | interface DAProposal { 163 | // Basic Info 164 | da_name?: string; // e.g., 'celestia' 165 | chain_id?: number; 166 | project_id?: string; 167 | 168 | // Cost Metrics 169 | error_rate?: number; // e.g., 0.02 170 | init_cost?: number; 171 | maintenance_cost?: number; 172 | accept_currencies?: string; 173 | 174 | // Performance Metrics 175 | network_type: string; // 'Mainnet' or 'Testnet' 176 | gas_token?: string; 177 | avg_cost?: number; 178 | max_throughput?: number; 179 | latency?: number; 180 | finality_time?: number; 181 | geo_coverage?: number; 182 | 183 | // Network Stats 184 | uptime?: number; 185 | block_time?: number; 186 | total_transactions?: number; 187 | number_of_nodes?: number; 188 | 189 | // Cost Analysis 190 | cost_per_transaction?: number; 191 | cost_per_mb?: number; 192 | gas_per_mb?: number; 193 | 194 | // Additional Metrics 195 | send_blob_latency?: number; 196 | total_data_transacted?: number; 197 | } 198 | ``` 199 | 200 | 201 | ### Calculate Your Metrics 202 | 203 | Provide accurate data about your DA solution's capabilities. Key metrics include the following: 204 | 205 | #### Performance Metrics 206 | 207 | - **`max_throughput`**: Maximum data processing capacity. 208 | - **`latency`**: Network response time. 209 | - **`finality_time`**: Time taken for transaction finality. 210 | - **`send_blob_latency`**: Data blob transmission time. 211 | - **`block_time`**: Average time between blocks. 212 | 213 | #### Cost Structure 214 | 215 | - **`init_cost`**: Initial setup costs. 216 | - **`maintenance_cost`**: Ongoing maintenance fees. 217 | - **`cost_per_mb`**: Data storage costs. 218 | - **`cost_per_transaction`**: Transaction fees. 219 | 220 | #### Network Statistics 221 | 222 | - **`number_of_nodes`**: Number of active nodes in the network. 223 | - **`uptime`**: Network availability. 224 | - **`error_rate`**: Measure of system reliability. 225 | 226 | > **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. 227 | 228 | ### Calculate Fit 229 | 230 | After computing your metrics, calculate how well your solution matches the request parameters: 231 | 232 | - **Compare your capabilities against the request requirements** to determine if your solution can meet the specified metrics. 233 | - **Calculate a fit score** between 0 and 1, representing how well your DA solution aligns with the requester’s needs. 234 | - **Consider cost-effectiveness and performance trade-offs** to provide an optimal solution balancing performance with cost. 235 | 236 | By following these steps, DA providers can ensure they submit comprehensive, relevant metrics and determine the suitability of their solutions for specific requests. 237 | 238 | 239 | ## Step 4: Generate SIWE Message 240 | 241 | After preparing your proposal, you need to generate a Sign-In with Ethereum (SIWE) message. 242 | Use the [generateProposalSIWE](https://github.com/crestalnetwork/crestal-js-sdk/blob/main/utils/generateProposalSIWE.ts) utility from the SDK: 243 | 244 | ```typescript 245 | // ESM 246 | import { generateProposalSIWE } from 'crestal-js-sdk/utils'; 247 | 248 | // CommonJS 249 | const { generateProposalSIWE } = require('crestal-js-sdk/utils'); 250 | ``` 251 | 252 | ### Usage 253 | 254 | Call the function with your proposal data: 255 | 256 | ```typescript 257 | const postSolverProposal = { 258 | project_id: "0x6119******f11f", 259 | request_id: "0x8531******e01f", 260 | proposals: [ 261 | { 262 | fit: 0.9, 263 | rank: 1, 264 | type: "public", 265 | da: { 266 | // Your DA metrics here 267 | } 268 | } 269 | ] 270 | }; 271 | 272 | const solverAddress = "0xYourSolverAddress"; 273 | const chainId = 80084; // Example: Berachain bArtio testnet 274 | 275 | const siweMessage = await generateProposalSIWE( 276 | postSolverProposal, 277 | solverAddress, 278 | chainId 279 | ); 280 | ``` 281 | 282 | 283 | The SIWE message expires after 10 minutes. Make sure to use it before expiration. 284 | 285 | 286 | The function will: 287 | 288 | - Fetch a nonce from the API 289 | - Create a SIWE message containing your proposal 290 | - Return the prepared message string 291 | 292 | If the generation fails, it will return `undefined` and log the error. 293 | 294 | ## Step 5: Sign the SIWE Message 295 | 296 | After generating the SIWE message, you need to sign it using your private key. 297 | Use the signMessageWithPrivateKey utility from the SDK: 298 | 299 | ```typescript 300 | // ESM 301 | import { signMessageWithPrivateKey } from 'crestal-js-sdk/utils'; 302 | 303 | // CommonJS 304 | const { signMessageWithPrivateKey } = require('crestal-js-sdk/utils'); 305 | ``` 306 | ### Usage 307 | 308 | Chain it with your SIWE message generation: 309 | 310 | ```typescript 311 | // Generated SIWE message from the previous step 312 | const siweMessage = await generateProposalSIWE( 313 | postSolverProposal, 314 | solverAddress, 315 | chainId 316 | ); 317 | 318 | // Sign the message 319 | const privateKey = "your-private-key"; // Your solver's private key 320 | const signature = await signMessageWithPrivateKey(siweMessage, privateKey); 321 | ``` 322 | 323 | ## Step 6: Submit the Proposal 324 | 325 | The final step is submitting your proposal using the generated SIWE message and signature. 326 | Use the `submitProposal` function from the SDK: 327 | 328 | ```typescript 329 | // ESM 330 | import { submitProposal } from 'crestal-js-sdk/utils'; 331 | 332 | // CommonJS 333 | const { submitProposal } = require('crestal-js-sdk/utils'); 334 | ``` 335 | 336 | ### Usage 337 | 338 | Here's how to chain all the previous steps together: 339 | 340 | ```typescript 341 | // SIWE message and Signature generated in previous steps 342 | const siweMessage = await generateProposalSIWE( 343 | postSolverProposal, 344 | solverAddress, 345 | chainId 346 | ); 347 | 348 | const signature = await signMessageWithPrivateKey(siweMessage, privateKey); 349 | 350 | // Submit the proposal 351 | const response = await submitProposal( 352 | solverAddress, 353 | siweMessage, 354 | signature 355 | ); 356 | ``` 357 | 358 | The submission API handles the login request and proposal submission in one step. 359 | The API used can be found [here](/api-reference/accept-a-list-of-proposals-from-solvers). 360 | 361 | 362 | The function will return: 363 | - The response data if successful 364 | - An error object if submission fails 365 | 366 | The response has the following format: 367 | 368 | ```typescript 369 | export interface SolversProposal { 370 | request_id?: string; 371 | solver_address?: string; 372 | solver_reputation?: number; 373 | fit?: number; 374 | rank?: number; 375 | da?: DAProposal; // See DAProposal format at step 3 376 | } 377 | ``` 378 | After following all these steps, you're ready to submit proposals as a DA provider on the Crestal network. 379 | 380 | ## Quick Commands for Solver Integration 381 | 382 | For a quick, command-based setup to integrate as a DA provider, follow these essential commands: 383 | 384 | ```bash 385 | # Step 1: Clone and build the SDK if building from source 386 | git clone https://github.com/crestalnetwork/crestal-js-sdk.git 387 | cd crestal-js-sdk 388 | npm install && npm run build 389 | 390 | # Step 2: Start an event listener for proposal requests 391 | npx ts-node utils/examples/listenToBerachainbArtio.ts # Listens for requests on Berachain bArtio 392 | 393 | # Step 3: Trigger a proposal request 394 | # - Add Berachain bArtio to your wallet, ensure testnet tokens, and connect to the Crestal dApp 395 | # - Start a new project and use the AI Assistant to generate a proposal request 396 | 397 | # Step 4: Submit a proposal by filling in `submitProposalExample.ts`: 398 | # - Replace `solverAddress`, `project_id`, and `request_id` with actual values from Step 4 399 | npx ts-node utils/examples/submitProposalExample.ts # Submit the proposal 400 | ``` 401 | 402 | For further details on each step, including code samples, refer to our 403 | [DA Solver Sample Integration Walkthrough](/solvers/solver-integration-quick-guide). -------------------------------------------------------------------------------- /mintlify-docs/solvers/worker-guide.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Worker Integration: Data Availability Sample Integration" 3 | description: "This guide showcases sample code and testing steps for DA worker integration with Crestal. Use it to explore how to set up listeners, submit a test deployment request and proof of deployment, to understand the flow before implementing a production setup." 4 | --- 5 | 6 | 7 | ## Prerequisites: Clone the CrestalJS SDK repository 8 | 9 | ```bash 10 | # Clone the SDK 11 | git clone https://github.com/crestalnetwork/crestal-js-sdk.git 12 | 13 | # Install and build 14 | cd crestal-js-sdk 15 | npm install # or yarn 16 | npm run build # or yarn build 17 | ``` 18 | 19 | ![Install](../images/solver-guide/solver1.gif) 20 | 21 | ## 1. **Create a New Project** 22 | 23 | 1. Visit the [Crestal Dashboard](https://app.testnet.crestal.xyz/dashboard). 24 | 2. Select **New Project**. 25 | 3. For testing purposes, type `/helloworld` into the AI assistant. The assistant will generate a **HelloWorld** target performance for you to try Crestal. 26 | 27 | ![AI Assistant](../images/worker-guide/worker1.png) 28 | 29 | --- 30 | 31 | ## 2. **Run the Event Listener** 32 | 33 | Run the event listener for your desired network. In this example, we use **Berachain**. 34 | 35 | 36 | Listeners are available for all supported networks: 37 | - [Listener for Berachain bArtio Testnet]() 38 | - [Listener for Polygon Amoy Testnet]() 39 | - [Listener for BSC Testnet]() 40 | 41 | 42 | ### Running the Listener 43 | ```bash 44 | npx ts-node utils/examples/listenToBerachainBartio.ts 45 | ``` 46 | 47 | ![Listener](../images/worker-guide/worker2.gif) 48 | 49 | ### Expected Output Example 50 | 51 | When you run the event listener, it listens for incoming `RequestProposal` events on the specified network. These events contain detailed information about the proposal request, including the `projectID`, `requestID`, and parameters like `chainRequestParam` that describe the required data availability (DA) configuration. 52 | 53 | ```bash 54 | laviniatalpas@Lavinias-MacBook-Pro crestal-js-sdk % npx ts-node utils/examples/listenToBerachainBartio.ts 55 | Listening for all events... 56 | Event listener started successfully. 57 | laviniatalpas@Lavinias-MacBook-Pro crestal-js-sdk % npx ts-node utils/examples/listenToBerachainBartio.ts 58 | Listening for all events... 59 | Event listener started successfully. 60 | RequestProposal Event Detected 61 | { 62 | projectID: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 63 | walletAddress: '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 64 | requestID: '0x7baa4f655fb2571f24be3bb7a096d406de03deb87fd62b1de9b68077a1a7e076', 65 | chainRequestParam: { 66 | project_id: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 67 | types: [ 'DA' ], 68 | cost_per_mb: 0.1, 69 | max_throughput: 100, 70 | number_of_nodes: 100, 71 | send_blob_latency: 1, 72 | finality_time: 20, 73 | latency: 0, 74 | block_time: 0, 75 | first_category: 'HelloWorld', 76 | second_category: 'General' 77 | }, 78 | serverURL: 'https://api.service.testnet.crestal.xyz', 79 | raw: ContractEventPayload { 80 | filter: 'RequestProposal', 81 | emitter: Contract { 82 | target: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 83 | interface: [Interface], 84 | runner: JsonRpcProvider {}, 85 | filters: {}, 86 | fallback: null, 87 | [Symbol(_ethersInternal_contract)]: {} 88 | }, 89 | log: EventLog { 90 | provider: JsonRpcProvider {}, 91 | transactionHash: '0x8c41c324cdc7b351b06e765bc473732f9d8b1b56b3623c5d165250de135cbe76', 92 | blockHash: '0x6ddfb049c654db7082035392f1c1d719ed2f3495c68e3d569268bb8b947e7bfb', 93 | blockNumber: 7127935, 94 | removed: false, 95 | address: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 96 | data: '0x000000000000000000000000bb900bbe1a20da4d474666b79a5fa6ce1262973300000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000017c65794a77636d39715a574e3058326c6b496a6f694d48686c5a575135595759774d7a4e6d5a574e6c597a45334d6d4a684e5751314e5459344e7a6b324d4451784d325535597a45354f5445334e3251794e6a51304d475977596a6c6c4f4751324e574977597a51344d474e6b4969776964486c775a584d694f6c736952454569585377695932397a644639775a584a66625749694f6a41754d537769625746345833526f636d39315a326877645851694f6a45774d437769626e5674596d56795832396d583235765a47567a496a6f784d444173496e4e6c626d5266596d7876596c39735958526c626d4e35496a6f784c434a6d6157356862476c30655639306157316c496a6f794d437769624746305a57356a655349364d437769596d78765932746664476c745a5349364d4377695a6d6c7963335266593246305a576476636e6b694f694a495a57787362316476636d786b496977696332566a6232356b58324e686447566e62334a35496a6f69523256755a584a6862434a3900000000000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f6170692e736572766963652e746573746e65742e6372657374616c2e78797a00000000000000000000000000000000000000000000000000', 97 | topics: [Array], 98 | index: 262, 99 | transactionIndex: 10, 100 | interface: [Interface], 101 | fragment: [EventFragment], 102 | args: [Result] 103 | }, 104 | args: Result(5) [ 105 | '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 106 | '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 107 | '0x7baa4f655fb2571f24be3bb7a096d406de03deb87fd62b1de9b68077a1a7e076', 108 | 'eyJwcm9qZWN0X2lkIjoiMHhlZWQ5YWYwMzNmZWNlYzE3MmJhNWQ1NTY4Nzk2MDQxM2U5YzE5OTE3N2QyNjQ0MGYwYjllOGQ2NWIwYzQ4MGNkIiwidHlwZXMiOlsiREEiXSwiY29zdF9wZXJfbWIiOjAuMSwibWF4X3Rocm91Z2hwdXQiOjEwMCwibnVtYmVyX29mX25vZGVzIjoxMDAsInNlbmRfYmxvYl9sYXRlbmN5IjoxLCJmaW5hbGl0eV90aW1lIjoyMCwibGF0ZW5jeSI6MCwiYmxvY2tfdGltZSI6MCwiZmlyc3RfY2F0ZWdvcnkiOiJIZWxsb1dvcmxkIiwic2Vjb25kX2NhdGVnb3J5IjoiR2VuZXJhbCJ9', 109 | 'https://api.service.testnet.crestal.xyz' 110 | ], 111 | fragment: EventFragment { 112 | type: 'event', 113 | inputs: [Array], 114 | name: 'RequestProposal', 115 | anonymous: false 116 | } 117 | } 118 | } 119 | ``` 120 | 121 | --- 122 | 123 | ## 3. **Submit a Proposal** 124 | 125 | The `chainRequestParam` field in the `RequestProposal` event provides all the necessary information required to craft and submit a proposal. 126 | The proposal we are sending now for test purposes doesn’t have to match the request exactly, as they are dummy values, but it must conform to the required format. 127 | For detailed guidance about proposals, refer to the [Solver Integration Walkthrough](https://docs.crestal.xyz/solvers/solver-integration-quick-guide). 128 | 129 | We are going to submit a proposal with private worker, this means that we mention a specific worker that will be the only one who can 130 | make the deployment. To do this, we'll use `utils/examples/submitPrivateProposalExample.ts`. 131 | 132 | **Populate Required Variables:** 133 | 134 | - `solver_address`: Your account address as a solver. 135 | - `project_id`: Use the `project_id` from the event listener output. 136 | - `request_id`: Use the `request_id` from the event listener output. 137 | - `privateKey`: The private key for the `solver_address`. 138 | - `worker_address`: The address of the worker handling the deployment. This can be the same as the solver address. 139 | 140 | 141 | Use the following command to run the script and submit the proposal: 142 | 143 | `npx ts-node utils/examples/submitPrivateProposalExample.ts` 144 | 145 | Once submitted, the proposal will appear on the Crestal frontend. 146 | 147 | ![Displayed Proposal](../images/worker-guide/worker3.png) 148 | 149 | 150 | Here’s an example proposal data with populated data: 151 | ```json 152 | { 153 | "project_id": "0x2835c205f8f558febf22804eb****************1dce1ff558b21ad094f13b7", 154 | "request_id": "0xa6f52234e6c993***********************************d35ecaa25f97c05", 155 | "target_performance": 10, 156 | "solver_address": "0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8", 157 | "proposals": [ 158 | { 159 | "fit": 0.9, 160 | "rank": 1, 161 | "worker_address": "0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8", 162 | "type": "private", 163 | "da": { 164 | "chain_id": 80084, 165 | "da_name": "Avail", 166 | "network_type": "Testnet", 167 | "gas_token": "ETH", 168 | "avg_cost": 3.2, 169 | "max_throughput": 10.5, 170 | "latency": 0.3, 171 | "finality_time": 2.0, 172 | "geo_coverage": 8, 173 | "grants_available": false, 174 | "number_of_projects": 1, 175 | "uptime": 10, 176 | "block_time": 10, 177 | "total_transactions": 1000000002, 178 | "total_blocks": 1000000003, 179 | "number_of_nodes": 5000, 180 | "cost_per_transaction": 0.3, 181 | "cost_per_mb": 0.2, 182 | "error_rate": 0.02, 183 | "init_cost": 100, 184 | "maintenance_cost": 20 185 | } 186 | } 187 | ] 188 | } 189 | ``` 190 | 191 | --- 192 | 193 | ## 4. **Approve the Proposal for Deployment** 194 | 195 | 1. Approve the proposal from the frontend. 196 | 2. Ensure the event listener is running to detect the following events: 197 | - **AcceptDeployment** 198 | - **RequestPrivateDeployment** 199 | 200 | 201 | ![Approve Proposal](../images/worker-guide/worker4.gif) 202 | 203 | ### Example Output 204 | ```bash 205 | Event listener started successfully. 206 | AcceptDeployment Event Detected 207 | { 208 | projectID: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 209 | requestID: '0x214a4cd565bc7a806781dd047ba96d5afa7f33aa545f13f1aeedee1872139c3a', 210 | workerAddress: '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 211 | raw: ContractEventPayload { 212 | filter: 'AcceptDeployment', 213 | emitter: Contract { 214 | target: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 215 | interface: [Interface], 216 | runner: JsonRpcProvider {}, 217 | filters: {}, 218 | fallback: null, 219 | [Symbol(_ethersInternal_contract)]: {} 220 | }, 221 | log: EventLog { 222 | provider: JsonRpcProvider {}, 223 | transactionHash: '0x79115afa6129c9d0a51561b01a1aa30a80b84f1f5d5b4c352c4ae76197d7e796', 224 | blockHash: '0x89fc7d295d3cf95ef2e73e77579a82e2c2eedf8d7b306c9ff8cea2d8936770df', 225 | blockNumber: 7128001, 226 | removed: false, 227 | address: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 228 | data: '0x', 229 | topics: [Array], 230 | index: 349, 231 | transactionIndex: 33, 232 | interface: [Interface], 233 | fragment: [EventFragment], 234 | args: [Result] 235 | }, 236 | args: Result(3) [ 237 | '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 238 | '0x214a4cd565bc7a806781dd047ba96d5afa7f33aa545f13f1aeedee1872139c3a', 239 | '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8' 240 | ], 241 | fragment: EventFragment { 242 | type: 'event', 243 | inputs: [Array], 244 | name: 'AcceptDeployment', 245 | anonymous: false 246 | } 247 | } 248 | } 249 | RequestPrivateDeployment Event Detected 250 | { 251 | projectID: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 252 | walletAddress: '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 253 | privateWorkerAddress: '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 254 | solverAddress: '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 255 | requestID: '0x214a4cd565bc7a806781dd047ba96d5afa7f33aa545f13f1aeedee1872139c3a', 256 | decodedProposal: { 257 | id: 28049, 258 | da_name: 'Avail', 259 | chain_id: 80084, 260 | project_id: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 261 | network_type: 'Testnet', 262 | gas_token: 'ETH', 263 | avg_cost: 3.2, 264 | max_throughput: 10.5, 265 | finality_time: 2, 266 | geo_coverage: 8, 267 | number_of_projects: 1, 268 | uptime: 10, 269 | block_time: 10, 270 | total_transactions: 1000000002, 271 | total_blocks: 1000000003, 272 | number_of_nodes: 5000, 273 | cost_per_transaction: 0.3, 274 | cost_per_mb: 0.2, 275 | error_rate: 0.02, 276 | init_cost: 100, 277 | maintenance_cost: 20, 278 | worker_address: '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 279 | type: 'DA', 280 | created_at: '2024-11-20T22:31:51.471797Z' 281 | }, 282 | serverURL: 'https://api.service.testnet.crestal.xyz', 283 | raw: ContractEventPayload { 284 | filter: 'RequestPrivateDeployment', 285 | emitter: Contract { 286 | target: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 287 | interface: [Interface], 288 | runner: JsonRpcProvider {}, 289 | filters: {}, 290 | fallback: null, 291 | [Symbol(_ethersInternal_contract)]: {} 292 | }, 293 | log: EventLog { 294 | provider: JsonRpcProvider {}, 295 | transactionHash: '0x79115afa6129c9d0a51561b01a1aa30a80b84f1f5d5b4c352c4ae76197d7e796', 296 | blockHash: '0x89fc7d295d3cf95ef2e73e77579a82e2c2eedf8d7b306c9ff8cea2d8936770df', 297 | blockNumber: 7128001, 298 | removed: false, 299 | address: '0x5D8d432C96DcEE25c9B3B72634B20f11AA5516d7', 300 | data: '0x000000000000000000000000bb900bbe1a20da4d474666b79a5fa6ce126297330000000000000000000000001e22a1c3ab5dfba41d61d546f39b08a43410cac80000000000000000000000001e22a1c3ab5dfba41d61d546f39b08a43410cac800000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000003e0000000000000000000000000000000000000000000000000000000000000031865794a705a4349364d6a67774e446b73496d526858323568625755694f694a42646d467062434973496d4e6f59576c7558326c6b496a6f344d4441344e43776963484a76616d566a644639705a434936496a42345a57566b4f57466d4d444d7a5a6d566a5a574d784e7a4a695954566b4e5455324f4463354e6a41304d544e6c4f574d784f546b784e7a646b4d6a59304e44426d4d4749355a54686b4e6a56694d474d304f44426a5a434973496d356c64486476636d746664486c775a534936496c526c633352755a5851694c434a6e59584e66644739725a5734694f694a46564567694c434a68646d64665932397a644349364d7934794c434a7459586866644768796233566e61484231644349364d5441754e5377695a6d6c755957787064486c6664476c745a5349364d6977695a32567658324e76646d56795957646c496a6f344c434a75645731695a584a6662325a6663484a76616d566a64484d694f6a4573496e567764476c745a5349364d544173496d4a7362324e7258335270625755694f6a45774c434a306233526862463930636d46756332466a64476c76626e4d694f6a45774d4441774d4441774d444973496e52766447467358324a7362324e72637949364d5441774d4441774d4441774d797769626e5674596d56795832396d583235765a47567a496a6f314d4441774c434a6a62334e305833426c636c3930636d46756332466a64476c76626949364d43347a4c434a6a62334e305833426c636c3974596949364d4334794c434a6c636e4a76636c39795958526c496a6f774c6a41794c434a70626d6c3058324e76633351694f6a45774d43776962574670626e526c626d4675593256665932397a644349364d6a4173496e6476636d746c636c39685a4752795a584e7a496a6f694d4867785a544979515446444d3046434e55526d596b45304d5751324d5751314e445a6d4d7a6c694d4468424e444d304d54426a59554d344969776964486c775a534936496b52424969776959334a6c5958526c5a46396864434936496a49774d6a51744d5445744d6a42554d6a49364d7a45364e5445754e4463784e7a6b3357694a390000000000000000000000000000000000000000000000000000000000000000000000000000002768747470733a2f2f6170692e736572766963652e746573746e65742e6372657374616c2e78797a00000000000000000000000000000000000000000000000000', 301 | topics: [Array], 302 | index: 348, 303 | transactionIndex: 33, 304 | interface: [Interface], 305 | fragment: [EventFragment], 306 | args: [Result] 307 | }, 308 | args: Result(7) [ 309 | '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 310 | '0xBB900BbE1A20dA4d474666B79a5fa6CE12629733', 311 | '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 312 | '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 313 | '0x214a4cd565bc7a806781dd047ba96d5afa7f33aa545f13f1aeedee1872139c3a', 314 | 'eyJpZCI6MjgwNDksImRhX25hbWUiOiJBdmFpbCIsImNoYWluX2lkIjo4MDA4NCwicHJvamVjdF9pZCI6IjB4ZWVkOWFmMDMzZmVjZWMxNzJiYTVkNTU2ODc5NjA0MTNlOWMxOTkxNzdkMjY0NDBmMGI5ZThkNjViMGM0ODBjZCIsIm5ldHdvcmtfdHlwZSI6IlRlc3RuZXQiLCJnYXNfdG9rZW4iOiJFVEgiLCJhdmdfY29zdCI6My4yLCJtYXhfdGhyb3VnaHB1dCI6MTAuNSwiZmluYWxpdHlfdGltZSI6MiwiZ2VvX2NvdmVyYWdlIjo4LCJudW1iZXJfb2ZfcHJvamVjdHMiOjEsInVwdGltZSI6MTAsImJsb2NrX3RpbWUiOjEwLCJ0b3RhbF90cmFuc2FjdGlvbnMiOjEwMDAwMDAwMDIsInRvdGFsX2Jsb2NrcyI6MTAwMDAwMDAwMywibnVtYmVyX29mX25vZGVzIjo1MDAwLCJjb3N0X3Blcl90cmFuc2FjdGlvbiI6MC4zLCJjb3N0X3Blcl9tYiI6MC4yLCJlcnJvcl9yYXRlIjowLjAyLCJpbml0X2Nvc3QiOjEwMCwibWFpbnRlbmFuY2VfY29zdCI6MjAsIndvcmtlcl9hZGRyZXNzIjoiMHgxZTIyQTFDM0FCNURmYkE0MWQ2MWQ1NDZmMzliMDhBNDM0MTBjYUM4IiwidHlwZSI6IkRBIiwiY3JlYXRlZF9hdCI6IjIwMjQtMTEtMjBUMjI6MzE6NTEuNDcxNzk3WiJ9', 315 | 'https://api.service.testnet.crestal.xyz' 316 | ], 317 | fragment: EventFragment { 318 | type: 'event', 319 | inputs: [Array], 320 | name: 'RequestPrivateDeployment', 321 | anonymous: false 322 | } 323 | } 324 | } 325 | ``` 326 | 327 | --- 328 | 329 | ## 5. **Submit the Deployment Request to Backend** 330 | 331 | The deployment request must be submitted to both the backend and the smart contract. For **private proposals** with a **private worker**, the request only needs to be submitted to the backend. 332 | 333 | ### Deployment Data 334 | The **`Deployment`** type represents the data structure required for submitting deployment requests. 335 | It also contains the proposal itself. The deployment details are also included in this type, but they are only 336 | required when submitting the proof of deployment. 337 | 338 | The `requestId` and `projectId` can be extracted from the `RequestPrivateDeployment` event. 339 | 340 | ```typescript 341 | const deploymentData: Deployment = { 342 | request_id: requestId, 343 | project_id: projectId, 344 | chain_id: chainId, 345 | worker_address: workerAddress, 346 | solver_address: workerAddress, 347 | status: 'deploying', 348 | proposal: proposal 349 | }; 350 | ``` 351 | 352 | 353 | 354 | ```typescript 355 | export interface Deployment { 356 | request_id: string; // Required field, unique ID for the deployment request 357 | chain_id: number; 358 | project_id?: string; // Optional field, project ID from the Crestal website 359 | worker_name?: string; // Optional field, name of the worker 360 | worker_address: string; // Required field, worker's Ethereum address in hex format 361 | solver_address: string; // Required field, solver's Ethereum address in hex format 362 | status: DeployStatus; // Required field, current status of the deployment 363 | proposal_hash?: string; // Optional field, hash of the proposal 364 | proposal?: object; // Optional field, serialized JSON string of the proposal 365 | deployment_details?: DeploymentDetails ; // Optional field, serialized JSON string of the deployment details 366 | } 367 | ``` 368 | 369 | 370 | 371 | Deployment Status Types: 372 | - `init` 373 | - `pick_up` 374 | - `deploying` 375 | - `deployed` 376 | - `generating_proof` 377 | - `generated_proof` 378 | 379 | 380 | ### Proposal Data 381 | 382 | For testing purposes, the predefined proposal from the SDK example we are using looks like this: 383 | 384 | ```javascript 385 | const proposal = { 386 | chain_id: chainId, 387 | da_name: "Avail", 388 | network_type: "Testnet", 389 | gas_token: "ETH", 390 | avg_cost: 3.2, 391 | max_throughput: 10.5, 392 | latency: 0.3, 393 | finality_time: 2.0, 394 | geo_coverage: 8, 395 | grants_available: false, 396 | number_of_projects: 1, 397 | uptime: 10, 398 | block_time: 10, 399 | total_transactions: 1000000002, 400 | total_blocks: 1000000003, 401 | number_of_nodes: 5000, 402 | cost_per_transaction: 0.3, 403 | cost_per_mb: 0.2, 404 | error_rate: 0.02, 405 | init_cost: 100, 406 | maintenance_cost: 20 407 | }; 408 | ``` 409 | 410 | However, in a real-world scenario, the actual data for the proposal can be extracted from the `RequestPrivateDeployment` event's `decodedProposal` field. Here's an example: 411 | 412 | ```bash 413 | decodedProposal: { 414 | id: 28049, 415 | da_name: 'Avail', 416 | chain_id: 80084, 417 | project_id: '0xeed9af033fecec172ba5d55687960413e9c199177d26440f0b9e8d65b0c480cd', 418 | network_type: 'Testnet', 419 | gas_token: 'ETH', 420 | avg_cost: 3.2, 421 | max_throughput: 10.5, 422 | finality_time: 2, 423 | geo_coverage: 8, 424 | number_of_projects: 1, 425 | uptime: 10, 426 | block_time: 10, 427 | total_transactions: 1000000002, 428 | total_blocks: 1000000003, 429 | number_of_nodes: 5000, 430 | cost_per_transaction: 0.3, 431 | cost_per_mb: 0.2, 432 | error_rate: 0.02, 433 | init_cost: 100, 434 | maintenance_cost: 20, 435 | worker_address: '0x1e22A1C3AB5DfbA41d61d546f39b08A43410caC8', 436 | type: 'DA', 437 | created_at: '2024-11-20T22:31:51.471797Z' 438 | } 439 | ``` 440 | 441 | This proposal is included in the `proposal` field from `Deployment`. 442 | 443 | ### Submission 444 | 445 | For this example, we are using the `utils/examples/submitDeploymentExample` script. 446 | 447 | To submit the deployment request, populate the following fields: 448 | 449 | - `workerAddress`: The address of the worker you want to use for deployment. 450 | - `privateKey`: The private key associated with your worker’s address. 451 | - `requestId`: The request ID from the `RequestPrivateDeployment` event. 452 | - `projectId`: The project ID from the `RequestPrivateDeployment` event. 453 | 454 | Then run the script: 455 | 456 | `npx ts-node utils/examples/submitDeploymentExample.ts` 457 | 458 | ![Submit Deployment](../images/worker-guide/worker5.gif) 459 | 460 | ## 6. **Update the Deployment Status** 461 | 462 | The deployment status needs can be updated by submitting requests to the backend. 463 | To achieve this, you can use the `utils/examples/updateDeploymentExample` script. 464 | 465 | ### Updating the Status to `deployed` 466 | 467 | Use the same **`projectId`** and **`requestId`** from Step 5. In the example, the status is set to **`deployed`**, indicating that the deployment has been successfully completed. 468 | 469 | 470 | For the full list of possible statuses please check Step 5. 471 | 472 | 473 | The run the command: 474 | 475 | `npx ts-node utils/examples/updateDeploymentExample.ts` 476 | 477 | ### Frontend Status Progression 478 | 479 | After the status is updated to **`deployed`**, the frontend will automatically update the status to **Generating Proof**. This signifies that the deployment is complete and now awaits the submission of the **Proof of Deployment**. 480 | 481 | ![Update Status](../images/worker-guide/worker6.gif) 482 | 483 | ## 8. **Submit the Proof of Deployment** 484 | 485 | After completing the deployment, the next step is to submit the Proof of Deployment to both the backend and the blueprint smart contract. 486 | 487 | ### Submitting to the Smart Contract 488 | 489 | To submit to the smart contract, use the example from `utils/examples/submitDeploymentProofContract.ts`. 490 | The format that needs to be submitted is of type `ProofOfDeploymentContract`. 491 | 492 | 493 | 494 | ```typescript 495 | export type ProofOfDeploymentContract = { 496 | request_id: string; 497 | proposal_base64: string; 498 | expiration_date: number; 499 | worker_address: string; 500 | server_https_url?: string; 501 | server_http_url?: string; 502 | server_web_socket_url?: string; 503 | server_rpc_endpoint?: string; 504 | server_grpc_endpoint?: string; 505 | deployment_pick_up_time: number; 506 | deployment_deployed_time: number; 507 | description?: string; 508 | machine_info?: MachineInfo; 509 | service_info?: ServiceInfo; 510 | }; 511 | 512 | export type MachineInfo = { 513 | mac_address: string; 514 | cloud_provider: string; 515 | unique_id: string; 516 | }; 517 | 518 | export type ServiceInfo = { 519 | api_infos: APIInfo[]; 520 | }; 521 | 522 | export type APIInfo = { 523 | endpoint: string; 524 | method: string; 525 | request?: string; 526 | response?: string; 527 | }; 528 | ``` 529 | 530 | 531 | All this data is already predefined in the example. You just need to populate required variables: 532 | 533 | - `projectaId`: Use the `projectId` from Step 6. 534 | - `requestId`: Use the `requestId` from Step 6. 535 | - `workerAddress`: The address of the worker handling the deployment. 536 | - `privateKey`: The private key for the `worker_address`. 537 | 538 | Run the script: 539 | 540 | ` npx ts-node utils/examples/submitDeploymentProofContract.ts` 541 | 542 | ![Contract Proof](../images/worker-guide/worker7.png) 543 | 544 | ### Submitting to the Backend 545 | 546 | To submit to the backend, we use the update backend endpoint and include the additional fields required for the proof of deployment. 547 | 548 | The format is the `Deployment` type from Step 5, and we add the proof of deployment details to the `deployment_details` field as `DeploymentDetails` type. 549 | 550 | 551 | 552 | ```typescript 553 | export type DeploymentDetails = { 554 | access_url: string; 555 | server_https_url: string; 556 | server_http_url: string; 557 | server_ws_url: string; 558 | server_wss_url: string; 559 | server_web_socket_url?: string; 560 | server_grpc_endpoint?: string; 561 | server_rpc_endpoint?: string; 562 | token: string; 563 | }; 564 | ``` 565 | 566 | 567 | All this data is already predefined in the example. You just need to populate required variables: 568 | 569 | - `projectId`: Use the `project_id` from Step 6. 570 | - `requestId`: Use the `request_id` from Step 6. 571 | - `workerAddress`: The address of the worker handling the deployment. 572 | - `solverAddress`: The account address as the solver. 573 | - `privateKey`: The private key for the `worker_address`. 574 | 575 | ![Backend Proof](../images/worker-guide/worker8.gif) 576 | 577 | --- 578 | 579 | ## 7. **Deployment Completed** 580 | 581 | The deployment process is now fully completed. The **Proof of Deployment** has been submitted to both the backend and the smart contract, and all events have been processed successfully. Verify on the frontend that the deployment status reflects the completion, confirming that everything is finalized. 582 | 583 | ## Quick Commands 584 | 585 | ```bash 586 | // Step 1: Create a New Project 587 | // Visit Crestal Dashboard and create a new project. 588 | npx ts-node utils/examples/listenToBerachainBartio.ts 589 | 590 | // Step 2: Submit Proposal 591 | // Populate solver_address, project_id, request_id, worker_address, and privateKey. 592 | npx ts-node utils/examples/submitPrivateProposalExample.ts 593 | 594 | // Step 3: Approve Proposal 595 | // Approve on frontend and ensure event listener detects AcceptDeployment. 596 | 597 | // Step 4: Submit Deployment 598 | // Use request_id, project_id, worker_address, and privateKey. 599 | npx ts-node utils/examples/submitDeploymentExample.ts 600 | 601 | // Step 5: Update Deployment Status 602 | // Set status to 'deployed'. 603 | npx ts-node utils/examples/updateDeploymentExample.ts 604 | 605 | // Step 6: Submit Proof of Deployment 606 | // Smart Contract submission 607 | npx ts-node utils/examples/submitDeploymentProofContract.ts 608 | 609 | // Backend submission 610 | npx ts-node utils/examples/submitDeploymentProofBackend.ts 611 | 612 | // Final Step: Verify on frontend 613 | // Ensure 'Proof Generated' status is displayed. 614 | ``` -------------------------------------------------------------------------------- /mintlify-docs/solvers/worker.mdx: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Worker Integration: Data Availability" 3 | description: "This guide provides a comprehensive overview of Crestal's worker deployment process, including the architecture, smart contract functions, and API integrations." 4 | --- 5 | 6 | ## Roles and Responsibilities 7 | 8 | ### Builder 9 | - Submits a deployment request to the Blueprint contract. 10 | - Retrieves proof of deployment after the process is completed. 11 | 12 | ### Worker 13 | - Listens for deployment request events from the Blueprint. 14 | - Submits a deployment request to the blockchain. 15 | - Performs a real deployment based on the proposal. 16 | - Submits a deployment proof to the Blueprint contract. 17 | 18 | ### Crestal Backend 19 | - Accepts off-chain deployment requests. 20 | - Updates deployment status. 21 | 22 | ### Blueprint Smart Contract 23 | - Accepts deployment requests from Builders or the Crestal frontend. 24 | - Emits deployment request events. 25 | - Decides which Worker can handle a deployment request. 26 | - Emits events for deployment acceptance and proof of deployment submission. 27 | 28 | --- 29 | 30 | ## Deployment Workflow 31 | 32 | ![Simple Workflow](../images/worker-guide/worker9.png) 33 | 34 | ![Detailed Workflow](../images/worker-guide/worker10.png) 35 | 36 | 37 | 1. **Builder (via API or Crestal Frontend)** triggers the Blueprint smart contract by requesting a proposal deployment 38 | with the following parameters: 39 | - `solverAddress`: The address of the Solver. If using the Crestal frontend, this is the address that generated the proposal. Otherwise, it can be any address. 40 | - `Base64Proposal`: Encoded proposal in Base64 format with additional attributes. Refer to the `proposal.format` chapter for details. 41 | - `serverURL`: The URL for the Crestal backend (default: Crestal backend URL). 42 | 43 | 2. **Blueprint Smart Contract** Emits a Deployment Event 44 | 45 | The Blueprint Smart Contract processes deployment requests and emits one of two events depending on the proposal type: 46 | 47 | **RequestDeployment** 48 | Emitted for general deployment requests. This event includes: 49 | - **`solverAddress`**: Address of the Solver (or Builder if submitted directly). 50 | - **`Base64Proposal`**: Encoded proposal details. 51 | - **`serverURL`**: Backend server URL. 52 | - **`requestID`**: Unique deployment request ID. 53 | 54 | **RequestPrivateDeployment** 55 | Emitted for private deployments when the proposal specifies a selected Worker. Includes: 56 | - **`privateWorkerAddress`**: The explicitly selected Worker’s address. 57 | 58 | These events can be detected by running the event listeners included in the SDK: 59 | - `utils/berachainBartioEventListener` 60 | - `utils/bscTestnetEventListener` 61 | - `utils/polygonAmoyEventListener` 62 | 63 | 64 | ```bash 65 | laviniatalpas@Lavinias-MacBook-Pro crestal-js-sdk % npx ts-node utils/examples/listenToBerachainBartio.ts 66 | Listening for all events... 67 | Event listener started successfully. 68 | AcceptDeployment Event Detected 69 | { 70 | projectID: '0x888d...360b4f', 71 | requestID: '0x8d62...305546', 72 | workerAddress: '0x1e22...10caC8', 73 | raw: ContractEventPayload { 74 | filter: 'AcceptDeployment', 75 | emitter: Contract { 76 | target: '0x5D8d...5516d7', 77 | interface: [Interface], 78 | runner: JsonRpcProvider {}, 79 | filters: {}, 80 | fallback: null, 81 | [Symbol(_ethersInternal_contract)]: {} 82 | }, 83 | log: EventLog { 84 | provider: JsonRpcProvider {}, 85 | transactionHash: '0xc9ea...ef9cb', 86 | blockHash: '0x9ff6...bd160', 87 | blockNumber: 6543539, 88 | removed: false, 89 | address: '0x5D8d...5516d7', 90 | data: '0x', 91 | topics: [Array], 92 | index: 505, 93 | transactionIndex: 18, 94 | interface: [Interface], 95 | fragment: [EventFragment], 96 | args: [Result] 97 | }, 98 | args: Result(3) [ 99 | '0x888d...360b4f', 100 | '0x8d62...305546', 101 | '0x1e22...10caC8' 102 | ], 103 | fragment: EventFragment { 104 | type: 'event', 105 | inputs: [Array], 106 | name: 'AcceptDeployment', 107 | anonymous: false 108 | } 109 | } 110 | } 111 | RequestPrivateDeployment Event Detected 112 | { 113 | projectID: '0x888d...360b4f', 114 | walletAddress: '0x1e22...10caC8', 115 | privateWorkerAddress: '0x1e22...10caC8', 116 | solverAddress: '0x1e22...10caC8', 117 | requestID: '0x8d62...305546', 118 | decodedProposal: { 119 | project_id: '0x5f8f...ea4f9b', 120 | request_id: '0x01e7...dfb385', 121 | target_performance: 10, 122 | solver_address: 'solverAddress', 123 | proposals: [ [Object] ] 124 | }, 125 | serverURL: 'https://api.service.testnet.crestal.xyz/v1', 126 | raw: ContractEventPayload { 127 | filter: 'RequestPrivateDeployment', 128 | emitter: Contract { 129 | target: '0x5D8d...5516d7', 130 | interface: [Interface], 131 | runner: JsonRpcProvider {}, 132 | filters: {}, 133 | fallback: null, 134 | [Symbol(_ethersInternal_contract)]: {} 135 | }, 136 | log: EventLog { 137 | provider: JsonRpcProvider {}, 138 | transactionHash: '0xc9ea...ef9cb', 139 | blockHash: '0x9ff6...bd160', 140 | blockNumber: 6543539, 141 | removed: false, 142 | address: '0x5D8d...5516d7', 143 | data: 'masked', 144 | topics: [Array], 145 | index: 504, 146 | transactionIndex: 18, 147 | interface: [Interface], 148 | fragment: [EventFragment], 149 | args: [Result] 150 | }, 151 | args: Result(7) [ 152 | '0x888d...360b4f', 153 | '0x1e22...10caC8', 154 | '0x1e22...10caC8', 155 | '0x1e22...10caC8', 156 | '0x8d62...305546', 157 | 'masked', 158 | 'https://api.service.testnet.crestal.xyz/v1' 159 | ], 160 | fragment: EventFragment { 161 | type: 'event', 162 | inputs: [Array], 163 | name: 'RequestPrivateDeployment', 164 | anonymous: false 165 | } 166 | } 167 | } 168 | ``` 169 | 170 | 171 | 172 | 3. **Worker submits deployment request** to the contract: 173 | - Listen for `RequestDeployment` events. 174 | - Fetch the associated `requestId` from the event. 175 | - Submit a deployment request to the Blueprint contract using the `submitDeploymentToContract` SDK util from 176 | `utils/submitDeploymentToContract` 177 | - The function takes two parameters, `projectId` and `requestId`, both are extracted from the `RequestDeployment` 178 | request 179 | **This step is skipped for private worker deployments.** 180 | 181 | 182 | 4. **Blueprint Contract selects worker**: 183 | - Receives multiple Worker requests. 184 | - Selects a Worker to handle the deployment using a first-come, first-serve strategy. 185 | - Emits an `AcceptDeployment` event containing the `requestId` and the selected Worker address. 186 | **This step is skipped for private worker deployments.** 187 | 188 | 5. **Selected Worker**: 189 | - Listens for `AcceptDeployment` events to verify if they are assigned. 190 | - If selected: 191 | - Performs the real deployment. 192 | - Sends a POST request to the Crestal backend (`/v1/deployments/worker`) to record the deployment using 193 | `submitDeployment` from `utils/submitDeployment` following the below format: 194 | ```typescript 195 | export interface Deployment { 196 | request_id: string; // Required field, unique ID for the deployment request 197 | chain_id: number; 198 | project_id?: string; // Optional field, project ID from the Crestal website 199 | worker_name?: string; // Optional field, name of the worker 200 | worker_address: string; // Required field, worker's Ethereum address in hex format 201 | solver_address: string; // Required field, solver's Ethereum address in hex format 202 | status: DeployStatus; // Required field, current status of the deployment 203 | proposal_hash?: string; // Optional field, hash of the proposal 204 | proposal?: object; // Optional field, serialized JSON string of the proposal 205 | deployment_details?: DeploymentDetails ; // Optional field, serialized JSON string of the deployment details 206 | } 207 | export type DeployStatus = 208 | | 'init' 209 | | 'pick_up' 210 | | 'deploying' 211 | | 'deployed' 212 | | 'generating_proof' 213 | | 'generated_proof'; 214 | ``` 215 | 216 | - Syncs deployment status via `/v1/deployments/worker/status` using `updateDeploymentStatus` from 217 | `utils/updateDeploymentStatus`. 218 | - Completes the deployment and submits proof to the Blueprint using `submitDeploymentToContract` 219 | from `utils/submitDeploymentToContract` following the above format: 220 | ```typescript 221 | export type ProofOfDeploymentContract = { 222 | request_id: string; 223 | proposal_base64: string; 224 | expiration_date: number; 225 | worker_address: string; 226 | server_https_url?: string; 227 | server_http_url?: string; 228 | server_web_socket_url?: string; 229 | server_rpc_endpoint?: string; 230 | server_grpc_endpoint?: string; 231 | deployment_pick_up_time: number; 232 | deployment_deployed_time: number; 233 | description?: string; 234 | machine_info?: MachineInfo; 235 | service_info?: ServiceInfo; 236 | }; 237 | 238 | export type MachineInfo = { 239 | mac_address: string; 240 | cloud_provider: string; 241 | unique_id: string; 242 | }; 243 | 244 | export type ServiceInfo = { 245 | api_infos: APIInfo[]; 246 | }; 247 | 248 | export type APIInfo = { 249 | endpoint: string; 250 | method: string; 251 | request?: string; 252 | response?: string; 253 | }; 254 | ``` 255 | - Syncs the proof of deployment with the Crestal backend via `/v1/deployments/worker/status` using 256 | `updateDeploymentStatus`, this time including `DeploymentDetails`: 257 | ```typescript 258 | export type DeploymentDetails = { 259 | access_url: string; 260 | server_https_url: string; 261 | server_http_url: string; 262 | server_ws_url: string; 263 | server_wss_url: string; 264 | server_web_socket_url?: string; 265 | server_grpc_endpoint?: string; 266 | server_rpc_endpoint?: string; 267 | token: string; 268 | }; 269 | ``` 270 | 271 | 6. **The contract** receives the proof of deployment: 272 | - Receives the proof of deployment. 273 | - Emits a `GeneratedProofOfDeployment` event containing the Base64-encoded proof. 274 | 275 | --- 276 | 277 | ## Event Details 278 | 279 | Events Emitted by the Blueprint Smart Contract 280 | - **`RequestDeployment`**: Signals a new deployment request. 281 | - **`AcceptDeployment`**: Indicates a Worker has been selected for deployment. 282 | - **`GeneratedProofOfDeployment`**: Contains the Base64-encoded proof of deployment. 283 | --------------------------------------------------------------------------------