<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Jeremy Green</title>
    <description>The latest articles on DEV Community by Jeremy Green (@jeremy_green_9a8ffa2cbccd).</description>
    <link>https://dev.to/jeremy_green_9a8ffa2cbccd</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4211806%2F63398f94-5684-4c65-9569-1351e3e0ce64.jpg</url>
      <title>DEV Community: Jeremy Green</title>
      <link>https://dev.to/jeremy_green_9a8ffa2cbccd</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jeremy_green_9a8ffa2cbccd"/>
    <language>en</language>
    <item>
      <title>Paying for crypto data one request at a time with x402 on Base</title>
      <dc:creator>Jeremy Green</dc:creator>
      <pubDate>Wed, 28 Oct 2026 13:03:04 +0000</pubDate>
      <link>https://dev.to/jeremy_green_9a8ffa2cbccd/paying-for-crypto-data-one-request-at-a-time-with-x402-on-base-4ibd</link>
      <guid>https://dev.to/jeremy_green_9a8ffa2cbccd/paying-for-crypto-data-one-request-at-a-time-with-x402-on-base-4ibd</guid>
      <description>&lt;p&gt;I run Blockchain IQ, a crypto research company. We sell some of our data to software agents one request at a time using the x402 payment standard, and this post shows how a call works end to end. At the end is what our integration bounty produced.&lt;/p&gt;

&lt;h2&gt;
  
  
  What x402 does
&lt;/h2&gt;

&lt;p&gt;x402 reuses the HTTP 402 "Payment Required" status. A request without payment gets a 402 response whose &lt;code&gt;PAYMENT-REQUIRED&lt;/code&gt; header states the price, the network and the asset. The client signs a USDC payment for that amount, retries the request with the signed payment, and gets the data. There is no account and no API key. Settlement is gasless for the payer.&lt;/p&gt;

&lt;p&gt;Our API settles in USDC on Base. You can see the price of every resource without a wallet: the catalogue at &lt;a href="https://www.blockchainiq.co/api/x402/v1" rel="noopener noreferrer"&gt;https://www.blockchainiq.co/api/x402/v1&lt;/a&gt; is free, and there is a free sample response at &lt;a href="https://www.blockchainiq.co/api/x402/v1/sample" rel="noopener noreferrer"&gt;https://www.blockchainiq.co/api/x402/v1/sample&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try an unpaid request
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl &lt;span class="nt"&gt;-i&lt;/span&gt; https://www.blockchainiq.co/api/x402/v1/brief
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You get &lt;code&gt;HTTP/1.1 402 Payment Required&lt;/code&gt;, a &lt;code&gt;PAYMENT-REQUIRED&lt;/code&gt; header and a short JSON error that includes the price (&lt;code&gt;$0.01&lt;/code&gt;). A 404 or an error response is never charged.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make a paid call in Node
&lt;/h2&gt;

&lt;p&gt;This is the example from our /agents page. It needs a wallet holding a little USDC on Base. A wallet that has never paid us gets its first call to &lt;code&gt;brief&lt;/code&gt; or &lt;code&gt;event-risk&lt;/code&gt; free, so the first test costs nothing; the second call is paid.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// npm install @x402/fetch @x402/evm viem&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;privateKeyToAccount&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;viem/accounts&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;wrapFetchWithPayment&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;x402Client&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;decodePaymentResponseHeader&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@x402/fetch&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ExactEvmScheme&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@x402/evm/exact/client&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;account&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;privateKeyToAccount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;AGENT_PRIVATE_KEY&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;x402Client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fromConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;schemes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;network&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;eip155:*&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;client&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;ExactEvmScheme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;account&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt;
  &lt;span class="na"&gt;spendControls&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;maxAmountPerPayment&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mf"&gt;0.6&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="c1"&gt;// dollars; refuse anything dearer&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;payFetch&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;wrapFetchWithPayment&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;payFetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://www.blockchainiq.co/api/x402/v1/event-risk?days=7&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Proof of settlement: payer, network and transaction hash.&lt;/span&gt;
&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;decodePaymentResponseHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;headers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;payment-response&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two routes are the cheapest way to test:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;brief&lt;/code&gt; costs $0.01 and returns prices and recent moves for Bitcoin, Ethereum, Solana and XRP, scheduled events in the next 48 hours, and short risk flags. It takes no parameters.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;event-risk&lt;/code&gt; costs $0.05 and returns US data releases, central bank decisions, Treasury auctions and dated crypto and regulatory milestones, seven days ahead by default, each with its official source.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keep the spend control in the snippet. It makes the client refuse a payment above the limit you set.&lt;/p&gt;

&lt;h2&gt;
  
  
  Use it from an MCP client
&lt;/h2&gt;

&lt;p&gt;We also publish an MCP server, &lt;code&gt;blockchainiq-x402-mcp&lt;/code&gt; (0.1.2, MIT licence) on npm:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx &lt;span class="nt"&gt;-y&lt;/span&gt; blockchainiq-x402-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The catalogue tools work without a wallet; the paid tools are paid by your own wallet.&lt;/p&gt;

&lt;h2&gt;
  
  
  A free index of x402 sellers
&lt;/h2&gt;

&lt;p&gt;Separately, we publish a free daily Conformance Index that sends an unpaid request to every paid x402 endpoint listed in public directories and grades the response (valid HTTP 402, x402 v2, valid payment terms, a schema): &lt;a href="https://www.blockchainiq.co/x402/index" rel="noopener noreferrer"&gt;https://www.blockchainiq.co/x402/index&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What the bounty produced
&lt;/h2&gt;

&lt;p&gt;On 23 October we offered $525 for integrations that let agents buy this data through x402. Between 24 and 26 October builders sent 22 claims. We matched each settlement hash and paying wallet to our purchase log, read each repository and its dependencies, and ran it in a clean temporary folder with install scripts off and a throwaway wallet. Twenty claims passed. Four took the slots, one each for LangChain, ElizaOS, Cloudflare Agents and Coinbase AgentKit, and all four were paid on 27 October in USDC on Base. Every repository is listed, pinned to the commit we ran: &lt;a href="https://www.blockchainiq.co/blog/x402-integrations-from-the-build-bounty" rel="noopener noreferrer"&gt;https://www.blockchainiq.co/blog/x402-integrations-from-the-build-bounty&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Our data is market data and analysis, not investment advice.&lt;/p&gt;

</description>
      <category>web3</category>
      <category>ai</category>
      <category>api</category>
      <category>node</category>
    </item>
  </channel>
</rss>
