Jason Transfer Protocol — JTP/1.0

December 28, 2025

Jason Transfer Protocol ("JTP") is a compact request/response protocol for listing and transferring images over TCP (optionally TLS), keyed by SHA-256-derived IDs.

# Abstract

JTP is a lightweight binary protocol for fast image distribution. A client first discovers available content with a catalog request (LIST), then requests one or more images by their content-derived identifiers (GET_BY_ID). Images are addressed by the first 16 bytes of SHA-256 over the file bytes, enabling deduplication and integrity checks; optional TLS provides confidentiality on the wire.

Connection + request/response sequence

# Connection

  • Transport is TCP, optionally wrapped in TLS.
  • The reference server listens on 127.0.0.1:9999.

# ImageID encoding

ImageID is 16 bytes: the first 16 bytes of SHA-256 over the raw file bytes.

image_bytes = read_file("jason.jpg") 
hash = SHA256(image_bytes) // 32 bytes 
image_id = hash[0..15] // first 16 bytes

# Client request packets

The first byte is ReqType.

3.1 LIST (ReqType = 1)

FieldSize (bytes)Description
ReqType11 = LIST

3.2 GET_BY_ID (ReqType = 0)

FieldSize (bytes)Description
ReqType10 = GET_BY_ID
Count1Number of IDs (N)
ImageID16 × NRequested image IDs

# Server response packets

4.1 LIST response (Header = JTPL)

FieldSize (bytes)Description
Header4ASCII "JTPL"
Count2Number of entries (u16)
EntriesvariableRepeated Count times

Each entry:

FieldSize (bytes)Description
ImageID16Image ID
FileType10=png,1=jpg,2=webp,3=bmp,4=gif,255=other
NameLen2Filename length (u16)
FilenameNameLenUTF-8 basename
Size4Data size (u32)

4.2 Image response (Header = JTP1)

FieldSize (bytes)Description
Header4ASCII "JTP1"
FileType10=png,1=jpg,2=webp,3=bmp,4=gif,255=other
ImageID16Matches requested ImageID
NameLen2Filename length (u16)
FilenameNameLenUTF-8 basename
Length4Data length (u32)
DatavariableRaw file bytes

# Example packets

Hex dumps are spaced by byte. Integers are big-endian.

1.1. LIST request

01
  • 01 = ReqType (LIST)

1.2. LIST response (Count = 1)

4A 54 50 4C  00 01
AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99  01  00 09
6A 61 73 6F 6E 31 2E 6A 70 67  00 00 12 34
  • JTPL header, Count=1
  • Entry: ImageID(16) + FileType(01=jpg) + NameLen(9)
  • Filename 'jason1.jpg' + Size(0x00001234)

2.1. GET_BY_ID request (Count = 1)

00  01
AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99
  • 00 = ReqType (GET_BY_ID)
  • 01 = Count
  • 16 bytes of ImageID

2.2. Response: image packet (JTP1)

4A 54 50 31  01
AA BB CC DD EE FF 00 11 22 33 44 55 66 77 88 99
00 09
6A 61 73 6F 6E 31 2E 6A 70 67
00 00 00 04
DE AD BE EF
  • JTP1 header + FileType(01=jpg)
  • ImageID echoes the requested ID
  • NameLen(9) + filename 'jason1.jpg'
  • Length(4) + 4 bytes of file data (example)