DEV Community

Daniel Ioni
Daniel Ioni

Posted on

Titolo: 🌱 Building a 2‑of‑3 Escrow API with Flask, AWS AgentCore & Boson

🌱 Building a 2‑of‑3 Escrow API for MyZubster

I recently built a REST API for MyZubster that handles:

  • βœ… x402 payment sessions (via AWS AgentCore)
  • βœ… 2‑of‑3 escrow (simulated via Boson)
  • βœ… Job completion with rating & review

The API is built with Flask, uses boto3 for AWS Signature v4, and is ready to be deployed on Render or any WSGI server.


πŸ”§ The Stack

  • Python 3.12
  • Flask + Gunicorn
  • boto3 / urllib3 – for SigV4‑signed AWS requests
  • Boson – escrow 2‑of‑3 (testnet)
  • dotenv – environment variables

πŸ§ͺ The API Endpoints

POST /escrow/create

Creates a new escrow and a payment session.

Request:


json
{
  "offer_id": "garden_test_001",
  "buyer": "0xBuyerWalletTest",
  "seller": "0xSellerWalletTest",
  "amount": 12.50
}

Response:
json

{
  "job_id": "myzubster_6c712474",
  "payment_id": "mock_payment_87f3ea91",
  "payment_address": "0xMockPaymentAddress",
  "escrow_id": "boson_mock_escrow_f92dd7a7",
  "status": "ESCROW_PENDING",
  "created_at": "2026-08-03T04:27:28.187745+00:00"
}

POST /escrow/complete

Completes a job and records a review.

Request:
json

{
  "job_id": "myzubster_6c712474",
  "rating": 5,
  "review": "Giardino tagliato in modo impeccabile!"
}

Response:
json

{
  "job_id": "myzubster_6c712474",
  "status": "COMPLETED",
  "rating": 5,
  "review": "Giardino tagliato in modo impeccabile!"
}

πŸ“ Repository & Code

The full source code, environment setup, and README are available on GitHub:

πŸ‘‰ https://github.com/MyZubster-Ecosystem/myzubster-escrow-api
πŸš€ Deploy on Render

You can deploy this API in minutes:

    Push the code to GitHub.

    On Render, create a new Web Service.

    Set Start Command to:
    bash

    gunicorn -w 4 -b 0.0.0.0:5000 escrow_api:app

    Add environment variables from .env.

πŸ’‘ Why This Matters

This API is the backbone of a decentralized job marketplace:

    Buyers pay via x402 (USDC).

    Sellers receive funds via 2‑of‑3 escrow.

    Reputation is built through reviews.

MyZubster is building a bridge between physical work, blockchain payments, and AI.
🀝 Contribute

If you're a Python developer, check out the issues on GitHub:

πŸ‘‰ https://github.com/MyZubster-Ecosystem/myzubster-escrow-api/issues
πŸ“Œ Final Thought

This is just the beginning.
Next steps: real Boson integration, ERC‑8004 reputation, and photo‑based validation.

#MyZubster #Python #Flask #Escrow #x402 #Blockchain #AWS #DevUpdate
Enter fullscreen mode Exit fullscreen mode

Top comments (0)