<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: alexcompute123nab-debug</title>
    <description>The latest articles on DEV Community by alexcompute123nab-debug (@alexcompute123nabdebug).</description>
    <link>https://dev.to/alexcompute123nabdebug</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4259123%2Fd4a9b2a5-dbba-4fde-849e-7697a6bf8c56.png</url>
      <title>DEV Community: alexcompute123nab-debug</title>
      <link>https://dev.to/alexcompute123nabdebug</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/alexcompute123nabdebug"/>
    <language>en</language>
    <item>
      <title>I built a paywall that can't be bypassed with DevTools</title>
      <dc:creator>alexcompute123nab-debug</dc:creator>
      <pubDate>Sun, 22 Nov 2026 17:48:36 +0000</pubDate>
      <link>https://dev.to/alexcompute123nabdebug/i-built-a-paywall-that-cant-be-bypassed-with-devtools-1ieh</link>
      <guid>https://dev.to/alexcompute123nabdebug/i-built-a-paywall-that-cant-be-bypassed-with-devtools-1ieh</guid>
      <description>&lt;h1&gt;
  
  
  I built a paywall that can't be bypassed with DevTools (Cloudflare Workers + KV + USDT-TRC20)
&lt;/h1&gt;

&lt;p&gt;A client-side paywall is a suggestion, not a paywall. If the check runs in the browser, anyone can open DevTools, flip a boolean, and unlock your "Pro" features. I wanted to see what a &lt;em&gt;real&lt;/em&gt; crypto paywall looks like without a billing account, a backend server, or KYC — so I built one with Cloudflare Workers, KV, and Tron's USDT-TRC20.&lt;/p&gt;

&lt;p&gt;Live service: &lt;a href="https://proofgate.proofgate.workers.dev" rel="noopener noreferrer"&gt;https://proofgate.proofgate.workers.dev&lt;/a&gt;&lt;br&gt;
Source: &lt;a href="https://github.com/alexcompute123nab-debug/proofgate" rel="noopener noreferrer"&gt;https://github.com/alexcompute123nab-debug/proofgate&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  The rule I started with
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Every access decision must be made on a machine I control, using data an attacker cannot forge locally.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That means three things have to live in the Worker:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Payment verification&lt;/strong&gt; — reading the chain, not trusting the client.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Entitlement storage&lt;/strong&gt; — who has a key, stored in KV.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Replay protection&lt;/strong&gt; — the same transaction cannot unlock two accounts.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The browser only ever sends a transaction hash and reads a JSON verdict.&lt;/p&gt;
&lt;h2&gt;
  
  
  Matching an anonymous on-chain transfer to a customer
&lt;/h2&gt;

&lt;p&gt;TRC20 transfers have no memo field. If you ask someone to "send 10 USDT and paste the txid", you cannot tell which customer paid — two people can send the same amount at the same time.&lt;/p&gt;

&lt;p&gt;The trick I used: &lt;strong&gt;a unique cent amount per order&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight http"&gt;&lt;code&gt;&lt;span class="no"&gt;POST&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;v1&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;  &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"email"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="s2"&gt;"buyer@example.com"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
→ &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="s2"&gt;"order_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"24035bd3b4fcf7c0"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;10.998245&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s2"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"TM2deFM4byG1rVvhA15fTJD7gLaE9xvSid"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The amount is derived from &lt;code&gt;sha256(order_id + email)&lt;/code&gt;, so it is unique per order. The customer sends exactly that amount. The Worker scans the treasury's incoming TRC20 transfers and looks for a transfer whose &lt;code&gt;value&lt;/code&gt; matches the order's raw amount (6 decimals):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;expectedRaw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;order&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;unique_amount&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mf"&gt;1e6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;hit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;transfers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
  &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="no"&gt;TREASURY&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;token_info&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="kt"&gt;symbol&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s1"&gt;'USDT'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt;
  &lt;span class="nb"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;value&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="n"&gt;expectedRaw&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;hit&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Only when that matches does the Worker generate an API key, store its SHA-256 in KV, and return it to the client.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verifying a payment server-side
&lt;/h2&gt;

&lt;p&gt;Given a txid, the Worker calls TronGrid:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;GET /v1/transactions/{txid}/events&lt;/code&gt; — find the &lt;code&gt;Transfer&lt;/code&gt; event for the USDT contract.&lt;/li&gt;
&lt;li&gt;Convert the event's hex addresses to Tron base58 (0x41 prefix + double-SHA-256 checksum + base58).&lt;/li&gt;
&lt;li&gt;Divide the raw &lt;code&gt;value&lt;/code&gt; by 10^6.&lt;/li&gt;
&lt;li&gt;Cross-check &lt;code&gt;GET /v1/transactions/{txid}&lt;/code&gt; for &lt;code&gt;contractRet === 'SUCCESS'&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Compare against the expected recipient and minimum amount.&lt;/li&gt;
&lt;li&gt;Write the txid to KV as "used" (30-day TTL) so it cannot be replayed.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A real response from the deployed service:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;"verified"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"from"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"TNS6Nk6sLT2ahajCsGyi8QxD3rQhsF7QLU"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"to"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"amount"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;15&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"success"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"block"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;88228145&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"checked_by"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"proofgate-worker"&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Two bugs I hit deploying it
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. KV binding in ES modules.&lt;/strong&gt; I wrote &lt;code&gt;PROOF_KV.get(...)&lt;/code&gt; and got &lt;code&gt;PROOF_KV is not defined&lt;/code&gt;. In an ES-module Worker the binding arrives via the &lt;code&gt;env&lt;/code&gt; parameter, so the handler must do &lt;code&gt;const KV = env.PROOF_KV&lt;/code&gt; and pass it down.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. workers.dev subdomain.&lt;/strong&gt; &lt;code&gt;wrangler deploy&lt;/code&gt; said success but the URL failed TLS with &lt;code&gt;ERR_SSL_VERSION_OR_CIPHER_MISMATCH&lt;/code&gt;. The account had no registered subdomain yet — I had to register it in the dashboard and redeploy. Lesson: a green deploy is not a working endpoint. Always curl &lt;code&gt;/health&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does not solve
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The claim scan reads the last 50 incoming transfers. A high-volume treasury needs an indexed event feed.&lt;/li&gt;
&lt;li&gt;"Verified" means &lt;em&gt;public chain evidence&lt;/em&gt;, not chargeback protection.&lt;/li&gt;
&lt;li&gt;Unique-amount matching is clever but awkward UX. A proper x402 flow would be cleaner — that is the next iteration I want to try.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What is free and what is not
&lt;/h2&gt;

&lt;p&gt;The public inspector is for manual checks only: five lookups per IP per day, in the browser. It has no API key, no widget, no webhooks and no replay protection, so it is not for accepting payments. The 10 USDT lifetime key is what enables &lt;code&gt;/v1/verify&lt;/code&gt; with replay protection in KV, the embeddable widget with status polling, webhooks and 5,000 calls a day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Acceptable use
&lt;/h2&gt;

&lt;p&gt;ProofGate must not be used for fraud, phishing or unlawful activity. A key may be revoked without refund on an abuse report. Reports go to the abuse contact in the API reference or &lt;a href="https://github.com/alexcompute123nab-debug/proofgate/issues/new" rel="noopener noreferrer"&gt;GitHub Issues&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Theme and embedding
&lt;/h2&gt;

&lt;p&gt;The site has a light and dark toggle in the header. It follows the system preference until you choose, then remembers the choice. The purchase button switches between a solid emerald variant and a graphite dark variant with the theme. The embeddable script at &lt;code&gt;/embed.js&lt;/code&gt; accepts &lt;code&gt;data-variant&lt;/code&gt; (&lt;code&gt;auto&lt;/code&gt;, &lt;code&gt;solid&lt;/code&gt;, &lt;code&gt;dark&lt;/code&gt; or &lt;code&gt;outline&lt;/code&gt;), &lt;code&gt;data-accent&lt;/code&gt;, &lt;code&gt;data-label&lt;/code&gt; and &lt;code&gt;data-amount&lt;/code&gt;. The amount renders on the right behind a divider with a TRC20 badge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Live API + docs: &lt;a href="https://proofgate.proofgate.workers.dev" rel="noopener noreferrer"&gt;https://proofgate.proofgate.workers.dev&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Source (MIT): &lt;a href="https://github.com/alexcompute123nab-debug/proofgate" rel="noopener noreferrer"&gt;https://github.com/alexcompute123nab-debug/proofgate&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Feedback welcome — especially on whether you would actually pay with the unique-amount flow or prefer x402.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>crypto</category>
      <category>security</category>
      <category>serverless</category>
    </item>
  </channel>
</rss>
