Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: build Askeladd DVM marketplace frontend #5

Closed
16 tasks
AbdelStark opened this issue Jul 29, 2024 · 0 comments · Fixed by #6
Closed
16 tasks

feat: build Askeladd DVM marketplace frontend #5

AbdelStark opened this issue Jul 29, 2024 · 0 comments · Fixed by #6

Comments

@AbdelStark
Copy link
Owner

Description

Implement the remaining elements of the Askeladd DVM marketplace frontend, including Nostr integration, NIP-90 Job Request submission, Job Result retrieval, and STWO proof verification using WebAssembly.

Tasks

  1. Nostr Integration

    • Install and set up the @rust-nostr/nostr-sdk package
    • Initialize the Nostr client in the application
    • Implement connection to Nostr relays
    • Handle Nostr client errors and connection status
  2. NIP-90 Job Request Submission

    • Implement the submitJob function to create and publish a NIP-90 Job Request event
    • Use the correct event kind (5600) for Job Requests
    • Include necessary tags (log_size, claim, output) in the Job Request event
  3. Job Result Retrieval

    • Implement the waitForJobResult function to listen for Job Result events
    • Use the correct event kind (6600) for Job Results
    • Parse the Job Result event content to extract the proof
  4. STWO Proof Verification

    • Integrate STWO WebAssembly module for proof verification
    • Implement the verifyProof function using STWO WASM
    • Handle the verification result and update the UI accordingly
  5. UI Enhancements

    • Add error handling and display error messages to the user
    • Improve loading states and transitions between different stages of the process
    • Enhance the display of the proof and verification result

Implementation Details

Nostr Integration

Use the @rust-nostr/nostr-sdk package to connect to Nostr relays and interact with the Nostr network. Example usage:

import { Client, Keys, Filter, loadWasmAsync, Timestamp, Duration } from "@rust-nostr/nostr-sdk";

// Initialize Nostr client
const client = new Client();
await client.addRelay("wss://relay.damus.io");
await client.connect();

See more examples here.

NIP-90 Job Request Submission

Implement the Job Request submission using the Nostr SDK:

const keys = Keys.generate();
const tags = [
  ['param', 'log_size', logSize.toString()],
  ['param', 'claim', claim.toString()],
  ['output', 'text/json']
];

const event = await client.publishJobRequest(5600, tags, '');

Job Result Retrieval

Listen for Job Result events:

const filter = new Filter()
  .kind(6600)
  .since(Timestamp.now())
  .matchTag('e', [jobId]);

const events = await client.getEventsOf([filter], Duration.fromSecs(60));

STWO Proof Verification

Integrate STWO WASM for proof verification. Reference the STWO WASM demo for implementation details:
STWO WASM Demo

Additional Notes

  • Ensure proper error handling throughout the application
  • Consider implementing a more robust state management solution (e.g., React Context or Redux) as the application grows
  • Add unit tests for critical functions, especially those interacting with Nostr and STWO WASM
  • Document any configuration steps required for setting up the development environment

Resources

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant