Technical Report · ECOSUS CO., LTD. · TR-2026-009 EN JP TH
TR-2026-009

gyotak-komon

Region Range Proof with Dual-Mode Privacy การพิสูจน์ขอบเขตพื้นที่พร้อมความเป็นส่วนตัวสองโหมด

Prove an item was registered inside a declared region without revealing the exact coordinates · Midnight Preprod · 2026-06-06 พิสูจน์ว่าวัตถุถูกลงทะเบียนภายในเขตที่ประกาศไว้โดยไม่เปิดเผยพิกัด · Midnight Preprod · 6 มิ.ย. 2569
Preprod Verifiedยืนยันบน Preprod แล้ว
Dateวันที่
June 6, 2026
Networkเครือข่าย
Midnight Preprod
Statusสถานะ
Finalฉบับสมบูรณ์
Classหมวดหมู่
Publicสาธารณะ
Abstract / 要旨 / บทคัดย่อ
This report documents the preprod deployment and on-chain verification of gyotak-komon, a Compact contract on Midnight that proves an item was registered within a declared geographic region without revealing its exact coordinates. The exact GPS position is a private witness; a zero-knowledge range proof discloses only the boolean fact that the point lies inside a public bounding box. A privacyMode flag offers two modes — shielded (coordinates hidden) and disclosed (coordinates also published) — and the circuit forces the chosen mode so it cannot be misrepresented. The contract was deployed to Midnight Preprod (address 06edca65…f11a) and verified across five test transactions covering both modes and duplicate rejection. This is a preprod design-and-verification report; integration into the live mainnet catch contract is deferred until after a third-party audit.
รายงานนี้บันทึกการ deploy บน preprod และการยืนยันบนเชนของ gyotak-komon คอนแทรกต์ Compact บน Midnight ที่พิสูจน์ว่าวัตถุถูกลงทะเบียนภายในเขตพื้นที่ที่ประกาศไว้โดยไม่เปิดเผยพิกัดที่แท้จริง พิกัด GPS จริงเป็น private witness; range proof แบบ zero-knowledge เปิดเผยเพียงผลบูลีนว่าจุดอยู่ในกรอบ bounding box สาธารณะ ธง privacyMode มีสองโหมด — shielded (ซ่อนพิกัด) และ disclosed (เปิดเผยพิกัดด้วย) — และวงจรบังคับโหมดที่เลือกจึงปลอมแปลงไม่ได้ คอนแทรกต์ deploy บน Midnight Preprod (ที่อยู่ 06edca65…f11a) และยืนยันด้วย 5 ธุรกรรมทดสอบครอบคลุมทั้งสองโหมดและการปฏิเสธรายการซ้ำ รายงานนี้เป็นการออกแบบและตรวจสอบบน preprod; การรวมเข้ากับคอนแทรกต์ catch บน mainnet จะทำหลังการตรวจสอบโดยบุคคลที่สาม

0. Background & Motivation 0. ที่มาและแรงจูงใจ

gyotak-catch (Layer 1, on Midnight mainnet) commits a hash of the registered coordinates but does not prove the coordinates lie inside the declared region — the region is a self-declared label. gyotak-komon closes that gap: it proves region-membership in zero knowledge while keeping the exact location — a genuine competitive asset — secret. KOMON's aim is broader than seafood: a QR/tag-free way to prove an item's one-of-a-kind identity and its origin from a photo alone — from an EPS foam box to agricultural produce such as durian — as an experiment toward bringing provenance to primary industry at large. It also adds a per-individual fingerprint (komonCommit) for item-level provenance. gyotak-catch (Layer 1 บน Midnight mainnet) คอมมิตแฮชของพิกัดที่ลงทะเบียนแต่ไม่พิสูจน์ว่าพิกัดอยู่ในเขตที่ประกาศ — region เป็นป้ายที่ประกาศเอง gyotak-komon ปิดช่องว่างนี้: พิสูจน์การอยู่ในเขตแบบ zero-knowledge โดยเก็บตำแหน่งที่แท้จริงเป็นความลับ เป้าหมายของ KOMON กว้างกว่าอาหารทะเล: วิธีพิสูจน์ความเป็นหนึ่งเดียวของวัตถุและแหล่งกำเนิดจากรูปภาพเพียงอย่างเดียว โดยไม่ต้องมี QR/แท็ก — ตั้งแต่กล่องโฟม EPS ไปจนถึงผลผลิตทางการเกษตรเช่นทุเรียน — เป็นการทดลองเพื่อขยายการพิสูจน์แหล่งกำเนิดสู่ภาคปฐมภูมิ และเพิ่มลายนิ้วมือรายตัว (komonCommit)

1. Contract Deployment 1. การ deploy คอนแทรกต์

Fieldฟิลด์ Valueค่า
Contract addressที่อยู่คอนแทรกต์06edca6576e324259d62778ab2e48adf2cd3001d296856ec63fc7b2ffd5af11a
NetworkMidnight Preprod (no mainnet deployment)
Deploy dateวันที่ deploy2026-06-06
Deploy TX1c90c096… (block 1,108,512)
Owner pk5e8c984df5acc1948c6a9b969e92f6d1c237257a8cc0e4b629335ec6818dcc99
compactc0.30.0
Language versionเวอร์ชันภาษา0.22.0
Runtime versionเวอร์ชัน runtime0.15.0
ledger^8.0.3
proof-server8.0.3 @ localhost:6300

2. Contract Specification 2. ข้อกำหนดคอนแทรกต์

KomonRecord fields stored on-chain: ฟิลด์ของ KomonRecord ที่เก็บบนเชน:

Field Typeชนิด Noteหมายเหตุ
komonCommitBytes<32>Per-individual fingerprintลายนิ้วมือรายตัว
photoHashBytes<32>SHA-256 of photoSHA-256 ของรูป
regionBytes<32>Region label e.g. "Pranburi"ชื่อเขต เช่น "Pranburi"
privacyModeUint<8>0 = shielded, 1 = disclosed
gpsHashBytes<32>Hash commitment of GPSแฮชพิกัด GPS
latUint<32>pm=0 → 0, pm=1 → real latitudepm=0 เป็น 0, pm=1 พิกัดจริง
lngUint<32>pm=0 → 0, pm=1 → real longitudepm=0 เป็น 0, pm=1 ลองจิจูดจริง
committedAtUint<64>Timestampเวลา

recordKomon circuit arguments: อาร์กิวเมนต์วงจร recordKomon:

batchId: Bytes<32>, region: Bytes<32>, komonCommit: Bytes<32>,
photoHash: Bytes<32>, privacyMode: Uint<8>,
latMin: Uint<32>, latMax: Uint<32>, lngMin: Uint<32>, lngMax: Uint<32>,
timestamp: Uint<64>

Witnesses (private inputs, never published): Witness (อินพุตส่วนตัว ไม่เปิดเผย):

witness getGpsCoords(batchId: Bytes<32>): Vector<2, Uint<32>>;  // exact coords (private)
witness localSecretKey(): Bytes<32>;                              // owner key (private)

3. The Range Proof 3. การพิสูจน์ขอบเขต

The bounds (latMin/latMax/lngMin/lngMax) are public circuit parameters. The witnessed coordinates are compared against them, and disclose() exposes only the boolean outcome — which must be true — never the coordinate values. ขอบเขต (latMin/latMax/lngMin/lngMax) เป็นพารามิเตอร์สาธารณะ พิกัดที่เป็น witness ถูกเทียบกับขอบเขต และ disclose() เปิดเผยเฉพาะผลบูลีน (ต้องเป็น true) ไม่ใช่ค่าพิกัด

assert(latMin <= latMax, "bad lat bounds");
assert(lngMin <= lngMax, "bad lng bounds");
assert(disclose(gps[0] >= latMin), "lat below range");
assert(disclose(gps[0] <= latMax), "lat above range");
assert(disclose(gps[1] >= lngMin), "lng below range");
assert(disclose(gps[1] <= lngMax), "lng above range");

4. Dual-Mode Privacy 4. ความเป็นส่วนตัวสองโหมด

Compact has no ternary operator, so mode selection uses a multiplication trick. privacyMode (0/1) is disclosed and recorded on-chain. shielded (pm=0) forces lat=lng=0; disclosed (pm=1) stores the real coordinates. The circuit enforces this, so a prover cannot claim shielded while revealing, nor claim disclosed while hiding. The range proof runs in BOTH modes. Compact ไม่มี ternary จึงใช้ multiplication trick เลือกโหมด privacyMode (0/1) ถูก disclose และบันทึกบนเชน shielded (pm=0) บังคับ lat=lng=0; disclosed (pm=1) เก็บพิกัดจริง วงจรบังคับ จึงอ้าง shielded แต่เปิดเผยไม่ได้ และอ้าง disclosed แต่ซ่อนไม่ได้ range proof ทำงานทั้งสองโหมด

const sel = pm as Uint<32>;
const latOut = (gps[0] * sel) as Uint<32>;  // pm=0 -> 0,  pm=1 -> real lat
const lngOut = (gps[1] * sel) as Uint<32>;  // pm=0 -> 0,  pm=1 -> real lng
Modeโหมด privacyMode lat/lng gpsHash Range proofRange proof
shielded0 0 (coordinates hidden)0 (ซ่อนพิกัด) ✓ only "inside the box" is disclosed✓ เปิดเผยเฉพาะ "อยู่ในกรอบ"
disclosed1 real coordinates (plaintext)พิกัดจริง (plaintext) ✓ same proof still runs✓ proof เดียวกันยังทำงาน

5. Circuit Verification Results 5. ผลการตรวจสอบวงจร

# Functionฟังก์ชัน batchId Modeโหมด TX Block Resultผลลัพธ์
1 recordKomon KMN-TESTFIXTURE01 shielded (pm=0) 003e863a2d12ed0dd8d768d55d3e1b5232d50623f3597201123a034060cab98b4d 1,108,580 PASS
2 verifyKomon KMN-TESTFIXTURE01 read-backอ่านกลับ PASS (region=Pranburi, privacyMode=0, lat=0, lng=0, gpsHash=846d5c47…)
3 recordKomon KMN-TESTFIXTURE02 disclosed (pm=1) 00643b54338eca0edd8425b1b8e9dcf2bb01f3e26f4887768eabdc1cb9dcf8613d 1,108,844 PASS
4 verifyKomon KMN-TESTFIXTURE02 read-backอ่านกลับ PASS (privacyMode=1, lat=2273483648, lng=3144483648, gpsHash=8db21bfb…)
5 recordKomon KMN-TESTFIXTURE01 (dup) shielded REJECT as expected ("komon already exists")ปฏิเสธตามที่คาด
Test 4 confirms disclosed-mode raw integers lat=2273483648 / lng=3144483648 decode to 12.6 / 99.7 (see §6). Test 2 confirms shielded-mode coordinates are forced to 0. เทสต์ 4 ยืนยันว่าโหมด disclosed ค่า lat=2273483648 / lng=3144483648 ถอดเป็น 12.6 / 99.7 (ดู §6) เทสต์ 2 ยืนยันโหมด shielded บังคับพิกัดเป็น 0

6. Coordinate Encoding 6. การเข้ารหัสพิกัด

Coordinates are stored as scaled unsigned integers: stored = round(degrees × 1e7) + 231. The ×1e7 keeps ~cm precision; the +231 offset shifts negatives into the unsigned range. Example: lat 12.3456789 → 123456789 + 2147483648 = 2270940437. พิกัดเก็บเป็นจำนวนเต็มไม่มีเครื่องหมาย: stored = round(องศา × 1e7) + 231 ×1e7 ให้ความละเอียดระดับ cm; +231 เลื่อนค่าลบเข้าสู่ช่วงไม่มีเครื่องหมาย ตัวอย่าง: lat 12.3456789 → 2270940437

7. Scope & Limitations 7. ขอบเขตและข้อจำกัด

8. Design Philosophy 8. ปรัชญาการออกแบบ

"The object is its own label. A foam box's grain pattern, a durian's skin — each is physically one of a kind and impossible to clone, so an item can prove it is itself and where it came from, with no QR or tag to forge. KOMON secures logistics today and aims to bring photo-only provenance to primary industry at large."
"วัตถุคือป้ายของตัวมันเอง ลายเม็ดของกล่องโฟม ผิวของทุเรียน — แต่ละชิ้นมีหนึ่งเดียวในเชิงกายภาพและลอกเลียนไม่ได้ ดังนั้นวัตถุจึงพิสูจน์ได้ว่ามันคือตัวมันเองและมาจากที่ใด โดยไม่มี QR หรือแท็กให้ปลอมแปลง KOMON ปกป้องโลจิสติกส์ในวันนี้ และมุ่งขยายการพิสูจน์แหล่งกำเนิดด้วยรูปภาพสู่ภาคปฐมภูมิ"

9. GYOTAK Protocol Layers 9. GYOTAK Protocol Layers

Layer 1
gyotak-catch
Provenance ZKP (origin commitment)ZKP พิสูจน์แหล่งกำเนิด
✓ Mainnet
Layer 1+
gyotak-komon
Region range proof + dual-mode privacy + per-item fingerprint (this report)Range proof + ความเป็นส่วนตัวสองโหมด + ลายนิ้วมือรายตัว (รายงานนี้)
✓ Preprod
Layer 2
gyotak-temp-log
Storage temp + quick-freeze ZKPZKP อุณหภูมิ
✓ Preprod → Mainnet
Layer 3
gyotak-ratio-log
Formula ratio compliance ZKPZKP สัดส่วนสูตร
✓ Preprod
Settlement
gyotak-x402
AI-agent round-trip settlementการชำระเงินไป-กลับ
✓ Preprod · Cardano
Layer 4+
gyotak-transit
Transport route verificationการยืนยันเส้นทาง
Plannedวางแผน

10. Archive Metadata 10. Metadata

Fieldฟิลด์ Valueค่า
Document IDECOSUS-TR-2026-009
Prior Reportรายงานก่อน TR-2026-008 · gyotak-x402
Teaching repo (Apache-2.0)Repo สอน (Apache-2.0) github.com/ecosus-co/gyotak-compact-teaching
Authorผู้เขียน Takuya Ogura, Chairman, ECOSUS CO., LTD.
Organizationองค์กร ECOSUS CO., LTD. · 0205562030631 · Pranburi, Thailand
Report dateวันที่ June 6, 2026
NetworkMidnight Preprod
Contract addressที่อยู่คอนแทรกต์ 06edca6576e324259d62778ab2e48adf2cd3001d296856ec63fc7b2ffd5af11a
Licenseใบอนุญาต CC BY 4.0 (reportรายงาน) · code in teaching repo is Apache-2.0โค้ดใน teaching repo เป็น Apache-2.0