All connectors

Blockscout

Official

Blockscout

Let agents explore public blockchain data:

  • Address balances, token holdings, NFTs and activity.
  • Transactions, blocks, decoded calls and event logs.
  • Tokens, holders, chain statistics and verified contract source code.

Each connection reads one chain and cannot sign or send transactions. Public explorers require no account; an optional API key provides a separate quota and avoids some automated-access restrictions. This connector is not affiliated with Blockscout.

Choose a chain.

Setup instructions

Add Blockscout

  1. Choose a Chain in Houston. Each connection reads one chain.
  2. Leave Use a Blockscout API key off for public explorer access, or enable it and paste a key from the Developer Portal.
  3. Select Add connection and share the connection with the members who need it.

Some public explorers block automated requests. An API key gives your connection its own quota and works across chains.

Advanced

In the Developer Portal, open API keys → Add new key, name it and select Generate API key. Copy the proapi_ value into Blockscout API key in Houston. Update Houston after rotating the key; check remaining credits in the portal if requests are refused.

Blockscout API guide.

Files

  • connector.luau
    -- Blockscout REST API v2 (https://docs.blockscout.com/devs/apis/rest) on one hosted chain, public and read-only. Arguments and results keep Blockscout's native field names.
    type Options = {[string]: any}
    type Chain = {host: string, name: string, id: number}
    type Endpoint = {name: string, path: string, args: {string}, options: {[string]: string}, list: boolean, about: string}
    
    -- The manifest's chain options, in its order: each chain's public explorer host, which is the option value, its name and chain ID.
    local CHAINS: {Chain} = {
    	{host = "eth.blockscout.com", name = "Ethereum", id = 1},
    	{host = "base.blockscout.com", name = "Base", id = 8453},
    	{host = "explorer.optimism.io", name = "OP Mainnet", id = 10},
    	{host = "arbitrum.blockscout.com", name = "Arbitrum One", id = 42161},
    	{host = "arbitrum-nova.blockscout.com", name = "Arbitrum Nova", id = 42170},
    	{host = "gnosisscan.io", name = "Gnosis", id = 100},
    	{host = "polygon.blockscout.com", name = "Polygon PoS", id = 137},
    	{host = "zksync.blockscout.com", name = "ZKsync Era", id = 324},
    	{host = "scrollscan.com", name = "Scroll", id = 534352},
    	{host = "celo.blockscout.com", name = "Celo", id = 42220},
    	{host = "unichain.blockscout.com", name = "Unichain", id = 130},
    	{host = "soneium.blockscout.com", name = "Soneium", id = 1868},
    	{host = "explorer.inkonchain.com", name = "Ink", id = 57073},
    	{host = "explorer.mode.network", name = "Mode", id = 34443},
    	{host = "blockscout.lisk.com", name = "Lisk", id = 1135},
    	{host = "worldchain-mainnet.explorer.alchemy.com", name = "World Chain", id = 480},
    	{host = "etc.blockscout.com", name = "Ethereum Classic", id = 61},
    	{host = "rootstock.blockscout.com", name = "Rootstock", id = 30},
    	{host = "filecoin.blockscout.com", name = "Filecoin", id = 314},
    	{host = "eth-sepolia.blockscout.com", name = "Ethereum Sepolia (testnet)", id = 11155111},
    	{host = "base-sepolia.blockscout.com", name = "Base Sepolia (testnet)", id = 84532},
    	{host = "testnet-explorer.optimism.io", name = "OP Sepolia (testnet)", id = 11155420},
    	{host = "arbitrum-sepolia.blockscout.com", name = "Arbitrum Sepolia (testnet)", id = 421614},
    	{host = "gnosis-chiado.blockscout.com", name = "Gnosis Chiado (testnet)", id = 10200},
    }
    local chain: Chain? = nil
    for _, entry in CHAINS do
    	if entry.host == config.chain then chain = entry end
    end
    -- With a key, every chain goes through the multichain Blockscout API; without one, through the chain's own explorer.
    local KEYED = config.use_api_key == true
    local API = if chain == nil then ""
    	elseif KEYED then "https://api.blockscout.com/" .. string.format("%d", chain.id) .. "/api/v2"
    	else "https://" .. chain.host .. "/api/v2"
    
    -- Each call makes one request. Houston ends a call after 30 s and the sandbox has no clock, so a fixed split of 27 s
    -- gives the headers 20 s and the body, an error body included, 7 s. A page of 50 transactions is about 0.5 MB.
    local CALL_TIME, BODY_TIME = 27000, 7000
    local MAX_BYTES = 4 * 1024 * 1024
    local MAX_TEXT, MAX_PAGE_KEYS, MAX_PAGE_VALUE = 256, 32, 512
    local NULL = json.decode("null")
    local TOKEN_TYPES = table.freeze({"ERC-20", "ERC-721", "ERC-1155", "ERC-404", "ERC-7984"})
    local LANGUAGES = "solidity vyper yul geas stylus_rust"
    
    -- Option kinds: a space-separated list of accepted values, or one of the formats below.
    local FORMATS = table.freeze({
    	["@address"] = "an address, 0x and 40 hex digits",
    	["@topic"] = "a 32-byte topic, 0x and 64 hex digits",
    	["@text"] = "a nonempty string of at most " .. tostring(MAX_TEXT) .. " bytes",
    	["@tokens"] = "a token type or an array of them: " .. table.concat(TOKEN_TYPES, ", "),
    })
    
    -- Every export, in help order. args are positional: path placeholders, then required query parameters.
    local ENDPOINTS: {Endpoint} = ({
    	{name = "getAddress", path = "/addresses/{address}", args = {"address"},
    		about = "An address: hash, coin_balance (in wei, as a string), exchange_rate (coin price in USD), is_contract, is_verified, name, ens_domain_name, token (when it is a token contract), proxy_type and implementations, creator_address_hash, creation_transaction_hash, public_tags, has_tokens and has_token_transfers. An address the chain has never seen still answers, with a null coin_balance."},
    	{name = "getAddressCounters", path = "/addresses/{address}/counters", args = {"address"},
    		about = "Activity counts as strings: transactions_count, token_transfers_count, gas_usage_count and validations_count."},
    	{name = "listAddressTransactions", path = "/addresses/{address}/transactions", args = {"address"}, list = true,
    		options = {filter = "to from", sort = "block_number value fee", order = "asc desc"},
    		about = "Transactions sent or received by the address, newest first, as in getTransaction. filter = \"to\" keeps incoming, \"from\" outgoing; sort and order change the order. Contract calls made inside other transactions are in listAddressInternalTransactions, token movements in listAddressTokenTransfers."},
    	{name = "listAddressTokenTransfers", path = "/addresses/{address}/token-transfers", args = {"address"}, list = true,
    		options = {filter = "to from", type = "@tokens", token = "@address"},
    		about = "Token transfers to or from the address, newest first: from, to, token, total ({value, decimals} for ERC-20; token_id for NFTs), type (token_transfer, token_minting, token_burning...), method, transaction_hash, log_index, block_number and timestamp. token keeps one token contract."},
    	{name = "listAddressInternalTransactions", path = "/addresses/{address}/internal-transactions", args = {"address"}, list = true,
    		options = {filter = "to from"},
    		about = "Internal transactions (calls and value transfers made by contracts) to or from the address: from, to, value, type (call, create, selfdestruct...), success, error, transaction_hash, index and block_number."},
    	{name = "listAddressLogs", path = "/addresses/{address}/logs", args = {"address"}, list = true,
    		options = {topic = "@topic"},
    		about = "Event logs the contract at the address emitted, newest first, as in listTransactionLogs. topic keeps the logs with that topic, such as an event signature hash."},
    	{name = "listAddressTokens", path = "/addresses/{address}/tokens", args = {"address"}, list = true,
    		options = {type = "@tokens"},
    		about = "Token balances of the address, highest fiat value first: each item has token (address_hash, name, symbol, decimals, type, exchange_rate, holders_count), value (in the token's smallest unit, as a string: divide by 10^decimals) and token_id for NFTs. Known scam tokens are left out."},
    	{name = "listAddressCoinBalanceHistory", path = "/addresses/{address}/coin-balance-history", args = {"address"}, list = true,
    		about = "Changes of the address's native coin balance, newest first: block_number, block_timestamp, value (the balance after the change, in wei), delta and transaction_hash."},
    	{name = "listAddressNFTs", path = "/addresses/{address}/nft", args = {"address"}, list = true,
    		options = {type = "@tokens"},
    		about = "NFT instances the address holds: id (the token ID), token, token_type, value (count held, for ERC-1155), metadata, image_url, animation_url and owner."},
    	{name = "listTransactions", path = "/transactions", args = {}, list = true,
    		options = {filter = "validated pending"},
    		about = "The chain's latest transactions, newest first, as in getTransaction; filter = \"pending\" lists the mempool where the explorer indexes it."},
    	{name = "getTransaction", path = "/transactions/{hash}", args = {"hash"},
    		about = "A transaction: hash, status (ok or error), result, revert_reason, block_number, timestamp, confirmations, from and to (address objects with hash, name, is_contract), value and fee ({type, value}) in wei, gas_used, gas_limit, gas_price, nonce, position, method (the called function's name), decoded_input ({method_call, method_id, parameters}) when the contract is verified, raw_input, token_transfers (at most 50, with token_transfers_overflow true when there are more) and transaction_types."},
    	{name = "listTransactionLogs", path = "/transactions/{hash}/logs", args = {"hash"}, list = true,
    		about = "The transaction's event logs: address, topics, data, index, block_number, transaction_hash and decoded ({method_call, method_id, parameters}) when the emitting contract is verified."},
    	{name = "listTransactionTokenTransfers", path = "/transactions/{hash}/token-transfers", args = {"hash"}, list = true,
    		options = {type = "@tokens"},
    		about = "Every token transfer of the transaction, as in listAddressTokenTransfers."},
    	{name = "listTransactionInternalTransactions", path = "/transactions/{hash}/internal-transactions", args = {"hash"}, list = true,
    		about = "The transaction's internal transactions, as in listAddressInternalTransactions."},
    	{name = "getTransactionSummary", path = "/transactions/{hash}/summary", args = {"hash"},
    		about = "Blockscout's human-readable summary of what the transaction did: `{success, data = {summaries}}`, where each summary has a summary_template such as \"{action_type} {amount} {token} to {to_address}\" and the summary_template_variables to fill it with. summaries is empty when Blockscout has no interpretation. It can fail as retryable while the explorer is busy."},
    	{name = "listBlocks", path = "/blocks", args = {}, list = true,
    		options = {type = "block uncle reorg"},
    		about = "The latest blocks, newest first, as in getBlock. type = \"uncle\" or \"reorg\" lists blocks outside the canonical chain."},
    	{name = "getBlock", path = "/blocks/{block}", args = {"block"},
    		about = "A block by number or hash: height, hash, parent_hash, timestamp, miner, transactions_count, internal_transactions_count, gas_used, gas_limit, base_fee_per_gas, burnt_fees, priority_fee, transaction_fees, rewards, size and withdrawals_count."},
    	{name = "listBlockTransactions", path = "/blocks/{block}/transactions", args = {"block"}, list = true,
    		options = {type = "coin_transfer contract_call contract_creation token_transfer token_creation"},
    		about = "The block's transactions in block order, as in getTransaction; type keeps one kind."},
    	{name = "listTokens", path = "/tokens", args = {}, list = true,
    		options = {q = "@text", type = "@tokens", sort = "fiat_value holders_count circulating_market_cap", order = "asc desc"},
    		about = "Tokens on the chain, by default by market cap and then holders, largest first: address_hash, name, symbol, type, decimals, total_supply, holders_count, exchange_rate, circulating_market_cap and volume_24h. q matches names and symbols. A sort other than the default can take 15 to 25 s on a large chain such as Ethereum, close to the time limit."},
    	{name = "getToken", path = "/tokens/{address}", args = {"address"},
    		about = "A token contract, with the fields of listTokens plus icon_url and reputation."},
    	{name = "getTokenCounters", path = "/tokens/{address}/counters", args = {"address"},
    		about = "token_holders_count and transfers_count, as strings."},
    	{name = "listTokenHolders", path = "/tokens/{address}/holders", args = {"address"}, list = true,
    		about = "Holders of the token, largest first: address (an address object), value (in the token's smallest unit) and token_id for ERC-1155."},
    	{name = "listTokenTransfers", path = "/tokens/{address}/transfers", args = {"address"}, list = true,
    		about = "Transfers of the token, newest first, as in listAddressTokenTransfers."},
    	{name = "listTokenInstances", path = "/tokens/{address}/instances", args = {"address"}, list = true,
    		options = {holder_address_hash = "@address"},
    		about = "Instances of an NFT collection, as in getTokenInstance without token. holder_address_hash keeps those one address holds."},
    	{name = "getTokenInstance", path = "/tokens/{address}/instances/{token_id}", args = {"address", "token_id"},
    		about = "One NFT: id, token, owner, metadata (the token URI's JSON, such as name, description and attributes), image_url, animation_url and external_app_url."},
    	{name = "listSmartContracts", path = "/smart-contracts", args = {}, list = true,
    		options = {q = "@text", filter = LANGUAGES},
    		about = "Verified contracts, most recently verified first: address, compiler_version, language, license_type, optimization_enabled, verified_at, coin_balance and transactions_count. q matches contract names and addresses; filter keeps one source language. There is no sort: Blockscout times out sorting verified contracts by balance or transactions."},
    	{name = "getSmartContract", path = "/smart-contracts/{address}", args = {"address"},
    		about = "A verified contract's source and ABI: name, language, compiler_version, evm_version, optimization_enabled, optimization_runs, license_type, source_code, file_path, additional_sources ({file_path, source_code}), abi (an array), constructor_args, decoded_constructor_args, compiler_settings, verified_at, is_verified, is_fully_verified, proxy_type and implementations (the logic contracts of a proxy, whose own source getSmartContract returns). Bytecode is included too, so a large contract can be several hundred KB. A contract without verified source still answers, with is_verified false, its bytecode and proxy fields, and no source_code or abi; an address without code fails with HTTP 404."},
    	{name = "search", path = "/search", args = {"q"}, list = true,
    		about = "Searches addresses, tokens, contracts, blocks, transactions and ENS names. Each item has type (address, contract, token, block, transaction, ens_domain...) and its fields, such as address_hash, name, symbol and token_type, or block_number and transaction_hash. q is a name, symbol, address, hash or block number. A broad text search can take long on a large chain and then fails as retryable; prefer exact names or addresses."},
    	{name = "getStats", path = "/stats", args = {},
    		about = "Chain statistics: total_blocks, total_addresses, total_transactions, transactions_today, average_block_time (ms), coin_price (USD), market_cap, gas_prices ({slow, average, fast} in gwei) and network_utilization_percentage."},
    } :: {Options}) :: any
    
    local function finite(value: any): boolean
    	return type(value) == "number" and value == value and math.abs(value) < 2 ^ 53
    end
    
    local function hex(value: any, digits: number): boolean
    	return type(value) == "string" and #value == digits + 2 and string.match(value, "^0x%x+$") ~= nil
    end
    
    local function text(value: any, field: string): string
    	assert(type(value) == "string" and string.find(value, "%S") and #value <= MAX_TEXT,
    		field .. " must be " .. FORMATS["@text"] .. ", not only spaces")
    	return value
    end
    
    -- A block is a number or a block hash; a token ID is a nonnegative integer up to 2^256, as a number or a string.
    local function positional(name: string, value: any): string
    	if name == "address" then
    		assert(hex(value, 40), "address must be " .. FORMATS["@address"])
    	elseif name == "hash" then
    		assert(hex(value, 64), "hash must be a transaction hash, 0x and 64 hex digits")
    	elseif name == "block" then
    		if finite(value) and value % 1 == 0 and value >= 0 then return string.format("%d", value) end
    		assert(hex(value, 64) or (type(value) == "string" and #value <= 16 and string.match(value, "^%d+$")),
    			"block must be a block number or a block hash, 0x and 64 hex digits")
    	elseif name == "token_id" then
    		if finite(value) and value % 1 == 0 and value >= 0 then return string.format("%d", value) end
    		assert(type(value) == "string" and #value <= 78 and string.match(value, "^%d+$"),
    			"token_id must be a nonnegative integer, as a number or a decimal string")
    	else
    		return text(value, name)
    	end
    	return value
    end
    
    local function option(name: string, kind: string, value: any): string
    	if kind == "@address" then
    		assert(hex(value, 40), name .. " must be " .. FORMATS[kind])
    	elseif kind == "@topic" then
    		assert(hex(value, 64), name .. " must be " .. FORMATS[kind])
    	elseif kind == "@text" then
    		return text(value, name)
    	elseif kind == "@tokens" then
    		local items: {any} = if type(value) == "table" then value else {value}
    		local types: {string} = {}
    		for index, item in items do
    			assert(index == #types + 1 and table.find(TOKEN_TYPES, item), name .. " must be " .. FORMATS[kind])
    			table.insert(types, item)
    		end
    		assert(#types > 0, name .. " must be " .. FORMATS[kind])
    		return table.concat(types, ",")
    	else
    		assert(type(value) == "string" and table.find(string.split(kind, " "), value),
    			name .. " must be one of " .. string.gsub(kind, " ", ", "))
    	end
    	return value
    end
    
    -- next_page_params holds the keyset of the last item; its values are scalars, sent back as Blockscout's frontend does.
    local function pageValue(key: string, value: any): string
    	if value == NULL then return "null" end
    	if type(value) == "boolean" then return tostring(value) end
    	if finite(value) then return if value % 1 == 0 then string.format("%d", value) else tostring(value) end
    	assert(type(value) == "string" and #value <= MAX_PAGE_VALUE, "page." .. key .. " must be a value from next_page_params")
    	return value
    end
    
    local function options(value: any, operation: string): Options
    	assert(value == nil or type(value) == "table", operation .. " options must be a table")
    	return table.clone((value or {}) :: Options)
    end
    
    local function query(endpoint: Endpoint, args: Options, params: {[string]: string}): string
    	for name, kind in endpoint.options do
    		if args[name] ~= nil then params[name] = option(name, kind, args[name]) end
    		args[name] = nil
    	end
    	if endpoint.list and args.page ~= nil then
    		local page = args.page
    		args.page = nil
    		assert(type(page) == "table", "page must be the next_page_params table of the previous page")
    		local count = 0
    		for key, value in page do
    			count += 1
    			assert(count <= MAX_PAGE_KEYS and type(key) == "string" and #key <= 64
    				and (string.match(key, "^%l[%l%d_]*$") or string.match(key, "^%l[%l%d_]*%[[%l%d_]+%]$"))
    				and key ~= "apikey" and key ~= "key", "page must be the next_page_params table of the previous page")
    			local kind = endpoint.options[key]
    			local rendered = if kind then option(key, kind, value) else pageValue(key, value)
    			assert(params[key] == nil or params[key] == rendered,
    				"page." .. key .. " differs from the option " .. key .. "; pass the previous page's options with its next_page_params")
    			params[key] = rendered
    		end
    	end
    	local unknown = next(args)
    	assert(unknown == nil, endpoint.name .. " received an unknown option " .. string.sub(tostring(unknown), 1, 64))
    	local names: {string} = {}
    	for name in params do table.insert(names, name) end
    	table.sort(names)
    	local parts: {string} = {}
    	for _, name in names do table.insert(parts, url.encode(name) .. "=" .. url.encode(params[name])) end
    	return if #parts > 0 then "?" .. table.concat(parts, "&") else ""
    end
    
    local function errorCode(err: any): any
    	return if type(err) == "table" then err.code else nil
    end
    
    local function fail(operation: string, status: number?, retryable: boolean, message: string): never
    	return houston.fail({operation = operation, layer = "upstream", upstream_status = status, retryable = retryable,
    		message = message})
    end
    
    -- houston.fail repairs a character split by the cut.
    local function tidy(message: string): string
    	return string.sub(string.match(string.gsub(message, "%s+", " "), "^ ?(.-) ?$") :: string, 1, 300)
    end
    
    -- Blockscout answers {"message"}, OpenAPI validation {"errors": [{source = {pointer}, detail}]}, and the Blockscout API
    -- {"error", "source"}; other bodies are never shown.
    local function reason(body: string): string
    	local ok, decoded = pcall(json.decode, body)
    	if not ok or type(decoded) ~= "table" then return "" end
    	local first = if type(decoded.errors) == "table" then decoded.errors[1] else nil
    	if type(first) == "table" and type(first.detail) == "string" then
    		local pointer = if type(first.source) == "table" and type(first.source.pointer) == "string" then first.source.pointer else nil
    		return tidy((if pointer then string.gsub(pointer, "^/", "") .. ": " else "") .. first.detail)
    	end
    	local message = if type(decoded.message) == "string" then decoded.message elseif type(decoded.error) == "string" then decoded.error else nil
    	return if message then tidy(message) else ""
    end
    
    local function failure(operation: string, response: HttpResponse): never
    	local status = response.statusCode
    	local detail, body = "", ""
    	if status >= 300 and status < 400 then
    		response.body:close()
    		detail = "unexpected redirect"
    	else
    		-- An error body that stalls or breaks counts as empty.
    		local read, prefix = pcall(function() return await(response.body:readPrefix(4096), BODY_TIME) end)
    		if not read and errorCode(prefix) == "cancelled" then error(prefix, 0) end
    		if read then body, detail = prefix, reason(prefix) end
    	end
    	local name = if chain then chain.name else "Blockscout"
    	local mitigated = response.headers["cf-mitigated"]
    	if status == 403 and not KEYED and ((mitigated and mitigated[1] == "challenge") or string.find(body, "Just a moment", 1, true)) then
    		return fail(operation, status, false, "The " .. name .. " explorer's bot protection refused the request; "
    			.. "a connection admin can add a free Blockscout API key to the connection to read this chain")
    	end
    	local message = "Blockscout HTTP " .. tostring(status) .. (if detail == "" then "" else ": " .. detail)
    	if (status == 401 or status == 402) and KEYED then message ..= "; the connection's Blockscout API key was refused or has no credits left" end
    	local retry, reset = response.headers["retry-after"], response.headers["x-ratelimit-reset"]
    	if (status == 429 or status == 503) and retry and retry[1] then
    		-- Retry-After is either delay seconds or an HTTP date.
    		local value = string.sub(retry[1], 1, 32)
    		message ..= "; retry after " .. value .. (if string.match(value, "^%d+$") then "s" else "")
    	elseif status == 429 and reset and reset[1] and string.match(reset[1], "^%d+$") and #reset[1] <= 9 then
    		-- Blockscout's own header counts milliseconds until the limit resets.
    		message ..= "; retry after " .. tostring(math.ceil(tonumber(reset[1]) :: number / 1000)) .. "s"
    	end
    	-- Input is validated first, so a 4xx is final; 501 means this explorer lacks the feature, other 5xx are server faults.
    	return fail(operation, status, status == 429 or (status >= 500 and status ~= 501), message)
    end
    
    local function fetch(operation: string, target: string): any
    	local sent, response = pcall(function()
    		return await(http.request({method = "GET", url = target, headers = {Accept = {"application/json"}},
    			timeoutMs = CALL_TIME - BODY_TIME}))
    	end)
    	if not sent then
    		if errorCode(response) ~= "timeout" then error(response, 0) end
    		fail(operation, nil, true, "Blockscout did not answer within " .. tostring((CALL_TIME - BODY_TIME) // 1000) .. " s; retry, or narrow the request")
    	end
    	if response.statusCode ~= 200 then failure(operation, response) end
    	local read, raw = pcall(function() return await(response.body:readAll(MAX_BYTES), BODY_TIME) end)
    	if not read then
    		local code = errorCode(raw)
    		if code == "limit_exceeded" then
    			fail(operation, 200, false, "Blockscout returned more data than one call can hold")
    		elseif code == "timeout" then
    			fail(operation, 200, true, "Blockscout did not finish sending its answer within " .. tostring(BODY_TIME // 1000) .. " s; retry")
    		elseif code == "cancelled" then
    			error(raw, 0)
    		end
    		local detail = if type(raw) == "table" and type(raw.message) == "string" then raw.message else tostring(raw)
    		fail(operation, 200, true, "Blockscout response failed: " .. string.sub(detail, 1, 300))
    	end
    	-- A collection's instance cursor holds unique_token as a bare integer up to 2^256, which would decode as a float.
    	raw = string.gsub(raw, '"unique_token":(%d+)', '"unique_token":"%1"')
    	-- The anchored check is cheap, so a large page that is not JSON is never decoded.
    	local ok, value = false, nil
    	if string.match(raw, "^%s*{") then ok, value = pcall(json.decode, raw) end
    	if not ok or type(value) ~= "table" then fail(operation, 200, false, "Blockscout returned an invalid JSON object") end
    	return value
    end
    
    local exports: {[string]: any} = {}
    local sections: {string} = {}
    
    local function optionHelp(endpoint: Endpoint): string
    	local names: {string} = {}
    	for name in endpoint.options do table.insert(names, name) end
    	table.sort(names)
    	local parts: {string} = {}
    	for _, name in names do
    		local kind = endpoint.options[name]
    		table.insert(parts, name .. ": " .. (FORMATS[kind] or string.gsub(kind, " ", ", ")))
    	end
    	return if #parts > 0 then " Options: " .. table.concat(parts, "; ") .. "." else ""
    end
    
    for _, endpoint in ENDPOINTS do
    	endpoint.options = endpoint.options or {}
    	endpoint.list = endpoint.list == true
    	local takesOptions = endpoint.list or next(endpoint.options) ~= nil
    	exports[endpoint.name] = function(...: any): any
    		local values = table.pack(...)
    		local target = endpoint.path
    		local args = options(if takesOptions then values[#endpoint.args + 1] else nil, endpoint.name)
    		local most = #endpoint.args + (if takesOptions then 1 else 0)
    		assert(values.n <= most, endpoint.name .. " takes at most " .. tostring(most) .. " arguments")
    		-- Arguments without a path placeholder, such as search's q, are required query parameters.
    		local params: {[string]: string} = {}
    		for index, name in endpoint.args do
    			local value = positional(name, values[index])
    			local placeholder = "{" .. name .. "}"
    			if string.find(target, placeholder, 1, true) then
    				target = string.gsub(target, placeholder, value)
    			else
    				params[name] = value
    			end
    		end
    		assert(chain, "the connection's chain is not one Houston knows; edit the connection and choose a chain")
    		local result = fetch(endpoint.name, API .. target .. query(endpoint, args, params))
    		-- JSON null is truthy in Luau, so the last page leaves next_page_params out.
    		if endpoint.list and result.next_page_params == NULL then result.next_page_params = nil end
    		return result
    	end
    	local signature = table.concat(endpoint.args, ", ")
    	if takesOptions then signature ..= (if signature == "" then "" else ", ") .. "opts?" end
    	table.insert(sections, "## " .. endpoint.name .. "(" .. signature .. ")\n\nGET " .. endpoint.path
    		.. (if endpoint.list then ", a page" else "") .. ". " .. endpoint.about .. optionHelp(endpoint))
    end
    
    local function help(): string
    	local name = if chain then chain.name .. " (chain ID " .. string.format("%d", chain.id) .. ")" else "an unknown chain"
    	local via = if KEYED then "through the multichain Blockscout API with the connection's API key, which allows 5 requests per second on the free plan and costs credits per call (20 for most, up to 50 for summaries and coin balance history)"
    		else "through the chain's public Blockscout explorer, without a key; every Houston connection shares its rate limit, and some explorers refuse automated requests until a connection admin adds a free Blockscout API key"
    	return [[Blockscout: read ]] .. name .. [[ from its Blockscout block explorer (REST API v2, https://docs.blockscout.com/devs/apis/rest): addresses with balances, tokens and transactions; transactions with logs, token transfers and internal transactions; blocks; tokens, holders and NFTs; verified contract sources and ABIs; search and chain statistics. Requests go ]] .. via .. [[. Read-only: nothing can sign or send a transaction. One connection reads one chain. Calls return completed values; do not wrap them in await(). Results are Blockscout's JSON unchanged. Amounts are integer strings in the smallest unit: wei for the native coin (divide by 10^18), and 10^decimals of the token for tokens; fiat values are current USD prices, never historical.
    
    Addresses are 0x and 40 hex digits, in any letter case; transaction and block hashes 0x and 64 hex digits. Each call makes one request. Invalid input and unknown options fail before any request.
    
    ## Pages
    
    A call marked "a page" returns `{items, next_page_params}`: up to 50 items, and next_page_params, the keyset of the last item, absent after the last page. For the next page, call again with the same arguments and options plus `page = result.next_page_params`; next_page_params does not always carry the options (such as sort, order, type or filter), so repeat every option. Collect only the pages you need: each call reads one.
    
    ]] .. table.concat(sections, "\n\n") .. [[
    
    
    ## Errors and limits
    
    Blockscout errors come back as upstream errors with the HTTP status and Blockscout's message: 404 for an unknown transaction, block or token, or a contract address without code, 422 for a value Blockscout rejects (such as an NFT-only type), 429 when the rate limit is reached and 5xx for server faults. 429 and 5xx (except 501, a feature this explorer lacks) are retryable; Houston waits and retries a refused request briefly. Each call reads at most ]] .. tostring(MAX_BYTES // 1048576) .. [[ MiB and gives Blockscout ]] .. tostring(CALL_TIME // 1000) .. [[ s: ]] .. tostring((CALL_TIME - BODY_TIME) // 1000) .. [[ s to start answering and ]] .. tostring(BODY_TIME // 1000) .. [[ s to send the body; a call that runs out of time fails as retryable. Lists of very active addresses, such as their tokens, can take long on large chains.
    
    ## Example
    
    Here blockscout is the configured Blockscout connection.
    
    ```lua
    local vitalik = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
    local account = blockscout.getAddress(vitalik)
    print(account.coin_balance, account.ens_domain_name)
    local page = blockscout.listAddressTransactions(vitalik, {filter = "from"})
    for _, tx in page.items do print(tx.hash, tx.method, tx.value, tx.status) end
    if #page.items == 0 then return end
    if page.next_page_params then
    	local older = blockscout.listAddressTransactions(vitalik, {filter = "from", page = page.next_page_params})
    end
    local tx = blockscout.getTransaction(page.items[1].hash)
    local transfers = blockscout.listTransactionTokenTransfers(tx.hash, {type = "ERC-20"})
    local holders = blockscout.listTokenHolders("0xdAC17F958D2ee523a2206206994597C13D831ec7")
    local contract = blockscout.getSmartContract("0x1f9840a85d5aF5bf1D1762F925BDADdC4201F984")
    if contract.is_verified then print(contract.name, contract.compiler_version, #contract.abi) end
    ```]]
    end
    
    exports.help = help
    return exports
    
  • houston.json
    {
      "schema_version": 2,
      "name": "Blockscout",
      "files": [
        "connector.luau"
      ],
      "icon": "icon.svg",
      "config": {
        "chain": {
          "type": "string",
          "label": "Chain",
          "default": "eth.blockscout.com",
          "description": "The blockchain this connection reads, through its Blockscout explorer. Add another connection for each chain.",
          "options": [
            {
              "label": "Ethereum",
              "value": "eth.blockscout.com"
            },
            {
              "label": "Base",
              "value": "base.blockscout.com"
            },
            {
              "label": "OP Mainnet",
              "value": "explorer.optimism.io"
            },
            {
              "label": "Arbitrum One",
              "value": "arbitrum.blockscout.com"
            },
            {
              "label": "Arbitrum Nova",
              "value": "arbitrum-nova.blockscout.com"
            },
            {
              "label": "Gnosis",
              "value": "gnosisscan.io"
            },
            {
              "label": "Polygon PoS",
              "value": "polygon.blockscout.com"
            },
            {
              "label": "ZKsync Era",
              "value": "zksync.blockscout.com"
            },
            {
              "label": "Scroll",
              "value": "scrollscan.com"
            },
            {
              "label": "Celo",
              "value": "celo.blockscout.com"
            },
            {
              "label": "Unichain",
              "value": "unichain.blockscout.com"
            },
            {
              "label": "Soneium",
              "value": "soneium.blockscout.com"
            },
            {
              "label": "Ink",
              "value": "explorer.inkonchain.com"
            },
            {
              "label": "Mode",
              "value": "explorer.mode.network"
            },
            {
              "label": "Lisk",
              "value": "blockscout.lisk.com"
            },
            {
              "label": "World Chain",
              "value": "worldchain-mainnet.explorer.alchemy.com"
            },
            {
              "label": "Ethereum Classic",
              "value": "etc.blockscout.com"
            },
            {
              "label": "Rootstock",
              "value": "rootstock.blockscout.com"
            },
            {
              "label": "Filecoin",
              "value": "filecoin.blockscout.com"
            },
            {
              "label": "Ethereum Sepolia (testnet)",
              "value": "eth-sepolia.blockscout.com"
            },
            {
              "label": "Base Sepolia (testnet)",
              "value": "base-sepolia.blockscout.com"
            },
            {
              "label": "OP Sepolia (testnet)",
              "value": "testnet-explorer.optimism.io"
            },
            {
              "label": "Arbitrum Sepolia (testnet)",
              "value": "arbitrum-sepolia.blockscout.com"
            },
            {
              "label": "Gnosis Chiado (testnet)",
              "value": "gnosis-chiado.blockscout.com"
            }
          ]
        },
        "use_api_key": {
          "type": "boolean",
          "label": "Use a Blockscout API key",
          "default": false,
          "description": "Optional. Without a key, Houston reads the chain's public explorer, whose limits every Houston connection shares, and some explorers refuse these requests. A free key gives this connection its own limit on every chain."
        },
        "api_key": {
          "type": "secret",
          "label": "Blockscout API key",
          "if": "{{ is config.use_api_key true }}",
          "required": true,
          "min_length": 1,
          "description": "Starts with proapi_. Create one for free in the Blockscout Developer Portal."
        }
      },
      "proxy": [
        {
          "if": "{{ is config.use_api_key true }}",
          "match": {
            "protocol": "http",
            "host": [
              "api.blockscout.com"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/{chain}/api/v2/addresses/{address}",
              "/{chain}/api/v2/addresses/{address}/counters",
              "/{chain}/api/v2/addresses/{address}/transactions",
              "/{chain}/api/v2/addresses/{address}/token-transfers",
              "/{chain}/api/v2/addresses/{address}/internal-transactions",
              "/{chain}/api/v2/addresses/{address}/logs",
              "/{chain}/api/v2/addresses/{address}/tokens",
              "/{chain}/api/v2/addresses/{address}/coin-balance-history",
              "/{chain}/api/v2/addresses/{address}/nft",
              "/{chain}/api/v2/transactions",
              "/{chain}/api/v2/transactions/{hash}",
              "/{chain}/api/v2/transactions/{hash}/logs",
              "/{chain}/api/v2/transactions/{hash}/token-transfers",
              "/{chain}/api/v2/transactions/{hash}/internal-transactions",
              "/{chain}/api/v2/transactions/{hash}/summary",
              "/{chain}/api/v2/blocks",
              "/{chain}/api/v2/blocks/{block}",
              "/{chain}/api/v2/blocks/{block}/transactions",
              "/{chain}/api/v2/tokens",
              "/{chain}/api/v2/tokens/{address}",
              "/{chain}/api/v2/tokens/{address}/counters",
              "/{chain}/api/v2/tokens/{address}/holders",
              "/{chain}/api/v2/tokens/{address}/transfers",
              "/{chain}/api/v2/tokens/{address}/instances",
              "/{chain}/api/v2/tokens/{address}/instances/{token_id}",
              "/{chain}/api/v2/smart-contracts",
              "/{chain}/api/v2/smart-contracts/{address}",
              "/{chain}/api/v2/search",
              "/{chain}/api/v2/stats"
            ]
          },
          "action": {
            "headers": {
              "remove": [
                "Authorization",
                "Cookie"
              ],
              "set": {
                "Authorization": "Bearer {{config.api_key}}"
              }
            }
          }
        },
        {
          "if": "{{ is config.use_api_key false }}",
          "match": {
            "protocol": "http",
            "host": [
              "{{config.chain}}"
            ],
            "method": [
              "GET"
            ],
            "path": [
              "/api/v2/addresses/{address}",
              "/api/v2/addresses/{address}/counters",
              "/api/v2/addresses/{address}/transactions",
              "/api/v2/addresses/{address}/token-transfers",
              "/api/v2/addresses/{address}/internal-transactions",
              "/api/v2/addresses/{address}/logs",
              "/api/v2/addresses/{address}/tokens",
              "/api/v2/addresses/{address}/coin-balance-history",
              "/api/v2/addresses/{address}/nft",
              "/api/v2/transactions",
              "/api/v2/transactions/{hash}",
              "/api/v2/transactions/{hash}/logs",
              "/api/v2/transactions/{hash}/token-transfers",
              "/api/v2/transactions/{hash}/internal-transactions",
              "/api/v2/transactions/{hash}/summary",
              "/api/v2/blocks",
              "/api/v2/blocks/{block}",
              "/api/v2/blocks/{block}/transactions",
              "/api/v2/tokens",
              "/api/v2/tokens/{address}",
              "/api/v2/tokens/{address}/counters",
              "/api/v2/tokens/{address}/holders",
              "/api/v2/tokens/{address}/transfers",
              "/api/v2/tokens/{address}/instances",
              "/api/v2/tokens/{address}/instances/{token_id}",
              "/api/v2/smart-contracts",
              "/api/v2/smart-contracts/{address}",
              "/api/v2/search",
              "/api/v2/stats"
            ]
          },
          "action": {
            "headers": {
              "remove": [
                "Authorization",
                "Cookie"
              ]
            }
          }
        }
      ]
    }
    
  • icon.svgicon.svg
  • README.md
    ---
    description: Read addresses, balances, transactions, blocks, tokens and verified smart contracts on Ethereum, Base, Arbitrum and other chains through Blockscout.
    ---
    
    # Blockscout
    
    Let agents explore public blockchain data:
    
    - Address balances, token holdings, NFTs and activity.
    - Transactions, blocks, decoded calls and event logs.
    - Tokens, holders, chain statistics and verified contract source code.
    
    Each connection reads one chain and cannot sign or send transactions. Public
    explorers require no account; an optional API key provides a separate quota and
    avoids some automated-access restrictions. This connector is not affiliated with
    Blockscout.
    
    [Choose a chain](SETUP.md).
    
  • SETUP.md
    # Add Blockscout
    
    1. Choose a **Chain** in Houston. Each connection reads one chain.
    2. Leave **Use a Blockscout API key** off for public explorer access, or enable it
       and paste a key from the [Developer Portal](https://dev.blockscout.com/).
    3. Select **Add connection** and share the connection with the members who need it.
    
    > Some public explorers block automated requests. An API key gives your connection
    > its own quota and works across chains.
    
    ## Advanced
    
    In the Developer Portal, open **API keys → Add new key**, name it and select
    **Generate API key**. Copy the `proapi_` value into **Blockscout API key** in Houston.
    Update Houston after rotating the key; check remaining credits in the portal if
    requests are refused.
    
    [Blockscout API guide](https://docs.blockscout.com/devs/apis).
    
  • tests
    • api_key.luau
      -- With an API key, which the proxy adds as a bearer token, every chain goes through the multichain Blockscout API.
      return {
      	scenario = {publisher = {}, config = {chain = "base.blockscout.com", use_api_key = true, api_key = "proapi_synthetic"}, auth_method = "",
      		auth_config = {}},
      	configure = function()
      		requests = {}
      		status, payload, responseHeaders = 200, '{"items":[],"next_page_params":null}', {}
      		http = {request = function(req)
      			table.insert(requests, req)
      			assert(req.headers.Authorization == nil and not string.find(req.url, "apikey", 1, true), "the proxy adds the key")
      			return fixture.operation({statusCode = status, headers = responseHeaders, body = fixture.reader(payload)})
      		end}
      	end,
      	run = function(blockscout)
      		local API = "https://api.blockscout.com/8453/api/v2"
      		local USDC = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
      		local function got(url) assert(requests[#requests].url == url, requests[#requests].url) end
      		assert(type(blockscout.getAddress) == "function" and type(blockscout.search) == "function")
      
      		blockscout.listTokenHolders(USDC)
      		got(API .. "/tokens/" .. USDC .. "/holders")
      		blockscout.listAddressTransactions(USDC, {page = {block_number = 37000000, index = 4}})
      		got(API .. "/addresses/" .. USDC .. "/transactions?block_number=37000000&index=4")
      		payload = '{"total_blocks":"37000000"}'
      		assert(blockscout.getStats().total_blocks == "37000000")
      		got(API .. "/stats")
      
      		-- The Blockscout API reports its own errors as {error, source}.
      		local function upstream(code, body, expected, absent)
      			status, payload = code, body
      			local ok, err = pcall(function() blockscout.getToken(USDC) end)
      			for _, text in expected do
      				assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err))
      			end
      			if absent then assert(not string.find(tostring(err), absent, 1, true), "unexpected " .. absent .. " in " .. tostring(err)) end
      		end
      		upstream(401, '{"error":"Unauthorized"}',
      			{"Blockscout HTTP 401: Unauthorized; the connection's Blockscout API key was refused or has no credits left", '"retryable":false'})
      		upstream(402, '{"error":"Proceed with API key or make a X402 payment to continue"}',
      			{"Blockscout HTTP 402: Proceed with API key", "API key was refused or has no credits left", '"retryable":false'})
      		-- With a key, a challenge page is not answered with advice to add one.
      		responseHeaders = {["cf-mitigated"] = {"challenge"}}
      		upstream(403, "<html>Just a moment...</html>", {"Blockscout HTTP 403", '"retryable":false'}, "bot protection")
      		upstream(404, '{"error":"Network not supported","source":"internal"}', {"Blockscout HTTP 404: Network not supported"})
      		upstream(504, '{"error":"Gateway timeout","source":"upstream"}', {"Blockscout HTTP 504: Gateway timeout", '"retryable":true'})
      		upstream(501, '{"error":"Not implemented","source":"upstream"}', {"Blockscout HTTP 501: Not implemented", '"retryable":false'})
      	end,
      }
      
    • authentication.luau
      return {
      	contract = function(m)
      		m.authentication({
      			{
      				auth = {},
      				config = {},
      				endpoint = { "GET", "https://eth.blockscout.com/api/v2/stats" },
      				expected = "",
      				header = "Authorization",
      				method = "",
      				publisher = {},
      			},
      		})
      	end,
      }
      
    • endpoints.luau
      return {
      	contract = function(m)
      		local source = m.modules["connector.luau"]
      		local rows = {}
      		for host, name in string.gmatch(source, '{host = "([^"]+)", name = "([^"]+)", id = %d+}') do
      			table.insert(rows, { value = host, label = name })
      		end
      		assert(#rows > 0 and m.equal(rows, m.raw.config.chain.options), "chain choices differ from connector")
      		local keyed, explorer = {}, {}
      		for path in string.gmatch(source, '{name = "[%w_]+", path = "([^"]+)"') do
      			table.insert(keyed, "/{chain}/api/v2" .. path)
      			table.insert(explorer, "/api/v2" .. path)
      		end
      		assert(
      			#keyed > 0
      				and m.equal(m.raw.proxy[1].match.path, keyed)
      				and m.equal(m.raw.proxy[2].match.path, explorer),
      			"endpoint paths differ from proxy rules"
      		)
      	end,
      }
      
    • errors.luau
      -- Invalid input never reaches Blockscout, and its errors, slow answers and bad bodies map to clear failures.
      return {
      	scenario = {publisher = {}, config = {chain = "arbitrum.blockscout.com"}, auth_method = "", auth_config = {}},
      	configure = function()
      		calls = 0
      		status, payload, responseHeaders = 200, "{}", {}
      		http = {request = function(req)
      			calls += 1
      			assert(string.sub(req.url, 1, 39) == "https://arbitrum.blockscout.com/api/v2/", req.url)
      			-- A table stands for a failure while waiting for headers, such as a timeout or a refused origin.
      			if requestError then error(requestError, 0) end
      			-- A body whose read fails stands in for a dropped connection or a cancelled invocation.
      			local body = if readError
      				then {readAll = function() error(readError, 0) end, readPrefix = function() error(readError, 0) end, close = function() end}
      				else fixture.reader(payload)
      			return fixture.operation({statusCode = status, headers = responseHeaders, body = body})
      		end}
      	end,
      	run = function(blockscout)
      		local ADDRESS = "0x" .. string.rep("a", 40)
      		local TX = "0x" .. string.rep("b", 64)
      		local function rejected(fn, expected)
      			local before = calls
      			local ok, err = pcall(fn)
      			assert(not ok and string.find(tostring(err), expected, 1, true), "wrong validation error: " .. tostring(err))
      			assert(calls == before, "invalid input reached Blockscout")
      		end
      
      		for _, value in {"", "0x", "0x" .. string.rep("a", 39), "0x" .. string.rep("a", 41), "0x" .. string.rep("g", 40),
      			string.rep("a", 42), "0x" .. string.rep("a", 38) .. "/.", 42, {ADDRESS}} do
      			rejected(function() blockscout.getAddress(value) end, "address must be an address, 0x and 40 hex digits")
      		end
      		for _, value in {ADDRESS, "0x" .. string.rep("b", 63) .. "/", string.rep("b", 66)} do
      			rejected(function() blockscout.getTransaction(value) end, "hash must be a transaction hash, 0x and 64 hex digits")
      		end
      		for _, value in {-1, 1.5, "1.5", "-1", "latest", "0x10", string.rep("1", 17), 2 ^ 53} do
      			rejected(function() blockscout.getBlock(value) end, "block must be a block number or a block hash")
      		end
      		for _, value in {-1, 0.5, "1e3", "-7", "0x1", string.rep("9", 79)} do
      			rejected(function() blockscout.getTokenInstance(ADDRESS, value) end, "token_id must be a nonnegative integer")
      		end
      		for _, value in {"", "   ", string.rep("q", 257), 5} do
      			rejected(function() blockscout.search(value) end, "q must be a nonempty string of at most 256 bytes")
      		end
      		rejected(function() blockscout.getAddress() end, "address must be an address")
      		rejected(function() blockscout.search() end, "q must be a nonempty string")
      		rejected(function() blockscout.getStats(1) end, "getStats takes at most 0 arguments")
      		rejected(function() blockscout.getAddress(ADDRESS, {}) end, "getAddress takes at most 1 arguments")
      		rejected(function() blockscout.listTokens({}, "x") end, "listTokens takes at most 1 arguments")
      		rejected(function() blockscout.listBlocks("reorg") end, "listBlocks options must be a table")
      		rejected(function() blockscout.listAddressTransactions(ADDRESS, {limit = 10}) end,
      			"listAddressTransactions received an unknown option limit")
      		-- Search takes q only as its argument.
      		rejected(function() blockscout.search("usdc", {q = "dai"}) end, "search received an unknown option q")
      		rejected(function() blockscout.listAddressTransactions(ADDRESS, {filter = "both"}) end, "filter must be one of to, from")
      		rejected(function() blockscout.listAddressTransactions(ADDRESS, {sort = "timestamp"}) end,
      			"sort must be one of block_number, value, fee")
      		rejected(function() blockscout.listTransactions({filter = "to"}) end, "filter must be one of validated, pending")
      		rejected(function() blockscout.listSmartContracts({filter = "Solidity"}) end,
      			"filter must be one of solidity, vyper, yul, geas, stylus_rust")
      		rejected(function() blockscout.listSmartContracts({sort = "balance"}) end, "listSmartContracts received an unknown option sort")
      		for _, value in {"ERC20", {}, {"ERC-20", "BEP-20"}, {[1] = "ERC-20", [3] = "ERC-721"}, {kind = "ERC-20"}, 20} do
      			rejected(function() blockscout.listAddressTokens(ADDRESS, {type = value}) end, "type must be a token type or an array of them")
      		end
      		rejected(function() blockscout.listAddressTokenTransfers(ADDRESS, {token = "USDT"}) end, "token must be an address")
      		rejected(function() blockscout.listAddressLogs(ADDRESS, {topic = "0x12"}) end, "topic must be a 32-byte topic")
      		rejected(function() blockscout.listTokens({q = ""}) end, "q must be a nonempty string")
      		-- A cursor holds scalars under Blockscout's own names; the credential's names never pass.
      		for _, page in {"next", 5, {index = {1}}, {[1] = 5}, {["Index"] = 1}, {["a&b"] = 1}, {["token[a][b]"] = 1},
      			{apikey = "x"}, {key = "x"}, {index = 2 ^ 53}, {hash = string.rep("h", 513)}} do
      			rejected(function() blockscout.listTransactions({page = page}) end, "page")
      		end
      		local many = {}
      		for i = 1, 33 do many["k" .. i] = i end
      		rejected(function() blockscout.listTransactions({page = many}) end, "page must be the next_page_params table")
      		rejected(function() blockscout.listAddressTransactions(ADDRESS, {filter = "to", page = {filter = "from"}}) end,
      			"page.filter differs from the option filter")
      		-- A cursor value under an option's name is checked as that option.
      		rejected(function() blockscout.listAddressTransactions(ADDRESS, {page = {filter = "both"}}) end, "filter must be one of to, from")
      		rejected(function() blockscout.search("usdc", {page = {q = "dai"}}) end, "page.q differs from the option q")
      		rejected(function() blockscout.getTransaction(TX, {page = {index = 1}}) end, "getTransaction takes at most 1 arguments")
      
      		local function upstream(code, body, headers, expected, absent)
      			status, payload, responseHeaders = code, body, headers
      			local before = calls
      			local ok, err = pcall(function() blockscout.getTransaction(TX) end)
      			for _, text in expected do
      				assert(not ok and string.find(tostring(err), text, 1, true), "missing " .. text .. " in " .. tostring(err))
      			end
      			if absent then assert(not string.find(tostring(err), absent, 1, true), "unexpected " .. absent .. " in " .. tostring(err)) end
      			assert(calls == before + 1, "a failed request was repeated")
      		end
      		upstream(404, '{"message":"Not found"}', {}, {"Blockscout HTTP 404: Not found", '"retryable":false', '"upstream_status":404'})
      		upstream(422, '{"errors":[{"title":"Invalid value","source":{"pointer":"/type"},"detail":"Invalid value for enum"}]}', {},
      			{"Blockscout HTTP 422: type: Invalid value for enum", '"retryable":false'})
      		upstream(400, '{"message":"Unknown API v2 action"}', {}, {"Blockscout HTTP 400: Unknown API v2 action"})
      		upstream(400, '{"message":"' .. string.rep("y", 1000) .. '"}', {}, {"Blockscout HTTP 400: " .. string.rep("y", 300)},
      			string.rep("y", 301))
      		upstream(403, '<!DOCTYPE html><html lang="en-US"><head><title>Just a moment...</title></head></html>', {},
      			{"The Arbitrum One explorer's bot protection refused the request; a connection admin can add a free Blockscout API key",
      				'"retryable":false', '"upstream_status":403'}, "DOCTYPE")
      		upstream(403, "<html><body>challenge</body></html>", {["cf-mitigated"] = {"challenge"}},
      			{"The Arbitrum One explorer's bot protection refused the request", '"retryable":false'}, "challenge<")
      		upstream(403, "<html>Forbidden</html>", {}, {"Blockscout HTTP 403", '"retryable":false'}, "Forbidden")
      		upstream(429, '{"message":"Too Many Requests"}', {["x-ratelimit-reset"] = {"43712"}},
      			{"Blockscout HTTP 429: Too Many Requests; retry after 44s", '"retryable":true'})
      		upstream(429, "", {["retry-after"] = {"Thu, 29 Oct 2026 20:00:00 GMT"}, ["x-ratelimit-reset"] = {"9"}},
      			{"Blockscout HTTP 429; retry after Thu, 29 Oct 2026 20:00:00 GMT", '"retryable":true'}, "GMTs")
      		upstream(429, "", {["x-ratelimit-reset"] = {"-1"}}, {"Blockscout HTTP 429", '"retryable":true'}, "retry after")
      		upstream(503, '{"error":"Transaction data is temporarily unavailable"}', {["retry-after"] = {"3"}},
      			{"Blockscout HTTP 503: Transaction data is temporarily unavailable; retry after 3s", '"retryable":true'})
      		upstream(500, "<html>Internal</html>", {}, {"Blockscout HTTP 500", '"retryable":true'}, "Internal")
      		upstream(301, "", {location = {"https://elsewhere.example.com/api/v2/stats"}},
      			{"Blockscout HTTP 301: unexpected redirect", '"retryable":false'}, "elsewhere")
      		upstream(200, "<html>maintenance</html>", {}, {"Blockscout returned an invalid JSON object", '"retryable":false'}, "maintenance")
      		upstream(200, "[]", {}, {"Blockscout returned an invalid JSON object"})
      		upstream(200, '{"x":"' .. string.rep("z", 4 * 1024 * 1024) .. '"}', {},
      			{"Blockscout returned more data than one call can hold", '"retryable":false'}, "limit_exceeded")
      
      		requestError = {code = "timeout", message = "request deadline"}
      		upstream(200, "", {}, {"Blockscout did not answer within 20 s; retry, or narrow the request", '"retryable":true'})
      		-- Other request failures pass through unchanged, message included, and never become an upstream failure.
      		requestError = {code = "access_denied", message = "origin not allowed"}
      		upstream(200, "", {}, {"origin not allowed"}, "retryable")
      		requestError = nil
      		readError = {code = "timeout", message = "await timed out"}
      		upstream(200, "", {}, {"Blockscout did not finish sending its answer within 7 s; retry", '"retryable":true'})
      		readError = {code = "io_error", message = "connection reset by peer"}
      		upstream(200, "", {}, {"Blockscout response failed: connection reset by peer", '"retryable":true'})
      		-- An error body that stalls or breaks still gives the structured failure.
      		upstream(502, "", {}, {"Blockscout HTTP 502", '"retryable":true', '"upstream_status":502'}, "reset")
      		readError = {code = "cancelled", message = "invocation cancelled"}
      		local before = calls
      		local ok, err = pcall(function() blockscout.getStats() end)
      		-- A stand-in error loses its native identity across the export boundary; it must still not become an upstream failure.
      		assert(not ok and not string.find(tostring(err), "retryable", 1, true), "cancellation became an upstream error: " .. tostring(err))
      		assert(calls == before + 1)
      		readError = nil
      	end,
      }
      
    • manifest.luau
      return {
      	contract = function(m)
      		local blockscoutManifest = "../../connectors/blockscout/houston.json"
      		local resolveBlockscout = function(config)
      			local r, err = m.resolve(nil, config, nil, "")
      			assert(not err, tostring(err))
      			return r
      		end
      		local blockscoutSource = function()
      			local source, err = m.modules["connector.luau"], nil
      			assert(not err, tostring(err))
      			return source
      		end
      		-- TestBlockscoutPublicExplorerRoutes
      		do
      			local address = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
      			local hash = "0x1ccc11eecc6d44bd0b03d278560a5257d4dc93ac8414a6d1982d96bd88a0ffbc"
      			local r = resolveBlockscout(nil)
      			local api = "https://eth.blockscout.com/api/v2"
      			m.routes(r, "", true, {
      				"GET " .. api .. "/addresses/" .. address,
      				"GET " .. api .. "/addresses/" .. address .. "/transactions?filter=to&sort=value&order=desc",
      				"GET " .. api .. "/addresses/" .. address .. "/tokens?type=ERC-20",
      				"GET " .. api .. "/transactions/" .. hash .. "/logs",
      				"GET " .. api .. "/blocks/26303681/transactions",
      				"GET " .. api .. "/tokens?q=usd",
      				"GET "
      					.. api
      					.. "/tokens/"
      					.. address
      					.. "/instances/115792089237316195423570985008687907853269984665640564039457584007913129639935",
      				"GET " .. api .. "/smart-contracts/" .. address,
      				"GET " .. api .. "/search?q=token%5Bname%5D",
      				"GET " .. api .. "/stats",
      			})
      			m.routes(r, "", false, {
      				"POST " .. api .. "/tokens/batch",
      				"PATCH " .. api .. "/tokens/" .. address .. "/instances/1/refetch-metadata",
      				"POST " .. api .. "/smart-contracts/" .. address .. "/verification/via/flattened-code",
      				"GET " .. api .. "/addresses/" .. address .. "/token-balances",
      				"GET " .. api .. "/addresses/" .. address .. "/transactions/csv",
      				"GET " .. api .. "/tokens/" .. address .. "/holders/csv",
      				"GET " .. api .. "/config/backend-version",
      				"GET " .. api .. "/addresses/%2e%2e/stats",
      				"GET https://eth.blockscout.com/api/account/v2/user/info",
      				"GET https://eth.blockscout.com/api?module=account&action=balance",
      				"GET https://eth.blockscout.com/api/eth-rpc",
      				"GET https://eth.blockscout.com/graphiql",
      				"GET https://base.blockscout.com/api/v2/stats",
      				"GET https://gnosisscan.io/api/v2/stats",
      				"GET https://api.blockscout.com/1/api/v2/stats",
      				"GET https://gnosis.blockscout.com/api/v2/stats",
      				"GET https://eth.blockscout.com.example.com/api/v2/stats",
      				"GET http://eth.blockscout.com:8080/api/v2/stats",
      				"GET https://blockscout.com/api/v2/stats",
      				"GET https://evil.blockscout.com/api/v2/stats",
      			})
      			r = resolveBlockscout({ chain = "gnosisscan.io" })
      			m.routes(r, "", true, { "GET https://gnosisscan.io/api/v2/stats" })
      			m.routes(r, "", false, { "GET https://eth.blockscout.com/api/v2/stats" })
      			do
      				local _, err = m.resolve(nil, { chain = "evil.example.com" }, nil, "")
      				if err == nil then
      					m.fail("a host outside the chain list resolved")
      				end
      			end
      		end
      		-- TestBlockscoutAPIKeyRoutes
      		do
      			local address = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
      			local r = resolveBlockscout({
      				chain = "base.blockscout.com",
      				use_api_key = true,
      				api_key = "proapi_synthetic",
      			})
      			local api = "https://api.blockscout.com/8453/api/v2"
      			m.routes(r, "Bearer proapi_synthetic", true, {
      				"GET " .. api .. "/tokens/" .. address .. "/holders",
      				"GET " .. api .. "/addresses/" .. address .. "/transactions?block_number=1&index=4",
      				"GET "
      					.. api
      					.. "/transactions/0x1ccc11eecc6d44bd0b03d278560a5257d4dc93ac8414a6d1982d96bd88a0ffbc/summary",
      			})
      			m.routes(r, "", false, {
      				"POST " .. api .. "/tokens/batch",
      				"GET " .. api .. "/addresses/" .. address .. "/token-balances",
      				"GET https://api.blockscout.com/v2/api?chain_id=8453&module=account&action=balance",
      				"GET https://api.blockscout.com/8453/api?module=account&action=balance",
      				"GET https://api.blockscout.com/8453/json-rpc",
      				"GET https://api.blockscout.com/8453/stats-service/api/v1/counters",
      				"GET https://api.blockscout.com/services/metadata/api/v1/metadata",
      				"GET https://api.blockscout.com/api/v2/stats",
      				"GET https://base.blockscout.com/api/v2/stats",
      				"GET https://eth.blockscout.com/api/v2/stats",
      				"GET https://api.blockscout.com.example.com/8453/api/v2/stats",
      			})
      			local recipe, err = m.recipe(r, "GET", api .. "/stats", nil)
      			assert(not err, tostring(err))
      			do
      				local prepared, err = m.prepareUrl(recipe, r.Context)
      				if (err ~= nil) or (prepared ~= api .. "/stats") then
      					m.fail("the key reached the URL: %s %s", prepared, err)
      				end
      			end
      			m.rejectPreparedOverrides(recipe, r.Context, "GET " .. api .. "/stats")
      			local dropped = { "Cookie" }
      			local caller = { Accept = { "application/json" }, Authorization = { "Bearer forged" } }
      			for _, name in dropped do
      				caller[name] = { "caller-value" }
      			end
      			local headers, err = m.prepare(recipe, r.Context, caller)
      			if
      				((err ~= nil) or (m.header(headers, "Accept") ~= "application/json"))
      				or (m.header(headers, "Authorization") ~= "Bearer proapi_synthetic")
      			then
      				m.fail("prepare: %s %s", headers, err)
      			end
      			for _, name in dropped do
      				if m.header(headers, name) ~= "" then
      					m.fail("%s reached Blockscout", name)
      				end
      			end
      		end
      		-- TestBlockscoutAPIKeyNeedsAValue
      		do
      			for _, config in { { use_api_key = true }, { use_api_key = true, api_key = "" } } do
      				do
      					local _, err = m.resolve(nil, config, nil, "")
      					if err == nil then
      						m.fail("%s resolved", config)
      					end
      				end
      			end
      		end
      	end,
      }
      
    • reads.luau
      -- Without a key, each export reads one exact URL from the Ethereum explorer and returns Blockscout's JSON unchanged.
      return {
      	scenario = {publisher = {}, config = {}, auth_method = "", auth_config = {}},
      	configure = function()
      		requests, responses = {}, {}
      		http = {request = function(req)
      			table.insert(requests, req)
      			assert(req.method == "GET" and req.body == nil, "every request is a GET without a body")
      			assert(req.headers.Accept[1] == "application/json" and req.headers.Authorization == nil, "the public explorer takes no credential")
      			assert(req.timeoutMs == 20000, "headers get the call's time less the body's share")
      			assert(#responses > 0, "unexpected request: " .. req.url)
      			return fixture.operation({statusCode = 200, headers = {}, body = fixture.reader(table.remove(responses, 1))})
      		end}
      		function respond(body) table.insert(responses, body) end
      	end,
      	run = function(blockscout)
      		local API = "https://eth.blockscout.com/api/v2"
      		local VITALIK = "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045"
      		local USDT = "0xdAC17F958D2ee523a2206206994597C13D831ec7"
      		local TX = "0x" .. string.rep("ab", 32)
      		local NULL = json.decode("null")
      		local function got(path)
      			local req = requests[#requests]
      			assert(req.url == API .. path, req.url)
      		end
      		local EMPTY = '{"items":[],"next_page_params":null}'
      
      		local names = {}
      		for name, fn in blockscout do
      			assert(type(fn) == "function")
      			table.insert(names, name)
      		end
      		table.sort(names)
      		assert(table.concat(names, ",") == "getAddress,getAddressCounters,getBlock,getSmartContract,getStats,getToken,getTokenCounters,"
      			.. "getTokenInstance,getTransaction,getTransactionSummary,listAddressCoinBalanceHistory,listAddressInternalTransactions,"
      			.. "listAddressLogs,listAddressNFTs,listAddressTokenTransfers,listAddressTokens,listAddressTransactions,listBlockTransactions,"
      			.. "listBlocks,listSmartContracts,listTokenHolders,listTokenInstances,listTokenTransfers,listTokens,listTransactionInternalTransactions,"
      			.. "listTransactionLogs,listTransactionTokenTransfers,listTransactions,search", table.concat(names, ","))
      		assert(#requests == 0, "initialization reached Blockscout")
      
      		-- Single records come back unchanged, nulls included.
      		respond('{"hash":"0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","coin_balance":"32644057673209982495","ens_domain_name":"vitalik.eth",'
      			.. '"is_contract":false,"token":null,"public_tags":[]}')
      		local account = blockscout.getAddress(VITALIK)
      		got("/addresses/" .. VITALIK)
      		assert(account.coin_balance == "32644057673209982495" and account.ens_domain_name == "vitalik.eth" and account.token == NULL)
      		assert(json.encode(account.public_tags) == "[]")
      		respond('{"transactions_count":"6311","token_transfers_count":"141803","gas_usage_count":"0","validations_count":"0"}')
      		assert(blockscout.getAddressCounters(string.lower(VITALIK)).transactions_count == "6311")
      		got("/addresses/" .. string.lower(VITALIK) .. "/counters")
      
      		-- A first page: options in name order, and the cursor returned as is.
      		respond('{"items":[{"hash":"' .. TX .. '","method":"transfer","value":"0","status":"ok"}],'
      			.. '"next_page_params":{"block_number":26134774,"index":237,"value":"371078167616008","hash":"' .. TX .. '",'
      			.. '"inserted_at":"2026-10-06T17:18:09.835753Z","fee":"17124093105626","items_count":50}}')
      		local opts = {filter = "from", sort = "value", order = "desc"}
      		local page = blockscout.listAddressTransactions(VITALIK, opts)
      		got("/addresses/" .. VITALIK .. "/transactions?filter=from&order=desc&sort=value")
      		assert(#page.items == 1 and page.items[1].method == "transfer" and page.next_page_params.index == 237)
      		-- The next page repeats the options and adds every cursor field, in name order.
      		respond(EMPTY)
      		opts.page = page.next_page_params
      		local last = blockscout.listAddressTransactions(VITALIK, opts)
      		got("/addresses/" .. VITALIK .. "/transactions?block_number=26134774&fee=17124093105626&filter=from&hash=" .. TX
      			.. "&index=237&inserted_at=2026-10-06T17%3A18%3A09.835753Z&items_count=50&order=desc&sort=value&value=371078167616008")
      		assert(json.encode(last.items) == "[]" and last.next_page_params == nil, "the last page has no cursor")
      		assert(opts.filter == "from" and opts.page.index == 237, "caller options were modified")
      		-- Cursor values may be null, booleans or bracketed keys, as search uses.
      		respond(EMPTY)
      		blockscout.search("usdc", {page = {next_page_params_type = "search", q = "usdc", ["token[fiat_value]"] = NULL,
      			["token[is_verified_via_admin_panel]"] = false, ["token[name]"] = "ICHI Vault Liquidity", ["token[holder_count]"] = "2"}})
      		got("/search?next_page_params_type=search&q=usdc&token%5Bfiat_value%5D=null&token%5Bholder_count%5D=2"
      			.. "&token%5Bis_verified_via_admin_panel%5D=false&token%5Bname%5D=ICHI%20Vault%20Liquidity")
      		respond('{"items":[{"type":"token","name":"USD Coin","address_hash":"0xA0b8"}],"next_page_params":null}')
      		assert(blockscout.search("USD Coin").items[1].name == "USD Coin")
      		got("/search?q=USD%20Coin")
      
      		-- Every other address list, with and without options.
      		respond(EMPTY)
      		blockscout.listAddressTokenTransfers(VITALIK, {filter = "to", type = {"ERC-20", "ERC-721"}, token = USDT})
      		got("/addresses/" .. VITALIK .. "/token-transfers?filter=to&token=" .. USDT .. "&type=ERC-20%2CERC-721")
      		respond(EMPTY)
      		blockscout.listAddressTokenTransfers(VITALIK)
      		got("/addresses/" .. VITALIK .. "/token-transfers")
      		respond(EMPTY)
      		blockscout.listAddressInternalTransactions(VITALIK, {filter = "from"})
      		got("/addresses/" .. VITALIK .. "/internal-transactions?filter=from")
      		respond(EMPTY)
      		blockscout.listAddressLogs(USDT, {topic = "0x" .. string.rep("dd", 32)})
      		got("/addresses/" .. USDT .. "/logs?topic=0x" .. string.rep("dd", 32))
      		respond('{"items":[{"token":{"symbol":"USDT","decimals":"6"},"value":"1500000","token_id":null}],"next_page_params":null}')
      		local balances = blockscout.listAddressTokens(VITALIK, {type = "ERC-20"})
      		got("/addresses/" .. VITALIK .. "/tokens?type=ERC-20")
      		assert(balances.items[1].value == "1500000" and balances.items[1].token.symbol == "USDT")
      		respond(EMPTY)
      		blockscout.listAddressCoinBalanceHistory(VITALIK, {page = {block_number = 26111475, items_count = 50}})
      		got("/addresses/" .. VITALIK .. "/coin-balance-history?block_number=26111475&items_count=50")
      		respond(EMPTY)
      		blockscout.listAddressNFTs(VITALIK, {type = "ERC-1155"})
      		got("/addresses/" .. VITALIK .. "/nft?type=ERC-1155")
      
      		-- Transactions.
      		respond(EMPTY)
      		blockscout.listTransactions({filter = "pending"})
      		got("/transactions?filter=pending")
      		respond(EMPTY)
      		blockscout.listTransactions()
      		got("/transactions")
      		respond('{"hash":"' .. TX .. '","status":"error","revert_reason":null,"value":"1000000000000000000","token_transfers":[]}')
      		local tx = blockscout.getTransaction(TX)
      		got("/transactions/" .. TX)
      		assert(tx.status == "error" and tx.value == "1000000000000000000" and json.encode(tx.token_transfers) == "[]")
      		respond('{"items":[{"index":3,"topics":["0x' .. string.rep("dd", 32) .. '",null],"data":"0x"}],"next_page_params":null}')
      		local logs = blockscout.listTransactionLogs("0x" .. string.rep("AB", 32))
      		got("/transactions/0x" .. string.rep("AB", 32) .. "/logs")
      		assert(logs.items[1].topics[2] == NULL)
      		respond(EMPTY)
      		blockscout.listTransactionTokenTransfers(TX, {type = "ERC-721"})
      		got("/transactions/" .. TX .. "/token-transfers?type=ERC-721")
      		respond(EMPTY)
      		blockscout.listTransactionInternalTransactions(TX, {page = {index = 2, block_number = 1, transaction_index = 107}})
      		got("/transactions/" .. TX .. "/internal-transactions?block_number=1&index=2&transaction_index=107")
      		respond('{"data":{"summaries":[]},"success":true}')
      		assert(json.encode(blockscout.getTransactionSummary(TX).data.summaries) == "[]")
      		got("/transactions/" .. TX .. "/summary")
      
      		-- Blocks by number, as a number or a string, or by hash.
      		respond(EMPTY)
      		blockscout.listBlocks({type = "reorg"})
      		got("/blocks?type=reorg")
      		respond('{"height":26303681,"hash":"' .. TX .. '","transactions_count":160}')
      		assert(blockscout.getBlock(26303681).height == 26303681)
      		got("/blocks/26303681")
      		respond('{"height":0}')
      		blockscout.getBlock("0")
      		got("/blocks/0")
      		respond('{"height":1}')
      		blockscout.getBlock(TX)
      		got("/blocks/" .. TX)
      		respond(EMPTY)
      		blockscout.listBlockTransactions(26303681, {type = "contract_call"})
      		got("/blocks/26303681/transactions?type=contract_call")
      
      		-- Tokens and NFTs; token IDs beyond 2^53 stay decimal strings.
      		respond(EMPTY)
      		blockscout.listTokens({q = "usd", type = "ERC-20", sort = "holders_count", order = "asc"})
      		got("/tokens?order=asc&q=usd&sort=holders_count&type=ERC-20")
      		respond('{"address_hash":"' .. USDT .. '","symbol":"USDT","decimals":"6","exchange_rate":"0.998"}')
      		assert(blockscout.getToken(USDT).decimals == "6")
      		got("/tokens/" .. USDT)
      		respond('{"token_holders_count":"12000000","transfers_count":"300000000"}')
      		blockscout.getTokenCounters(USDT)
      		got("/tokens/" .. USDT .. "/counters")
      		respond('{"items":[{"address":{"hash":"0x5754284f345afc66a98fbb0a0afe71e0f007b949"},"value":"165680228936471","token_id":null}],'
      			.. '"next_page_params":{"value":"165680228936471","address_hash":"0x5754284f345afc66a98fbb0a0afe71e0f007b949","items_count":50}}')
      		local holders = blockscout.listTokenHolders(USDT)
      		got("/tokens/" .. USDT .. "/holders")
      		respond(EMPTY)
      		blockscout.listTokenHolders(USDT, {page = holders.next_page_params})
      		got("/tokens/" .. USDT .. "/holders?address_hash=0x5754284f345afc66a98fbb0a0afe71e0f007b949&items_count=50&value=165680228936471")
      		respond(EMPTY)
      		blockscout.listTokenTransfers(USDT)
      		got("/tokens/" .. USDT .. "/transfers")
      		respond(EMPTY)
      		blockscout.listTokenInstances(USDT, {holder_address_hash = VITALIK})
      		got("/tokens/" .. USDT .. "/instances?holder_address_hash=" .. VITALIK)
      		-- A collection cursor's unique_token is a bare integer beyond 2^53; it comes back as a decimal string.
      		local UNIQUE = "115790456664004915351485478058966557979628998555645103315289660377220126223400"
      		respond('{"items":[{"id":"1"}],"next_page_params":{"unique_token":' .. UNIQUE .. '}}')
      		local instances = blockscout.listTokenInstances(USDT)
      		assert(instances.next_page_params.unique_token == UNIQUE, tostring(instances.next_page_params.unique_token))
      		respond(EMPTY)
      		blockscout.listTokenInstances(USDT, {page = instances.next_page_params})
      		got("/tokens/" .. USDT .. "/instances?unique_token=" .. UNIQUE)
      		local BIG = "115792089237316195423570985008687907853269984665640564039457584007913129639935"
      		respond('{"id":"' .. BIG .. '","metadata":{"name":"x"}}')
      		assert(blockscout.getTokenInstance(USDT, BIG).id == BIG)
      		got("/tokens/" .. USDT .. "/instances/" .. BIG)
      		respond('{"id":"7"}')
      		blockscout.getTokenInstance(USDT, 7)
      		got("/tokens/" .. USDT .. "/instances/7")
      
      		-- Verified contracts and chain statistics.
      		respond(EMPTY)
      		blockscout.listSmartContracts({q = "Uniswap", filter = "vyper"})
      		got("/smart-contracts?filter=vyper&q=Uniswap")
      		respond('{"name":"Uni","language":"solidity","abi":[{"type":"function","name":"transfer"}],"additional_sources":[]}')
      		local contract = blockscout.getSmartContract(USDT)
      		got("/smart-contracts/" .. USDT)
      		assert(contract.abi[1].name == "transfer" and json.encode(contract.additional_sources) == "[]")
      		respond('{"total_blocks":"26303431","gas_prices":{"slow":0.72,"average":1.14,"fast":6.37}}')
      		assert(blockscout.getStats().gas_prices.fast == 6.37)
      		got("/stats")
      		assert(#responses == 0, "a queued response was not read")
      	end,
      }