ColossusColossus
Technical

ISO 8583 Middleware

ISO 8583 middleware architecture, API endpoints, message parsing, UserOperation construction, and gas sponsorship.

ISO 8583 Middleware

The ISO 8583 middleware is the bridge between the traditional card payment network and ColossusNet's on-chain settlement layer. It translates binary ISO 8583 authorization requests into ERC-4337 UserOperations and translates on-chain results back into ISO 8583 responses.

Service architecture

The middleware is a stateless translation service running at the acquirer boundary:

  1. Receives a binary ISO 8583 message (MTI 0200)
  2. Parses DE55 (ICC/EMV data) and DE62 (signature data)
  3. Looks up the ERC-4337 account by PAN via the Colossus Indexer
  4. Constructs an ERC-4337 UserOperation
  5. Submits to the ColossusNet sequencer
  6. Receives a preconfirmation
  7. Returns a binary ISO 8583 response (MTI 0210)

API endpoints

MethodPathContent-TypeDescription
POST/arqcapplication/octet-streamProcess ARQC, return ARPC
GET/healthapplication/jsonService health (DB + contracts)
GET/metricstext/plainPrometheus metrics

Inbound message (MTI 0200)

The middleware expects the following Data Elements in the ISO 8583 MTI 0200 financial request:

DENameRequiredDescription
2PANYesPrimary Account Number
4AmountYesTransaction amount
11STANYesSystems Trace Audit Number
14Expiration DateYesCard expiry
22POS Entry ModeYes051 (chip) or 071 (contactless)
41Terminal IDYes8-character terminal identifier
42Merchant IDYes15-character merchant identifier
49Currency CodeYesISO 4217 numeric
55ICC DataYesTLV-encoded EMV tags including 9F4B

DE55 tag extraction

The middleware parses the following tags from DE55 (ICC/EMV Data):

TagFieldUsed for
9F26Application CryptogramPacked into on-chain data
9F27CIDVerify ARQC type (must be 0x80)
9F37Unpredictable NumberReplay protection (uniqueness)
9F02AmountSettlement amount
5F2ACurrency CodeToken selection
9ATransaction DateAudit
9CTransaction TypeMust be 0x00 (purchase)
95TVRPassed through to contract
9F34CVM ResultsPassed through
9F4BSDADECDSA signature (extracted for UserOp)

UserOperation construction

After parsing the ISO 8583 message, the middleware constructs an ERC-4337 UserOperation:

UserOperation {
    sender:           <ERC-4337 account address (from PAN lookup)>,
    nonce:            <EntryPoint nonce for EMVValidator>,
    callData:         kernel.execute(
                        CALLTYPE_DELEGATECALL,
                        encodePacked(
                            emvSettlement,
                            emvSettlement.execute.selector,
                            emvFields[61 bytes]
                        )
                      ),
    signature:        <ECDSA signature from 9F4B (raw r,s)>,
    paymasterAndData: <ColossusNet gas sponsor>
}

The sender is resolved by querying the Colossus Indexer with the PAN from DE2. The signature field contains the raw (r, s) values extracted from the DER-encoded ECDSA signature in tag 9F4B. The callData encodes a delegatecall through the ZeroDev Kernel to the EMVSettlement executor module, passing the 61-byte packed EMV fields.

EMV fields packing (61 bytes)

The EMV fields are packed into a 61-byte binary structure passed as callData to the EMVSettlement contract:

OffsetSizeSource tagField
089F26ARQC (Application Cryptogram)
849F37Unpredictable Number
1269F02Amount (BCD)
1825F2ACurrency Code
2039ATransaction Date (BCD)
2319CTransaction Type
24595TVR
2939F34CVM Results
3289F1CTerminal ID
40159F16Merchant ID
5569F01Acquirer ID

The EMVValidator contract hashes these 61 bytes with SHA-256 and verifies the ECDSA P-256 signature against the cardholder's registered public key using the RIP-7212 precompile at address 0x100:

H = SHA-256(emvFields[0:61])
valid = ecrecover_P256(H, r, s, publicKey)

Response message (MTI 0210)

After receiving the on-chain result, the middleware constructs an ISO 8583 MTI 0210 financial response:

DENameValue
39Response Code00 (Approved) or 05 (Declined)
38Authorization IDTransaction hash (first 6 chars)
55ICC DataARPC cryptogram (tag 91)

The response is returned as binary application/octet-stream to the acquirer, which forwards it to the terminal. A DE39 value of 00 causes the terminal to display "Approved."

Gas sponsorship

ColossusNet sponsors all transaction gas. The cardholder does not need ETH or any native token. The paymasterAndData field in the UserOperation references the ColossusNet paymaster contract, which covers execution costs. Gas costs are amortized into the network fee structure.

On this page