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
- 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)
| Field | Size (bytes) | Description |
|---|---|---|
| ReqType | 1 | 1 = LIST |
3.2 GET_BY_ID (ReqType = 0)
| Field | Size (bytes) | Description |
|---|---|---|
| ReqType | 1 | 0 = GET_BY_ID |
| Count | 1 | Number of IDs (N) |
| ImageID | 16 × N | Requested image IDs |
# Server response packets
4.1 LIST response (Header = JTPL)
| Field | Size (bytes) | Description |
|---|---|---|
| Header | 4 | ASCII "JTPL" |
| Count | 2 | Number of entries (u16) |
| Entries | variable | Repeated Count times |
Each entry:
| Field | Size (bytes) | Description |
|---|---|---|
| ImageID | 16 | Image ID |
| FileType | 1 | 0=png,1=jpg,2=webp,3=bmp,4=gif,255=other |
| NameLen | 2 | Filename length (u16) |
| Filename | NameLen | UTF-8 basename |
| Size | 4 | Data size (u32) |
4.2 Image response (Header = JTP1)
| Field | Size (bytes) | Description |
|---|---|---|
| Header | 4 | ASCII "JTP1" |
| FileType | 1 | 0=png,1=jpg,2=webp,3=bmp,4=gif,255=other |
| ImageID | 16 | Matches requested ImageID |
| NameLen | 2 | Filename length (u16) |
| Filename | NameLen | UTF-8 basename |
| Length | 4 | Data length (u32) |
| Data | variable | Raw 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)