{"openapi":"3.1.0","info":{"title":"Crypto Operations API","version":"1.0.0","description":"Static checks for caller-supplied cross-chain bridge records. Source and destination operations are matched by the message identifiers in the request. No network calls are made. Paid with x402 exact USDC on Base. No account is required.","contact":{"email":"support@brainiac.software"},"x-guidance":"BRAINIAC.software is a pay-per-call API for software agents. No account or API key is required.\nPayment uses the x402 protocol with exact USDC on Base (chain id 8453). Each POST operation has a fixed USD price.\nHow to call an operation:\n1. POST JSON matching the requestBody. Invalid input returns 400 with no payment challenge.\n2. A valid unpaid call returns 402 with the exact amount and payTo.\n3. Pay and retry with payment-signature. Payment settles only if the operation returns 2xx. A 4xx/5xx is not charged.\nInclude an Idempotency-Key header of 64 hex characters from 32 random bytes. Reuse that key only for retries of the same operation and request body.\nAll outputs are compliance prechecks, drafts, or data lookups for human review. They are not official determinations, legal advice, identity confirmation, or certified filings. Verify time-sensitive or official data with the cited source before acting."},"servers":[{"url":"https://www.brainiac.software"}],"paths":{"/api/v1/crypto-operations/bridge-partial-failure-audit":{"post":{"operationId":"audit_bridge_partial_failure","summary":"Audit bridge partial failure","description":"Compare caller-supplied source and destination records for a cross-chain bridge. Operations are matched only by message identifier, or by the log field named in fieldMapping. Amounts are scaled with the supplied decimals, fee, and optional conversion rate. consistency_status is consistent, inconsistent, incomplete, or indeterminate. risk_level is low, medium, high, or critical. A missing record is incomplete evidence, not proof that the bridge failed. No chain is queried, and no transaction is treated as final.","tags":["crypto-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"source":{"type":"object","properties":{"chainId":{"type":"integer","exclusiveMinimum":0,"maximum":2147483647},"transactions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"nonce":{"type":"integer","minimum":0,"maximum":2147483647},"receipt":{"type":"object","properties":{"status":{"type":"string","enum":["success","reverted"]},"logs":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"logIndex":{"type":"integer","minimum":0,"maximum":1000000},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"topics":{"maxItems":4,"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}},"data":{"type":"string","maxLength":8194,"pattern":"^0x(?:[0-9a-fA-F]{2})*$"},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"type":"string","maxLength":200}}},"additionalProperties":false}}},"required":["status"],"additionalProperties":false}},"required":["hash"],"additionalProperties":false}},"operations":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"messageId":{"type":"string","maxLength":200,"pattern":"^\\S(?:.*\\S)?$"},"nonce":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"},"recipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36},"status":{"type":"string","enum":["pending","sent","completed","failed","reverted"]},"transactionHash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}},"required":["messageId"],"additionalProperties":false}},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36}},"required":["chainId"],"additionalProperties":false},"destination":{"type":"object","properties":{"chainId":{"type":"integer","exclusiveMinimum":0,"maximum":2147483647},"transactions":{"maxItems":20,"type":"array","items":{"type":"object","properties":{"hash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"},"from":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"to":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"nonce":{"type":"integer","minimum":0,"maximum":2147483647},"receipt":{"type":"object","properties":{"status":{"type":"string","enum":["success","reverted"]},"logs":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"logIndex":{"type":"integer","minimum":0,"maximum":1000000},"address":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"topics":{"maxItems":4,"type":"array","items":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}},"data":{"type":"string","maxLength":8194,"pattern":"^0x(?:[0-9a-fA-F]{2})*$"},"fields":{"type":"object","propertyNames":{"type":"string","minLength":1,"maxLength":80},"additionalProperties":{"type":"string","maxLength":200}}},"additionalProperties":false}}},"required":["status"],"additionalProperties":false}},"required":["hash"],"additionalProperties":false}},"operations":{"maxItems":40,"type":"array","items":{"type":"object","properties":{"messageId":{"type":"string","maxLength":200,"pattern":"^\\S(?:.*\\S)?$"},"nonce":{"type":"string","pattern":"^(0|[1-9][0-9]{0,77})$"},"recipient":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36},"status":{"type":"string","enum":["pending","sent","completed","failed","reverted"]},"transactionHash":{"type":"string","pattern":"^0x[0-9a-fA-F]{64}$"}},"required":["messageId"],"additionalProperties":false}},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"},"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36}},"required":["chainId"],"additionalProperties":false},"fieldMapping":{"type":"object","properties":{"messageId":{"type":"string","minLength":1,"maxLength":80},"nonce":{"type":"string","minLength":1,"maxLength":80},"recipient":{"type":"string","minLength":1,"maxLength":80},"token":{"type":"string","minLength":1,"maxLength":80},"amount":{"type":"string","minLength":1,"maxLength":80},"decimals":{"type":"string","minLength":1,"maxLength":80},"status":{"type":"string","minLength":1,"maxLength":80}},"required":["messageId"],"additionalProperties":false},"fee":{"type":"object","properties":{"amount":{"type":"string"},"decimals":{"type":"integer","minimum":0,"maximum":36},"token":{"type":"string","pattern":"^0x[0-9a-fA-F]{40}$"}},"required":["amount"],"additionalProperties":false},"conversion":{"type":"object","properties":{"numerator":{"type":"string","pattern":"^[1-9][0-9]{0,77}$"},"denominator":{"type":"string","pattern":"^[1-9][0-9]{0,77}$"}},"required":["numerator","denominator"],"additionalProperties":false},"expectedStatus":{"type":"string","enum":["settled","pending","failed"]}},"required":["source","destination"],"additionalProperties":false},"example":{"source":{"chainId":1,"token":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","transactions":[{"hash":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","receipt":{"status":"success","logs":[{"address":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","data":"0x"}]}}],"operations":[{"messageId":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","nonce":"7","recipient":"0x1111111111111111111111111111111111111111","token":"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48","amount":"1000000","decimals":6,"status":"completed","transactionHash":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"},{"messageId":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","amount":"500000","decimals":6,"status":"sent"}]},"destination":{"chainId":8453,"token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","transactions":[{"hash":"0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd","receipt":{"status":"success"}},{"hash":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee","receipt":{"status":"success"}},{"hash":"0x1111111111111111111111111111111111111111111111111111111111111111","receipt":{"status":"success"}}],"operations":[{"messageId":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","nonce":"7","recipient":"0x2222222222222222222222222222222222222222","token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"900000","decimals":6,"status":"completed","transactionHash":"0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"},{"messageId":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","nonce":"7","recipient":"0x2222222222222222222222222222222222222222","token":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","amount":"900000","decimals":6,"status":"completed","transactionHash":"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"},{"messageId":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","token":"0x4444444444444444444444444444444444444444","amount":"1","decimals":6,"status":"completed","transactionHash":"0x1111111111111111111111111111111111111111111111111111111111111111"}]},"fee":{"amount":"0","decimals":6},"expectedStatus":"settled"}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"consistency_status":{"type":"string"},"risk_level":{"type":"string"},"matched_operations":{"type":"array","items":{"type":"object","properties":{"message_id":{"type":"string"},"source":{"type":"object","properties":{"chain_id":{"type":"number"},"count":{"type":"number"},"transaction_hash":{"type":"string"},"status":{"type":"string"},"token":{"type":"string"},"amount":{"type":"string"},"decimals":{"type":"number"},"recipient":{"type":"string"},"nonce":{"type":"string"}},"additionalProperties":true},"destination":{"type":"object","properties":{"chain_id":{"type":"number"},"count":{"type":"number"},"status":{"type":"string"},"token":{"type":"string"},"amount":{"type":"string"},"decimals":{"type":"number"},"recipient":{"type":"string"},"nonce":{"type":"string"}},"additionalProperties":true}},"additionalProperties":true}},"missing_records":{"type":"array","items":{"type":"object","properties":{"side":{"type":"string"},"message_id":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"amount_mismatches":{"type":"array","items":{"type":"object","properties":{"message_id":{"type":"string"},"expected_destination_amount":{"type":"string"},"actual_destination_amount":{"type":"string"},"source_amount":{"type":"string"},"fee_amount":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"duplicate_operations":{"type":"array","items":{"type":"object","properties":{"side":{"type":"string"},"message_id":{"type":"string"},"count":{"type":"number"},"transaction_hashes":{"type":"array","items":{"type":"string"}}},"additionalProperties":true}},"findings":{"type":"array","items":{"type":"object","properties":{"code":{"type":"string"},"severity":{"type":"string"},"detail":{"type":"string"}},"additionalProperties":true}},"limitations":{"type":"array","items":{"type":"string"}}},"additionalProperties":true},"example":{"consistency_status":"inconsistent","risk_level":"critical","matched_operations":[{"message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","source":{"chain_id":1,"count":1,"transaction_hash":"0xbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb","status":"completed","token":"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48","amount":"1000000","decimals":6,"recipient":"0x1111111111111111111111111111111111111111","nonce":"7"},"destination":{"chain_id":8453,"count":2,"status":"completed","token":"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913","amount":"900000","decimals":6,"recipient":"0x2222222222222222222222222222222222222222","nonce":"7"}}],"missing_records":[{"side":"destination","message_id":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","detail":"No destination operation with this message identifier was supplied. The absent destination record does not prove that the bridge failed."},{"side":"source","message_id":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","detail":"A destination operation uses this message identifier, and no source operation with that identifier was supplied. The absent source record does not prove that a source transaction failed."}],"amount_mismatches":[{"message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","expected_destination_amount":"1000000","actual_destination_amount":"900000","source_amount":"1000000","fee_amount":"0","detail":"The destination amount does not equal the source amount minus the declared fee after decimal scaling. No conversion rate was supplied, so the rate used was 1/1."}],"duplicate_operations":[{"side":"destination","message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","count":2,"transaction_hashes":["0xdddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd","0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"]}],"findings":[{"code":"token_mismatch","severity":"high","detail":"An operation token on chain 8453 does not match the token declared for that side."},{"code":"duplicate_destination","severity":"critical","message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","detail":"More than one destination operation uses this message identifier."},{"code":"recipient_mismatch","severity":"high","message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","detail":"The source and destination recipients differ."},{"code":"amount_mismatch","severity":"critical","message_id":"0xaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa","detail":"The source and destination amounts do not agree after decimals, the declared fee, and the conversion rate."},{"code":"missing_destination_record","severity":"medium","message_id":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","detail":"The source operation has no matching destination operation in this request."},{"code":"expected_settlement_not_shown","severity":"medium","message_id":"0xcccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc","detail":"The expected status is settled, and a supplied status is still pending or sent."},{"code":"destination_without_source","severity":"high","message_id":"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff","detail":"The destination records contain an execution whose message identifier does not appear on the source side of this request."}],"limitations":["Only the records in this request were compared. No chain was queried, and no transaction is treated as final.","A missing source or destination record is incomplete evidence. It does not prove that the bridge failed.","Chain IDs are labels from the request. They were not checked against a network.","Token addresses on different chains are not assumed to be the same asset. A token is compared only with the token declared for that same side.","Bridge event formats are not inferred. Event logs become operations only through fieldMapping.","Chain 1 has more than one operation, so the side-level token, amount, and decimals were not copied onto each operation.","Chain 8453 has more than one operation, so the side-level token, amount, and decimals were not copied onto each operation.","1 event log on chain 1 was not turned into operations. A log is used only when fieldMapping names its message-identifier field."]}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object: x402Version, resource with the operation description, accepts with the price and network, and extensions.bazaar with the input schema, input example, output schema, and output example."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed before settlement, so no payment is taken. Reuse the same idempotency key to retrieve the stored error without paying again."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.05"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}},"/api/v1/crypto-operations/bridge-leg-consistency":{"post":{"operationId":"score_bridge_leg_consistency","summary":"Score bridge leg consistency","description":"Group caller-supplied source and destination legs by message id. A message is consistent when both legs succeeded for the same amount. The recovery index is the hardest leg: a pending destination after a successful source scores lower than two matching successes. No chain is queried.","tags":["crypto-operations"],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$schema":"https://json-schema.org/draft/2020-12/schema","type":"object","properties":{"legs":{"minItems":2,"maxItems":80,"type":"array","items":{"type":"object","properties":{"message_id":{"type":"string","minLength":1,"maxLength":80},"role":{"type":"string","enum":["source","destination"]},"status":{"type":"string","enum":["success","failed","pending"]},"amount":{"type":"integer","minimum":0,"maximum":9007199254740991}},"required":["message_id","role","status","amount"],"additionalProperties":false}}},"required":["legs"],"additionalProperties":false},"example":{"legs":[{"message_id":"a","role":"source","status":"success","amount":1000000},{"message_id":"a","role":"destination","status":"success","amount":1000000},{"message_id":"b","role":"source","status":"success","amount":500000},{"message_id":"b","role":"destination","status":"pending","amount":0}]}}}},"parameters":[{"name":"Idempotency-Key","in":"header","required":true,"description":"Fresh random 32-byte value encoded as 64 hexadecimal characters. Reuse unchanged only for retries of the same operation and request.","schema":{"type":"string","pattern":"^[0-9a-fA-F]{64}$"}}],"responses":{"200":{"description":"Illustrative endpoint-specific JSON response shape. Conditional fields depend on the result and data-source availability.","content":{"application/json":{"schema":{"type":"object","properties":{"consistency_score":{"type":"number"},"recovery_feasibility_index":{"type":"number"}},"additionalProperties":true},"example":{"consistency_score":50,"recovery_feasibility_index":45}}}},"400":{"description":"Invalid JSON or request schema."},"402":{"description":"Payment required. The JSON body is the x402 PaymentRequired object: x402Version, resource with the operation description, accepts with the price and network, and extensions.bazaar with the input schema, input example, output schema, and output example."},"409":{"description":"Idempotency conflict, in-progress payment, or expired result cache. Reusing the key cannot trigger a second charge."},"413":{"description":"Request body exceeds the 24 MB limit."},"500":{"description":"Operation failed before settlement, so no payment is taken. Reuse the same idempotency key to retrieve the stored error without paying again."},"503":{"description":"Payment or retry-safe result storage is unavailable; the operation is not run."}},"x-payment-info":{"price":{"mode":"fixed","currency":"USD","amount":"0.04"},"protocols":[{"x402":{"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}],"facilitator":"https://api.cdp.coinbase.com/platform/v2/x402"}}}},"components":{"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}