<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
<channel>
<title>Coder Legion - Recent posts tagged bitcoin</title>
<link>https://coderlegion.com/tag/bitcoin</link>
<description>Powered by Question2Answer</description>
<item>
<title>Crypto Real Estate Swap</title>
<link>https://coderlegion.com/26040/crypto-real-estate-swap</link>
<description>&lt;p&gt;Salaam! Crypto holders such as COBOL and Fortran IBM Watson array rig operators can go to eBay and buy real estate and pay with crypto perhaps but it is against the rules.  Also, it is not all online and the properties may not be high quality.  Therefore, we decided to add a platform where crypto adopters can acquire farms, vineyards, houses and more with a simple click!  No more waiting for realtors to call back, now it is buy now and most tokens are accepted.  What is different from eBay?  High quality only, no scams.  Crypto tool.  &lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=5686201982492030218&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
&lt;p&gt;How does it work? Visitors simply browse listings and click buy now then fill out a short form and the deed is mailed to them.  This fills a gap in the real estate automation and crypto markets.  Java and HTML allow users to push buttons and create a listing or research parcel maps using custom functions like:&lt;br&gt;
&lt;br&gt;
 function gazaPeace() {&lt;br&gt;
   if (land &amp;lt; house) {&lt;br&gt;
......&lt;/p&gt;
&lt;p&gt;As many insiders know, buying and selling real estate can be a chore especially if paying in DOGE or Tron.  Our platform from Moonshee International is a nice solution to a huge problem in the market.&lt;/p&gt;
&lt;p&gt;The tool works as a website and has animations and many special features like user settings.  We prefer to launch webtools because they work on almost all devices except 3270 and Amiga along with C128.  Apple is supported along with Linux, Cobol emus and Fortran terminals.&lt;/p&gt;
&lt;p&gt;We used unFreeze tool make animated gifs and used scrolling effects as well to make the site feel alive.  We also added a special feature which shows gems and rings, money falling from the sky like rain.  Feel free to add your listings or borrow the template.  To run it, use a browser on any smart phone or terminal.   &lt;/p&gt;
&lt;p&gt;In Hong Kong we havre a lot of unhoused residents.  We need disruptive solutions to get people housed including the power of crypto.  With our platform, people can buy land and donate to homeless, deploy their crypto in a new way.  Or buy 10 lots for themselves and one for homeless, it is purely optional.  We used AGS to help with the animation and testing.  Made on recycled computer running 32 bits on an AMD processor with Linux and COBOL flowchart style.  CSS was key to project success.  One problem we had when developing was bandwith constraints.  Other than that the wi-fi in Kowloon Harbour was fluid.  We avoided using built in translators for this suite because of the heavy Java animations which trip up our translator module.&lt;br&gt;
Waheguru.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://coderlegion.com/?qa=blob&amp;amp;qa_blobid=121641134261167362&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
</description>
<category>Launches</category>
<guid isPermaLink="true">https://coderlegion.com/26040/crypto-real-estate-swap</guid>
<pubDate>Wed, 02 Sep 2026 00:15:09 +0000</pubDate>
</item>
<item>
<title>Engineering a Non-Custodial Bitcoin Paywall for an AI Assistant</title>
<link>https://coderlegion.com/25907/engineering-a-non-custodial-bitcoin-paywall-for-an-ai-assistant</link>
<description>&lt;h2 id=&quot;engineering-a-non-custodial-bitcoin-paywall-for-an-ai-assistant&quot;&gt;Engineering a Non-Custodial Bitcoin Paywall for an AI Assistant&lt;/h2&gt;
&lt;p&gt;We recently completed the first real Bitcoin payment for Zorgax, the AI assistant inside the MyZubster ecosystem.&lt;/p&gt;
&lt;p&gt;The goal was not simply to display a wallet address. We wanted a complete production flow that could connect a verified on-chain payment to an authenticated account and automatically activate paid features.&lt;/p&gt;
&lt;p&gt;The final lifecycle looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Authentication
      ↓
Payment intent
      ↓
External Bitcoin wallet
      ↓
Blockchain transaction
      ↓
Independent verification
      ↓
Entitlement activation
      ↓
Backend feature access
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;zorgax-access-levels&quot;&gt;Zorgax access levels&lt;/h3&gt;
&lt;p&gt;Zorgax currently provides three plans:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Free
- Basic AI assistant
- Limited web research
- Maximum 2 sources

Pro — €9.90 monthly equivalent
- Advanced web research
- Maximum 5 sources
- Zorgax workspace

Developer — €29.90 monthly equivalent
- Everything in Pro
- Maximum 8 sources
- Direct API access
- Automation features
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The current Bitcoin flow creates time-bounded access. It is not an automatic recurring wallet subscription.&lt;/p&gt;
&lt;h3 id=&quot;why-a-wallet-address-is-not-enough&quot;&gt;Why a wallet address is not enough&lt;/h3&gt;
&lt;p&gt;A public Bitcoin address can receive payments, but it cannot answer several application-level questions:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Which account made the payment?&lt;/li&gt;
&lt;li&gt;Which plan was selected?&lt;/li&gt;
&lt;li&gt;What BTC amount was expected?&lt;/li&gt;
&lt;li&gt;When was the exchange-rate quote generated?&lt;/li&gt;
&lt;li&gt;Has this transaction already been used?&lt;/li&gt;
&lt;li&gt;When should the entitlement expire?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;For this reason, Zorgax creates a persistent payment intent before displaying the payment instructions.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;intentId&quot;: &quot;payment-intent-id&quot;,
  &quot;ownerId&quot;: &quot;authenticated-user&quot;,
  &quot;plan&quot;: &quot;pro&quot;,
  &quot;asset&quot;: &quot;BTC&quot;,
  &quot;destination&quot;: &quot;bitcoin-address&quot;,
  &quot;expectedAmountSats&quot;: 14728,
  &quot;status&quot;: &quot;PENDING&quot;,
  &quot;expiresAt&quot;: &quot;quote-expiration&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The exact amount varies according to the quote generated for the order.&lt;/p&gt;
&lt;h3 id=&quot;creating-the-checkout&quot;&gt;Creating the checkout&lt;/h3&gt;
&lt;p&gt;The authenticated frontend requests a new payment intent:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const response = await fetch(
  &quot;/api/zorgax/assistant/checkout/intent&quot;,
  {
    method: &quot;POST&quot;,
    headers: {
      &quot;Content-Type&quot;: &quot;application/json&quot;,
      Authorization: `Bearer ${token}`
    },
    body: JSON.stringify({
      plan: &quot;pro&quot;,
      asset: &quot;BTC&quot;
    })
  }
);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The backend associates the intent with the current user and returns:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The BTC destination&lt;/li&gt;
&lt;li&gt;The exact amount&lt;/li&gt;
&lt;li&gt;The expiration time&lt;/li&gt;
&lt;li&gt;The payment-intent identifier&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The user then pays from an external wallet.&lt;/p&gt;
&lt;p&gt;MyZubster never requests the private key and never signs or broadcasts the transaction.&lt;/p&gt;
&lt;h3 id=&quot;verifying-the-transaction&quot;&gt;Verifying the transaction&lt;/h3&gt;
&lt;p&gt;After broadcasting the payment, the user receives a Bitcoin transaction ID.&lt;/p&gt;
&lt;p&gt;The TXID is submitted to the verification endpoint:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;await fetch(
  `/api/zorgax/assistant/checkout/intent/${intentId}/verify`,
  {
    method: &quot;POST&quot;,
    headers: {
      &quot;Content-Type&quot;: &quot;application/json&quot;,
      Authorization: `Bearer ${token}`
    },
    body: JSON.stringify({
      paymentReference: txid
    })
  }
);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The server then retrieves the public transaction and checks:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Transaction exists
        ↓
Correct destination
        ↓
Sufficient amount
        ↓
Required confirmations
        ↓
Intent belongs to the user
        ↓
Payment has not already been consumed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A simplified verifier looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const transaction = await getBitcoinTransaction(txid);

const output = transaction.outputs.find(
  item =&amp;gt; item.address === intent.destination
);

if (!output) {
  throw new Error(&quot;Unexpected payment destination&quot;);
}

if (output.value &amp;lt; intent.expectedAmountSats) {
  throw new Error(&quot;Insufficient payment amount&quot;);
}

if (transaction.confirmations &amp;lt; minimumConfirmations) {
  throw new Error(&quot;Insufficient blockchain confirmations&quot;);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;why-confirmations-matter&quot;&gt;Why confirmations matter&lt;/h3&gt;
&lt;p&gt;During the first live production test, Zorgax detected the transaction while it was still in the mempool.&lt;/p&gt;
&lt;p&gt;The application returned:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Payment not activated:
Insufficient blockchain confirmations
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was expected.&lt;/p&gt;
&lt;p&gt;Seeing a transaction in the mempool does not mean the system should immediately grant paid access. Zorgax waited until the payment entered a Bitcoin block.&lt;/p&gt;
&lt;p&gt;After the required confirmation, the same TXID was verified again:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Payment verified
Access ACTIVE
Plan Pro
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No second payment was required.&lt;/p&gt;
&lt;h3 id=&quot;activating-the-entitlement&quot;&gt;Activating the entitlement&lt;/h3&gt;
&lt;p&gt;After successful verification, Zorgax creates or updates the account’s entitlement:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;plan&quot;: &quot;pro&quot;,
  &quot;tier&quot;: &quot;PRO&quot;,
  &quot;status&quot;: &quot;ACTIVE&quot;,
  &quot;source&quot;: &quot;BITCOIN_PAYMENT&quot;,
  &quot;startsAt&quot;: &quot;activation-date&quot;,
  &quot;expiresAt&quot;: &quot;expiration-date&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Every protected request evaluates this access state before running the requested operation.&lt;/p&gt;
&lt;h3 id=&quot;enforcing-access-on-the-backend&quot;&gt;Enforcing access on the backend&lt;/h3&gt;
&lt;p&gt;Hiding a button in the frontend is not security.&lt;/p&gt;
&lt;p&gt;The backend applies an access policy to every Zorgax request:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const policies = {
  guest: {
    chat: true,
    webResearch: false,
    workspace: false,
    directApi: false
  },

  free: {
    chat: true,
    webResearch: true,
    maxWebResults: 2,
    workspace: false,
    directApi: false
  },

  pro: {
    chat: true,
    webResearch: true,
    maxWebResults: 5,
    workspace: true,
    directApi: false
  },

  developer: {
    chat: true,
    webResearch: true,
    maxWebResults: 8,
    workspace: true,
    directApi: true
  }
};
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;For example, direct research requires the Developer tier:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;router.get(
  &quot;/research&quot;,
  authenticate,
  requireZorgaxPlan(&quot;developer&quot;),
  researchHandler
);
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Workspace persistence requires Pro or higher:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;router.post(
  &quot;/data/commit&quot;,
  authenticate,
  requireZorgaxPlan(&quot;pro&quot;),
  commitHandler
);
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;guest-access-without-silent-authentication-failures&quot;&gt;Guest access without silent authentication failures&lt;/h3&gt;
&lt;p&gt;Zorgax supports guest chat, but an invalid token must never silently become a guest session.&lt;/p&gt;
&lt;p&gt;The authentication boundary is:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;No token
→ Guest access

Valid token
→ Authenticated access

Invalid token
→ 401 Unauthorized
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This distinction prevents expired or manipulated credentials from bypassing protected logic.&lt;/p&gt;
&lt;h3 id=&quot;unifying-legacy-subscriptions-and-new-entitlements&quot;&gt;Unifying legacy subscriptions and new entitlements&lt;/h3&gt;
&lt;p&gt;MyZubster already had legacy subscription records. The new payment implementation introduced a more explicit entitlement model.&lt;/p&gt;
&lt;p&gt;We created one access service that evaluates both:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Legacy subscriptions ─┐
                      ├── Unified Zorgax access
New entitlements ─────┘
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The service selects the highest active plan and returns a single feature policy.&lt;/p&gt;
&lt;p&gt;This allows existing accounts to remain compatible while new Bitcoin payments use the improved lifecycle.&lt;/p&gt;
&lt;h3 id=&quot;a-vercel-routing-problem&quot;&gt;A Vercel routing problem&lt;/h3&gt;
&lt;p&gt;The application also contains a generic Zorgax AI gateway route.&lt;/p&gt;
&lt;p&gt;A broad rule such as:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;/api/zorgax/*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;could intercept requests intended for the monetization backend.&lt;/p&gt;
&lt;p&gt;The specific monetization route now takes priority:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;source&quot;: &quot;/api/zorgax/monetization/(.*)&quot;,
  &quot;destination&quot;: &quot;/api/index.js&quot;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Only afterward does the generic AI proxy apply.&lt;/p&gt;
&lt;p&gt;This ensures that purchases and entitlements are handled by the backend containing the correct authentication middleware and database connection.&lt;/p&gt;
&lt;h3 id=&quot;confirming-persistent-ai-writes&quot;&gt;Confirming persistent AI writes&lt;/h3&gt;
&lt;p&gt;Zorgax can prepare structured data, but it does not silently persist AI-generated content.&lt;/p&gt;
&lt;p&gt;The workspace flow requires:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;A generated preview.&lt;/li&gt;
&lt;li&gt;A cryptographic digest of that preview.&lt;/li&gt;
&lt;li&gt;An explicit user confirmation.&lt;/li&gt;
&lt;li&gt;Digest validation before persistence.&lt;/li&gt;
&lt;/ol&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const expectedDigest = digestPreview(preview);

if (expectedDigest !== submittedDigest) {
  throw new Error(&quot;Preview changed&quot;);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This creates a clear boundary between AI suggestions and authorized writes.&lt;/p&gt;
&lt;h3 id=&quot;production-verification&quot;&gt;Production verification&lt;/h3&gt;
&lt;p&gt;Before deployment, the Zorgax test family completed:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;58 test suites
206 tests passed
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Production checks confirmed that:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Public pricing                  → 200
Guest chat                      → 200
Guest web research              → disabled
Protected monetization routes   → 401 without login
Developer research API          → 401 without login
Checkout                        → 401 without login
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The real Bitcoin transaction then proved the final missing part: verified payment-to-entitlement activation.&lt;/p&gt;
&lt;h3 id=&quot;security-boundaries&quot;&gt;Security boundaries&lt;/h3&gt;
&lt;p&gt;The production design follows these rules:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No private keys are accepted.&lt;/li&gt;
&lt;li&gt;MyZubster does not sign transactions.&lt;/li&gt;
&lt;li&gt;Users pay from external wallets.&lt;/li&gt;
&lt;li&gt;The destination and amount are verified.&lt;/li&gt;
&lt;li&gt;Blockchain confirmations are required.&lt;/li&gt;
&lt;li&gt;Payment intents belong to authenticated users.&lt;/li&gt;
&lt;li&gt;Paid features are enforced server-side.&lt;/li&gt;
&lt;li&gt;Persistent writes require explicit confirmation.&lt;/li&gt;
&lt;li&gt;Invalid tokens never become anonymous sessions.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;what-comes-next&quot;&gt;What comes next&lt;/h3&gt;
&lt;p&gt;The current system is operational but intentionally conservative.&lt;/p&gt;
&lt;p&gt;Possible next improvements include:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Renewal notifications&lt;/li&gt;
&lt;li&gt;Payment-history dashboards&lt;/li&gt;
&lt;li&gt;Downloadable receipts&lt;/li&gt;
&lt;li&gt;Additional independent Bitcoin providers&lt;/li&gt;
&lt;li&gt;More supported settlement assets&lt;/li&gt;
&lt;li&gt;Entitlement-expiration reminders&lt;/li&gt;
&lt;li&gt;Better transaction monitoring&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Every new asset will require its own trusted quote source, verification logic and confirmation policy.&lt;/p&gt;
&lt;h3 id=&quot;final-result&quot;&gt;Final result&lt;/h3&gt;
&lt;p&gt;Zorgax monetization is no longer only a pricing page.&lt;/p&gt;
&lt;p&gt;A real production payment successfully completed this sequence:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;BTC payment
→ blockchain confirmation
→ independent verification
→ entitlement activation
→ Pro features enabled
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The result was:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Access: ACTIVE
Plan: Pro
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;project-links&quot;&gt;Project links&lt;/h3&gt;
&lt;p&gt;Zorgax:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.myzubster.com/zorgax&quot;&gt;https://www.myzubster.com/zorgax&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;MyZubster source code:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/MyZubster-Ecosystem/myzubster&quot;&gt;https://github.com/MyZubster-Ecosystem/myzubster&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Production monetization implementation:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/MyZubster-Ecosystem/myzubster/commit/d7a579cd89801d29ac094a19af42fb17350691ef&quot;&gt;https://github.com/MyZubster-Ecosystem/myzubster/commit/d7a579cd89801d29ac094a19af42fb17350691ef&lt;/a&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25907/engineering-a-non-custodial-bitcoin-paywall-for-an-ai-assistant</guid>
<pubDate>Mon, 31 Aug 2026 07:12:12 +0000</pubDate>
</item>
<item>
<title>We Completed the First Live Bitcoin-to-Pro Activation on MyZubster</title>
<link>https://coderlegion.com/25905/we-completed-the-first-live-bitcoin-to-pro-activation-on-myzubster</link>
<description>&lt;h2 id=&quot;we-completed-the-first-live-bitcoin-to-pro-activation-on-myzubster&quot;&gt;We Completed the First Live Bitcoin-to-Pro Activation on MyZubster&lt;/h2&gt;
&lt;p&gt;Today we reached a major milestone: &lt;strong&gt;Zorgax successfully processed a real Bitcoin payment and activated Pro access in production.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This was a complete end-to-end test, not a simulated checkout.&lt;/p&gt;
&lt;p&gt;The production flow was:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;MyZubster login
      ↓
Zorgax payment intent
      ↓
External Bitcoin wallet
      ↓
On-chain transaction
      ↓
Blockchain confirmation
      ↓
Independent verification
      ↓
Pro access activated
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;what-is-zorgax-&quot;&gt;What is Zorgax?&lt;/h3&gt;
&lt;p&gt;Zorgax is the AI assistant inside the MyZubster ecosystem.&lt;/p&gt;
&lt;p&gt;It combines:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;General AI assistance&lt;/li&gt;
&lt;li&gt;Web research&lt;/li&gt;
&lt;li&gt;Source collection&lt;/li&gt;
&lt;li&gt;Structured-data preparation&lt;/li&gt;
&lt;li&gt;Workspace features&lt;/li&gt;
&lt;li&gt;Developer APIs&lt;/li&gt;
&lt;li&gt;Bitcoin-based access activation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The available plans are:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Free       €0
Pro        €9.90
Developer  €29.90
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Free users receive limited research, Pro users gain workspace features and additional sources, while Developer accounts can access automation and direct APIs.&lt;/p&gt;
&lt;h3 id=&quot;a-non-custodial-payment-architecture&quot;&gt;A non-custodial payment architecture&lt;/h3&gt;
&lt;p&gt;MyZubster does not request, store or manage users’ private keys.&lt;/p&gt;
&lt;p&gt;Users send Bitcoin through their own external wallet. Zorgax only creates a payment intent and records:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The selected plan&lt;/li&gt;
&lt;li&gt;The expected BTC amount&lt;/li&gt;
&lt;li&gt;The destination address&lt;/li&gt;
&lt;li&gt;The expiration time&lt;/li&gt;
&lt;li&gt;The submitted transaction ID&lt;/li&gt;
&lt;li&gt;The verification status&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The backend then verifies the public transaction independently.&lt;/p&gt;
&lt;p&gt;A simplified version of the process looks like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-js&quot;&gt;const payment = await verifyTransaction(txid);

if (payment.destination !== intent.destination) {
  throw new Error(&quot;Unexpected payment destination&quot;);
}

if (payment.amount &amp;lt; intent.expectedAmount) {
  throw new Error(&quot;Insufficient payment amount&quot;);
}

if (payment.confirmations &amp;lt; minimumConfirmations) {
  throw new Error(&quot;Insufficient blockchain confirmations&quot;);
}

await activateEntitlement({
  ownerId: intent.ownerId,
  plan: intent.plan,
  status: &quot;ACTIVE&quot;
});
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The application never signs or broadcasts a transaction.&lt;/p&gt;
&lt;h3 id=&quot;waiting-for-blockchain-confirmation&quot;&gt;Waiting for blockchain confirmation&lt;/h3&gt;
&lt;p&gt;During the live test, Zorgax detected the transaction but initially returned:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Payment not activated:
Insufficient blockchain confirmations
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This was the expected behavior.&lt;/p&gt;
&lt;p&gt;The system did not activate Pro access simply because a valid-looking TXID had been submitted. It waited until the transaction had the required blockchain confirmation.&lt;/p&gt;
&lt;p&gt;After confirmation, we submitted the same TXID again:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Payment verified
Access ACTIVE
Plan Pro
&lt;/code&gt;&lt;/pre&gt;
&lt;h3 id=&quot;backend-access-enforcement&quot;&gt;Backend access enforcement&lt;/h3&gt;
&lt;p&gt;We also implemented server-side feature enforcement.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Guest
- Basic chat
- No live web research

Free
- Limited research
- Maximum 2 sources

Pro
- Advanced research
- Maximum 5 sources
- Zorgax workspace

Developer
- Higher limits
- Automation
- Direct research API
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;These restrictions are enforced by the backend, not only hidden in the user interface.&lt;/p&gt;
&lt;p&gt;Protected endpoints return authentication or payment-required responses when the account does not have the necessary plan.&lt;/p&gt;
&lt;h3 id=&quot;fixing-a-production-routing-problem&quot;&gt;Fixing a production routing problem&lt;/h3&gt;
&lt;p&gt;During implementation, we discovered that the generic Zorgax gateway could intercept monetization requests.&lt;/p&gt;
&lt;p&gt;The Vercel routing order was corrected so that:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;/api/zorgax/monetization/*
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;is processed by the authenticated MyZubster backend before the generic AI proxy route.&lt;/p&gt;
&lt;p&gt;This ensures that purchases, subscriptions and entitlements use the correct database and authentication middleware.&lt;/p&gt;
&lt;h3 id=&quot;unifying-subscriptions-and-entitlements&quot;&gt;Unifying subscriptions and entitlements&lt;/h3&gt;
&lt;p&gt;The project contained both legacy subscription records and newer entitlement records.&lt;/p&gt;
&lt;p&gt;We introduced a unified access service that:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Checks both stores.&lt;/li&gt;
&lt;li&gt;Selects active records.&lt;/li&gt;
&lt;li&gt;Chooses the highest available plan.&lt;/li&gt;
&lt;li&gt;Fails safely when access cannot be verified.&lt;/li&gt;
&lt;li&gt;Returns a single policy to every Zorgax endpoint.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;This keeps older subscriptions compatible with the new payment system.&lt;/p&gt;
&lt;h3 id=&quot;what-the-live-test-proves&quot;&gt;What the live test proves&lt;/h3&gt;
&lt;p&gt;The successful transaction proves that the following components work together in production:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Payment-intent generation&lt;/li&gt;
&lt;li&gt;BTC amount calculation&lt;/li&gt;
&lt;li&gt;External wallet payment&lt;/li&gt;
&lt;li&gt;TXID submission&lt;/li&gt;
&lt;li&gt;Destination validation&lt;/li&gt;
&lt;li&gt;Amount validation&lt;/li&gt;
&lt;li&gt;Confirmation validation&lt;/li&gt;
&lt;li&gt;Database persistence&lt;/li&gt;
&lt;li&gt;Pro entitlement activation&lt;/li&gt;
&lt;li&gt;Feature-access enforcement&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;It transforms Zorgax monetization from a pricing interface into a functioning production system.&lt;/p&gt;
&lt;h3 id=&quot;current-boundaries&quot;&gt;Current boundaries&lt;/h3&gt;
&lt;p&gt;The first release intentionally remains conservative:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bitcoin is currently the operational settlement asset.&lt;/li&gt;
&lt;li&gt;Payments are non-custodial.&lt;/li&gt;
&lt;li&gt;Private keys are never accepted.&lt;/li&gt;
&lt;li&gt;Access activation requires independent verification.&lt;/li&gt;
&lt;li&gt;Automatic recurring billing is not currently enabled.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Future work can add renewal notifications, payment dashboards, downloadable receipts and more independent blockchain providers.&lt;/p&gt;
&lt;h3 id=&quot;explore-the-project&quot;&gt;Explore the project&lt;/h3&gt;
&lt;p&gt;Zorgax:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://www.myzubster.com/zorgax&quot;&gt;https://www.myzubster.com/zorgax&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;MyZubster repository:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/MyZubster-Ecosystem/myzubster&quot;&gt;https://github.com/MyZubster-Ecosystem/myzubster&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Production monetization update:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/MyZubster-Ecosystem/myzubster/commit/d7a579cd89801d29ac094a19af42fb17350691ef&quot;&gt;https://github.com/MyZubster-Ecosystem/myzubster/commit/d7a579cd89801d29ac094a19af42fb17350691ef&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The next goal is to make the complete payment and entitlement lifecycle easier to monitor while preserving the non-custodial design.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25905/we-completed-the-first-live-bitcoin-to-pro-activation-on-myzubster</guid>
<pubDate>Mon, 31 Aug 2026 07:04:21 +0000</pubDate>
</item>
<item>
<title># We Built a Safer Bitcoin Payment Layer for Zorgax — Here's What We Learned</title>
<link>https://coderlegion.com/25742/we-built-a-safer-bitcoin-payment-layer-for-zorgax-heres-what-we-learned</link>
<description>&lt;h2 id=&quot;we-built-a-safer-bitcoin-payment-layer-for-zorgax-here-s-what-we-learned&quot;&gt;We Built a Safer Bitcoin Payment Layer for Zorgax — Here's What We Learned&lt;/h2&gt;
&lt;p&gt;Adding Bitcoin to an application sounds simple.&lt;/p&gt;
&lt;p&gt;Generate an address, wait for a transaction, verify the amount, unlock the service.&lt;/p&gt;
&lt;p&gt;In a prototype, that might be enough.&lt;/p&gt;
&lt;p&gt;In a system designed around AI agents and autonomous infrastructure, it isn't.&lt;/p&gt;
&lt;p&gt;We've been working on the Bitcoin payment layer for &lt;strong&gt;Zorgax&lt;/strong&gt;, the AI and knowledge component of the MyZubster ecosystem.&lt;/p&gt;
&lt;p&gt;The latest implementation milestone is now complete locally:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;60 test suites. 208 tests. All passing.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;But the more interesting part isn't the test count.&lt;/p&gt;
&lt;p&gt;It's what we had to design around.&lt;/p&gt;
&lt;h3 id=&quot;one-checkout-one-bitcoin-address&quot;&gt;One Checkout, One Bitcoin Address&lt;/h3&gt;
&lt;p&gt;The first architectural decision was to avoid using a single Bitcoin address for every payment.&lt;/p&gt;
&lt;p&gt;Each checkout intent receives a different address derived from an Electrum-compatible watch-only wallet.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Payment Intent #001
        ↓
    Address A

Payment Intent #002
        ↓
    Address B

Payment Intent #003
        ↓
    Address C
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This gives us a much cleaner relationship between an intent and its blockchain activity.&lt;/p&gt;
&lt;p&gt;Instead of asking:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;Which customer sent this transaction?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;we already have a strong association between the destination address and the checkout.&lt;/p&gt;
&lt;p&gt;It also avoids unnecessarily reusing the same public address across unrelated payments.&lt;/p&gt;
&lt;h3 id=&quot;the-application-doesn-t-need-the-spending-keys&quot;&gt;The Application Doesn't Need the Spending Keys&lt;/h3&gt;
&lt;p&gt;A payment service needs to observe money.&lt;/p&gt;
&lt;p&gt;It doesn't necessarily need permission to spend it.&lt;/p&gt;
&lt;p&gt;That's why the architecture uses a &lt;strong&gt;watch-only boundary&lt;/strong&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;             ZORGAX

                ↓

        Watch-Only Wallet

                ↓

              XPUB

                ↓

       Address Derivation

                ↓

       Blockchain Monitoring
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The application can derive and monitor addresses without holding the corresponding private spending keys.&lt;/p&gt;
&lt;p&gt;That's an important security boundary.&lt;/p&gt;
&lt;p&gt;If the web application doesn't need the capability to spend funds, we shouldn't give it that capability.&lt;/p&gt;
&lt;h3 id=&quot;bitcoin-amounts-are-integers&quot;&gt;Bitcoin Amounts Are Integers&lt;/h3&gt;
&lt;p&gt;Another rule: don't make financial correctness depend on floating-point arithmetic.&lt;/p&gt;
&lt;p&gt;Bitcoin gives us a convenient smallest unit:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;1 BTC = 100,000,000 satoshis
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;So internally we verify integer satoshi values.&lt;/p&gt;
&lt;p&gt;Instead of reasoning about:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;0.00125000 BTC
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;the system can reason about:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;125000 sats
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Expected amount:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;125000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Received amount:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;125000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Comparison:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;125000 == 125000
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Boring?&lt;/p&gt;
&lt;p&gt;Absolutely.&lt;/p&gt;
&lt;p&gt;That's exactly what I want from payment arithmetic.&lt;/p&gt;
&lt;h3 id=&quot;distributed-systems-retry-everything&quot;&gt;Distributed Systems Retry Everything&lt;/h3&gt;
&lt;p&gt;Then we reach one of the more important problems.&lt;/p&gt;
&lt;p&gt;Imagine the blockchain watcher detects a transaction.&lt;/p&gt;
&lt;p&gt;It sends the event to the application.&lt;/p&gt;
&lt;p&gt;The application processes it successfully.&lt;/p&gt;
&lt;p&gt;But the acknowledgement gets lost.&lt;/p&gt;
&lt;p&gt;The watcher retries.&lt;/p&gt;
&lt;p&gt;Without protection:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;TX detected
    ↓
Payment processed
    ↓
Network problem
    ↓
Retry
    ↓
Payment processed AGAIN
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;That's unacceptable.&lt;/p&gt;
&lt;p&gt;So transaction processing needs to be idempotent.&lt;/p&gt;
&lt;p&gt;The TXID becomes part of that boundary.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Incoming TXID
     ↓
Already processed?
   ↙             ↘
 YES             NO
  ↓               ↓
Stop            Verify
                  ↓
                Record
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The same blockchain transaction should not create multiple economic effects because a distributed system retried a message.&lt;/p&gt;
&lt;h3 id=&quot;valid-doesn-t-mean-valid-everywhere&quot;&gt;Valid Doesn't Mean Valid Everywhere&lt;/h3&gt;
&lt;p&gt;There's another subtle distinction.&lt;/p&gt;
&lt;p&gt;A real Bitcoin transaction can be perfectly valid on-chain and still be invalid for a particular checkout.&lt;/p&gt;
&lt;p&gt;That's why we also need anti-replay protections.&lt;/p&gt;
&lt;p&gt;Payment verification isn't simply:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Is this TX valid?
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;It is closer to:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Does this transaction
        ↓
belong to this payment intent
        ↓
for this derived address
        ↓
for this expected amount
        ↓
and has it already been consumed?
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The transaction has context.&lt;/p&gt;
&lt;p&gt;That's especially important once machines start consuming payment APIs automatically.&lt;/p&gt;
&lt;h3 id=&quot;database-state-is-part-of-the-deployment&quot;&gt;Database State Is Part of the Deployment&lt;/h3&gt;
&lt;p&gt;Payment systems don't live entirely inside application code.&lt;/p&gt;
&lt;p&gt;Adding new payment behavior changes persisted state too.&lt;/p&gt;
&lt;p&gt;For Zorgax, that means MongoDB migration needs to be treated as an explicit deployment operation.&lt;/p&gt;
&lt;p&gt;Not:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;git push
   ↓
hope
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Code
 ↓
Tests
 ↓
Review
 ↓
Migration Plan
 ↓
Infrastructure Check
 ↓
Database Migration
 ↓
Deployment
 ↓
Enable Rail
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The migration should be controlled independently from writing the feature.&lt;/p&gt;
&lt;h3 id=&quot;feature-flags-are-security-features-too&quot;&gt;Feature Flags Are Security Features Too&lt;/h3&gt;
&lt;p&gt;The Bitcoin rail currently remains disabled.&lt;/p&gt;
&lt;p&gt;Not because the implementation hasn't been tested.&lt;/p&gt;
&lt;p&gt;Because the surrounding production infrastructure isn't ready yet.&lt;/p&gt;
&lt;p&gt;The code still needs production dependencies such as the watch-only wallet XPUB and a reachable Electrum boundary through appropriately protected infrastructure.&lt;/p&gt;
&lt;p&gt;This gives us an important rule:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;CODE COMPLETE

     ≠

PRODUCTION READY
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;A payment feature shouldn't become active just because somebody merged the code.&lt;/p&gt;
&lt;p&gt;Infrastructure readiness is part of feature readiness.&lt;/p&gt;
&lt;h3 id=&quot;where-we-are-now&quot;&gt;Where We Are Now&lt;/h3&gt;
&lt;p&gt;The current local milestone includes per-intent Electrum watch-only addresses, anti-replay protection, TXID idempotency, integer satoshi verification and a controlled MongoDB migration path.&lt;/p&gt;
&lt;p&gt;The implementation currently passes:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;60 test suites
208 tests
──────────────
ALL PASSING
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The generated patch was also checked using:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;git apply --check
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;But no production commit, push, deployment, real database migration or Bitcoin transaction was performed as part of this milestone.&lt;/p&gt;
&lt;p&gt;That distinction matters.&lt;/p&gt;
&lt;h3 id=&quot;why-are-we-doing-this-inside-an-ai-project-&quot;&gt;Why Are We Doing This Inside an AI Project?&lt;/h3&gt;
&lt;p&gt;Because Zorgax isn't intended to remain only a chatbot.&lt;/p&gt;
&lt;p&gt;We're exploring what happens when AI systems become capable of interacting with services and infrastructure.&lt;/p&gt;
&lt;p&gt;Eventually an agent might need to purchase something.&lt;/p&gt;
&lt;p&gt;Maybe compute.&lt;/p&gt;
&lt;p&gt;Maybe an API request.&lt;/p&gt;
&lt;p&gt;Maybe access to a specialized dataset.&lt;/p&gt;
&lt;p&gt;Maybe a physical service.&lt;/p&gt;
&lt;p&gt;The workflow starts looking like this:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;AI Agent
   ↓
Needs Resource
   ↓
Requests Service
   ↓
Receives Payment Intent
   ↓
Payment
   ↓
Verification
   ↓
Resource Unlocked
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Now the payment layer becomes part of agent architecture.&lt;/p&gt;
&lt;h3 id=&quot;machine-payments-change-the-threat-model&quot;&gt;Machine Payments Change the Threat Model&lt;/h3&gt;
&lt;p&gt;Humans are relatively slow.&lt;/p&gt;
&lt;p&gt;Agents aren't.&lt;/p&gt;
&lt;p&gt;An automated agent could make hundreds of requests, retry failed operations and coordinate multiple services simultaneously.&lt;/p&gt;
&lt;p&gt;That means payment infrastructure designed for agents has to assume automation from the beginning.&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;          AI AGENT
              ↓
       Payment Intent
              ↓
      Per-Intent Address
              ↓
            BTC
              ↓
           Electrum
              ↓
     Blockchain Detection
              ↓
       Verification Layer
        ↙      ↓       ↘
    Amount    TXID    Intent
      ↓        ↓        ↓
    sats   idempotent  replay
              ↓
        Payment State
              ↓
          SERVICE
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;This is where payments stop being just a UI problem.&lt;/p&gt;
&lt;p&gt;They become a distributed-systems problem.&lt;/p&gt;
&lt;h3 id=&quot;the-bigger-experiment&quot;&gt;The Bigger Experiment&lt;/h3&gt;
&lt;p&gt;Bitcoin checkout is useful by itself.&lt;/p&gt;
&lt;p&gt;But we're interested in what comes after it.&lt;/p&gt;
&lt;p&gt;Imagine autonomous software where:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-text&quot;&gt;Agent A
   ↓
discovers
   ↓
Service B
   ↓
requests price
   ↓
Payment Intent
   ↓
settlement
   ↓
verification
   ↓
service delivered
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;No shopping cart.&lt;/p&gt;
&lt;p&gt;No human clicking &quot;Pay Now.&quot;&lt;/p&gt;
&lt;p&gt;Potentially no traditional account relationship between the two systems.&lt;/p&gt;
&lt;p&gt;Just protocols.&lt;/p&gt;
&lt;p&gt;That creates a much larger engineering question:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What does payment infrastructure look like when the customer is software?&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;We don't have the complete answer yet.&lt;/p&gt;
&lt;p&gt;But building the boring pieces correctly — integer amounts, idempotency, replay protection, isolated payment intents, watch-only wallets and controlled migrations — is probably where it starts.&lt;/p&gt;
&lt;p&gt;Because autonomous payments won't become reliable by making agents smarter.&lt;/p&gt;
&lt;p&gt;They'll become reliable by making the infrastructure underneath them predictable.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;If you were designing payments specifically for autonomous AI agents, what would you prioritize first: Bitcoin, Lightning, stablecoins, traditional APIs, or protocol-native payments?&lt;/strong&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25742/we-built-a-safer-bitcoin-payment-layer-for-zorgax-heres-what-we-learned</guid>
<pubDate>Sat, 29 Aug 2026 06:45:23 +0000</pubDate>
</item>
<item>
<title>From a Bitcoin Transaction to a Paid AI Subscription — Without Holding Private Keys</title>
<link>https://coderlegion.com/25708/from-a-bitcoin-transaction-to-a-paid-ai-subscription-without-holding-private-keys</link>
<description>&lt;p&gt;From a Bitcoin Transaction to a Paid AI Subscription — Without Holding Private Keys&lt;/p&gt;
&lt;p&gt;Building a paid AI assistant sounds straightforward.&lt;/p&gt;
&lt;p&gt;Define a price, add a checkout button, verify the payment, and unlock the premium features.&lt;/p&gt;
&lt;p&gt;But when we started building the monetization layer for Zorgax, the AI assistant inside MyZubster, one question quickly became more important than the pricing itself:&lt;/p&gt;
&lt;p&gt;How can an application verify a cryptocurrency payment without becoming a custodian of the user's funds?&lt;/p&gt;
&lt;p&gt;That question has shaped the latest development of Zorgax.&lt;/p&gt;
&lt;p&gt;The goal&lt;/p&gt;
&lt;p&gt;Zorgax currently has three planned access levels:&lt;/p&gt;
&lt;p&gt;Zorgax Free, Zorgax Pro (€9.90 monthly equivalent) and Zorgax Developer (€29.90 monthly equivalent).&lt;/p&gt;
&lt;p&gt;The broader payment architecture is designed around multiple crypto assets, including BTC, ETH, XMR and TARI.&lt;/p&gt;
&lt;p&gt;But there is an important rule:&lt;/p&gt;
&lt;p&gt;Zorgax should coordinate and verify payments — not control the user's wallet.&lt;/p&gt;
&lt;p&gt;That means no seed phrases in the application.&lt;/p&gt;
&lt;p&gt;No private keys in the frontend.&lt;/p&gt;
&lt;p&gt;No transaction signing by Zorgax.&lt;/p&gt;
&lt;p&gt;A payment button isn't enough&lt;/p&gt;
&lt;p&gt;Imagine a user selects Zorgax Pro and chooses Bitcoin.&lt;/p&gt;
&lt;p&gt;The application knows:&lt;/p&gt;
&lt;p&gt;Plan: Zorgax Pro&lt;br&gt;
Price: €9.90&lt;br&gt;
Asset: BTC&lt;/p&gt;
&lt;p&gt;A server-side quote can calculate the corresponding BTC amount.&lt;/p&gt;
&lt;p&gt;The naive approach would then be to trust information coming back from the client:&lt;/p&gt;
&lt;p&gt;&quot;I paid this address.&quot;&lt;br&gt;
&quot;This is the amount.&quot;&lt;br&gt;
&quot;This is my transaction.&quot;&lt;br&gt;
&quot;Activate my subscription.&quot;&lt;/p&gt;
&lt;p&gt;That's exactly what we don't want.&lt;/p&gt;
&lt;p&gt;A client should never be the authority deciding what it was supposed to pay.&lt;/p&gt;
&lt;p&gt;So we introduced another layer.&lt;/p&gt;
&lt;p&gt;The Payment Intent&lt;/p&gt;
&lt;p&gt;Before the user pays anything, Zorgax creates a persistent Payment Intent.&lt;/p&gt;
&lt;p&gt;It records information such as:&lt;/p&gt;
&lt;p&gt;intent ID&lt;br&gt;
authenticated owner&lt;br&gt;
selected plan&lt;br&gt;
crypto asset&lt;br&gt;
destination address&lt;br&gt;
expected crypto amount&lt;br&gt;
EUR value&lt;br&gt;
quote timestamp&lt;br&gt;
expiration&lt;br&gt;
settlement status&lt;/p&gt;
&lt;p&gt;The important part is that this information is stored server-side.&lt;/p&gt;
&lt;p&gt;Later, when the user provides a blockchain transaction reference, the backend doesn't ask the browser:&lt;/p&gt;
&lt;p&gt;“How much were you supposed to pay?”&lt;/p&gt;
&lt;p&gt;It already knows.&lt;/p&gt;
&lt;p&gt;The architecture becomes:&lt;/p&gt;
&lt;p&gt;User&lt;br&gt;
  ↓&lt;br&gt;
Authenticated Checkout&lt;br&gt;
  ↓&lt;br&gt;
Server-side Crypto Quote&lt;br&gt;
  ↓&lt;br&gt;
Persistent Payment Intent&lt;br&gt;
  ↓&lt;br&gt;
External Wallet Payment&lt;br&gt;
  ↓&lt;br&gt;
Trusted Blockchain Verifier&lt;br&gt;
  ↓&lt;br&gt;
Verified Payment&lt;br&gt;
  ↓&lt;br&gt;
Active Subscription&lt;/p&gt;
&lt;p&gt;This changes the trust model considerably.&lt;/p&gt;
&lt;p&gt;Bitcoin became our first real test&lt;/p&gt;
&lt;p&gt;For Bitcoin, we built a small verification service around Electrum.&lt;/p&gt;
&lt;p&gt;The service runs separately from the application and doesn't need to sign transactions.&lt;/p&gt;
&lt;p&gt;Its job is much narrower:&lt;/p&gt;
&lt;p&gt;inspect a transaction and report what actually happened on the blockchain.&lt;/p&gt;
&lt;p&gt;While testing against Electrum 4.8.1, we discovered an important implementation detail.&lt;/p&gt;
&lt;p&gt;We initially expected:&lt;/p&gt;
&lt;p&gt;gettransaction &lt;/p&gt;
&lt;p&gt;to give us a conveniently decoded transaction.&lt;/p&gt;
&lt;p&gt;Instead, the real Electrum CLI returned the serialized transaction.&lt;/p&gt;
&lt;p&gt;So the verifier had to evolve.&lt;/p&gt;
&lt;p&gt;The flow became:&lt;/p&gt;
&lt;p&gt;TXID&lt;br&gt;
 ↓&lt;br&gt;
gettransaction&lt;br&gt;
 ↓&lt;br&gt;
raw transaction&lt;br&gt;
 ↓&lt;br&gt;
deserialize&lt;br&gt;
 ↓&lt;br&gt;
outputs&lt;br&gt;
 ↓&lt;br&gt;
address + value_sats&lt;/p&gt;
&lt;p&gt;Confirmations are obtained separately through:&lt;/p&gt;
&lt;p&gt;get_tx_status &lt;/p&gt;
&lt;p&gt;This is one reason I like developing infrastructure in the open.&lt;/p&gt;
&lt;p&gt;The repository doesn't just show the final design.&lt;/p&gt;
&lt;p&gt;It also shows where assumptions met reality.&lt;/p&gt;
&lt;p&gt;Satoshis instead of guessing units&lt;/p&gt;
&lt;p&gt;Another useful result of decoding the transaction is that Electrum exposes output values explicitly as satoshis.&lt;/p&gt;
&lt;p&gt;Conceptually:&lt;/p&gt;
&lt;p&gt;{&lt;br&gt;
  &quot;address&quot;: &quot;bc1q...&quot;,&lt;br&gt;
  &quot;value_sats&quot;: 7212&lt;br&gt;
}&lt;/p&gt;
&lt;p&gt;That lets the verifier perform the critical comparison using integers:&lt;/p&gt;
&lt;p&gt;paid satoshis &amp;gt;= expected satoshis&lt;/p&gt;
&lt;p&gt;instead of relying on floating-point BTC arithmetic or guessing units.&lt;/p&gt;
&lt;p&gt;For payment verification, small details like this matter.&lt;/p&gt;
&lt;p&gt;A transaction isn't automatically a payment&lt;/p&gt;
&lt;p&gt;Finding a transaction containing the expected address and amount still isn't enough.&lt;/p&gt;
&lt;p&gt;We also need confirmation policy.&lt;/p&gt;
&lt;p&gt;A transaction with:&lt;/p&gt;
&lt;p&gt;confirmations: 0&lt;/p&gt;
&lt;p&gt;may exist in the mempool, but the trusted payment layer can require a minimum number of confirmations before granting access.&lt;/p&gt;
&lt;p&gt;Only after verification succeeds can Zorgax move toward:&lt;/p&gt;
&lt;p&gt;PENDING&lt;br&gt;
   ↓&lt;br&gt;
VERIFIED&lt;br&gt;
   ↓&lt;br&gt;
ACTIVE&lt;/p&gt;
&lt;p&gt;where ACTIVE refers to the subscription access, not simply the existence of a transaction.&lt;/p&gt;
&lt;p&gt;Preventing one transaction from becoming many subscriptions&lt;/p&gt;
&lt;p&gt;There is another less visible problem: replay.&lt;/p&gt;
&lt;p&gt;Suppose someone takes one valid Bitcoin transaction and submits its TXID multiple times.&lt;/p&gt;
&lt;p&gt;Without protection, the same economic event could potentially be used to activate several subscriptions.&lt;/p&gt;
&lt;p&gt;So the payment-intent architecture also tracks consumed payment references and introduces uniqueness constraints around them.&lt;/p&gt;
&lt;p&gt;A verified transaction should represent one settlement event, not an unlimited activation token.&lt;/p&gt;
&lt;p&gt;Payment intents expire too&lt;/p&gt;
&lt;p&gt;Crypto prices change continuously.&lt;/p&gt;
&lt;p&gt;For that reason, the current checkout architecture uses short-lived quotes.&lt;/p&gt;
&lt;p&gt;A Payment Intent currently has a 15-minute lifetime.&lt;/p&gt;
&lt;p&gt;If it expires before settlement, it shouldn't remain a permanent promise to accept the original crypto amount.&lt;/p&gt;
&lt;p&gt;The user can simply request a new quote and create a new intent.&lt;/p&gt;
&lt;p&gt;What Zorgax never needs&lt;/p&gt;
&lt;p&gt;The interesting result is what this architecture does not require.&lt;/p&gt;
&lt;p&gt;Zorgax doesn't need the user's:&lt;/p&gt;
&lt;p&gt;seed phrase&lt;br&gt;
private key&lt;br&gt;
wallet password&lt;br&gt;
spend key&lt;/p&gt;
&lt;p&gt;The user can pay from an external wallet.&lt;/p&gt;
&lt;p&gt;The blockchain verifier observes the result.&lt;/p&gt;
&lt;p&gt;The application decides whether that external event satisfies an internally stored Payment Intent.&lt;/p&gt;
&lt;p&gt;That's a very different model from embedding a cryptocurrency wallet directly inside an AI application.&lt;/p&gt;
&lt;p&gt;Beyond Bitcoin&lt;/p&gt;
&lt;p&gt;Bitcoin is currently serving as our clearest implementation example, but the architecture is intended to be chain-independent.&lt;/p&gt;
&lt;p&gt;Conceptually:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;              Payment Intent
                   ↓
           Verification Layer
          /       |       |       \
        BTC      ETH     XMR      TARI
         ↓
      Electrum
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Each blockchain can have a different verifier behind the same general boundary.&lt;/p&gt;
&lt;p&gt;This is especially important for Monero.&lt;/p&gt;
&lt;p&gt;Because of Monero's privacy properties, its verification model cannot simply copy the assumptions used for transparent Bitcoin transactions.&lt;/p&gt;
&lt;p&gt;The common abstraction should stay the same while chain-specific verification remains isolated.&lt;/p&gt;
&lt;p&gt;Connecting this to the MyZubster Marketplace&lt;/p&gt;
&lt;p&gt;The same idea extends beyond Zorgax subscriptions.&lt;/p&gt;
&lt;p&gt;MyZubster's Marketplace is experimenting with a broader economic layer involving:&lt;/p&gt;
&lt;p&gt;BTC, ETH, XMR, TARI, MYZ, barter and free exchanges.&lt;/p&gt;
&lt;p&gt;The underlying principle remains:&lt;/p&gt;
&lt;p&gt;The platform can coordinate economic activity without needing custody of users' private keys.&lt;/p&gt;
&lt;p&gt;Zorgax monetization gives us a concrete environment in which to test that principle.&lt;/p&gt;
&lt;p&gt;What is actually finished?&lt;/p&gt;
&lt;p&gt;It's important not to confuse architecture with production readiness.&lt;/p&gt;
&lt;p&gt;We now have several important building blocks: subscription plans, server-side crypto quoting, trusted verification boundaries, the BTC/Electrum verifier, persistent Payment Intents, expiry and replay protections, and the connection between verified payments and subscription activation.&lt;/p&gt;
&lt;p&gt;But the complete system still needs production configuration, live end-to-end deployment testing and further operational hardening.&lt;/p&gt;
&lt;p&gt;The other chains also need their own production-grade verification paths.&lt;/p&gt;
&lt;p&gt;So this isn't a “payments are finished” announcement.&lt;/p&gt;
&lt;p&gt;It's a development update.&lt;/p&gt;
&lt;p&gt;The architecture we're moving toward&lt;/p&gt;
&lt;p&gt;The final flow is becoming increasingly simple to describe:&lt;/p&gt;
&lt;p&gt;Choose Plan&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;↓
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Create Payment Intent&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;↓
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Pay From External Wallet&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;↓
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Verify Blockchain Transaction&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;↓
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Match Transaction to Intent&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;↓
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Activate Subscription&lt;/p&gt;
&lt;p&gt;And underneath that flow is one rule that we don't want to compromise:&lt;/p&gt;
&lt;p&gt;Verify the payment without owning the money.&lt;/p&gt;
&lt;p&gt;For me, that's becoming one of the more interesting parts of building Zorgax.&lt;/p&gt;
&lt;p&gt;Not simply teaching an AI assistant how to answer questions, but connecting software, identity, economic events and permissions while keeping the trust boundaries explicit.&lt;/p&gt;
&lt;p&gt;The system is still evolving.&lt;/p&gt;
&lt;p&gt;And, as with the rest of MyZubster, we're building it in the open.&lt;/p&gt;
&lt;p&gt;Project links&lt;/p&gt;
&lt;p&gt;MyZubster core:&lt;br&gt;
github.com/MyZubster-Ecosystem/myzubster&lt;/p&gt;
&lt;p&gt;Zorgax trusted payment verification — PR #814:&lt;br&gt;
PR #814&lt;/p&gt;
&lt;p&gt;Bitcoin/Electrum verifier — PR #815:&lt;br&gt;
PR #815&lt;/p&gt;
&lt;p&gt;Electrum 4.8.1 hardening — PR #817:&lt;br&gt;
PR #817&lt;/p&gt;
&lt;p&gt;Persistent Payment Intents — PR #818:&lt;br&gt;
PR #818&lt;/p&gt;
&lt;p&gt;MyZubster Marketplace:&lt;br&gt;
github.com/MyZubster-Ecosystem/MyZubster-Marketplace&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/25708/from-a-bitcoin-transaction-to-a-paid-ai-subscription-without-holding-private-keys</guid>
<pubDate>Fri, 28 Aug 2026 16:17:18 +0000</pubDate>
</item>
<item>
<title>Why I love this new Bitcoin use case, and what you guys think?</title>
<link>https://coderlegion.com/22576/why-i-love-this-new-bitcoin-use-case-and-what-you-guys-think</link>
<description>&lt;p&gt;I recently came across an incredibly creative application of blockchain technology: Blockonomics' FIFA 2026 Global Fan Wall: &lt;a rel=&quot;nofollow&quot; href=&quot;https://insights.blockonomics.co/put-your-fifa-2026-world-cup-memory-on-the-global-fan-wall-for-eternity/&quot;&gt;https://insights.blockonomics.co/put-your-fifa-2026-world-cup-memory-on-the-global-fan-wall-for-eternity/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;It’s refreshing to see Bitcoin being used for something beyond just financial transactions.&lt;/p&gt;
&lt;p&gt;What do you guys honestly think of this?&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/22576/why-i-love-this-new-bitcoin-use-case-and-what-you-guys-think</guid>
<pubDate>Tue, 14 Jul 2026 04:10:51 +0000</pubDate>
</item>
<item>
<title>Demystifying the Bitcoin Lightning Network: A Technical Deep Dive from a Bootcamp Hackathon</title>
<link>https://coderlegion.com/21885/demystifying-the-bitcoin-lightning-network-technical-deep-dive-from-bootcamp-hackathon</link>
<description>&lt;p&gt;Last week, I had the incredible opportunity to transition from a Bitcoin beginner to building a Layer 2 solution in less than 12 hours at the &lt;strong&gt;Kisumu Lightning Network Bootcamp&lt;/strong&gt; hosted by &lt;a rel=&quot;nofollow&quot; href=&quot;https://zone01kisumu.ke&quot;&gt;Zone01 Kisumu&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;While most articles explain the Lightning Network (LN) abstractly as &quot;fast and cheap,&quot; I will break down the technical mechanisms;the actual cryptographic primitives and scripts that make trustless, off-chain Bitcoin transactions possible today. All from what I learnt from the 5-day bootcamp.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The Core Primitive: Bidirectional Payment Channels&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;At its foundation, the Lightning Network is a peer-to-peer network of bidirectional payment channels. It avoids blockchain congestion by shifting transactions off-chain, using the underlying base layer strictly as a final settlement layer.&lt;/p&gt;
&lt;p&gt;A channel is established when two nodes execute an on-chain Funding Transaction. &lt;/p&gt;
&lt;p&gt;The Funding State&lt;br&gt;
2-of-2 Multi-Signature UTXO: Both participants lock up an agreed amount of Bitcoin into a multisig address. This requires signatures from both parties to move funds.&lt;br&gt;
Commitment Transactions**: Before broadcasting the funding transaction to the blockchain, both parties sign an asymmetric, unbroadcasted &lt;br&gt;
Commitment Transaction. This acts as a&lt;br&gt;
 balance sheet of the current channel state.&lt;/p&gt;
&lt;p&gt;From a total beginner to atleast an intermediate knowledgeable person in regards to bitcoin,this was a great learning experience for me and I'm so grateful to the organizers and facilitators of this intensive bootcamp.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/21885/demystifying-the-bitcoin-lightning-network-technical-deep-dive-from-bootcamp-hackathon</guid>
<pubDate>Sat, 04 Jul 2026 06:34:22 +0000</pubDate>
</item>
<item>
<title>Unboxing My New OneKey Classic 1S Hardware Wallet</title>
<link>https://coderlegion.com/18319/unboxing-my-new-onekey-classic-1s-hardware-wallet</link>
<description>&lt;p&gt;There are moments in crypto when you realize that security is no longer optional — it becomes a responsibility.&lt;/p&gt;
&lt;p&gt;After spending years working with blockchain infrastructure, nodes, wallets, and decentralized systems, I finally decided to move part of my operational environment toward a dedicated hardware wallet experience.&lt;/p&gt;
&lt;p&gt;And honestly… I did not expect the experience to be this good.&lt;/p&gt;
&lt;p&gt;First Impressions&lt;/p&gt;
&lt;p&gt;The first thing that surprised me about the OneKey Classic 1S was the packaging quality.&lt;/p&gt;
&lt;p&gt;Everything arrived professionally sealed and protected, giving a very strong first impression focused on authenticity and tamper protection. In a market where hardware wallet trust is everything, details like this matter much more than people think.&lt;/p&gt;
&lt;p&gt;The packaging feels premium without being unnecessarily excessive.&lt;br&gt;
Minimalistic. Clean. Professional.&lt;/p&gt;
&lt;p&gt;You immediately notice that security was considered from the very beginning of the user experience.&lt;/p&gt;
&lt;p&gt;Security Seals &amp;amp; Packaging Quality&lt;/p&gt;
&lt;p&gt;One of the biggest concerns when purchasing a hardware wallet is whether the device could have been manipulated before arrival.&lt;/p&gt;
&lt;p&gt;Fortunately, the OneKey Classic 1S arrived:&lt;/p&gt;
&lt;p&gt;Completely sealed&lt;br&gt;
Properly protected&lt;br&gt;
Professionally packaged&lt;br&gt;
With visible security-focused presentation&lt;/p&gt;
&lt;p&gt;The unboxing experience genuinely felt closer to opening a high-end security device than a simple crypto accessory.&lt;/p&gt;
&lt;p&gt;That matters.&lt;/p&gt;
&lt;p&gt;Especially today.&lt;/p&gt;
&lt;p&gt;Setup Experience&lt;/p&gt;
&lt;p&gt;I expected the installation process to be complicated or technical.&lt;/p&gt;
&lt;p&gt;It wasn't.&lt;/p&gt;
&lt;p&gt;The wallet initialization and software setup process was relatively simple and intuitive.&lt;/p&gt;
&lt;p&gt;The official OneKey software guided the entire process step-by-step, including:&lt;/p&gt;
&lt;p&gt;Wallet creation&lt;br&gt;
Recovery phrase backup&lt;br&gt;
Device verification&lt;br&gt;
Security confirmation&lt;br&gt;
Connection process&lt;/p&gt;
&lt;p&gt;Even for users who are not deeply technical, the experience feels approachable and clean.&lt;/p&gt;
&lt;p&gt;Build Quality&lt;/p&gt;
&lt;p&gt;The device itself feels solid and surprisingly lightweight.&lt;/p&gt;
&lt;p&gt;The physical buttons are responsive, the screen is clear, and the overall design has a professional aesthetic that feels modern instead of outdated.&lt;/p&gt;
&lt;p&gt;Some hardware wallets still look and feel experimental.&lt;/p&gt;
&lt;p&gt;The OneKey Classic 1S does not.&lt;/p&gt;
&lt;p&gt;It feels polished.&lt;/p&gt;
&lt;p&gt;Why This Matters&lt;/p&gt;
&lt;p&gt;In recent months, the crypto ecosystem has seen increasing concerns related to:&lt;/p&gt;
&lt;p&gt;Wallet compromises&lt;br&gt;
Malicious smart contracts&lt;br&gt;
Fake applications&lt;br&gt;
Phishing attacks&lt;br&gt;
Blind signing risks&lt;/p&gt;
&lt;p&gt;Because of that, I started looking more seriously into dedicated cold-storage solutions with:&lt;/p&gt;
&lt;p&gt;Strong security architecture&lt;br&gt;
Transparent development&lt;br&gt;
Open-source firmware&lt;br&gt;
Clear signing support&lt;br&gt;
Modern ecosystem compatibility&lt;/p&gt;
&lt;p&gt;The OneKey ecosystem checked many of those boxes.&lt;/p&gt;
&lt;p&gt;Final Thoughts&lt;/p&gt;
&lt;p&gt;The truth is simple:&lt;/p&gt;
&lt;p&gt;I expected a decent hardware wallet.&lt;/p&gt;
&lt;p&gt;What I received was a much more polished experience than anticipated.&lt;/p&gt;
&lt;p&gt;From the packaging quality to the onboarding process, the OneKey Classic 1S gave a very strong first impression.&lt;/p&gt;
&lt;p&gt;For anyone looking to improve their crypto security setup while keeping usability simple, this device is definitely worth researching.&lt;/p&gt;
&lt;p&gt;Official Link + 10% Discount&lt;/p&gt;
&lt;p&gt;If you want to check the device directly from the official website, you can use my referral link here:&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://onekey.so/r/MUGY73&quot;&gt;https://onekey.so/r/MUGY73&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;You can also use the discount code:&lt;/p&gt;
&lt;p&gt;MUGY73&lt;/p&gt;
&lt;p&gt;to receive 10% OFF on your purchase directly from the official OneKey website.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/18319/unboxing-my-new-onekey-classic-1s-hardware-wallet</guid>
<pubDate>Tue, 19 May 2026 13:57:58 +0000</pubDate>
</item>
<item>
<title>UltrafastSecp256k1 v4.0 — Optional Secondary secp256k1 Backend for Evaluation</title>
<link>https://coderlegion.com/18131/ultrafastsecp256k1-v4-0-optional-secondary-secp256k1-backend-for-evaluation</link>
<description>&lt;p&gt;Overview&lt;br&gt;
UltrafastSecp256k1 v4.0 is a high-performance secp256k1 engine built for evaluation as an optional secondary backend for Bitcoin Core. The goal is not to replace libsecp256k1, but to make it possible to measure, compare, and selectively enable an alternative implementation under controlled conditions.&lt;/p&gt;
&lt;p&gt;This post presents the current state of the project, its integration model, and the evidence gathered through continuous audit infrastructure.&lt;/p&gt;
&lt;p&gt;Repository: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1&quot;&gt;https://github.com/shrec/UltrafastSecp256k1&lt;/a&gt; Release v4.0.0: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1/releases/tag/v4.0.0&quot;&gt;https://github.com/shrec/UltrafastSecp256k1/releases/tag/v4.0.0&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Integration Model&lt;br&gt;
Integration uses a shim layer that exposes the identical secp256k1.h API surface. Bitcoin Core can be built with the alternative backend using a single CMake flag:&lt;/p&gt;
&lt;p&gt;cmake -B build -DSECP256K1_BACKEND=ultrafast&lt;br&gt;
cmake --build build&lt;br&gt;
The default backend remains libsecp256k1 unchanged. All existing Bitcoin Core C++ source files remain unmodified — only the CMake build system references a different library.&lt;/p&gt;
&lt;p&gt;Fork demonstrating this integration: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/bitcoin/tree/feature/ultrafast-secp256k1-backend&quot;&gt;https://github.com/shrec/bitcoin/tree/feature/ultrafast-secp256k1-backend&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Shim API coverage:&lt;/p&gt;
&lt;p&gt;secp256k1.h — context, pubkey, seckey&lt;br&gt;
secp256k1_extrakeys.h — keypair, x-only pubkey (BIP-340/341)&lt;br&gt;
secp256k1_schnorrsig.h — Schnorr sign/verify (BIP-340)&lt;br&gt;
secp256k1_ecdh.h — ECDH&lt;br&gt;
secp256k1_recovery.h — ECDSA recovery&lt;br&gt;
secp256k1_ellswift.h — ElligatorSwift (BIP-324)&lt;br&gt;
secp256k1_musig.h — MuSig2 (BIP-327, all 14 functions)&lt;br&gt;
Performance — Bitcoin Core Integration Paths&lt;br&gt;
All numbers from bench_bitcoin (Bitcoin Core's native benchmark harness) on Intel i5-14400F, GCC 14.2.0, Release+LTO, intel_pstate/no_turbo=1, taskset -c 0, nice -20, 5 runs.&lt;/p&gt;
&lt;p&gt;Canonical artifact: docs/BITCOIN_CORE_BENCH_RESULTS.json&lt;/p&gt;
&lt;p&gt;Transaction signing:&lt;/p&gt;
&lt;p&gt;BenchmarkUltralibsecp256k1Delta&lt;br&gt;
SignSchnorrWithMerkleRoot83.9 µs113.4 µs+35% faster&lt;br&gt;
SignSchnorrWithNullMerkleRoot84.0 µs113.0 µs+35% faster&lt;br&gt;
SignTransactionECDSA149.5 µs165.1 µs+10% faster&lt;br&gt;
SignTransactionSchnorr125.4 µs137.5 µs+10% faster&lt;br&gt;
Script verification:&lt;/p&gt;
&lt;p&gt;BenchmarkUltralibsecp256k1Delta&lt;br&gt;
VerifyScriptP2TR_KeyPath45.4 µs46.3 µs+2.0% faster&lt;br&gt;
VerifyScriptP2TR_ScriptPath76.5 µs83.8 µs+10% faster&lt;br&gt;
VerifyScriptP2WPKH46.0 µs45.8 µsparity (within noise)&lt;br&gt;
Block validation aggregate (ConnectBlock, 2000 unique signatures):&lt;/p&gt;
&lt;p&gt;ScenarioUltralibsecp256k1Delta&lt;br&gt;
All ECDSA254.3 ms257.4 ms+1.2% faster&lt;br&gt;
All Schnorr253.0 ms255.3 ms+0.9% faster&lt;br&gt;
Mixed (2k Schnorr + 1k ECDSA)253.9 ms257.7 ms+1.5% faster&lt;br&gt;
Without LTO: ConnectBlock is ~0.5–1.0% slower than libsecp256k1 due to i-cache pressure from a larger code footprint. LTO is required for Ultra to win the aggregate. This tradeoff is documented in docs/SHIM_KNOWN_DIVERGENCES.md.&lt;/p&gt;
&lt;p&gt;Bitcoin Core test suite: 749/749 passing with Ultra backend (GCC 14.2.0, May 2026).&lt;/p&gt;
&lt;p&gt;Performance — Constant-Time Signing Primitives&lt;br&gt;
From docs/bench_unified_2026-05-16_gcc14_x86-64.json. CT-vs-CT co-measured in the same run (ratios are TSC-independent):&lt;/p&gt;
&lt;p&gt;OperationUltra CTlibsecp256k1Ratio&lt;br&gt;
CT ECDSA sign21.6 µs59.7 µs1.30× faster&lt;br&gt;
CT Schnorr sign (BIP-340)18.1 µs46.5 µs1.28× faster&lt;br&gt;
Schnorr verify84.3 µs84.3 µsequal&lt;br&gt;
Field arithmetic primitives:&lt;/p&gt;
&lt;p&gt;PrimitiveUltralibsecp256k1Ratio&lt;br&gt;
field_mul20.1 ns26.5 ns1.32×&lt;br&gt;
field_sqr18.7 ns22.3 ns1.19×&lt;br&gt;
field_inv1253.9 ns1506.0 ns1.20×&lt;br&gt;
field_from_bytes4.8 ns13.0 ns2.71×&lt;br&gt;
Continuous Audit and Assurance (CAAS)&lt;br&gt;
The repository includes a continuous audit infrastructure tracking security regressions across every commit.&lt;/p&gt;
&lt;p&gt;Current state at v4.0.0:&lt;/p&gt;
&lt;p&gt;262 exploit PoC modules covering 20+ CVE/attack classes — all pass&lt;br&gt;
369 total audit modules (262 exploit PoC + 107 non-exploit)&lt;br&gt;
CAAS autonomy score: 100/100 (8/8 gates)&lt;br&gt;
Source: docs/SECURITY_AUTONOMY_KPI.json&lt;/p&gt;
&lt;p&gt;Audit surfaces include: nonce reuse, side-channel timing (dudect), CT boundary verification, batch verify soundness, MuSig2/FROST protocol attacks, adaptor signatures, DER BIP-66 strict parsing, BIP-340/RFC-6979 known-answer tests, Wycheproof vectors, structure-aware fuzzing, differential testing vs libsecp256k1, and Python-based algebraic property testing.&lt;/p&gt;
&lt;p&gt;Security properties enforced:&lt;/p&gt;
&lt;p&gt;Constant-time signing: ECDSA, Schnorr, MuSig2, FROST, BIP-324 XDH&lt;br&gt;
Per-context DPA blinding (secp256k1_context_randomize fully implemented)&lt;br&gt;
Strict scalar parsing for private key inputs (parse_bytes_strict_nonzero)&lt;br&gt;
Fail-closed batch signing APIs&lt;br&gt;
BIP-66 strict DER enforcement in all shim paths&lt;br&gt;
Benchmarking Methodology&lt;br&gt;
Benchmarks distinguish between:&lt;/p&gt;
&lt;p&gt;CT vs CT — constant-time Ultra signing vs constant-time libsecp signing (production-equivalent, fair comparison)&lt;br&gt;
Bitcoin Core integration — bench_bitcoin binary, real validation pipeline&lt;br&gt;
LTO vs no-LTO — both measured and documented&lt;br&gt;
Warm-cache vs cold-cache — noted where applicable&lt;br&gt;
All claimed improvements include error percentage from nanobench's internal statistics. Inconclusive results (overlapping ranges) are reported as such. Results are reproducible from the canonical JSON artifacts in the repository.&lt;/p&gt;
&lt;p&gt;Reproducibility&lt;br&gt;
Builds are deterministic:&lt;/p&gt;
&lt;p&gt;-ffile-prefix-map strips source paths from debug info&lt;br&gt;
SOURCE_DATE_EPOCH awareness&lt;br&gt;
Fixed -march=x86-64-v3 (no host-native variation)&lt;br&gt;
SLSA provenance attached to v4.0.0 release artifacts (via Sigstore/Cosign)&lt;br&gt;
Platform Coverage&lt;br&gt;
CI passing on all platforms as of v4.0.0:&lt;/p&gt;
&lt;p&gt;PlatformArchitectureCompiler&lt;br&gt;
Linuxx86-64-v3GCC 14 / Clang 17&lt;br&gt;
LinuxARM64GCC 14&lt;br&gt;
LinuxRISC-V 64GCC 14&lt;br&gt;
macOSARM64 (Apple Silicon)Clang 15&lt;br&gt;
Windowsx86-64MSVC / GCC&lt;br&gt;
Additional: Android ARM64 (NDK), WASM, ESP32, STM32.&lt;/p&gt;
&lt;p&gt;Known Limitations&lt;br&gt;
ConnectBlock improvement requires Release+LTO. Without LTO: ~0.5–1.0% slower than libsecp256k1.&lt;br&gt;
GPU backends (CUDA, OpenCL, Metal) are present but not part of the Bitcoin Core evaluation profile.&lt;br&gt;
This covers the CPU backend only.&lt;br&gt;
Current Objective&lt;br&gt;
No mandatory integration path is proposed. The current objective is to make an alternative backend available for evaluation on technical grounds, with reproducible evidence, minimal integration surface, and an easy rollback path.&lt;/p&gt;
&lt;p&gt;The default backend remains libsecp256k1. All existing behavior is preserved unless the new backend is explicitly enabled at build time.&lt;/p&gt;
&lt;p&gt;Reviewer Entry Path&lt;br&gt;
git clone &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1&quot;&gt;https://github.com/shrec/UltrafastSecp256k1&lt;/a&gt;&lt;br&gt;
cd UltrafastSecp256k1&lt;br&gt;
python3 ci/verify_external_audit_bundle.py --allow-commit-mismatch&lt;br&gt;
Key documents:&lt;/p&gt;
&lt;p&gt;docs/BITCOIN_CORE_BACKEND_EVIDENCE.md — full reviewer package&lt;br&gt;
docs/BENCHMARKS.md — benchmark methodology and raw data&lt;br&gt;
docs/AUDIT_CHANGELOG.md — security audit history&lt;br&gt;
docs/SHIM_KNOWN_DIVERGENCES.md — documented behavioral differences from libsecp256k1&lt;br&gt;
All performance numbers are from controlled benchmark runs with hard turbo lock. Raw data available in the repository. Canonical benchmark artifact: docs/BITCOIN_CORE_BENCH_RESULTS.json, docs/bench_unified_2026-05-16_gcc14_x86-64.json.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/18131/ultrafastsecp256k1-v4-0-optional-secondary-secp256k1-backend-for-evaluation</guid>
<pubDate>Sun, 17 May 2026 00:46:15 +0000</pubDate>
</item>
<item>
<title>UltrafastSecp256k1 v3.67.0</title>
<link>https://coderlegion.com/15480/ultrafastsecp256k1-v3-67-0</link>
<description>&lt;p&gt;v3.67.0 — CAAS hardening, multi-CI reproducible builds, OpenSSF Scorecard cleanup, Zenodo + funding outreach&lt;br&gt;
This release closes the remaining CAAS gap-closure roadmap, lands the multi-CI reproducible-build attestation surface, brings the OpenSSF Scorecard code-scanning queue to zero open alerts, and pre-stages Zenodo metadata + a funding-outreach playbook. No public-API or ABI breakage; no behavioral changes to the crypto engine.&lt;/p&gt;
&lt;p&gt;Highlights&lt;br&gt;
Continuous Audit (CAAS) — roadmap complete&lt;br&gt;
All eleven CAAS hardening items (H-1 … H-11) closed in a single sweep.&lt;br&gt;
Gap-closure roadmap G-1 … G-10 closed: threat model, RNG entropy attestation, hardware side-channel methodology, compliance stance, INTEROP matrix, multi-CI reproducible builds, CT-tool independence, SPEC traceability matrix, protocol spec, traceability-join gate, RFC 9116.&lt;br&gt;
scripts/audit_gate.py now wires G-1 / G-1b / G-8 / G-10 as first-class sub-gates; caas_runner.py is fail-fast across all five stages.&lt;br&gt;
scripts/check_exploit_wiring.py enforces the Exploit / Audit Test Conversion Standard at CAAS Stage 0 — every audit/test&lt;em&gt;exploit&lt;/em&gt;*.cpp file must be wired into unified_audit_runner.cpp or the gate refuses the push.&lt;br&gt;
Audit dashboard refreshed: hardening progress 12/12 (100%).&lt;br&gt;
Multi-CI reproducible-build attestation&lt;br&gt;
.gitlab-ci.yml and .woodpecker.yml (Codeberg) added alongside the existing GitHub Actions surface — the same release artifact is now built on three independent CI providers and verified byte-identical via SHA-256.&lt;br&gt;
docs/MULTI_CI_REPRODUCIBLE_BUILD.md documents the protocol; docs/SUPPLY_CHAIN_LOCAL_PARITY.md describes the local-parity check.&lt;br&gt;
INTEROP differential testing&lt;br&gt;
First INTEROP §2 reference wired: OpenSSL 3.x random-vector differential PoC (audit/test_exploit_differential_openssl.cpp), advisory module, host-only.&lt;br&gt;
INTEROP §3 closure tracked for k256 (Rust), btcd (Go), BoringSSL, WolfSSL, NSS, MuSig2 wire, FROST wire.&lt;br&gt;
OpenSSF Scorecard — code-scanning queue cleared&lt;br&gt;
All open code-scanning alerts on main resolved.&lt;br&gt;
PinnedDependenciesID (6): every GitHub Action pinned by 40-character SHA in mutation-weekly.yml, rocm-smoke.yml, and formal-verification.yml; pip installs in those workflows switched to pip install --require-hashes -r ... against new hash-pinned requirement files.&lt;br&gt;
TokenPermissionsID (1 fixed in code): caas-evidence-refresh.yml top-level contents: write dropped to read; write retained only at the job level where the workflow actually pushes refreshed evidence back to dev.&lt;br&gt;
Six remaining TokenPermissionsID alerts dismissed as legitimate job-scoped writes (release sync-docs, audit-report publish to gh-pages, bench-regression baseline push, three ClusterFuzzLite SARIF uploads).&lt;br&gt;
BranchProtectionID resolved at config level: main-protection ruleset hardened — bypass_actors=, required_approving_review_count=2, require_code_owner_review=true, require_last_push_approval=true, dismiss_stale_reviews_on_push=true.&lt;br&gt;
Crypto bug-pattern scanner&lt;br&gt;
13 CVE-grounded pattern checkers added to scripts/dev_bug_scanner.py (timing-dependent branches on secret data, missing zeroization, RFC 6979 misuse patterns, ECDSA nonce reuse signatures, scalar-mod-n omission, …).&lt;br&gt;
False-positive reduction pass across eight checkers; investigation report at docs/SCANNER_INVESTIGATION_REPORT.md.&lt;br&gt;
GPU backend parity&lt;br&gt;
schnorr_snark_witness_batch parity gap closed via deterministic host-side CPU fallback in gpu/src/gpu_backend_fallback.cpp — CUDA, OpenCL, and Metal now all return correct byte-identical results. Native GPU kernels remain a future optimisation; public-data-only operation.&lt;br&gt;
Cross-compile / CI fixes&lt;br&gt;
arm64 + riscv64 cross-compile no longer picks up host OpenSSL headers via bare &lt;strong&gt;has_include. The OpenSSL gate is now driven by a CMake UFSECP_HAVE_OPENSSL=1 define that is only set when find_package(OpenSSL) actually links — the source guard requires both the define and &lt;/strong&gt;has_include.&lt;br&gt;
-Werror build no longer trips on OpenSSL EC_KEY deprecation warnings (pragma block scoped to the differential PoC).&lt;br&gt;
CAAS verdict accepts both PASS and PASS with advisory.&lt;br&gt;
Visibility surface&lt;br&gt;
.zenodo.json added — academic metadata staged for the next release; the next release-tag push will trigger Zenodo archival and DOI minting (Zenodo↔GitHub OAuth toggle is enabled).&lt;br&gt;
README.md &quot;Cite this work&quot; section + DOI badge placeholder.&lt;br&gt;
CITATION.cff linked from &quot;Where to Start&quot;; docs/ADOPTION.md and docs/FUNDING_TARGETS.md linked next to it.&lt;br&gt;
docs/FUNDING_TARGETS.md — funding playbook covering Bitcoin grant programmes (HRF, OpenSats, Brink, Spiral, Strike Catalyst, MIT DCI), Ethereum programmes (EF ESP, Protocol Guild, EF Academic, Optimism RetroPGF, Arbitrum, Coinbase / Base), EU / cross-cutting (NLnet NGI Zero, Sovereign Tech Fund, OSTIF, GitHub Accelerator, a16z crypto Open Source Grants), with 30-second + 5-minute pitches and an evidence-pointer column.&lt;br&gt;
README.md hero block now carries explicit CTAs: a one-line invitation for production users to PR themselves into docs/ADOPTION.md, and a one-line pointer for prospective sponsors to docs/FUNDING_TARGETS.md.&lt;br&gt;
Documentation reconciliation&lt;br&gt;
Exploit-PoC counts reconciled across all audit docs to the real number (189).&lt;br&gt;
Non-exploit module + CI workflow counts reconciled to reality.&lt;br&gt;
docs/SPEC_TRACEABILITY_MATRIX.md paths reconciled; traceability-join gate flipped to strict by default.&lt;br&gt;
Compatibility&lt;br&gt;
C ABI: unchanged.&lt;br&gt;
Public C++ API: unchanged.&lt;br&gt;
GPU backend GpuBackend virtual interface: one method (schnorr_snark_witness_batch) gained a deterministic CPU fallback; previously returned Unsupported on every backend.&lt;br&gt;
Reproducible build: byte-identical to v3.66.0 for the engine + library outputs; only CI / docs / audit-tooling surface changed.&lt;br&gt;
Adoption&lt;br&gt;
Sparrow Wallet Frigate ships UltrafastSecp256k1 by default since 1.4.0. See docs/ADOPTION.md for the integration details and Craig Raw's independent benchmarks.&lt;/p&gt;
&lt;p&gt;Cite this work&lt;br&gt;
This release will be archived on Zenodo with a DOI assigned automatically once the tag push completes. See .zenodo.json and CITATION.cff.&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1/releases/tag/v3.67.0&quot;&gt;https://github.com/shrec/UltrafastSecp256k1/releases/tag/v3.67.0&lt;/a&gt;&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1&quot;&gt;https://github.com/shrec/UltrafastSecp256k1&lt;/a&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/15480/ultrafastsecp256k1-v3-67-0</guid>
<pubDate>Wed, 22 Apr 2026 09:10:44 +0000</pubDate>
</item>
<item>
<title>Bitcoin Dust Attacks: What They Are and How to Defend Against Them</title>
<link>https://coderlegion.com/15072/bitcoin-dust-attacks-what-they-are-and-how-to-defend-against-them</link>
<description>&lt;p&gt;In the context of blockchain, dust is referred to as tiny amounts of any cryptocurrency that is uneconomical to spend. &lt;br&gt;
An amount is considered uneconomical to spend when the transaction cost it incurs is greater than its value.&lt;/p&gt;
&lt;p&gt;An attack is a malicious-intent action that attempts to do things like steal funds, exploit loopholes in rules, or disrupt the network. There are different types of attacks in Bitcoin. One of them is the &lt;strong&gt;Dust Attack&lt;/strong&gt;.&lt;/p&gt;
&lt;h3 id=&quot;how-addresses-keys-today-in-bitcoin-work-&quot;&gt;How addresses/keys today in Bitcoin work:&lt;/h3&gt;
&lt;p&gt;Bitcoin uses Elliptic Curve Cyptography, which is a form of asymmetric cryptography involving a keypair instead of a key, where there is the private key, and there is the public key. Public keys are derived from private keys. They are secured by the discrete-log problem in math, which ensures that it is extremely difficult to work your way back from a public key to a private key. There are different forms of spend, but the basic rule is simple: public keys are associated with bitcoins recorded on the blockchain, and the controller of the keys (the holders of the corresponding private key) can spend the bitcoins, by addressing them to some other public key. Addresses are derived from public keys.&lt;br&gt;
Now, the blockchain is a public network, implying that transactions there are completely visible, so that when a transaction happens, you can see what addresses are involved in the transactions, and the amounts spent. &lt;br&gt;
Bitcoiners love their privacy however, so a natural solution is to control more than one keypair, so that you can send different addresses for different transactions, and make it more difficult for addresses to be traced to you.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/kfsi18vr3pl63tt7v6at.png&quot; alt=&quot;Deterministic Key Generation: Tree of wallet keys generated from a single seed&quot;&gt;&lt;/p&gt;
&lt;p&gt;Modern wallets have a clever way of doing this whereby from a seed, a private key can be derived, and a whole tree of child keys (private and public) can be derived. The whole idea is that each user has a master key, that gives birth to descriptors, that are used to deterministically derive  new keypairs, to evolve into a whole tree of keys, so that any key in the tree can be parent to other keys, and there is no limit on the depth of the tree. &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/bitcoinbook/bitcoinbook/blob/develop/ch05_wallets.adoc&quot;&gt;More on this can be seen on the Bitcoin Book&lt;/a&gt;&lt;/p&gt;
&lt;h3 id=&quot;what-this-implies&quot;&gt;What This Implies&lt;/h3&gt;
&lt;p&gt;This means that for every transaction you receive coins from, you could actually publish a different address, so that the coins could not be traced to you. There is also the concept of internal and external descriptors, where internal descriptors derive wallet addresses you never share - also called change descriptors, because you use them to make change for yourself in transactions. External descriptors derive addresses that are shared, for you to receive coins from other people.&lt;br&gt;
The main point of descriptors and many addresses is privacy through non-reuse. Having these many addresses breaks transaction links, helps hide which output from a transaction is your change (since to the unknowing eye, it is not addressed to your wallet), it limits damages from key leak, so that if a private key gets leaked, just that address and its UTXOs are in danger, not your entire wallet. &lt;/p&gt;
&lt;p&gt;Note: As you continue down this article, know that Bitcoin doesn't use the arithmetic balance model, but the UTXO model for amounts, so that you have units of cryptocurrency, instead of a constant you just subtract from when you want to spend. It is like different units of money in a physical wallet. Each unit is called an Unspent Transaction Output (UTXO)&lt;/p&gt;
&lt;h3 id=&quot;enter-dust-attacks&quot;&gt;Enter Dust Attacks&lt;/h3&gt;
&lt;p&gt;In dust attacks, an attacker is not directly after your coins. Instead, they want to uncover your identity, by plotting your &lt;strong&gt;identity graph&lt;/strong&gt; - a map of which Bitcoin addresses belong to the same wallet. This can be used to deanonymize a person, so that you find out their total holdings. Knowledge of who holds how many bitcoins in the past has greatly led to threats, physical attakcs, abuse, torture, etc., so you want to protect yourself. &lt;br&gt;
The knowledge can also be used to link a pseudonymous identity - yours, to a real-world activity.&lt;/p&gt;
&lt;h3 id=&quot;how-dust-attacks-happen-&quot;&gt;How Dust Attacks Happen:&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/rzgrt2jelw5hqe1x5i0a.png&quot; alt=&quot;How Dust Attacks Happen&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 1: Target Selection:&lt;/strong&gt;&lt;br&gt;
First of all, the attacker identifies the address(es) they want to deanonymize. This is done by looking at the blockchain directly, since transactions are public. They could get the address from anywhere at all.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Dust Delivery:&lt;/strong&gt;&lt;br&gt;
Next, the attacker builds the dust delivery transaction. They can do this anyway, but to be economical, it is usually a single transaction, that sends tiny amounts (dust) to all target addresses simultaneously. This amount is chosen so carefully, it is most likely very very tiny, but not so tiny as it wouldn't make sense to spend economically, and above the relay floor, so that even if the victims might not notice it, nodes could relay it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3: Waiting/Monitoring:&lt;/strong&gt;&lt;br&gt;
Next, the attacker waits for the wallet owner to spend the outputs they sent. This could be a gamble, depending on how long it takes for the user to spend the coins. If somehow, the victim's wallet's coin selection algorithm picks any of these UTXOs, alongside a real UTXO, it becomes part of the graph.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4: Clustering:&lt;/strong&gt;&lt;br&gt;
When the user spends this UTXO, the inputs reveal co-ownership, since all inputs to a transaction &lt;strong&gt;usually&lt;/strong&gt; belong to one controller. The attacker now knows that these addresses in the transaction input belong to the target.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 5: Graph Expansion:&lt;/strong&gt;&lt;br&gt;
The attacker can now expand their knowledge graph of you, trace forward or backward, expand the graph, and get closer to whatever goal it is they have.&lt;/p&gt;
&lt;h3 id=&quot;how-to-combat-dust-attacks-&quot;&gt;How To Combat dust attacks:&lt;/h3&gt;
&lt;p&gt;From the steps above as regards the &lt;strong&gt;How&lt;/strong&gt; of dust attacks, the way to avoid dust attacks is simple: &lt;strong&gt;Do not spend the dust&lt;/strong&gt;. More accurately, do not spend the dust on a canonical transaction. Instead, you can arrange transactions with no output to spend them, so that the entire dust goes into network fees and the trail ends there, or you could mix the dust through a coinjoin with other users' dust. Here it gets mixed with hundreds other dust UTXOs, and the link breaks.&lt;/p&gt;
&lt;p&gt;I built a tool using Rust called &lt;strong&gt;Hoover&lt;/strong&gt; that acts to identify dust attack UTXOs, and construct Partially Signed Bitcoin Transactions (PSBTs) that safely spend them to fees, and safely remove them from the users' wallets. &lt;/p&gt;
&lt;h3 id=&quot;hoover&quot;&gt;Hoover&lt;/h3&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8o3ffmept2zl2yuiobzu.png&quot; alt=&quot;Hoover: a tool that identifies dust attacks and sweeps&quot;&gt;&lt;/p&gt;
&lt;p&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/OWK50GA/hoover&quot;&gt;Hoover&lt;/a&gt; is one of many dust attack tools that have been created for this purpose, and they all have one general idea. &lt;br&gt;
These dust attack tools take in your descriptors, internal and/or external, and register them. Then, on your command, it scans your wallet for dust UTXOs, showing them to you. Promptly, it constructs PSBTs for you to spend these transactions, with OP_RETURN output, so that there is no UTXO output. These PSBTs can then be taken and signed however you may, and broadcasted to the network as regular signed transactions. &lt;/p&gt;
&lt;p&gt;One critical part of creating the PSBTs is that you do not create a PSBT that contains dust from multiple addresses. The consolidation must be per address, else it compromises the privacy it aims to protect.&lt;/p&gt;
&lt;p&gt;Of course, these steps/processes differ from tool to tool, with different tools making innovations in different parts of the process, such as the nature of the PSBT.&lt;br&gt;
In the same light, the part of the process Hoover does different is in the dust identification. &lt;/p&gt;
&lt;p&gt;Usually, the tool would just check all the UTXOs to see which one is below or sometimes equal to the relay floor for that script type. Optionally, a user may configure their minimum number of sats for a UTXO to be considered non-dust, so that for a relay floor of 546 sats, a user may choose to remove every UTXO under 600 sats.&lt;br&gt;
However, a user may by coincidence have a lot of UTXOs that are not economically unspendable, but might be dust attacks, and in this case, depending on how many of them they have, sweeping all from their wallet may be considered waste.&lt;br&gt;
Another case is that depending on how sophisticated the attacker is, the attacker could send as high as 700 sats so that the user is much more likely to spend, and less likely to suspect as a dust attack UTXO, which increase the attacker's chances of succeeding in that attack. &lt;br&gt;
Here is what Hoover does different: Hoover divides dust into different types. UTXOs under the relay floor for a particular script-type are automatically counted as dust, and since they are economically unspendable, they are added to the &quot;psbt staging area&quot;. &lt;br&gt;
Hoover goes further to inspect UTXOs as high as a configurable amount by the user, trying to detect dishonest patterns from the source, and marks the UTXO in the list by suspicion level. This results in a user knowing their UTXO may be from a dust attack, even if it is not canonical dust. Some of the flags used to detect these dishonest patterns are:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Dust UTXOs received on a change address: this could be dust, or it could be a bit more than a dust UTXO, but your change addresses should not receive UTXOs from external parties in the first place. A person should only know your change address if they have been monitoring your transactions on the blockchain. This particular flag is highly suspicious.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Multiple of your addresses receiving dust from same txid: this is also almost certainly from a dust attack, and the attacker has actually done their research well and almost accurately, and at this point, doing anything might help finally achieve their goal. The suspicion on this flag is also very high.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/64n9wlpcixwi4hjitwbz.png&quot; alt=&quot;Red flags in a transaction that indicate dust attack patters&quot;&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Number of outputs of sending tx: this is another fingerprint of a dust attack. The outputs of the sending transaction are inspected. If a high ratio of these outputs are dust, as opposed to not, it is almost certainly a dust attack. The suspicion flag is also high, but not as high as the previous two.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Suspicious round value: in case this wasn't caught by first type of dust, UTXOs with their values too close to, or exactly at the relay floor have to be inspected to be dust attack UTXOs. Other methods are used to check, but the fact that it is too close to the relay floor adds a suspicion weight as well to the UTXO.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Same address sending dust in more than one tx: Catching dust from  the same address more than once, even when not in the same transaction is also a bad flag.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;There are more flags Hoover uses for detection (some still being implemented), but the idea is the same: In what context did my wallet receive this UTXO? That will tell whether or not the UTXO is a dust-attack UTXO, even for UTXOs above the canonical dust threshold.&lt;/p&gt;
&lt;h3 id=&quot;conclusion&quot;&gt;Conclusion&lt;/h3&gt;
&lt;p&gt;When dust attacks succeed, an attacker successfully clusters your address. The attacker now knows you hold significant amounts in bitcoin, and you become a target for extortion; kidnapping or ransom has happened to known Bitcoin holders. For an individual, transaction history exposure could expose salary, spending habits, political donations. Every transaction you ever made/will ever make becomes readable in the context of your identity. Social engineering is also possible with this information in the hands of bad actors. They know when you received large amounts, which services you use, and can do terrible things, such as timely impersonation of such services.&lt;/p&gt;
&lt;p&gt;What are some other flags you think would mean UTXOs probably are part of a dust attack campaign?&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/15072/bitcoin-dust-attacks-what-they-are-and-how-to-defend-against-them</guid>
<pubDate>Fri, 17 Apr 2026 13:07:12 +0000</pubDate>
</item>
<item>
<title># CAAS: The Audit System That Caught a Private Key Leak During a Platform Port</title>
<link>https://coderlegion.com/14717/caas-the-audit-system-that-caught-a-private-key-leak-during-a-platform-port</link>
<description>&lt;p&gt;I'll start with the bug that makes the case.&lt;/p&gt;
&lt;p&gt;I was porting &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1&quot;&gt;UltrafastSecp256k1&lt;/a&gt; — my secp256k1 cryptographic library — to RISC-V. New architecture, new compiler behavior. The code compiled fine. Tests passed.&lt;/p&gt;
&lt;p&gt;But the CT (constant-time) verification pipeline flagged something.&lt;/p&gt;
&lt;p&gt;GCC on RISC-V was optimizing my constant-time field arithmetic into branches that depended on secret data. The RISC-V backend had different optimization behavior than x86-64. The result: timing side-channel. The kind that leaks private keys over many observations.&lt;/p&gt;
&lt;p&gt;A traditional security audit, done on x86-64, would never have seen this. The audit report would say &quot;constant-time: verified.&quot; The library would ship to RISC-V users with a subtle vulnerability.&lt;/p&gt;
&lt;p&gt;My CAAS pipeline caught it in the same commit as the port. Fixed. Bug capsule created. Permanent regression test. Can never silently return.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-is-caas-&quot;&gt;What is CAAS?&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Continuous Adversarial Audit System&lt;/strong&gt; — a methodology for security-critical libraries where every security claim is backed by an executable test that runs on every commit.&lt;/p&gt;
&lt;p&gt;The key word is &lt;em&gt;continuous&lt;/em&gt;. Not &quot;we audited it in March.&quot; On. Every. Commit.&lt;/p&gt;
&lt;p&gt;For UltrafastSecp256k1, CAAS consists of:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Three independent CT verification pipelines:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;ct-verif.yml&lt;/code&gt; — LLVM IR symbolic analysis. Analyzes at compile time whether any secret-bearing operation produces a branch or memory address visible in the IR.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;valgrind-ct.yml&lt;/code&gt; — Runtime Valgrind taint propagation. Marks secret bytes as undefined at entry, runs the signing path, catches any branch or memory access derived from secret data.&lt;/li&gt;
&lt;li&gt;&lt;code&gt;ct-prover.yml&lt;/code&gt; — dudect statistical timing. Runs the operation thousands of times with different secret data and tests whether timing distributions are statistically distinguishable.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;171 exploit PoC tests&lt;/strong&gt; covering known CVE and academic attack classes. Each test is a standalone C++ file that actively tries to break the library. All run on every commit. None can be removed.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A bug capsule system:&lt;/strong&gt;&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;id&quot;: &quot;BUG-2026-0001&quot;,
  &quot;category&quot;: &quot;CT&quot;,  
  &quot;severity&quot;: &quot;critical&quot;,
  &quot;title&quot;: &quot;CT branch leak in ecdsa_sign_recoverable&quot;,
  &quot;fix_commit&quot;: &quot;0a93ff4b&quot;,
  &quot;exploit_poc&quot;: true,
  &quot;expected&quot;: { &quot;result&quot;: &quot;no_timing_leak&quot; }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Run &lt;code&gt;bug_capsule_gen.py&lt;/code&gt; and it generates a regression test, an exploit PoC, and CMake integration — automatically. The bug class is permanently sealed in CI.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A domain-specific static analyzer&lt;/strong&gt; (&lt;code&gt;dev_bug_scanner.py&lt;/code&gt;) with 28 rules that generic tools miss:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;CT_VIOLATION&lt;/code&gt; — &lt;code&gt;fast::scalar_mul()&lt;/code&gt; called in signing path (generic tools see valid C++; this is a side-channel)&lt;/li&gt;
&lt;li&gt;&lt;code&gt;SECRET_UNERASED&lt;/code&gt; — &lt;code&gt;Scalar&lt;/code&gt; variable without &lt;code&gt;secure_erase&lt;/code&gt; on signing path exit&lt;/li&gt;
&lt;li&gt;&lt;code&gt;TAGGED_HASH_BYPASS&lt;/code&gt; — &lt;code&gt;sha256()&lt;/code&gt; where BIP-340 &lt;code&gt;tagged_hash()&lt;/code&gt; is required&lt;/li&gt;
&lt;li&gt;&lt;code&gt;RANDOM_IN_SIGNING&lt;/code&gt; — non-deterministic RNG in RFC 6979 deterministic signing&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;~1,000,000+ assertions per build&lt;/strong&gt; across 55 audit modules covering field arithmetic invariants, scalar operations, point group law, CT properties, and protocol-level correctness.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;full-reproducibility&quot;&gt;Full Reproducibility&lt;/h3&gt;
&lt;p&gt;Everything runs in Docker. Not &quot;runs if you install the right toolchain.&quot; Runs with one command:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;# Local CI with GitHub parity
docker compose -f docker-compose.ci.yml run --rm pre-push    # 5 min
docker compose -f docker-compose.ci.yml run --rm gh-parity   # full

# Auditor challenge environment
docker build -f Dockerfile.auditor -t ufsecp-auditor .
docker run --rm ufsecp-auditor

# Bit-for-bit reproducible build
docker build -f Dockerfile.reproducible -t uf-repro-check .
docker run --rm uf-repro-check  # compares two independent builds byte-for-byte
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;The auditor image includes libsecp256k1, @noble/secp256k1, coincurve, and python-ecdsa for differential testing — all hash-pinned. No setup required.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-ci-regression-baseline&quot;&gt;The CI Regression Baseline&lt;/h3&gt;
&lt;p&gt;The code quality pipeline uses a baseline model:&lt;/p&gt;
&lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;{
  &quot;dev_bug_scanner&quot;: { &quot;HIGH&quot;: 0, &quot;MEDIUM&quot;: 138, &quot;LOW&quot;: 234 },
  &quot;hot_path_alloc_scanner&quot;: { &quot;HIGH&quot;: 104, &quot;MEDIUM&quot;: 44 }
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;CI doesn't require zero findings. It requires &lt;strong&gt;findings don't increase&lt;/strong&gt;. This is mature engineering — existing technical debt acknowledged, new debt blocked. The 104 HIGH hot_path allocations are intentional for performance reasons. If a new commit adds one more HIGH finding, CI fails.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-happens-when-you-fork-this&quot;&gt;What Happens When You Fork This&lt;/h3&gt;
&lt;p&gt;You inherit the accumulated security knowledge of every platform port, every bug found, every academic paper evaluated:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;RISC-V CT leak → caught → capsule → permanent&lt;/li&gt;
&lt;li&gt;Metal &lt;code&gt;field_reduce_512&lt;/code&gt; truncation (affecting ~0.05% of inputs) → caught → capsule → permanent  &lt;/li&gt;
&lt;li&gt;OpenCL carry propagation bug → caught → capsule → permanent&lt;/li&gt;
&lt;li&gt;CT branch leak in ECDSA signing low-s normalization → caught → capsule → permanent&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A startup forking this doesn't spend six months building security infrastructure. They start from a system that has already caught the bugs above, with permanent regression tests for each.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;real-world-validation&quot;&gt;Real-World Validation&lt;/h3&gt;
&lt;p&gt;Craig Raw integrated the library into &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/sparrowwallet/frigate&quot;&gt;Frigate&lt;/a&gt; for BIP-352 Silent Payments scanning. Real Bitcoin mainnet. Real transactions.&lt;/p&gt;
&lt;p&gt;The GPU BIP-352 pipeline achieves 11 million operations per second on an RTX 5060 Ti. Frigate's real-world scan of two years of Bitcoin mainnet history (133M tweaks) completes in 3.2 seconds on 2× RTX 5090s.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;what-caas-doesn-t-replace&quot;&gt;What CAAS Doesn't Replace&lt;/h3&gt;
&lt;p&gt;To be direct:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;No third-party audit yet. Documented openly. CAAS is designed to make one cheaper and faster when it happens.&lt;/li&gt;
&lt;li&gt;GPU CT verification is code-discipline (branchless source) but not formally pipeline-verified — vendor JIT compilers transform kernels at runtime.&lt;/li&gt;
&lt;li&gt;Novel, unknown attack classes have no prior test by definition.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;getting-started&quot;&gt;Getting Started&lt;/h3&gt;
&lt;pre&gt;&lt;code class=&quot;language-bash&quot;&gt;git clone https://github.com/shrec/UltrafastSecp256k1.git
cd UltrafastSecp256k1

# Run the full audit suite locally
docker compose -f docker-compose.ci.yml run --rm pre-push

# Or directly
cmake -S . -B build -DSECP256K1_BUILD_AUDIT=ON &amp;amp;&amp;amp; cmake --build build -j
ctest --test-dir build -L exploit -V  # run all exploit PoC tests
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;CAAS specification: &lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/shrec/UltrafastSecp256k1/blob/main/docs/AUDIT_STANDARD.md&quot;&gt;docs/AUDIT_STANDARD.md&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;The audit infrastructure ships with the library. MIT licensed.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/14717/caas-the-audit-system-that-caught-a-private-key-leak-during-a-platform-port</guid>
<pubDate>Tue, 14 Apr 2026 02:08:19 +0000</pubDate>
</item>
<item>
<title>UltrafastSecp256k1 v3.60</title>
<link>https://coderlegion.com/13974/ultrafastsecp256k1-v3-60</link>
<description>&lt;h3 id=&quot;v3-60-0-audit-campaign-wave-ii-zk-layer-full-gpu-parity-wallet-api-performance&quot;&gt;v3.60.0 — Audit Campaign Wave II · ZK Layer · Full GPU Parity · Wallet API · Performance&lt;/h3&gt;
&lt;blockquote&gt;&lt;p&gt;&lt;strong&gt;Release date&lt;/strong&gt;: 2026-04-04&lt;br&gt;
&lt;strong&gt;Previous release&lt;/strong&gt;: v3.50.0 (2026-03-XX)&lt;br&gt;
&lt;strong&gt;Commits since v3.50.0&lt;/strong&gt;: 50+&lt;br&gt;
ABI-compatible with v3.50.x — drop-in upgrade&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h4 id=&quot;security-amp-correctness&quot;&gt;Security &amp;amp; Correctness&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ECDSA large-x fix&lt;/strong&gt; (&lt;code&gt;cpu/src/ecdsa.cpp&lt;/code&gt;) — corrected &lt;code&gt;r_less_than_pmn&lt;/code&gt; comparison in both FE52 and 4×64 paths. Wrong PMN constants assumed limb[2]=0; actual &lt;code&gt;p−n&lt;/code&gt; has limb[2]=1. Signatures where &lt;code&gt;k·G.x ∈ [n, p−1]&lt;/code&gt; (~2⁻¹²⁸ probability per sig) were incorrectly rejected. Equivalent to the Stark Bank CVE-2021-43568..43572 false-negative class. Found and confirmed by Wycheproof tcId 346. ([`ea8cfb3c`])&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ECDSA r-overflow test suite&lt;/strong&gt; (&lt;code&gt;audit/test_exploit_ecdsa_r_overflow.cpp&lt;/code&gt;) — 19 checks: &lt;code&gt;k·G.x ≥ n&lt;/code&gt; accept case (tcId 346), &lt;code&gt;r=p−3&lt;/code&gt; strict-parse rejection, &lt;code&gt;r=n&lt;/code&gt; zero-reduction reject, &lt;code&gt;r=0&lt;/code&gt; reject, range sanity and sign/verify consistency. Closes Wycheproof PR #206 / Stark Bank CVE assurance gap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Wycheproof ECDSA Bitcoin vectors&lt;/strong&gt; (&lt;code&gt;audit/test_wycheproof_ecdsa_bitcoin.cpp&lt;/code&gt;) — 53 checks: BIP-62 low-S enforcement, tcId 346/347/348/351, high-S malleability boundary, r=0/s=0 special-value rejection, point-at-infinity rejection during verify.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CUDA &lt;code&gt;jacobian_add_mixed_unchecked&lt;/code&gt; infinity flag&lt;/strong&gt; — missing &lt;code&gt;r-&amp;gt;infinity = false&lt;/code&gt; in the normal code path caused generator table entries &lt;code&gt;table[3..15]&lt;/code&gt; to carry uninitialized infinity flags. Scalars with many consecutive high nibbles (e.g. &lt;code&gt;n−1&lt;/code&gt;) hit &lt;code&gt;table[15]&lt;/code&gt; and produced wrong public keys. All 52/52 CUDA signing tests now pass.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;ASan/UBSan clean&lt;/strong&gt;: 210/210 C++ tests pass under &lt;code&gt;-fsanitize=address,undefined -fno-sanitize-recover=all&lt;/code&gt; after full rebuild.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;exploit-poc-audit-coverage-wave-ii-&quot;&gt;Exploit PoC / Audit Coverage (Wave II)&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Suite &lt;/th&gt;&lt;th&gt;Tests &lt;/th&gt;&lt;th&gt;What it proves&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_schnorr_nonce_reuse.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;SNR-1..16 &lt;/td&gt;&lt;td&gt;Nonce reuse → full privkey recovery via &lt;code&gt;d' = (s1−s2)·(e1−e2)⁻¹ mod n&lt;/code&gt;; RFC6979 safety&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_bip32_child_key_attack.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;CKA-1..18 &lt;/td&gt;&lt;td&gt;xpub + child_sk → parent_sk recovery; chained grandchild→child→master; hardened blockage&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_frost_identifiable_abort.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;FIA-1..14 &lt;/td&gt;&lt;td&gt;&lt;code&gt;frost_verify_partial()&lt;/code&gt; correctly attributes bad partial sigs; multi-cheater, honest subset&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_hash_algo_sig_isolation.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;HAS-1..11 &lt;/td&gt;&lt;td&gt;Cross-hash confusion rejected; Schnorr↔ECDSA format confusion; domain prefix isolation&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_zk_adversarial.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;14 tests &lt;/td&gt;&lt;td&gt;Malformed/forged ZK proofs: garbage bytes, scalar overflow, identity pubkey, 64-byte-flip&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_pedersen_adversarial.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;12 tests &lt;/td&gt;&lt;td&gt;Switch commitment security, imbalanced verify_sum, double-spend detection&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_ethereum_differential.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;10 tests &lt;/td&gt;&lt;td&gt;go-ethereum / web3.py / ethers.js KAT vectors, ecrecover, EIP-155/EIP-191, keccak256&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_fuzz_musig2_frost.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;15 tests &lt;/td&gt;&lt;td&gt;MuSig2 key_agg/nonce_agg/partial_verify; FROST keygen/sign/verify random inputs (5000+ rounds)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_wycheproof_ecdsa_bitcoin.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;53 checks &lt;/td&gt;&lt;td&gt;Wycheproof BIP-62 + large-x vectors&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;test_exploit_ecdsa_r_overflow.cpp&lt;/code&gt; &lt;/td&gt;&lt;td&gt;19 checks &lt;/td&gt;&lt;td&gt;Wycheproof PR #206 r-overflow class&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;strong&gt;EIP-712 KAT&lt;/strong&gt; &lt;/td&gt;&lt;td&gt;12 tests &lt;/td&gt;&lt;td&gt;Typed structured data, 13 assertions&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h4 id=&quot;python-dynamic-audit-suite-9-ctest-targets-&quot;&gt;Python Dynamic Audit Suite (9 CTest targets)&lt;/h4&gt;
&lt;p&gt;All powered by &lt;code&gt;--lib path/to/libufsecp.so&lt;/code&gt;, integrated in CI and &lt;code&gt;unified_audit_runner&lt;/code&gt;:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;CTest target &lt;/th&gt;&lt;th&gt;Checks &lt;/th&gt;&lt;th&gt;What it catches&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_differential_crossimpl&lt;/code&gt; &lt;/td&gt;&lt;td&gt;1000+ &lt;/td&gt;&lt;td&gt;Wrong low-S, pubkey parity bugs, ECDH mismatches (vs coincurve + python-ecdsa)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_nonce_bias&lt;/code&gt; &lt;/td&gt;&lt;td&gt;10,000+ ops &lt;/td&gt;&lt;td&gt;Chi-squared + KS + per-bit sweep (Minerva/TPM-FAIL-class biases)&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_rfc6979_spec&lt;/code&gt; &lt;/td&gt;&lt;td&gt;200+ &lt;/td&gt;&lt;td&gt;Independent RFC 6979 §3.2 HMAC-SHA256 nonce derivation + Appendix A.2.5 KAT&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_bip32_cka&lt;/code&gt; &lt;/td&gt;&lt;td&gt;— &lt;/td&gt;&lt;td&gt;Live BIP-32 parent key recovery demo + hardened immunity&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_glv_exhaustive&lt;/code&gt; &lt;/td&gt;&lt;td&gt;5000+ scalars &lt;/td&gt;&lt;td&gt;GLV decomposition — adversarial Babai-boundary scalars vs coincurve reference&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_semantic_props&lt;/code&gt; &lt;/td&gt;&lt;td&gt;1450+ &lt;/td&gt;&lt;td&gt;Algebraic properties (kG+lG==(k+l)G), roundtrip, determinism, Hypothesis&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_invalid_input_grammar&lt;/code&gt; &lt;/td&gt;&lt;td&gt;37 &lt;/td&gt;&lt;td&gt;Structured rejection — bad prefix, x≥p, sk=0/n, r=0/s=0, invalid BIP-32 paths&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_stateful_sequences&lt;/code&gt; &lt;/td&gt;&lt;td&gt;401+ &lt;/td&gt;&lt;td&gt;Error-injection recovery, BIP-32 multi-level consistency, 5000-op endurance&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;py_dev_bug_scan&lt;/code&gt; &lt;/td&gt;&lt;td&gt;221 files &lt;/td&gt;&lt;td&gt;15-category static scanner: NULL, CPASTE, SIG, RETVAL, MSET, OB1, ZEROIZE, …&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ClusterFuzzLite&lt;/strong&gt; expanded to 5 targets: added &lt;code&gt;fuzz_ecdsa.cpp&lt;/code&gt; (sign→verify invariant, wrong-msg, compact parse) and &lt;code&gt;fuzz_schnorr.cpp&lt;/code&gt; (BIP-340 sign→verify, adversarial from_bytes).&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;performance&quot;&gt;Performance&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Path &lt;/th&gt;&lt;th&gt;Before &lt;/th&gt;&lt;th&gt;After &lt;/th&gt;&lt;th&gt;Delta&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;CUDA ECDSA Sign (w=8 generator table) &lt;/td&gt;&lt;td&gt;220.9 ns &lt;/td&gt;&lt;td&gt;198.3 ns &lt;/td&gt;&lt;td&gt;&lt;strong&gt;−10.2%&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;CUDA/OpenCL/Metal MSM (GLV Shamir w=1 scatter) &lt;/td&gt;&lt;td&gt;baseline &lt;/td&gt;&lt;td&gt;+18–24% &lt;/td&gt;&lt;td&gt;&lt;strong&gt;+18–24%&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;ARM64 ECDSA Sign (SHA-2 HW accel) &lt;/td&gt;&lt;td&gt;25.89 µs &lt;/td&gt;&lt;td&gt;22.22 µs &lt;/td&gt;&lt;td&gt;&lt;strong&gt;−14.2%&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;ARM64 Schnorr Sign (precomputed) &lt;/td&gt;&lt;td&gt;17.73 µs &lt;/td&gt;&lt;td&gt;16.67 µs &lt;/td&gt;&lt;td&gt;&lt;strong&gt;−6.0%&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Bulletproof MSM verifier &lt;/td&gt;&lt;td&gt;5,079 µs &lt;/td&gt;&lt;td&gt;2,634 µs &lt;/td&gt;&lt;td&gt;&lt;strong&gt;−48% (1.93×)&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;CPU KPlan zero-alloc (stack wnaf arrays) &lt;/td&gt;&lt;td&gt;heap &lt;/td&gt;&lt;td&gt;stack &lt;/td&gt;&lt;td&gt;alloc eliminated&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;BIP-352 SHA-256 tag midstate &lt;/td&gt;&lt;td&gt;per-call &lt;/td&gt;&lt;td&gt;precomputed &lt;/td&gt;&lt;td&gt;hash call eliminated&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;&lt;code&gt;precompute&lt;/code&gt; (scalar_mul_generator) &lt;/td&gt;&lt;td&gt;2 heap allocs &lt;/td&gt;&lt;td&gt;0 &lt;/td&gt;&lt;td&gt;&lt;strong&gt;zero-alloc hot path&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h4 id=&quot;zero-knowledge-proof-layer-new-&quot;&gt;Zero-Knowledge Proof Layer (new)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Knowledge proofs&lt;/strong&gt; — non-interactive Schnorr PoK, Fiat-Shamir with tagged SHA-256, no trusted setup.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;DLEQ proofs&lt;/strong&gt; — discrete log equality, batch-verify capable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bulletproof range proofs&lt;/strong&gt; — 64-bit range, MSM-optimized verifier (Pippenger + Montgomery batch inversion).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GPU ZK&lt;/strong&gt;: CUDA CT kernels (&lt;code&gt;ct_zk.cuh&lt;/code&gt;), OpenCL (&lt;code&gt;secp256k1_zk.cl&lt;/code&gt;), Metal (kernels 19–22), all batch-capable.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;5 new GPU C ABI functions&lt;/strong&gt;: &lt;code&gt;ufsecp_gpu_zk_knowledge_verify_batch&lt;/code&gt;, &lt;code&gt;ufsecp_gpu_zk_dleq_verify_batch&lt;/code&gt;, &lt;code&gt;ufsecp_gpu_bulletproof_verify_batch&lt;/code&gt;, &lt;code&gt;ufsecp_gpu_bip324_aead_encrypt_batch&lt;/code&gt;, &lt;code&gt;ufsecp_gpu_bip324_aead_decrypt_batch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;24 tests&lt;/strong&gt; in &lt;code&gt;test_zk.cpp&lt;/code&gt;; &lt;strong&gt;8.5 benchmarks&lt;/strong&gt; in &lt;code&gt;bench_unified&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;full-gpu-parity-zero-unsupported-stubs-&quot;&gt;Full GPU Parity (zero Unsupported stubs)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Bulletproof on OpenCL + Metal&lt;/strong&gt;: removed &lt;code&gt;#if 0&lt;/code&gt; guard in &lt;code&gt;secp256k1_zk.cl&lt;/code&gt;; fixed address-space qualifiers; wired &lt;code&gt;bulletproof_verify_batch&lt;/code&gt; on both backends. CUDA ↔ OpenCL ↔ Metal parity complete.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;4 new OpenCL kernels&lt;/strong&gt; wired: &lt;code&gt;zk_knowledge_verify_batch&lt;/code&gt;, &lt;code&gt;zk_dleq_verify_batch&lt;/code&gt;, &lt;code&gt;bip324_aead_encrypt_batch&lt;/code&gt;, &lt;code&gt;bip324_aead_decrypt_batch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;4 Metal kernels connected&lt;/strong&gt;: same 4 operations — kernels existed but dispatch was unwired.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Metal ZK fix&lt;/strong&gt;: &lt;code&gt;zk_knowledge_verify_batch&lt;/code&gt; was treating pubkey buffer as a scalar; corrected to &lt;code&gt;lift_x&lt;/code&gt; to recover full point.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CUDA 13 compatibility&lt;/strong&gt;: replaced deprecated &lt;code&gt;cudaDeviceProp::clockRate&lt;/code&gt; / &lt;code&gt;::memoryClockRate&lt;/code&gt; with &lt;code&gt;cudaDeviceGetAttribute&lt;/code&gt;. Backward-compatible with CUDA 12. (RTX 5080 / CUDA 13 reported by @craigraw)&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;wallet-api-amp-address-formats-new-&quot;&gt;Wallet API &amp;amp; Address Formats (new)&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Unified Wallet API&lt;/strong&gt; (&lt;code&gt;wallet.hpp&lt;/code&gt;/&lt;code&gt;wallet.cpp&lt;/code&gt;) — chain-agnostic key management, address generation, message signing, pubkey recovery — Bitcoin, Ethereum, Tron, and all 28 coins from a single &lt;code&gt;wallet::&lt;/code&gt; namespace.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;BIP-39 Mnemonic&lt;/strong&gt; (&lt;code&gt;bip39.hpp&lt;/code&gt;/&lt;code&gt;bip39.cpp&lt;/code&gt;) — entropy→mnemonic (12–24 words), validation, PBKDF2-HMAC-SHA512 seed derivation. 57 tests.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Bitcoin message signing&lt;/strong&gt; (&lt;code&gt;message_signing.hpp&lt;/code&gt;) — BIP-137/Electrum compatible: sign, verify, recover, Base64.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;P2SH-P2WPKH&lt;/strong&gt; (nested SegWit, BIP-49) — &lt;code&gt;3...&lt;/code&gt; addresses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;P2SH&lt;/strong&gt; and &lt;strong&gt;P2WSH&lt;/strong&gt; primitives.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;CashAddr&lt;/strong&gt; (BIP-0185) — &lt;code&gt;bitcoincash:q...&lt;/code&gt; addresses.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tron (TRX)&lt;/strong&gt; coin — coin_type=195, &lt;code&gt;0x41&lt;/code&gt; prefix + Keccak-256 + Base58Check. Now &lt;strong&gt;28 coins&lt;/strong&gt; total.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;bindings&quot;&gt;Bindings&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Stable validation closure&lt;/strong&gt; across 11 language bindings: C#, Java, Swift, Python, Go, Rust, Node.js, PHP, Ruby, Dart, React Native. Fixed wrapper/API drift, zero-length FFI buffer edge cases, Dart &lt;code&gt;NativeFinalizer&lt;/code&gt;, local Dart smoke-runner.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h4 id=&quot;audit-coverage-summary&quot;&gt;Audit Coverage Summary&lt;/h4&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;&lt;th&gt;Surface &lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;&lt;td&gt;C ABI functions (&lt;code&gt;ufsecp_*&lt;/code&gt;) &lt;/td&gt;&lt;td&gt;155&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;GPU C ABI functions (&lt;code&gt;ufsecp_gpu_*&lt;/code&gt;) &lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Unified audit runner modules &lt;/td&gt;&lt;td&gt;70&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Python CTest audit targets &lt;/td&gt;&lt;td&gt;9&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;ClusterFuzz targets &lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Exploit PoC test files &lt;/td&gt;&lt;td&gt;13&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td&gt;Active GPU Unsupported stubs &lt;/td&gt;&lt;td&gt;&lt;strong&gt;0&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;hr&gt;
&lt;h4 id=&quot;ci-cd&quot;&gt;CI/CD&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;All jobs green on: &lt;strong&gt;Linux (GCC + Clang), macOS (arm64 + amd64), Windows, Android (ARM64), RISC-V, ARM64 cross, ROCm, CUDA&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Fixed: macOS &lt;code&gt;externally-managed-environment&lt;/code&gt;, Windows Unicode &lt;code&gt;cp1252&lt;/code&gt;, Python-order CMake embed, ASan/MSan/TSan &lt;code&gt;py_*&lt;/code&gt; symbol issue, SonarCloud &lt;code&gt;coincurve&lt;/code&gt; missing.&lt;/li&gt;
&lt;li&gt;10 CodeQL code-scanning alerts resolved.&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;p&gt;&lt;strong&gt;Full diff&lt;/strong&gt;: &lt;code&gt;v3.50.0...v3.60.0&lt;/code&gt;&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/13974/ultrafastsecp256k1-v3-60</guid>
<pubDate>Sat, 04 Apr 2026 16:57:36 +0000</pubDate>
</item>
<item>
<title>Don’t Trust, Verify  Continuously: UltrafastSecp256k1 Meets Frigate</title>
<link>https://coderlegion.com/13826/dont-trust-verify-continuously-ultrafastsecp256k1-meets-frigate</link>
<description>&lt;h3 id=&quot;introduction&quot;&gt;Introduction&lt;/h3&gt;
&lt;p&gt;Most cryptographic libraries rely on a simple model:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;write code&lt;/li&gt;
&lt;li&gt;get audited once&lt;/li&gt;
&lt;li&gt;ship a PDF&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;But modern systems don’t stand still.&lt;br&gt;
They evolve daily.&lt;/p&gt;
&lt;p&gt;So I asked a different question:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;What if audit was not a document, but a continuous process?&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;the-idea&quot;&gt;The Idea&lt;/h3&gt;
&lt;p&gt;UltrafastSecp256k1 was designed around two principles:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;High-performance cryptographic execution (CPU + GPU)&lt;/li&gt;
&lt;li&gt;Continuous, self-evolving audit system&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Instead of relying on one-time audits, the system:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;runs ~1M+ checks per audit&lt;/li&gt;
&lt;li&gt;performs nightly differential validation&lt;/li&gt;
&lt;li&gt;converts every discovered exploit into a permanent test&lt;/li&gt;
&lt;li&gt;uses AI-assisted adversarial analysis&lt;/li&gt;
&lt;li&gt;enforces correctness through CI&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Security is not declared — it is continuously verified.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;real-world-adoption-frigate&quot;&gt;Real-World Adoption: Frigate&lt;/h3&gt;
&lt;p&gt;Recently, Sparrow Wallet’s &lt;strong&gt;Frigate&lt;/strong&gt; integrated UltrafastSecp256k1 as its core compute layer.&lt;/p&gt;
&lt;p&gt;Frigate is an experimental Silent Payments (BIP352) server that performs high-throughput blockchain scanning using DuckDB.&lt;/p&gt;
&lt;p&gt;Instead of treating cryptography as a separate layer, Frigate embeds it directly into the database via a custom extension:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;ufsecp.duckdb_extension&lt;/li&gt;
&lt;li&gt;ufsecp_scan(...)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This extension is powered by UltrafastSecp256k1.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;performance-in-practice&quot;&gt;Performance in Practice&lt;/h3&gt;
&lt;p&gt;Independent benchmarks from Frigate show:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;~40 million operations/sec on 2 RTX 5090&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This is not a synthetic benchmark —&lt;br&gt;
it’s a real-world scanning pipeline.&lt;/p&gt;
&lt;p&gt;Source:&lt;br&gt;
&lt;a rel=&quot;nofollow&quot; href=&quot;https://github.com/sparrowwallet/frigate/blob/master/README.md&quot;&gt;https://github.com/sparrowwallet/frigate/blob/master/README.md&lt;/a&gt;&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;why-this-matters&quot;&gt;Why This Matters&lt;/h3&gt;
&lt;p&gt;This is not about “fastest library” claims.&lt;/p&gt;
&lt;p&gt;This is about:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;independent integration&lt;/li&gt;
&lt;li&gt;real-world validation&lt;/li&gt;
&lt;li&gt;reproducible performance&lt;/li&gt;
&lt;li&gt;continuous verification&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;No contracts.&lt;br&gt;
No paid audits.&lt;br&gt;
No marketing.&lt;/p&gt;
&lt;p&gt;Just:&lt;/p&gt;
&lt;blockquote&gt;&lt;p&gt;clone → build → run → verify&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;rethinking-audit&quot;&gt;Rethinking Audit&lt;/h3&gt;
&lt;p&gt;Traditional model:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;audit = event&lt;/li&gt;
&lt;li&gt;output = PDF&lt;/li&gt;
&lt;li&gt;trust = assumption&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;This model:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;audit = process&lt;/li&gt;
&lt;li&gt;output = evidence&lt;/li&gt;
&lt;li&gt;trust = reproducibility&lt;/li&gt;
&lt;/ul&gt;
&lt;hr&gt;
&lt;h3 id=&quot;final-thought&quot;&gt;Final Thought&lt;/h3&gt;
&lt;p&gt;If a system cannot be verified continuously,&lt;br&gt;
it is only temporarily trusted.&lt;/p&gt;
&lt;p&gt;UltrafastSecp256k1 is an attempt to change that.&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/13826/dont-trust-verify-continuously-ultrafastsecp256k1-meets-frigate</guid>
<pubDate>Wed, 01 Apr 2026 20:35:03 +0000</pubDate>
</item>
<item>
<title>Bark &amp; Ark: A Deep Dive into Bitcoin's Most Ambitious Payment Layer</title>
<link>https://coderlegion.com/12938/bark-ark-a-deep-dive-into-bitcoins-most-ambitious-payment-layer</link>
<description>&lt;blockquote&gt;&lt;p&gt;&lt;em&gt;A comprehensive technical and philosophical breakdown of what Ark is, how Bark implements it natively on Bitcoin, why it matters, and what could still go wrong.&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h3 id=&quot;table-of-contents&quot;&gt;Table of Contents&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#1-the-problem-space&quot;&gt;The Problem Space — Why Bitcoin Needs More Than Lightning&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#2-ark-fundamentals&quot;&gt;Ark Fundamentals — The Original Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#3-bark-specifically&quot;&gt;Bark Specifically — What Second.tech Built and Why&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#4-technical-deep-dive&quot;&gt;Technical Deep Dive — How It Actually Works&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#5-lightning-vs-arkbark&quot;&gt;Lightning vs Ark/Bark — Complement, Not Competition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#6-the-bitcoin-native-philosophy&quot;&gt;The Bitcoin-Native Philosophy — Why No Liquid, No Bridges, No Soft Fork Required&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a rel=&quot;nofollow&quot; href=&quot;#7-risks-and-failure-modes&quot;&gt;Risks and Failure Modes — The Honest Breakdown&lt;/a&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h3 id=&quot;1-the-problem-space&quot;&gt;1. The Problem Space&lt;/h3&gt;
&lt;h4 id=&quot;bitcoin-s-fundamental-scaling-constraint&quot;&gt;Bitcoin's Fundamental Scaling Constraint&lt;/h4&gt;
&lt;p&gt;To understand why Bark was built at all, you first need to understand the ceiling Bitcoin runs into as a payment system. Bitcoin's blockchain can process roughly &lt;strong&gt;3 to 7 transactions per second&lt;/strong&gt;, a number determined by two hard constraints that were baked into the protocol from the beginning: a block time of approximately 10 minutes, and a block size capped at 1 megabyte.&lt;/p&gt;
&lt;p&gt;Contrast that with Visa, which processes around 24,000 transactions per second at peak demand. For Bitcoin to function as a global payment layer used by billions of people, on-chain transactions alone can never get you there. That gap isn't a bug waiting to be patched, it's a fundamental design trade-off that Bitcoin made in exchange for decentralization and security. Bigger blocks mean fewer people can run full nodes, which means more centralization. Bitcoin's community has consistently chosen to preserve that decentralization, which means the base layer will always be a bottleneck at scale.&lt;/p&gt;
&lt;p&gt;This is not a failing. It is a deliberate architectural choice. But it does create a genuine engineering problem: if billions of people can't settle transactions on-chain, what do they use instead?&lt;/p&gt;
&lt;h4 id=&quot;what-lightning-solved-and-what-it-didn-t&quot;&gt;What Lightning Solved — and What It Didn't&lt;/h4&gt;
&lt;p&gt;The Lightning Network, first described in a 2015 whitepaper by Joseph Poon and Thaddeus Dryja and launched in 2018, was Bitcoin's first serious answer to this question. The core idea is elegant: instead of recording every payment on the blockchain, two parties lock funds into a shared &quot;payment channel&quot; with a single on-chain transaction. They can then make as many payments as they want between themselves off-chain, updating their shared balance instantly and for near-zero cost. When they're done, they close the channel with one more on-chain transaction, and the final balance gets settled.&lt;/p&gt;
&lt;p&gt;The genius of Lightning is that it extends this concept to a &lt;em&gt;network&lt;/em&gt;. You don't need a direct channel with everyone you want to pay, you just need a connected path through the network. Alice can pay Dave by routing through Bob and Carol, with each hop atomically updating channel balances. In theory, this allows millions of transactions per second with no practical upper bound on throughput.&lt;/p&gt;
&lt;p&gt;In practice, Lightning has delivered real results. By mid-2024, Lightning accounted for over 16% of all Bitcoin orders processed by European crypto payments processor CoinGate, up from around 6.5% just two years earlier. Routed payments on Lightning increased 1,212% between 2021 and 2023, according to River's Lightning report. Major integrations, Coinbase adding Lightning support in 2024, widespread wallet adoption across Africa, Latin America, and Asia, have proven that Lightning works and is growing.&lt;/p&gt;
&lt;p&gt;But years of real-world deployment have also exposed structural friction points that don't disappear with more engineering. These aren't edge cases, they are fundamental properties of the channel-based model:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Inbound Liquidity Problem.&lt;/strong&gt; To receive a Lightning payment, someone else must have already committed bitcoin &lt;em&gt;into a channel pointed toward you&lt;/em&gt;. If you're a new user or a new merchant, that liquidity doesn't exist yet. You can't just show up and start receiving. You either have to pay a Lightning Service Provider (LSP) to open a channel toward you, or you have to find someone willing to do it. This is confusing and counterintuitive to new users, and it creates friction during onboarding that has measurably slowed adoption.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Channel Management Complexity.&lt;/strong&gt; Channels have finite capacity on both sides. If you exhaust the outbound capacity of your channel, you can't send until you receive more. If your inbound side runs dry, you can't receive until you send. Maintaining a &quot;balanced&quot; channel, or managing multiple channels strategically, is a continuous task that requires ongoing attention. For casual users or businesses that don't want to think about this, it's a significant burden. For developers building wallet products, it forces either custodial shortcuts or complex liquidity management code.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Online Requirement and Security Risks.&lt;/strong&gt; To route Lightning payments, a node needs to be online. This creates a liveness requirement, a technical term meaning the system requires you to be present and active. If a node goes offline and a counterparty broadcasts an outdated channel state (an attempted theft), the victim has a limited time window to detect and respond. While watchtower services mitigate this, they introduce additional trust and complexity. The attack vector is real: in 2023, Lightning developer Antoine Riard disclosed a new class of vulnerabilities called replacement cycling attacks targeting hash time-locked contracts (HTLCs), the cryptographic mechanism Lightning uses to route payments.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Routing Failure Rates.&lt;/strong&gt; Lightning payments are routed through the network by finding a path with sufficient liquidity at each hop. As networks scale, finding reliable paths becomes harder, particularly for larger payments. Routing failures cause payments to hang, retry, or fail outright. While routing algorithms have improved dramatically, payment reliability remains uneven across the network, especially for large or unusual payment amounts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The Onboarding Cost Problem.&lt;/strong&gt; Every new Lightning user needs at least one on-chain transaction to open a channel. During periods of high on-chain fees, like the 2021 and 2023 congestion spikes driven by NFT activity and Ordinals inscriptions, this cost can easily exceed the value of small payments. The channel opening fee makes Lightning economically inaccessible for users who hold small amounts of bitcoin.&lt;/p&gt;
&lt;p&gt;These aren't fatal flaws. Lightning is real, it works, and it serves hundreds of millions of dollars worth of payments. But collectively, these constraints define the population of users Lightning can't serve well: new users without existing channels, users in low-trust environments where custodial trade-offs are unacceptable, and users in regions where on-chain fees represent a significant financial barrier to entry.&lt;/p&gt;
&lt;p&gt;That gap, self-custodial payments for users who can't or won't manage channels, liquidity, and routing complexity, is exactly the problem Ark was designed to solve.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;2-ark-fundamentals&quot;&gt;2. Ark Fundamentals&lt;/h3&gt;
&lt;h4 id=&quot;the-origin-story&quot;&gt;The Origin Story&lt;/h4&gt;
&lt;p&gt;In May 2023, a developer named Burak Keceli — known in the Bitcoin community simply as &quot;Burak&quot; — published a proposal to the bitcoin-dev mailing list under the placeholder title &quot;TBDXXX.&quot; He had previously been dissatisfied with both Blockstream's Liquid sidechain (which requires a permissioned federation) and the Lightning Network (with its liquidity and privacy constraints). Ark, as the protocol was soon renamed, was his attempt to design a second layer that eliminated those frustrations while remaining fully self-custodial.&lt;/p&gt;
&lt;p&gt;Burak's core insight was that Lightning's fundamental limitation isn't the &lt;em&gt;idea&lt;/em&gt; of off-chain payments, it's the &lt;em&gt;channel model&lt;/em&gt; itself. Channels require pre-allocated, per-user liquidity. They require both parties to be online. They require routing. What if instead, you could take Bitcoin's UTXO model, which is already beautifully simple and doesn't require any of those things, and extend it off-chain?&lt;/p&gt;
&lt;h4 id=&quot;the-shared-utxo-concept&quot;&gt;The Shared UTXO Concept&lt;/h4&gt;
&lt;p&gt;To understand Ark, you first need to understand what a UTXO is. In Bitcoin, every time you receive a payment, it creates a new &quot;Unspent Transaction Output&quot; (UTXO), essentially a chunk of bitcoin locked to your address that only your private key can spend. When you want to pay someone, you spend that UTXO as an input to a new transaction, and new UTXOs are created as outputs.&lt;/p&gt;
&lt;p&gt;Ark's fundamental innovation is the &lt;strong&gt;shared UTXO&lt;/strong&gt;. Instead of each user owning their own separate UTXO on the blockchain, multiple users, potentially hundreds of thousands of them, share a single on-chain UTXO. Each user holds a &lt;em&gt;virtual&lt;/em&gt; claim on their portion of that shared pool, represented by what Ark calls a &lt;strong&gt;Virtual Transaction Output (VTXO)&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;&lt;img src=&quot;https://dev-to-uploads.s3.amazonaws.com/uploads/articles/j5yisuyf0mbe2mjar7si.png&quot; alt=&quot;VTXOs the Shared UTXO concept&quot;&gt;&lt;/p&gt;
&lt;p&gt;From the blockchain's perspective, there is one UTXO. From the users' perspective, they each have their own independently spendable balance.&lt;/p&gt;
&lt;p&gt;The elegance of this is immediately apparent from a fee perspective. One on-chain transaction can anchor the funds of a thousand users. The cost of that transaction is split across all of them, making each user's effective on-chain footprint vanishingly small.&lt;/p&gt;
&lt;h4 id=&quot;what-is-a-vtxo-&quot;&gt;What Is a VTXO?&lt;/h4&gt;
&lt;p&gt;A VTXO (Virtual Transaction Output) is the central unit of value on Ark. The most accurate way to think about it is this: a VTXO is a &lt;em&gt;pre-signed, off-chain transaction that proves you have the right to create a real on-chain UTXO whenever you want to&lt;/em&gt;.&lt;/p&gt;
&lt;p&gt;You never need to broadcast it. You simply hold it. If everything goes well, if the Ark server keeps operating, if your counterparty doesn't try to cheat, the VTXO stays off-chain forever, and you just keep transacting within Ark. But if anything goes wrong, you can take that pre-signed transaction to the Bitcoin blockchain and claim your sats as a real, fully confirmed UTXO. No one can stop you.&lt;/p&gt;
&lt;p&gt;This unilateral exit capability is what makes Ark genuinely self-custodial rather than custodial or federated. You are not trusting the Ark server to &lt;em&gt;hold your money&lt;/em&gt;. The server cannot take your money. It can at most inconvenience you by going offline, in which case you exit unilaterally to the base layer.&lt;/p&gt;
&lt;h4 id=&quot;the-vtxo-tree-how-shared-utxos-are-built&quot;&gt;The VTXO Tree: How Shared UTXOs Are Built&lt;/h4&gt;
&lt;p&gt;Here's the clever part of the construction. When an Ark server wants to anchor the funds of a large group of users, it doesn't just lock a pile of bitcoin into one massive multi-signature address. That would create a problem: if any user wanted to unilaterally exit, they'd need everyone else to cooperate.&lt;/p&gt;
&lt;p&gt;Instead, Ark builds a &lt;strong&gt;tree of pre-signed transactions&lt;/strong&gt;. Think of it like a binary tree. At the root is a single on-chain UTXO — the shared output. This UTXO has a covenant (more on how this works without soft forks later) that says: &quot;the only valid ways to spend this UTXO are the pre-signed transactions we've already prepared.&quot; Each internal node of the tree is a pre-signed transaction that splits the previous output into two. Each leaf of the tree is a pre-signed transaction that delivers a specific amount to a specific user.&lt;/p&gt;
&lt;p&gt;To exit, a user broadcasts their &lt;em&gt;branch&lt;/em&gt;, the chain of pre-signed transactions starting from the shared UTXO down to their leaf. Only their branch goes on-chain. Other users' branches stay off-chain.&lt;/p&gt;
&lt;p&gt;The trade-off: an individual exit is more expensive than a direct UTXO spend, because you're broadcasting multiple transactions. But this is far more efficient than having everyone exit simultaneously, which would be catastrophic for blockspace and fees. The tree structure allows individual users to exit independently without forcing everyone else to do the same.&lt;/p&gt;
&lt;h4 id=&quot;the-asp-ark-service-provider&quot;&gt;The ASP: Ark Service Provider&lt;/h4&gt;
&lt;p&gt;Coordinating all of this, building the VTXO trees, batching users together, providing liquidity, managing rounds, is the job of the &lt;strong&gt;Ark Service Provider (ASP)&lt;/strong&gt;. The ASP is a server that users connect to in order to participate in Ark. It is always online, provides the liquidity that backs new VTXO issuance, and coordinates the periodic &quot;rounds&quot; that settle the off-chain payment activity into new on-chain transactions.&lt;/p&gt;
&lt;p&gt;Critically, the ASP is &lt;em&gt;not&lt;/em&gt; a custodian. It cannot steal your bitcoin. Its role is purely coordinative and operational. Users sign their own exit transactions before any of their funds are committed, so the ASP never has unilateral access to user funds. This is architecturally closer to how a Lightning node operates (where you remain in custody of your keys) than how an exchange or custodial wallet operates (where they hold your funds on your behalf).&lt;/p&gt;
&lt;p&gt;The ASP does have some power, though: it can &lt;em&gt;refuse to serve you&lt;/em&gt;. It can decline to include you in rounds, effectively making you unable to transact within Ark. But it cannot take your money, you can always exit unilaterally.&lt;/p&gt;
&lt;h4 id=&quot;how-rounds-work&quot;&gt;How Rounds Work&lt;/h4&gt;
&lt;p&gt;An Ark round is the periodic batch event that anchors off-chain activity to the Bitcoin blockchain. Here's the sequence:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;The ASP announces the start of a round.&lt;/li&gt;
&lt;li&gt;Users who want to participate: to refresh their VTXOs, make payments, or onboard, communicate to the ASP what they want.&lt;/li&gt;
&lt;li&gt;The ASP constructs a new VTXO tree containing all the requested new outputs.&lt;/li&gt;
&lt;li&gt;All participating users sign the tree (and their associated &quot;forfeit transactions&quot; — more on this below).&lt;/li&gt;
&lt;li&gt;The ASP broadcasts the root transaction on-chain, permanently anchoring this round's state to Bitcoin.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Every round produces a single on-chain transaction. Whether ten users participated or ten thousand, the blockchain sees one output. That is the fundamental efficiency of the model.&lt;/p&gt;
&lt;h4 id=&quot;the-forfeit-transaction-how-trust-is-maintained&quot;&gt;The Forfeit Transaction: How Trust Is Maintained&lt;/h4&gt;
&lt;p&gt;There's a subtle problem in the above flow. When a user is receiving a new VTXO in a round, what stops them from simultaneously trying to broadcast their &lt;em&gt;old&lt;/em&gt; VTXO to claim their funds on-chain while also getting the new VTXO? This would be double-spending.&lt;/p&gt;
&lt;p&gt;Ark prevents this through &lt;strong&gt;forfeit transactions&lt;/strong&gt;. Before the new VTXO tree is finalized, the user signs a transaction saying &quot;if my old VTXO ever appears on-chain, the ASP gets to claim it.&quot; This is the forfeit. The ASP keeps the signed forfeit. If the user misbehaves, by broadcasting their old VTXO after they've already gotten a new one, the ASP can immediately claim the old UTXO as compensation.&lt;/p&gt;
&lt;p&gt;The atomicity guarantee works in the other direction too, via &lt;strong&gt;connector outputs&lt;/strong&gt;. The user's forfeit transaction is only valid if the ASP actually published the new round transaction on-chain. If the ASP fails to do so, the forfeit transaction is invalid, and the user loses nothing.&lt;/p&gt;
&lt;h4 id=&quot;out-of-round-payments-arkoor-&quot;&gt;Out-of-Round Payments (ArkOOR)&lt;/h4&gt;
&lt;p&gt;Rounds are powerful but not instant, users have to wait for the next round to begin, which could be minutes or hours depending on ASP configuration. For cases where speed matters more than maximum trustlessness, Ark supports &lt;strong&gt;out-of-round payments&lt;/strong&gt;, often written as &quot;arkoor.&quot;&lt;/p&gt;
&lt;p&gt;In an arkoor payment, Alice transfers her VTXO directly to Bob without waiting for a round. She signs a transaction passing her VTXO to Bob. The ASP co-signs to confirm it won't double-spend. Bob receives immediately, nearly instantly, with just one round-trip to the server.&lt;/p&gt;
&lt;p&gt;The trade-off: Bob must trust that Alice and the ASP aren't colluding to double-spend. This is a different security model than an in-round payment. If Bob is worried, he can &quot;refresh&quot; his arkoor VTXO in the next round, upgrading it to full trustlessness.&lt;/p&gt;
&lt;p&gt;This two-tier system, fast arkoor payments for everyday use, in-round payments for full trustlessness, is one of the most pragmatic design choices in the protocol.&lt;/p&gt;
&lt;hr&gt;
&lt;h3 id=&quot;3-bark-specifically&quot;&gt;3. Bark Specifically&lt;/h3&gt;
&lt;h4 id=&quot;who-is-second-tech-&quot;&gt;Who Is Second.tech?&lt;/h4&gt;
&lt;p&gt;Second is a Belgium-based Bitcoin company whose stated mission is to bring self-custodial Bitcoin payments to billions of people. Their CEO is &lt;strong&gt;Steven Roose&lt;/strong&gt;, a Bitcoin developer with deep roots in the ecosystem. The team decided early on that Ark was the most promising protocol architecture for solving the onboarding and liquidity problems that have held back self-custodial Lightning adoption, and they went all-in on building it.&lt;/p&gt;
&lt;p&gt;Bark is the name of Second's implementation of the Ark protocol. It is written in Rust, hosted on GitLab, and designed to be used both as a standalone CLI wallet (for testing and development) and as a library that developers can integrate into their own applications via FFI (Foreign Function Interface) bindings.&lt;/p&gt;
&lt;p&gt;The name &quot;Bark&quot; is a playful reference, Ark, plus the sound a dog makes, because why not. Their ASP server implementation is called &lt;strong&gt;captaind&lt;/strong&gt; (the captain of the Ark, presumably).&lt;/p&gt;
&lt;h4 id=&quot;what-bark-inherits-from-ark&quot;&gt;What Bark Inherits from Ark&lt;/h4&gt;
&lt;p&gt;Bark is fundamentally an implementation of the Ark protocol design. Everything described in the previous section, VTXOs, VTXO trees, ASPs, rounds, forfeit transactions, connector outputs, arkoor payments, Bark implements all of it. The core protocol design is not Second's invention; it evolved from Burak's original proposal through a community design process.&lt;/p&gt;
&lt;p&gt;Bark inherits from Ark:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The &lt;strong&gt;shared UTXO model&lt;/strong&gt; as the primary scaling primitive.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;VTXO abstraction&lt;/strong&gt; — off-chain ownership claims with on-chain exit guarantees.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;tree-based transaction structure&lt;/strong&gt; that enables individual exits without group coordination.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;ASP coordination model&lt;/strong&gt; — centralized coordination with non-custodial guarantees.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;rounds mechanism&lt;/strong&gt; for periodic on-chain settlement.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;arkoor (out-of-round) payment mechanism&lt;/strong&gt; for instant off-chain transfers.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;Lightning interoperability design&lt;/strong&gt; — the ASP acts as a Lightning gateway, enabling users to pay any Lightning invoice directly from their Ark balance.&lt;/li&gt;
&lt;li&gt;The &lt;strong&gt;unilateral exit guarantee&lt;/strong&gt; — users can always retrieve their funds on-chain without ASP cooperation.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4 id=&quot;the-pivotal-decision-bitcoin-only-no-soft-fork-required&quot;&gt;The Pivotal Decision: Bitcoin-Only, No Soft Fork Required&lt;/h4&gt;
&lt;p&gt;Here's where Bark diverges significantly from the original Ark vision and from other implementations. The original Ark design, as proposed by Burak, required &lt;strong&gt;covenants&lt;/strong&gt;, a Bitcoin scripting primitive that doesn't currently exist in Bitcoin's protocol.&lt;/p&gt;
&lt;p&gt;Specifically, the original Ark needed &lt;strong&gt;OP_CHECKTEMPLATEVERIFY (CTV)&lt;/strong&gt;, a proposed opcode defined in BIP 119. CTV would allow a transaction output to specify exactly which future transactions are allowed to spend it, a &quot;covenant&quot; constraining how funds can be moved. With CTV, you could build the VTXO tree natively: the root UTXO's script would encode the entire tree structure, making it deterministic and tamper-proof without requiring any signatures.&lt;/p&gt;
&lt;p&gt;The problem: CTV doesn't exist in Bitcoin yet. It's been a contentious proposed soft fork for years. Getting changes into Bitcoin's consensus rules requires persuading the global community of node operators and miners, a process that has historically been slow, contentious, and deeply political. The Bitcoin community does not accept protocol changes lightly, and for good reason.&lt;/p&gt;
&lt;p&gt;Second's decision was bold: &lt;strong&gt;build Ark on Bitcoin today, without waiting for any consensus changes&lt;/strong&gt;.&lt;/p&gt;
&lt;p&gt;This required solving a fundamental problem. Without CTV, how do you make the VTXO tree tamper-proof? The answer they implemented is called &lt;strong&gt;clArk&lt;/strong&gt; (covenant-less Ark), and it uses pre-signed transactions and multi-party signing to simulate what a covenant would do natively.&lt;/p&gt;
&lt;p&gt;The clArk approach: instead of a covenant that mechanically enforces the tree structure, all users who are participating in a given round collectively sign the VTXO tree using &lt;strong&gt;n-of-n multi-signature&lt;/strong&gt; via MuSig2. Because every participant has signed the tree, and any single participant can refuse to sign a conflicting transaction, the tree is effectively locked, not by a covenant, but by collective cryptographic commitment.&lt;/p&gt;
&lt;p&gt;This is what Second's documentation describes as a &quot;pseudo-covenant&quot;: it achieves the same&lt;/p&gt;
</description>
<category>Articles</category>
<guid isPermaLink="true">https://coderlegion.com/12938/bark-ark-a-deep-dive-into-bitcoins-most-ambitious-payment-layer</guid>
<pubDate>Mon, 16 Mar 2026 12:26:35 +0000</pubDate>
</item>
</channel>
</rss>