Skip to content
Fourohtwo

api.macaroonnetwork.com/execute/block-number-v1

Current block height of Base or Ethereum mainnet with the block hash and timestamp, read live from public JSON-RPC after checking the endpoint's chain id. One cheap call for agents that need a fresh chain tip.

BaseUnchecked
POSThttps://api.macaroonnetwork.com/execute/block-number-v1

UptimeNot checked yet

30 days agoToday

Try it

Pays from your browser wallet in USDC on Base or USDG on Robinhood Chain, whichever the endpoint takes. The provider is paid directly; failed calls aren't refunded by Fourohtwo.

The response shows up here.

Call it from an agent

import { createPayer } from "fourohtwo";

// One agent key pays USDC on Base or USDG on Robinhood Chain,
// inside the spending rules you set on Fourohtwo.
const pay = createPayer({ privateKey: process.env.AGENT_KEY });
const res = await pay("https://api.macaroonnetwork.com/execute/block-number-v1", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"input":{"chain":"base"},"predicate":{"conditions":[{"field":"$.chain_id","operator":"in","type":"field_changed","value":[8453,1]},{"field":"$.block_number","operator":"gte","type":"field_changed","value":1},{"field":"$.block_hash","type":"count_gte","value":1},{"duration_hours":1,"field":"$.block_timestamp","type":"within"},{"duration_hours":1,"field":"$.retrieved_at","type":"within"}],"type":"a),
});
console.log(await res.json());

Example input

{"input":{"chain":"base"},"predicate":{"conditions":[{"field":"$.chain_id","operator":"in","type":"field_changed","value":[8453,1]},{"field":"$.block_number","operator":"gte","type":"field_changed","value":1},{"field":"$.block_hash","type":"count_gte","value":1},{"duration_hours":1,"field":"$.block_timestamp","type":"within"},{"duration_hours":1,"field":"$.retrieved_at","type":"within"}],"type":"a

More from Macaroon Network