๐Ÿš€ MyZubster: Completing a Real Ethereum Sepolia Marketplace E2E Payment Flow

Leader โ—2 โ—24 โ—155
calendar_today โ€ข schedule9 min read

MyZubster Sepolia E2E โ€” Technical Deep Dive: Debugging the Full Marketplace Payment Pipeline
I have just completed a full end-to-end technical validation of the MyZubster Marketplace ETH payment pipeline on Ethereum Sepolia.
This was not a simple frontend test.
The work involved debugging and validating multiple layers of the system:

  • React routing
  • React development server
  • Webpack Dev Server
  • browser runtime diagnostics
  • frontend bundle generation
  • Cloudflare CDN caching
  • Cloudflare Tunnel ingress rules
  • SPA fallback behavior
  • API/backend routing
  • authentication/JWT handling
  • Marketplace order state
  • payment-intent generation
  • MetaMask
  • Ethereum Sepolia
  • transaction construction
  • on-chain transaction verification
  • confirmation tracking
  • final Marketplace payment state
    The interesting part was that several apparently unrelated browser errors were actually symptoms of infrastructure and routing problems.
    1. Starting point: the Marketplace Operations route
      The target route was:
      MyZubster Marketplace Operations โ€” Sepolia
      The React application explicitly defines:
      if (path === '/marketplace/scambi') {
      return ;
      }

and the navigation contains:
window.location.href = '/marketplace/scambi';

So the expected application architecture was:
/marketplace

    โ†“

MarketplacePage

/marketplace/scambi

    โ†“

MarketplaceOpsPage

The first task was proving that this code was actually reaching the browser.

  1. Frontend development server investigation
    The frontend was running through Create React App:
    react-scripts start

The relevant process was:
/usr/bin/node
/root/myzubster-sepolia-e2e/frontend/node_modules/react-scripts/scripts/start.js

The application was bound to:
127.0.0.1:3010

We verified the listener with:
ss -ltnp | grep ':3010'

which returned the React process.
The process tree was also inspected:
sh
โ””โ”€โ”€ react-scripts

  โ””โ”€โ”€ node
       โ””โ”€โ”€ webpack/react development server

This was important because an attempted restart initially produced:
Something is already running on port 3010.

The issue was not that React could not start.
A previous React development process was already occupying the port.

  1. Local route versus public route
    We then compared:
    http://127.0.0.1:3010/marketplace/scambi

against:
https://sepolia.myzubster.com/marketplace/scambi

Both returned:
HTTP 200
Content-Type: text/html

This initially suggested that the route was fine.
But an HTTP 200 response alone does not prove that the correct React application version is being served.
The next step was therefore to inspect the actual JavaScript bundle.

  1. Runtime instrumentation
    A temporary diagnostic marker was inserted into App.js:
    console.log('[MYZ-APP-RUNTIME]', {
    pathname: window.location.pathname,
    path,
    marketplaceOps: path === '/marketplace/scambi',
    href: window.location.href
    });

The browser then reported:
pathname: "/marketplace/scambi"
path: "/marketplace/scambi"
marketplaceOps: true

This established that the browser itself was correctly interpreting:
/marketplace/scambi

as the Marketplace Operations route.
We also inspected the DOM and confirmed that the browser was loading:
/static/js/bundle.js

  1. Bundle-level verification
    The bundle was downloaded and searched directly.
    The relevant route was found in the compiled JavaScript:
    if (path === '/marketplace/scambi')
    return MarketplaceOpsPage;

We also searched for:
Paga ETH su Sepolia

and found it.
This was important because it proved that the Marketplace Operations component was not merely present in the source tree.
It was present in the bundle being served.

  1. Cloudflare cache investigation
    The next layer was Cloudflare.
    The public bundle returned headers such as:
    HTTP/2 200
    content-type: application/javascript; charset=utf-8
    etag: W/"2c9e23-..."
    age: 582
    cache-control: max-age=14400
    cf-cache-status: HIT

The local bundle had a different ETag:
ETag: W/"2c9ec3-..."

This was the key observation.
The local development server had a newer bundle, while Cloudflare was still serving an older cached object.
So the situation was:
SOURCE CODE

โ†“

React build/dev server

โ†“

NEW BUNDLE

โ”‚
X

Cloudflare cache

โ†“

OLD BUNDLE

โ†“

Browser

This can be particularly confusing because:
HTTP 200

does not mean:
latest application version

  1. Targeted Cloudflare cache purge
    Instead of performing a full cache purge, the specific asset was targeted:
    https://sepolia.myzubster.com/static/js/bundle.js

through Cloudflare's cache purge interface.
Cloudflare Dashboard
After the purge, a cache-busting request returned:
cf-cache-status: MISS

and the public ETag changed to the current bundle's ETag.
This established that Cloudflare was now fetching the updated asset from the origin.

  1. WebSocket error from Webpack Dev Server
    The browser was also reporting:
    Firefox cannot establish a connection to
    ws://127.0.0.1:3010/ws

This initially looked alarming because the public site was being accessed through:
https://sepolia.myzubster.com

while the Webpack development client was attempting to establish a WebSocket against:
127.0.0.1:3010

The important distinction is that this is development-server HMR/WebSocket infrastructure, not the Marketplace HTTP/API request itself.
The application bundle was nevertheless loading and executing.
The browser continued to report:
MYZ-APP-RUNTIME

and:
marketplaceOps: true

so the WebSocket failure was not the root cause of the Marketplace API problem.

  1. The real API problem
    The more significant error appeared when testing:
    /api/marketplace/orders/mine

The browser expected JSON.
Instead, it received:
HTTP 200
Content-Type: text/html

with:
<!DOCTYPE html>

This immediately explained:
JSON.parse:
unexpected character at line 1 column 1

The frontend wasn't receiving malformed JSON.
It wasn't receiving JSON at all.
It was receiving the React application's HTML.
This is a classic SPA/API routing failure.

  1. Why this happened
    The Cloudflare Tunnel configuration originally routed:
    sepolia.myzubster.com
    โ†“
    

    127.0.0.1:3010

But the backend API was actually listening on:
127.0.0.1:5010

Therefore:
GET /api/marketplace/orders/mine

was effectively becoming:
Cloudflare

โ†“

Frontend :3010

โ†“

React index.html

instead of:
Cloudflare

โ†“

Backend :5010

โ†“

JSON API

  1. Correcting Cloudflare ingress
    The ingress configuration was changed to explicitly separate API traffic:

The routing architecture became:

                     Cloudflare Tunnel
                            โ”‚
              sepolia.myzubster.com
                            โ”‚
                โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                โ”‚                       โ”‚
             /api/*                   /*
                โ”‚                       โ”‚
                โ–ผ                       โ–ผ
           Backend :5010          Frontend :3010
                โ”‚                       โ”‚
                โ–ผ                       โ–ผ
              JSON                  React SPA

The configuration was validated:
Validating rules from /root/.cloudflared/config.yml
OK

  1. Discovering how Cloudflared was actually managed
    An attempt to restart:
    systemctl restart cloudflared

failed because:
cloudflared.service not found

We then traced the process:
systemd
โ””โ”€โ”€ PM2

  โ””โ”€โ”€ cloudflared

PM2 showed:
id: 4
name: cloudflared
status: online

and the command:
/usr/local/bin/cloudflared tunnel
--config /root/.cloudflared/config.yml
--protocol http2
run myzubster

Therefore the correct restart mechanism was:
pm2 restart 4

or:
pm2 restart cloudflared

This is another useful operational lesson: before restarting infrastructure, identify which process manager actually owns it.

  1. API routing verification
    After the Tunnel configuration was corrected, the same public endpoint:
    https://sepolia.myzubster.com/api/marketplace/orders/mine

returned:
HTTP/2 401
Content-Type: application/json

with:
{
"success": false,
"message": "Token di autenticazione mancante o non valido"
}

This was exactly what we wanted from an unauthenticated request.
The important change was:
Before
200
text/html
React index.html

After
401
application/json
Backend authentication response

A 401 here was actually evidence that routing was fixed.

  1. Authenticated Marketplace order
    Using the authenticated browser session:
    fetch('/api/marketplace/orders/mine', {
    headers: {
    Authorization:
    Bearer ${localStorage.getItem('myzubster-token')}
    },
    cache: 'no-store'
    })

the backend returned the actual test order.
The order was:
ID:
6ab870ffc33da1e61579745d

with:
status: ACCEPTED

and:
payment.status: AWAITING_PAYMENT

The order snapshot contained:
title:
MyZubster Sepolia ETH E2E Test

price:
0.0001

currency:
ETH

exchangeMode:
payment

At this stage the Marketplace order existed correctly, but the blockchain payment had not yet been made.

  1. Payment-intent endpoint debugging
    The frontend initially attempted:
    /api/marketplace/orders/{id}/payment-intent

which returned:
404
Cannot GET /api/marketplace/orders/.../payment-intent

The actual endpoint was:
/api/marketplace/orders/{id}/payment/eth-intent

For the E2E order:
/api/marketplace/orders/6ab870ffc33da1e61579745d/payment/eth-intent

the backend returned:
HTTP 200
Content-Type: application/json

with the complete payment intent.

  1. Payment intent structure
    The backend returned:
    {
    "success": true,
    "data": {
    "asset": "ETH",
    "network": "sepolia",
    "chainId": 11155111,
    "chainHex": "0xaa36a7",
    "expectedSender": "0xB15707286c4dFC6f642fcDf217419b2665e1847a",
    "expectedRecipient": "0x14d751a54E8617C5A9DF87972dC980827fA91e4d",
    "expectedAmountWei": "100000000000000",
    "expectedAmountEth": "0.0001",
    "minConfirmations": 3,
    "paymentStatus": "AWAITING_PAYMENT",
    "txId": null,
    "testnet": true
    }
    }

This establishes several critical properties.
Network
Sepolia

Chain
11155111

Amount
100000000000000 wei

which corresponds to:
0.0001 ETH

Required confirmation depth
3

Expected sender
0xB15707286c4dFC6f642fcDf217419b2665e1847a

Expected recipient
0x14d751a54E8617C5A9DF87972dC980827fA91e4d

  1. MetaMask and testnet funding
    When attempting to execute the transaction, MetaMask correctly identified that the wallet did not initially have enough SepoliaETH to cover the transaction and network fees.
    This is an important distinction in E2E testing:
    Payment amount
    +
    Gas fee

both require testnet funds.
The test wallet was subsequently funded using a Sepolia faucet.
Once the wallet had sufficient SepoliaETH, the transaction could be submitted.

  1. Transaction execution
    MetaMask was used to submit:
    0.0001 SepoliaETH

from:
0xB15707286c4dFC6f642fcDf217419b2665e1847a

to:
0x14d751a54E8617C5A9DF87972dC980827fA91e4d

The transaction was submitted on:
Ethereum Sepolia
Chain ID: 11155111

The Marketplace immediately entered:
PAYMENT: CONFIRMING

rather than incorrectly assuming that the payment was already final.

  1. Confirmation tracking
    The UI displayed:
    Confirmations: 0

immediately after transaction submission.
This is an important state distinction:
transaction submitted

    โ‰ 

payment finalized

The backend continued checking the blockchain until the required confirmation depth was reached.
The configured threshold was:
3 confirmations

  1. Server-side verification
    The final payment state was not determined solely by the frontend or by MetaMask.
    The verification process used the payment intent as the expected source of truth.
    Conceptually:
    Expected sender
    โ”‚
    โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    Expected recipient โ”‚
    โ”‚ โ”‚
    Expected amount โ”‚
    โ”‚ โ–ผ
    Expected network โ†’ Blockchain transaction
                  โ”‚
                  โ–ผ
             Verification
                  โ”‚
           โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”
           โ”‚             โ”‚
        Valid?       Confirmations
           โ”‚             โ”‚
           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                  โ–ผ
                 PAID
    

The final transaction satisfied the expected payment parameters.

  1. Final transaction state
    The Marketplace eventually showed:
    PAYMENT: PAID

with:
Amount:
0.0001 ETH

Network:
Ethereum Sepolia

Confirmations:
3

and the transaction evidence:
TX:
0xae0b...5af9f94c37

The final sender and recipient matched the payment intent.

  1. Complete state transition
    The entire Marketplace payment state machine was demonstrated:
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ ACCEPTED โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
       โ”‚
       โ–ผ
    

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ AWAITING_PAYMENT โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

       โ”‚
       โ”‚ MetaMask transaction
       โ–ผ
    

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ CONFIRMING โ”‚
    โ”‚ confirmations: 0 โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

       โ”‚
       โ”‚ blockchain
       โ”‚ confirmations
       โ–ผ
    

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ CONFIRMING โ”‚
    โ”‚ confirmations: 3 โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

       โ”‚
       โ–ผ
    

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ PAID โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

This is substantially more meaningful than a mocked frontend payment.

  1. Problems encountered and resolved
    The E2E test exposed several independent technical problems.
    Problem 1 โ€” Existing React process
    Something is already running on port 3010

Resolution: identify the existing react-scripts process and manage the correct process.
Problem 2 โ€” Stale Cloudflare bundle
cf-cache-status: HIT
age: 582

with an outdated ETag.
Resolution: targeted Cloudflare cache purge.
Problem 3 โ€” Webpack development WebSocket
ws://127.0.0.1:3010/ws

could not be reached from the public browser.
Resolution: identified as development-server/HMR infrastructure rather than the Marketplace API failure.
Problem 4 โ€” API returned HTML
/api/marketplace/orders/mine

returned:
200 text/html

instead of JSON.
Resolution: separate /api/* from frontend routing in Cloudflare Tunnel.
Problem 5 โ€” Wrong payment-intent endpoint
The frontend attempted:
/payment-intent

while the backend exposed:
/payment/eth-intent

Resolution: use the correct endpoint.
Problem 6 โ€” Missing SepoliaETH
MetaMask reported insufficient funds for network fees.
Resolution: fund the Sepolia test wallet through a faucet.

  1. What makes this a real E2E test?
    A useful distinction is:
    Mocked test
    Click Pay
    โ†“
    setState(PAID)

versus:
This test
Marketplace order

   โ†“

authenticated API

   โ†“

payment intent

   โ†“

MetaMask

   โ†“

real Sepolia transaction

   โ†“

Ethereum network

   โ†“

transaction confirmation

   โ†“

server-side verification

   โ†“

3 confirmations

   โ†“

PAID

The second flow crosses actual system boundaries.

  1. Infrastructure architecture after the fixes
    The final architecture is:

                     INTERNET
                        โ”‚
                        โ–ผ
                 Cloudflare Edge
                        โ”‚
                        โ–ผ
              Cloudflare Tunnel
                        โ”‚
         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
         โ”‚                             โ”‚
     /api/*                         /*
         โ”‚                             โ”‚
         โ–ผ                             โ–ผ
    

    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚ Backend โ”‚ โ”‚ React โ”‚
    โ”‚ 127.0.0.1 โ”‚ โ”‚ 127.0.0.1 โ”‚
    โ”‚ :5010 โ”‚ โ”‚ :3010 โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

         โ”‚                            โ”‚
         โ–ผ                            โ–ผ
    

    Marketplace API Marketplace UI

         โ”‚
         โ–ผ
    

    Payment Intent

         โ”‚
         โ–ผ
      MetaMask
         โ”‚
         โ–ผ
    

    Ethereum Sepolia

         โ”‚
         โ–ผ
    

    Blockchain TX

         โ”‚
         โ–ผ
    

    Server Verification

         โ”‚
         โ–ผ
        PAID
    
  2. Useful debugging methodology
    One of the biggest takeaways from this test is that debugging a Web3 application is not limited to the blockchain.
    The actual dependency chain was:
    Browser
    โ†“
    React
    โ†“
    Webpack
    โ†“
    HTTP
    โ†“
    Cloudflare
    โ†“
    Tunnel
    โ†“
    Backend
    โ†“
    JWT
    โ†“
    Marketplace
    โ†“
    Payment intent
    โ†“
    MetaMask
    โ†“
    Ethereum
    โ†“
    Verification

A failure anywhere in this chain can manifest as a completely misleading browser error.
For example:
JSON.parse error

looked like a frontend parsing bug.
The real problem was:
Cloudflare routing

    โ†“

React index.html

    โ†“

JSON.parse("<!DOCTYPE html>")

Likewise:
HTTP 200

looked successful.
But:
200 + text/html

was actually evidence of a routing failure.

  1. Live demonstration
    The complete Marketplace Operations interface is available here:
    MyZubster Marketplace Operations โ€” Sepolia
    The public Sepolia environment:
    MyZubster Sepolia Environment
    The blockchain can be independently inspected through:
    Ethereum Sepolia Etherscan
    The completed transaction can be located using the transaction hash displayed by the Marketplace payment verification panel:
    0xae0b...5af9f94c37

  2. Final technical checklist
    [โœ“] React frontend running
    [โœ“] Marketplace route detected
    [โœ“] MarketplaceOpsPage present in bundle
    [โœ“] Runtime diagnostics verified
    [โœ“] Public bundle verified
    [โœ“] Cloudflare stale cache identified
    [โœ“] Cloudflare cache purged
    [โœ“] Frontend served current bundle
    [โœ“] API routing issue identified
    [โœ“] /api/* routed to backend :5010
    [โœ“] Frontend routes remain on :3010
    [โœ“] Cloudflare Tunnel configuration validated
    [โœ“] PM2 cloudflared process identified
    [โœ“] cloudflared restarted correctly
    [โœ“] Unauthenticated API returns JSON 401
    [โœ“] Authenticated orders endpoint works
    [โœ“] Marketplace order retrieved
    [โœ“] ETH payment intent generated
    [โœ“] Sepolia chain ID verified
    [โœ“] Sender verified
    [โœ“] Recipient verified
    [โœ“] Amount verified
    [โœ“] MetaMask transaction executed
    [โœ“] Sepolia transaction confirmed
    [โœ“] Server-side verification completed
    [โœ“] 3 confirmations reached
    [โœ“] Payment transitioned to PAID

Conclusion
The most important result of this work is not simply that 0.0001 SepoliaETH was transferred.
The important result is that the entire distributed system was exercised and debugged across its real boundaries.
We started with frontend routing and a browser that was not behaving as expected.
We then traced the problem through:
React
โ†’ Webpack Dev Server
โ†’ browser bundle
โ†’ Cloudflare cache
โ†’ Cloudflare Tunnel
โ†’ API routing
โ†’ backend authentication
โ†’ Marketplace order
โ†’ payment intent
โ†’ MetaMask
โ†’ Ethereum Sepolia
โ†’ blockchain confirmations
โ†’ server-side verification

The final state was:
Marketplace Order

    โ”‚
    โ–ผ
  ACCEPTED
    โ”‚
    โ–ผ

Payment Intent

    โ”‚
    โ–ผ

MetaMask / Sepolia

    โ”‚
    โ–ผ

Blockchain TX

    โ”‚
    โ–ผ

3 Confirmations

    โ”‚
    โ–ผ

Server Verification

    โ”‚
    โ–ผ
   PAID

The MyZubster Sepolia ETH Marketplace payment pipeline has therefore been successfully exercised end-to-end against a real Sepolia blockchain transaction.

MyZubster #Web3 #Ethereum #Sepolia #Blockchain #React #NodeJS #Express #MetaMask #Cloudflare #CloudflareTunnel #DevOps #E2E #IntegrationTesting #API #JWT #OpenSource #Marketplace #PaymentInfrastructure #SoftwareEngineering

๐Ÿ”ฅ Join developers growing publicly
Share your knowledge, build in public, and grow your developer presence with a global community.

More Posts

Building a Real MetaMask + Ethereum Sepolia Payment Flow for MyZubster

Myzubster - Sep 25

Debugging 6.5 Million PM2 Restarts: Stabilizing MyZubster Sepolia and I-ECO-01

Myzubster - Sep 26

Cloudflare Blocked My Server, So I Made My Visitors' Browsers Do the Fetching

bryanhamiltondevverified - Nov 15

ERC20 Edge Cases Every Smart Contract Engineer Should Know

BinnaDev - Jun 24

The Brief for the Judge: Writing Audit-Ready Documentation

BinnaDev - May 26
chevron_left
4.4k Points โ€ข 181 Badges
Rimini
112Posts
17Comments
33Connections

Related Jobs

View all jobs โ†’

Commenters (This Week)

2 comments
1 comment
1 comment

Contribute meaningful comments to climb the leaderboard and earn badges!