1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
|
<!DOCTYPE HTML>
<html lang="en" class="light sidebar-visible" dir="ltr">
<head>
<!-- Book generated using mdBook -->
<meta charset="UTF-8">
<title>Tesseras User Guide</title>
<meta name="robots" content="noindex">
<!-- Custom HTML head -->
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="theme-color" content="#ffffff">
<link rel="shortcut icon" href="favicon-bfbdfe47.png">
<link rel="stylesheet" href="css/variables-8adf115d.css">
<link rel="stylesheet" href="css/general-2459343d.css">
<link rel="stylesheet" href="css/chrome-ae938929.css">
<link rel="stylesheet" href="css/print-9e4910d8.css" media="print">
<!-- Fonts -->
<link rel="stylesheet" href="fonts/fonts-9644e21d.css">
<!-- Highlight.js Stylesheets -->
<link rel="stylesheet" id="mdbook-highlight-css" href="highlight-493f70e1.css">
<link rel="stylesheet" id="mdbook-tomorrow-night-css" href="tomorrow-night-4c0ae647.css">
<link rel="stylesheet" id="mdbook-ayu-highlight-css" href="ayu-highlight-3fdfc3ac.css">
<!-- Custom theme stylesheets -->
<link rel="stylesheet" href="theme/custom-eff59930.css">
<!-- Provide site root and default themes to javascript -->
<script>
const path_to_root = "";
const default_light_theme = "light";
const default_dark_theme = "navy";
window.path_to_searchindex_js = "searchindex-ee09cfdc.js";
</script>
<!-- Start loading toc.js asap -->
<script src="toc-9150d087.js"></script>
</head>
<body>
<div id="mdbook-help-container">
<div id="mdbook-help-popup">
<h2 class="mdbook-help-title">Keyboard shortcuts</h2>
<div>
<p>Press <kbd>←</kbd> or <kbd>→</kbd> to navigate between chapters</p>
<p>Press <kbd>S</kbd> or <kbd>/</kbd> to search in the book</p>
<p>Press <kbd>?</kbd> to show this help</p>
<p>Press <kbd>Esc</kbd> to hide this help</p>
</div>
</div>
</div>
<div id="mdbook-body-container">
<!-- Work around some values being stored in localStorage wrapped in quotes -->
<script>
try {
let theme = localStorage.getItem('mdbook-theme');
let sidebar = localStorage.getItem('mdbook-sidebar');
if (theme.startsWith('"') && theme.endsWith('"')) {
localStorage.setItem('mdbook-theme', theme.slice(1, theme.length - 1));
}
if (sidebar.startsWith('"') && sidebar.endsWith('"')) {
localStorage.setItem('mdbook-sidebar', sidebar.slice(1, sidebar.length - 1));
}
} catch (e) { }
</script>
<!-- Set the theme before any content is loaded, prevents flash -->
<script>
const default_theme = window.matchMedia("(prefers-color-scheme: dark)").matches ? default_dark_theme : default_light_theme;
let theme;
try { theme = localStorage.getItem('mdbook-theme'); } catch(e) { }
if (theme === null || theme === undefined) { theme = default_theme; }
const html = document.documentElement;
html.classList.remove('light')
html.classList.add(theme);
html.classList.add("js");
</script>
<input type="checkbox" id="mdbook-sidebar-toggle-anchor" class="hidden">
<!-- Hide / unhide sidebar before it is displayed -->
<script>
let sidebar = null;
const sidebar_toggle = document.getElementById("mdbook-sidebar-toggle-anchor");
if (document.body.clientWidth >= 1080) {
try { sidebar = localStorage.getItem('mdbook-sidebar'); } catch(e) { }
sidebar = sidebar || 'visible';
} else {
sidebar = 'hidden';
sidebar_toggle.checked = false;
}
if (sidebar === 'visible') {
sidebar_toggle.checked = true;
} else {
html.classList.remove('sidebar-visible');
}
</script>
<nav id="mdbook-sidebar" class="sidebar" aria-label="Table of contents">
<!-- populated by js -->
<mdbook-sidebar-scrollbox class="sidebar-scrollbox"></mdbook-sidebar-scrollbox>
<noscript>
<iframe class="sidebar-iframe-outer" src="toc.html"></iframe>
</noscript>
<div id="mdbook-sidebar-resize-handle" class="sidebar-resize-handle">
<div class="sidebar-resize-indicator"></div>
</div>
</nav>
<div id="mdbook-page-wrapper" class="page-wrapper">
<div class="page">
<div id="mdbook-menu-bar-hover-placeholder"></div>
<div id="mdbook-menu-bar" class="menu-bar sticky">
<div class="left-buttons">
<label id="mdbook-sidebar-toggle" class="icon-button" for="mdbook-sidebar-toggle-anchor" title="Toggle Table of Contents" aria-label="Toggle Table of Contents" aria-controls="mdbook-sidebar">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M0 96C0 78.3 14.3 64 32 64H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32C14.3 128 0 113.7 0 96zM0 256c0-17.7 14.3-32 32-32H416c17.7 0 32 14.3 32 32s-14.3 32-32 32H32c-17.7 0-32-14.3-32-32zM448 416c0 17.7-14.3 32-32 32H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H416c17.7 0 32 14.3 32 32z"/></svg></span>
</label>
<button id="mdbook-theme-toggle" class="icon-button" type="button" title="Change theme" aria-label="Change theme" aria-haspopup="true" aria-expanded="false" aria-controls="mdbook-theme-list">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M371.3 367.1c27.3-3.9 51.9-19.4 67.2-42.9L600.2 74.1c12.6-19.5 9.4-45.3-7.6-61.2S549.7-4.4 531.1 9.6L294.4 187.2c-24 18-38.2 46.1-38.4 76.1L371.3 367.1zm-19.6 25.4l-116-104.4C175.9 290.3 128 339.6 128 400c0 3.9 .2 7.8 .6 11.6c1.8 17.5-10.2 36.4-27.8 36.4H96c-17.7 0-32 14.3-32 32s14.3 32 32 32H240c61.9 0 112-50.1 112-112c0-2.5-.1-5-.2-7.5z"/></svg></span>
</button>
<ul id="mdbook-theme-list" class="theme-popup" aria-label="Themes" role="menu">
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-default_theme">Auto</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-light">Light</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-rust">Rust</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-coal">Coal</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-navy">Navy</button></li>
<li role="none"><button role="menuitem" class="theme" id="mdbook-theme-ayu">Ayu</button></li>
</ul>
<button id="mdbook-search-toggle" class="icon-button" type="button" title="Search (`/`)" aria-label="Toggle Searchbar" aria-expanded="false" aria-keyshortcuts="/ s" aria-controls="mdbook-searchbar">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352c79.5 0 144-64.5 144-144s-64.5-144-144-144S64 128.5 64 208s64.5 144 144 144z"/></svg></span>
</button>
</div>
<h1 class="menu-title">Tesseras User Guide</h1>
<div class="right-buttons">
<a href="print.html" title="Print this book" aria-label="Print this book">
<span class=fa-svg id="print-button"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M128 0C92.7 0 64 28.7 64 64v96h64V64H354.7L384 93.3V160h64V93.3c0-17-6.7-33.3-18.7-45.3L400 18.7C388 6.7 371.7 0 354.7 0H128zM384 352v32 64H128V384 368 352H384zm64 32h32c17.7 0 32-14.3 32-32V256c0-35.3-28.7-64-64-64H64c-35.3 0-64 28.7-64 64v96c0 17.7 14.3 32 32 32H64v64c0 35.3 28.7 64 64 64H384c35.3 0 64-28.7 64-64V384zm-16-88c-13.3 0-24-10.7-24-24s10.7-24 24-24s24 10.7 24 24s-10.7 24-24 24z"/></svg></span>
</a>
<a href="https://git.sr.ht/~ijanc/tesseras" title="Git repository" aria-label="Git repository">
<span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z"/></svg></span>
</a>
</div>
</div>
<div id="mdbook-search-wrapper" class="hidden">
<form id="mdbook-searchbar-outer" class="searchbar-outer">
<div class="search-wrapper">
<input type="search" id="mdbook-searchbar" name="searchbar" placeholder="Search this book ..." aria-controls="mdbook-searchresults-outer" aria-describedby="searchresults-header">
<div class="spinner-wrapper">
<span class=fa-svg id="fa-spin"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M304 48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zm0 416c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM48 304c26.5 0 48-21.5 48-48s-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48zm464-48c0-26.5-21.5-48-48-48s-48 21.5-48 48s21.5 48 48 48s48-21.5 48-48zM142.9 437c18.7-18.7 18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zm0-294.2c18.7-18.7 18.7-49.1 0-67.9S93.7 56.2 75 75s-18.7 49.1 0 67.9s49.1 18.7 67.9 0zM369.1 437c18.7 18.7 49.1 18.7 67.9 0s18.7-49.1 0-67.9s-49.1-18.7-67.9 0s-18.7 49.1 0 67.9z"/></svg></span>
</div>
</div>
</form>
<div id="mdbook-searchresults-outer" class="searchresults-outer hidden">
<div id="mdbook-searchresults-header" class="searchresults-header"></div>
<ul id="mdbook-searchresults">
</ul>
</div>
</div>
<!-- Apply ARIA attributes after the sidebar and the sidebar toggle button are added to the DOM -->
<script>
document.getElementById('mdbook-sidebar-toggle').setAttribute('aria-expanded', sidebar === 'visible');
document.getElementById('mdbook-sidebar').setAttribute('aria-hidden', sidebar !== 'visible');
Array.from(document.querySelectorAll('#mdbook-sidebar a')).forEach(function(link) {
link.setAttribute('tabIndex', sidebar === 'visible' ? 0 : -1);
});
</script>
<div id="mdbook-content" class="content">
<main>
<h1 id="introduction"><a class="header" href="#introduction">Introduction</a></h1>
<p>Tesseras is a peer-to-peer network for preserving human memories across millennia. Each person creates a <strong>tessera</strong> — a self-contained time capsule of memories (photos, audio, video, text) that survives independently of any software, company, or infrastructure.</p>
<h2 id="what-is-a-tessera"><a class="header" href="#what-is-a-tessera">What is a tessera?</a></h2>
<p>The word <em>tessera</em> comes from the small tiles used to make mosaics in the ancient world. In Tesseras, each tessera is a collection of memories packaged into a format designed to be understood even thousands of years from now, without any special software.</p>
<p>A tessera contains:</p>
<ul>
<li><strong>Memories</strong> — photos (JPEG), audio recordings (WAV), video (WebM), and text (plain UTF-8)</li>
<li><strong>Metadata</strong> — when and where each memory was created, who it involves, and what it means</li>
<li><strong>Identity</strong> — cryptographic signatures proving who created it</li>
<li><strong>Decoding instructions</strong> — plain-text explanations of every format used, so future humans can read the contents</li>
</ul>
<h2 id="core-philosophy"><a class="header" href="#core-philosophy">Core philosophy</a></h2>
<ul>
<li><strong>No company dependency</strong> — your memories are yours, stored locally and replicated across a peer-to-peer network</li>
<li><strong>No format lock-in</strong> — every tessera includes instructions for decoding its contents</li>
<li><strong>Availability over secrecy</strong> — public memories are not encrypted, because long-term accessibility matters more than hiding things</li>
<li><strong>Minimal encryption</strong> — only private and sealed content is encrypted; everything else is open</li>
<li><strong>Quantum-resistant</strong> — dual signatures (Ed25519 + ML-DSA) protect integrity even against future quantum computers</li>
</ul>
<h2 id="current-status-phase-4"><a class="header" href="#current-status-phase-4">Current status: Phase 4</a></h2>
<p>Tesseras has completed through <strong>Phase 4</strong> — encryption and sealed tesseras. The project now covers local tessera management, networking, replication, a mobile app, and cryptographic privacy.</p>
<p>What’s available today:</p>
<ul>
<li>Identity generation (Ed25519 keypair with proof-of-work)</li>
<li>Tessera creation from local files</li>
<li>Content-addressed storage (BLAKE3 hashing)</li>
<li>Integrity verification and self-contained export</li>
<li>Full node daemon with QUIC transport</li>
<li>Peer discovery via Kademlia DHT</li>
<li>Tessera pointer publishing and lookup across the network</li>
<li>Reed-Solomon erasure coding with automatic fragment repair</li>
<li>Flutter mobile app with embedded Rust P2P node</li>
<li><strong>Private tesseras</strong> — encrypted content only the owner can access</li>
<li><strong>Sealed tesseras</strong> — time-locked content that opens after a specific date</li>
<li><strong>Hybrid post-quantum encryption</strong> — X25519 + ML-KEM-768 key encapsulation</li>
<li><strong>AES-256-GCM</strong> content encryption with AAD binding</li>
</ul>
<h2 id="key-concepts"><a class="header" href="#key-concepts">Key concepts</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Concept</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><strong>Tessera</strong></td><td>A self-contained time capsule of memories</td></tr>
<tr><td><strong>Memory</strong></td><td>A single item (photo, recording, video, or text) within a tessera</td></tr>
<tr><td><strong>Content hash</strong></td><td>A BLAKE3 hash that uniquely identifies a tessera by its contents</td></tr>
<tr><td><strong>Visibility</strong></td><td>Controls who can access a tessera: public, private, sealed, or circle</td></tr>
<tr><td><strong>Sealed tessera</strong></td><td>A time capsule that can only be opened after a specific date</td></tr>
<tr><td><strong>MANIFEST</strong></td><td>A plain-text index listing every file in the tessera with its checksum</td></tr>
<tr><td><strong>Memory type</strong></td><td>Categorizes a memory: moment, reflection, daily, relation, or object</td></tr>
<tr><td><strong>Node</strong></td><td>A device running the Tesseras daemon, participating in the P2P network</td></tr>
<tr><td><strong>DHT</strong></td><td>Distributed hash table — how nodes find tessera pointers without a central server</td></tr>
<tr><td><strong>Bootstrap</strong></td><td>The process of joining the network by contacting known seed nodes</td></tr>
</tbody>
</table>
</div>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="installation"><a class="header" href="#installation">Installation</a></h1>
<p>Tesseras is currently available by building from source.</p>
<h2 id="prerequisites"><a class="header" href="#prerequisites">Prerequisites</a></h2>
<h3 id="rust"><a class="header" href="#rust">Rust</a></h3>
<p>Tesseras requires <strong>Rust 1.85 or higher</strong>. The recommended way to install Rust is via <a href="https://rustup.rs/">rustup</a>:</p>
<pre><code class="language-bash">curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
</code></pre>
<p>After installation, make sure <code>~/.cargo/bin</code> is in your <code>PATH</code>. The installer usually adds it automatically. Verify with:</p>
<pre><code class="language-bash">rustc --version
cargo --version
</code></pre>
<p>If you already have Rust installed, update to the latest version:</p>
<pre><code class="language-bash">rustup update stable
</code></pre>
<h3 id="sqlite"><a class="header" href="#sqlite">SQLite</a></h3>
<p>Tesseras uses SQLite for local storage. You have two options:</p>
<p><strong>Option 1: System SQLite (recommended)</strong></p>
<p>Install SQLite development libraries via your system package manager:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Distribution</th><th>Command</th></tr>
</thead>
<tbody>
<tr><td>Arch Linux</td><td><code>sudo pacman -S sqlite</code></td></tr>
<tr><td>Debian / Ubuntu</td><td><code>sudo apt install libsqlite3-dev</code></td></tr>
<tr><td>Fedora</td><td><code>sudo dnf install sqlite-devel</code></td></tr>
<tr><td>Alpine</td><td><code>apk add sqlite-dev</code></td></tr>
<tr><td>macOS (Homebrew)</td><td><code>brew install sqlite</code></td></tr>
<tr><td>FreeBSD</td><td><code>pkg install sqlite3</code></td></tr>
<tr><td>OpenBSD</td><td>Included in the base system</td></tr>
</tbody>
</table>
</div>
<p><strong>Option 2: Bundled SQLite</strong></p>
<p>If you prefer not to install SQLite on your system, use the <code>bundled-sqlite</code> feature flag during compilation. This compiles SQLite alongside Tesseras:</p>
<pre><code class="language-bash">cargo install --path crates/tesseras-cli --features bundled-sqlite
cargo install --path crates/tesseras-daemon --features bundled-sqlite
</code></pre>
<h3 id="optional-tools"><a class="header" href="#optional-tools">Optional tools</a></h3>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Tool</th><th>Purpose</th><th>Installation</th></tr>
</thead>
<tbody>
<tr><td><a href="https://github.com/casey/just">just</a></td><td>Run project build commands</td><td><code>cargo install just</code></td></tr>
<tr><td><a href="https://rust-lang.github.io/mdBook/">mdBook</a></td><td>Build the documentation</td><td><code>cargo install mdbook</code></td></tr>
<tr><td><a href="https://docs.docker.com/get-docker/">Docker</a></td><td>Run nodes in containers</td><td>See <a href="#docker">Docker</a></td></tr>
<tr><td><a href="https://flutter.dev/docs/get-started/install">Flutter</a></td><td>Build the mobile/desktop app</td><td>See <a href="#flutter-app">Flutter App</a></td></tr>
</tbody>
</table>
</div>
<h2 id="build-from-source"><a class="header" href="#build-from-source">Build from source</a></h2>
<p>Clone the repository and install the binaries:</p>
<pre><code class="language-bash">git clone https://git.sr.ht/~ijanc/tesseras
cd tesseras
cargo install --path crates/tesseras-cli
cargo install --path crates/tesseras-daemon
</code></pre>
<p>Or, if you have <code>just</code> installed:</p>
<pre><code class="language-bash">just install
</code></pre>
<p>This installs two binaries to <code>~/.cargo/bin/</code> and configures shell auto-completions:</p>
<ul>
<li><code>tes</code> — CLI tool for creating, verifying, and exporting tesseras</li>
<li><code>tesseras-daemon</code> — full node daemon that participates in the P2P network</li>
</ul>
<h2 id="verify-installation"><a class="header" href="#verify-installation">Verify installation</a></h2>
<pre><code class="language-bash">tes --help
</code></pre>
<p>You should see:</p>
<pre><code>Create and preserve human memories
Usage: tes [OPTIONS] <COMMAND>
Commands:
init Initialize identity and local database
create Create a tessera from a directory of files
verify Verify integrity of a stored tessera
export Export tessera to a self-contained directory
list List local tesseras
help Print this message or the help of the given subcommand(s)
Options:
--data-dir <DATA_DIR> Base directory for data storage [default: ~/.tesseras]
-h, --help Print help
</code></pre>
<h2 id="shell-completions"><a class="header" href="#shell-completions">Shell completions</a></h2>
<p>The <code>just install</code> command configures completions automatically. If you installed manually, generate completions for your shell:</p>
<pre><code class="language-bash"># Fish
tes completions fish > ~/.config/fish/completions/tes.fish
# Zsh
tes completions zsh > "${XDG_DATA_HOME:-$HOME/.local/share}/zsh/site-functions/_tes"
# Bash
tes completions bash > "${XDG_DATA_HOME:-$HOME/.local/share}/bash-completion/completions/tes"
</code></pre>
<h2 id="flutter-app"><a class="header" href="#flutter-app">Flutter App</a></h2>
<p>To build the mobile or desktop app, you need additional dependencies:</p>
<h3 id="flutter-prerequisites"><a class="header" href="#flutter-prerequisites">Flutter prerequisites</a></h3>
<ol>
<li><strong>Flutter SDK</strong> — install following the <a href="https://flutter.dev/docs/get-started/install">official guide</a></li>
<li><strong>Rust</strong> — already installed as above</li>
<li><strong>Platform dependencies:</strong></li>
</ol>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Platform</th><th>Dependencies</th></tr>
</thead>
<tbody>
<tr><td>Android</td><td>Android SDK, Android NDK, Java 17+</td></tr>
<tr><td>iOS</td><td>Xcode, CocoaPods</td></tr>
<tr><td>Linux desktop</td><td>GTK 3.0+, pkg-config (<code>sudo apt install libgtk-3-dev pkg-config</code> on Debian/Ubuntu)</td></tr>
<tr><td>macOS desktop</td><td>Xcode Command Line Tools</td></tr>
</tbody>
</table>
</div>
<h3 id="build-the-app"><a class="header" href="#build-the-app">Build the app</a></h3>
<pre><code class="language-bash">cd apps/flutter
flutter pub get
# Linux desktop
flutter build linux --debug
# Android
flutter build apk --debug
# iOS
flutter build ios --debug
# Tests
flutter test
</code></pre>
<p>Or using <code>just</code> from the repository root:</p>
<pre><code class="language-bash">just build-linux # Linux desktop
just build-android # Android APK
just test-flutter # Tests
</code></pre>
<h2 id="network-ports"><a class="header" href="#network-ports">Network ports</a></h2>
<p>The Tesseras daemon uses QUIC (protocol over UDP). If you are behind a firewall, allow traffic on the port:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Protocol</th><th>Port</th><th>Direction</th></tr>
</thead>
<tbody>
<tr><td>UDP</td><td>4433</td><td>Inbound and outbound</td></tr>
</tbody>
</table>
</div>
<h2 id="next-steps"><a class="header" href="#next-steps">Next steps</a></h2>
<ul>
<li><a href="#quick-start">Quick Start</a> — create your first tessera</li>
<li><a href="#running-a-node">Running a Node</a> — configure and run the daemon</li>
<li><a href="#configuration">Configuration</a> — configuration options</li>
<li><a href="#docker">Docker</a> — run in containers</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="quick-start"><a class="header" href="#quick-start">Quick Start</a></h1>
<p>This tutorial walks you through a complete workflow: creating an identity, building a tessera from files, verifying it, and exporting it.</p>
<h2 id="1-initialize-your-identity"><a class="header" href="#1-initialize-your-identity">1. Initialize your identity</a></h2>
<p>First, set up your local identity and database:</p>
<pre><code class="language-bash">tes init
</code></pre>
<pre><code>Generated Ed25519 identity
Database initialized
Config written to /home/user/.tesseras/config.toml
Tesseras initialized at /home/user/.tesseras
</code></pre>
<p>This creates:</p>
<ul>
<li><code>~/.tesseras/identity/</code> — your Ed25519 keypair</li>
<li><code>~/.tesseras/db/</code> — SQLite database for indexing</li>
<li><code>~/.tesseras/blobs/</code> — storage for memory files</li>
<li><code>~/.tesseras/config.toml</code> — configuration file</li>
</ul>
<h2 id="2-prepare-your-files"><a class="header" href="#2-prepare-your-files">2. Prepare your files</a></h2>
<p>Create a directory with the memories you want to preserve:</p>
<pre><code class="language-bash">mkdir my-memories
cp ~/photos/family-dinner.jpg my-memories/
cp ~/photos/garden.jpg my-memories/
echo "A warm Sunday afternoon with the family." > my-memories/reflection.txt
</code></pre>
<p>Supported formats: <code>.jpg</code>, <code>.jpeg</code>, <code>.png</code> (images), <code>.wav</code> (audio), <code>.webm</code> (video), <code>.txt</code> (text).</p>
<h2 id="3-preview-with-dry-run"><a class="header" href="#3-preview-with-dry-run">3. Preview with dry run</a></h2>
<p>See what would be included without creating anything:</p>
<pre><code class="language-bash">tes create my-memories --dry-run
</code></pre>
<h2 id="4-create-a-tessera"><a class="header" href="#4-create-a-tessera">4. Create a tessera</a></h2>
<pre><code class="language-bash">tes create my-memories --tags "family,sunday" --location "Home"
</code></pre>
<p>The output includes the content hash — a 64-character hex string that uniquely identifies your tessera. Copy it for the next steps.</p>
<h2 id="5-list-your-tesseras"><a class="header" href="#5-list-your-tesseras">5. List your tesseras</a></h2>
<pre><code class="language-bash">tes list
</code></pre>
<pre><code>Hash Created Memories Size Visibility
9f2c4a1b3e7d8f0c 2026-02-14 3 284 KB public
</code></pre>
<h2 id="6-verify-integrity"><a class="header" href="#6-verify-integrity">6. Verify integrity</a></h2>
<p>Use the content hash to verify that all files are intact and the signature is valid:</p>
<pre><code class="language-bash">tes verify 9f2c4a1b3e7d8f0c...
</code></pre>
<pre><code>Tessera: 9f2c4a1b3e7d8f0c...
Signature: VALID
[OK] memories/a1b2c3/media.jpg
[OK] memories/d4e5f6/media.jpg
[OK] memories/g7h8i9/media.txt
Verification: PASSED
</code></pre>
<h2 id="7-export-a-self-contained-copy"><a class="header" href="#7-export-a-self-contained-copy">7. Export a self-contained copy</a></h2>
<p>Export the tessera to a directory that can be read without Tesseras:</p>
<pre><code class="language-bash">tes export 9f2c4a1b3e7d8f0c... ./backup
</code></pre>
<pre><code>Exported to ./backup/tessera-9f2c4a1b3e7d8f0c...
</code></pre>
<h2 id="8-inspect-the-export"><a class="header" href="#8-inspect-the-export">8. Inspect the export</a></h2>
<p>The exported directory is fully self-contained:</p>
<pre><code>tessera-9f2c4a1b3e7d8f0c.../
├── MANIFEST # Plain text index with checksums
├── README.decode # How to read this tessera without software
├── identity/
│ ├── creator.pub.ed25519 # Your public key
│ └── signature.ed25519.sig # Signature of the MANIFEST
├── memories/
│ ├── <hash>/
│ │ ├── media.jpg # The photo
│ │ ├── context.txt # Description in plain text
│ │ └── meta.json # Structured metadata
│ └── .../
└── decode/
├── formats.txt # Explanation of all formats used
├── jpeg.txt # How to decode JPEG
└── json.txt # How to decode JSON
</code></pre>
<p>Everything a future reader needs to understand the contents is included in the directory itself — no Tesseras software required.</p>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="tes-init"><a class="header" href="#tes-init">tes init</a></h1>
<p>Initialize identity and local database.</p>
<h2 id="usage"><a class="header" href="#usage">Usage</a></h2>
<pre><code class="language-bash">tes init
</code></pre>
<h2 id="description"><a class="header" href="#description">Description</a></h2>
<p>Sets up your local Tesseras environment. This is the first command you should run after installing Tesseras.</p>
<p>The command creates:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Path</th><th>Contents</th></tr>
</thead>
<tbody>
<tr><td><code>~/.tesseras/identity/</code></td><td>Ed25519 keypair for signing tesseras</td></tr>
<tr><td><code>~/.tesseras/db/</code></td><td>SQLite database for indexing</td></tr>
<tr><td><code>~/.tesseras/blobs/</code></td><td>Blob storage for memory files</td></tr>
<tr><td><code>~/.tesseras/config.toml</code></td><td>Configuration file</td></tr>
</tbody>
</table>
</div>
<h2 id="options"><a class="header" href="#options">Options</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>--data-dir <PATH></code></td><td>Base directory for data storage (default: <code>~/.tesseras</code>)</td></tr>
</tbody>
</table>
</div>
<h2 id="idempotent"><a class="header" href="#idempotent">Idempotent</a></h2>
<p>Running <code>init</code> again is safe. If an identity already exists, it is preserved:</p>
<pre><code class="language-bash">tes init
</code></pre>
<pre><code>Ed25519 identity already exists
Database initialized
Tesseras initialized at /home/user/.tesseras
</code></pre>
<h2 id="custom-data-directory"><a class="header" href="#custom-data-directory">Custom data directory</a></h2>
<pre><code class="language-bash">tes --data-dir /mnt/usb/tesseras init
</code></pre>
<p>This creates the full directory structure under <code>/mnt/usb/tesseras/</code> instead of the default location.</p>
<h2 id="what-happens-under-the-hood"><a class="header" href="#what-happens-under-the-hood">What happens under the hood</a></h2>
<ol>
<li>Creates the directory structure (<code>identity/</code>, <code>db/</code>, <code>blobs/</code>)</li>
<li>Generates an Ed25519 keypair (private key stays local, public key identifies you)</li>
<li>Runs SQLite migrations to set up the database schema</li>
<li>Writes a default <code>config.toml</code></li>
</ol>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="tes-create"><a class="header" href="#tes-create">tes create</a></h1>
<p>Create a tessera from a directory of files.</p>
<h2 id="usage-1"><a class="header" href="#usage-1">Usage</a></h2>
<pre><code class="language-bash">tes create <PATH> [OPTIONS]
</code></pre>
<h2 id="arguments"><a class="header" href="#arguments">Arguments</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Argument</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code><PATH></code></td><td>Directory containing files to include</td></tr>
</tbody>
</table>
</div>
<h2 id="options-1"><a class="header" href="#options-1">Options</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th><th>Default</th></tr>
</thead>
<tbody>
<tr><td><code>-n, --non-interactive</code></td><td>Skip prompts</td><td>off</td></tr>
<tr><td><code>--dry-run</code></td><td>Preview what would be included</td><td>off</td></tr>
<tr><td><code>--visibility <VALUE></code></td><td>Visibility level: <code>public</code>, <code>private</code>, <code>circle</code></td><td><code>public</code></td></tr>
<tr><td><code>--language <CODE></code></td><td>Language code (e.g., <code>en</code>, <code>pt-BR</code>)</td><td><code>en</code></td></tr>
<tr><td><code>--tags <LIST></code></td><td>Comma-separated tags</td><td>none</td></tr>
<tr><td><code>--location <DESC></code></td><td>Location description</td><td>none</td></tr>
<tr><td><code>--data-dir <PATH></code></td><td>Base directory for data storage</td><td><code>~/.tesseras</code></td></tr>
</tbody>
</table>
</div>
<h2 id="supported-file-formats"><a class="header" href="#supported-file-formats">Supported file formats</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Extension</th><th>Type</th><th>Memory type</th></tr>
</thead>
<tbody>
<tr><td><code>.jpg</code>, <code>.jpeg</code></td><td>Image (JPEG)</td><td>Moment</td></tr>
<tr><td><code>.png</code></td><td>Image (PNG)</td><td>Moment</td></tr>
<tr><td><code>.wav</code></td><td>Audio (WAV PCM)</td><td>Moment</td></tr>
<tr><td><code>.webm</code></td><td>Video (WebM)</td><td>Moment</td></tr>
<tr><td><code>.txt</code></td><td>Plain text (UTF-8)</td><td>Reflection</td></tr>
</tbody>
</table>
</div>
<p>Files with other extensions are ignored.</p>
<h2 id="memory-type-inference"><a class="header" href="#memory-type-inference">Memory type inference</a></h2>
<p>The command automatically assigns a memory type based on the file format:</p>
<ul>
<li><strong>Text files</strong> (<code>.txt</code>) are classified as <strong>Reflection</strong> — thoughts, beliefs, or opinions</li>
<li><strong>All other formats</strong> are classified as <strong>Moment</strong> — a photo, recording, or video of something happening</li>
</ul>
<h2 id="examples"><a class="header" href="#examples">Examples</a></h2>
<h3 id="preview-before-creating"><a class="header" href="#preview-before-creating">Preview before creating</a></h3>
<pre><code class="language-bash">tes create ./my-photos --dry-run
</code></pre>
<h3 id="create-with-metadata"><a class="header" href="#create-with-metadata">Create with metadata</a></h3>
<pre><code class="language-bash">tes create ./vacation-2026 \
--tags "vacation,summer,beach" \
--location "Florianópolis, Brazil" \
--language pt-BR \
--visibility public
</code></pre>
<h3 id="non-interactive-mode"><a class="header" href="#non-interactive-mode">Non-interactive mode</a></h3>
<pre><code class="language-bash">tes create ./daily-log --non-interactive --tags "daily"
</code></pre>
<h2 id="visibility-levels"><a class="header" href="#visibility-levels">Visibility levels</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Level</th><th>Who can access</th></tr>
</thead>
<tbody>
<tr><td><code>public</code></td><td>Anyone (default)</td></tr>
<tr><td><code>private</code></td><td>Only you (and designated heirs)</td></tr>
<tr><td><code>circle</code></td><td>Explicitly chosen people</td></tr>
</tbody>
</table>
</div>
<h2 id="what-happens-under-the-hood-1"><a class="header" href="#what-happens-under-the-hood-1">What happens under the hood</a></h2>
<ol>
<li>Scans the directory for supported files</li>
<li>Computes a BLAKE3 hash for each file</li>
<li>Assigns a memory type based on file extension</li>
<li>Generates a MANIFEST listing all files with their checksums</li>
<li>Signs the MANIFEST with your Ed25519 private key</li>
<li>Stores the files and metadata in the local database</li>
<li>Outputs the content hash that uniquely identifies this tessera</li>
</ol>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="tes-verify"><a class="header" href="#tes-verify">tes verify</a></h1>
<p>Verify integrity of a stored tessera.</p>
<h2 id="usage-2"><a class="header" href="#usage-2">Usage</a></h2>
<pre><code class="language-bash">tes verify <HASH>
</code></pre>
<h2 id="arguments-1"><a class="header" href="#arguments-1">Arguments</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Argument</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code><HASH></code></td><td>Tessera content hash (64 hex characters)</td></tr>
</tbody>
</table>
</div>
<h2 id="options-2"><a class="header" href="#options-2">Options</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>--data-dir <PATH></code></td><td>Base directory for data storage (default: <code>~/.tesseras</code>)</td></tr>
</tbody>
</table>
</div>
<h2 id="what-it-checks"><a class="header" href="#what-it-checks">What it checks</a></h2>
<ol>
<li><strong>Signature validity</strong> — verifies the Ed25519 signature over the MANIFEST</li>
<li><strong>File integrity</strong> — recomputes the BLAKE3 hash of every file and compares it against the MANIFEST</li>
</ol>
<h2 id="exit-codes"><a class="header" href="#exit-codes">Exit codes</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Code</th><th>Meaning</th></tr>
</thead>
<tbody>
<tr><td><code>0</code></td><td>Verification passed — all files intact, signature valid</td></tr>
<tr><td><code>1</code></td><td>Verification failed — corrupted files or invalid signature</td></tr>
</tbody>
</table>
</div>
<h2 id="examples-1"><a class="header" href="#examples-1">Examples</a></h2>
<h3 id="successful-verification"><a class="header" href="#successful-verification">Successful verification</a></h3>
<pre><code class="language-bash">tes verify 9f2c4a1b3e7d8f0cabc123def456789012345678abcdef0123456789abcdef01
</code></pre>
<pre><code>Tessera: 9f2c4a1b3e7d8f0cabc123def456789012345678abcdef0123456789abcdef01
Signature: VALID
[OK] memories/a1b2c3d4/media.jpg
[OK] memories/e5f6a7b8/media.txt
[OK] memories/c9d0e1f2/media.wav
Verification: PASSED
</code></pre>
<h3 id="failed-verification"><a class="header" href="#failed-verification">Failed verification</a></h3>
<p>If a file has been modified or corrupted:</p>
<pre><code>Tessera: 9f2c4a1b3e7d8f0cabc123def456789012345678abcdef0123456789abcdef01
Signature: VALID
[OK] memories/a1b2c3d4/media.jpg
[FAILED] memories/e5f6a7b8/media.txt
[OK] memories/c9d0e1f2/media.wav
Verification: FAILED
</code></pre>
<h2 id="use-cases"><a class="header" href="#use-cases">Use cases</a></h2>
<ul>
<li><strong>Routine integrity checks</strong> — periodically verify that your stored tesseras haven’t been corrupted</li>
<li><strong>After transfer</strong> — verify after copying tesseras to a new device or storage medium</li>
<li><strong>Trust verification</strong> — confirm that a tessera received from someone else hasn’t been tampered with</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="tes-export"><a class="header" href="#tes-export">tes export</a></h1>
<p>Export a tessera as a self-contained directory.</p>
<h2 id="usage-3"><a class="header" href="#usage-3">Usage</a></h2>
<pre><code class="language-bash">tes export <HASH> <DEST>
</code></pre>
<h2 id="arguments-2"><a class="header" href="#arguments-2">Arguments</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Argument</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code><HASH></code></td><td>Tessera content hash (64 hex characters)</td></tr>
<tr><td><code><DEST></code></td><td>Destination directory</td></tr>
</tbody>
</table>
</div>
<h2 id="options-3"><a class="header" href="#options-3">Options</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>--data-dir <PATH></code></td><td>Base directory for data storage (default: <code>~/.tesseras</code>)</td></tr>
</tbody>
</table>
</div>
<h2 id="output-structure"><a class="header" href="#output-structure">Output structure</a></h2>
<p>The export creates a directory named <code>tessera-<hash></code> inside the destination:</p>
<pre><code>tessera-9f2c4a1b.../
├── MANIFEST # Plain text index with checksums
├── README.decode # Human-readable decoding instructions
├── identity/
│ ├── creator.pub.ed25519 # Creator's public key
│ └── signature.ed25519.sig # Signature of the MANIFEST
├── memories/
│ ├── <content-hash>/
│ │ ├── media.jpg # Primary media file
│ │ ├── context.txt # Human context in plain UTF-8
│ │ └── meta.json # Structured metadata
│ └── .../
├── schema/
│ └── v1.json # JSON schema for metadata validation
└── decode/
├── formats.txt # Explanation of all formats used
├── jpeg.txt # How to decode JPEG
├── wav.txt # How to decode WAV
└── json.txt # How to decode JSON
</code></pre>
<h2 id="example"><a class="header" href="#example">Example</a></h2>
<pre><code class="language-bash">tes export 9f2c4a1b3e7d8f0cabc123def4567890... ./backup
</code></pre>
<pre><code>Exported to ./backup/tessera-9f2c4a1b3e7d8f0cabc123def4567890...
</code></pre>
<h2 id="key-feature-self-contained"><a class="header" href="#key-feature-self-contained">Key feature: self-contained</a></h2>
<p>The exported directory is designed to be readable <strong>without Tesseras software</strong>. It includes:</p>
<ul>
<li><strong>MANIFEST</strong> — a plain-text file listing every file with its BLAKE3 checksum, readable by any text editor</li>
<li><strong>README.decode</strong> — human-readable instructions for understanding the contents</li>
<li><strong>decode/</strong> — detailed explanations of every file format used (JPEG, WAV, JSON, UTF-8)</li>
</ul>
<p>This means someone thousands of years from now, with no knowledge of Tesseras, can still understand and access the memories.</p>
<h2 id="use-cases-1"><a class="header" href="#use-cases-1">Use cases</a></h2>
<ul>
<li><strong>Backup</strong> — export to an external drive, USB stick, or cloud storage</li>
<li><strong>Sharing</strong> — give someone a complete copy of a tessera</li>
<li><strong>Archival</strong> — store on write-once media (DVD, Blu-ray, tape)</li>
<li><strong>Migration</strong> — move tesseras between machines without needing the database</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="tes-list"><a class="header" href="#tes-list">tes list</a></h1>
<p>List all local tesseras.</p>
<h2 id="usage-4"><a class="header" href="#usage-4">Usage</a></h2>
<pre><code class="language-bash">tes list
</code></pre>
<h2 id="options-4"><a class="header" href="#options-4">Options</a></h2>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>--data-dir <PATH></code></td><td>Base directory for data storage (default: <code>~/.tesseras</code>)</td></tr>
</tbody>
</table>
</div>
<h2 id="output"><a class="header" href="#output">Output</a></h2>
<p>Displays a table with the following columns:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Column</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><strong>Hash</strong></td><td>First 16 characters of the content hash</td></tr>
<tr><td><strong>Created</strong></td><td>Creation date (YYYY-MM-DD)</td></tr>
<tr><td><strong>Memories</strong></td><td>Number of memories in the tessera</td></tr>
<tr><td><strong>Size</strong></td><td>Total size (B, KB, MB, or GB)</td></tr>
<tr><td><strong>Visibility</strong></td><td>Visibility level (public, private, or circle)</td></tr>
</tbody>
</table>
</div>
<h2 id="example-1"><a class="header" href="#example-1">Example</a></h2>
<pre><code class="language-bash">tes list
</code></pre>
<pre><code>Hash Created Memories Size Visibility
9f2c4a1b3e7d8f0c 2026-02-14 3 284 KB public
a3b7c2d9e4f01823 2026-02-10 1 12 KB private
f8e7d6c5b4a39201 2026-01-28 12 4 MB public
</code></pre>
<h2 id="empty-database"><a class="header" href="#empty-database">Empty database</a></h2>
<p>If no tesseras have been created yet:</p>
<pre><code class="language-bash">tes list
</code></pre>
<pre><code>No tesseras found.
</code></pre>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="running-a-node"><a class="header" href="#running-a-node">Running a Node</a></h1>
<p>The <code>tesseras-daemon</code> binary runs a full Tesseras node that participates in the peer-to-peer network. It listens for connections over QUIC, joins the distributed hash table (DHT), and enables other nodes to discover and find tessera pointers.</p>
<h2 id="starting-the-daemon"><a class="header" href="#starting-the-daemon">Starting the daemon</a></h2>
<pre><code class="language-bash">tesseras-daemon
</code></pre>
<p>On first run, the daemon:</p>
<ol>
<li>Creates the data directory (<code>~/.local/share/tesseras</code> on Linux, <code>~/Library/Application Support/tesseras</code> on macOS)</li>
<li>Generates a node identity with proof-of-work (takes about 1 second)</li>
<li>Binds a QUIC listener on <code>0.0.0.0:4433</code></li>
<li>Bootstraps into the network by contacting seed nodes</li>
<li>Prints <code>daemon ready</code> when fully operational</li>
</ol>
<h2 id="command-line-options"><a class="header" href="#command-line-options">Command-line options</a></h2>
<pre><code>tesseras-daemon [OPTIONS]
</code></pre>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Option</th><th>Description</th><th>Default</th></tr>
</thead>
<tbody>
<tr><td><code>-c, --config <PATH></code></td><td>Path to a TOML config file</td><td>None (uses built-in defaults)</td></tr>
<tr><td><code>-l, --listen <ADDR></code></td><td>Address and port to listen on</td><td><code>0.0.0.0:4433</code></td></tr>
<tr><td><code>-b, --bootstrap <ADDRS></code></td><td>Comma-separated bootstrap addresses</td><td><code>boot1.tesseras.net:4433,boot2.tesseras.net:4433</code></td></tr>
<tr><td><code>-d, --data-dir <PATH></code></td><td>Data directory</td><td>Platform-specific (see above)</td></tr>
</tbody>
</table>
</div>
<p>CLI options override values from the config file.</p>
<h2 id="examples-2"><a class="header" href="#examples-2">Examples</a></h2>
<p>Run with defaults (join the public network):</p>
<pre><code class="language-bash">tesseras-daemon
</code></pre>
<p>Run as a seed node (no bootstrap, other nodes connect to you):</p>
<pre><code class="language-bash">tesseras-daemon --bootstrap ""
</code></pre>
<p>Run on a custom port with a specific data directory:</p>
<pre><code class="language-bash">tesseras-daemon --listen 0.0.0.0:5000 --data-dir /var/lib/tesseras
</code></pre>
<p>Bootstrap from a specific node:</p>
<pre><code class="language-bash">tesseras-daemon --bootstrap "192.168.1.50:4433"
</code></pre>
<p>Join a local network of multiple nodes:</p>
<pre><code class="language-bash">tesseras-daemon --bootstrap "192.168.1.10:4433,192.168.1.11:4433"
</code></pre>
<h2 id="node-identity"><a class="header" href="#node-identity">Node identity</a></h2>
<p>Each node has a unique identity stored in <code><data-dir>/identity.key</code>. This file contains a 32-byte public key and an 8-byte proof-of-work nonce.</p>
<p>The node ID is derived from the public key: <code>BLAKE3(pubkey || nonce)</code> truncated to 20 bytes. The nonce must produce a hash with 8 leading zero bits, which takes about 256 hash attempts. This lightweight proof-of-work makes creating thousands of fake identities expensive while costing legitimate users less than a second.</p>
<p>The identity is generated automatically on first run and reused on subsequent runs. If you delete <code>identity.key</code>, a new identity will be generated.</p>
<h2 id="logging"><a class="header" href="#logging">Logging</a></h2>
<p>The daemon uses structured logging via <code>tracing</code>. Control the log level with the <code>RUST_LOG</code> environment variable:</p>
<pre><code class="language-bash"># Default (info level)
tesseras-daemon
# Debug logging
RUST_LOG=debug tesseras-daemon
# Only show warnings and errors
RUST_LOG=warn tesseras-daemon
# Debug for DHT, info for everything else
RUST_LOG=info,tesseras_dht=debug tesseras-daemon
</code></pre>
<h2 id="shutting-down"><a class="header" href="#shutting-down">Shutting down</a></h2>
<p>Press <strong>Ctrl+C</strong> to initiate graceful shutdown. The daemon will:</p>
<ol>
<li>Stop accepting new connections</li>
<li>Finish in-flight operations (up to 5 seconds)</li>
<li>Close all QUIC connections</li>
<li>Exit cleanly</li>
</ol>
<h2 id="firewall"><a class="header" href="#firewall">Firewall</a></h2>
<p>The daemon communicates over UDP port 4433 (QUIC). If you’re behind a firewall, ensure this port is open for both inbound and outbound UDP traffic.</p>
<pre><code class="language-bash"># Example: Linux with ufw
sudo ufw allow 4433/udp
</code></pre>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="configuration"><a class="header" href="#configuration">Configuration</a></h1>
<p>The daemon can be configured via a TOML file. Pass the path with <code>--config</code>:</p>
<pre><code class="language-bash">tesseras-daemon --config /etc/tesseras/config.toml
</code></pre>
<p>If no config file is given, the daemon uses sensible defaults. CLI options (<code>--listen</code>, <code>--bootstrap</code>, <code>--data-dir</code>) override the corresponding config values.</p>
<h2 id="full-example"><a class="header" href="#full-example">Full example</a></h2>
<pre><code class="language-toml">[node]
data_dir = "~/.local/share/tesseras"
listen_addr = "0.0.0.0:4433"
[dht]
k = 20
alpha = 3
bucket_refresh_interval_secs = 3600
republish_interval_secs = 3600
pointer_ttl_secs = 86400
max_stored_pointers = 100000
ping_failure_threshold = 3
[bootstrap]
dns_domain = "_tesseras._udp.tesseras.net"
hardcoded = [
"boot1.tesseras.net:4433",
"boot2.tesseras.net:4433",
]
[network]
enable_mdns = true
[observability]
metrics_addr = "127.0.0.1:9190"
log_format = "json"
</code></pre>
<h2 id="sections"><a class="header" href="#sections">Sections</a></h2>
<h3 id="node"><a class="header" href="#node"><code>[node]</code></a></h3>
<p>Basic node settings.</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key</th><th>Type</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>data_dir</code></td><td>path</td><td>Platform-specific</td><td>Where to store identity, database, and blobs</td></tr>
<tr><td><code>listen_addr</code></td><td>address</td><td><code>0.0.0.0:4433</code></td><td>QUIC listener address</td></tr>
</tbody>
</table>
</div>
<p>The default <code>data_dir</code> is <code>~/.local/share/tesseras</code> on Linux and <code>~/Library/Application Support/tesseras</code> on macOS.</p>
<h3 id="dht"><a class="header" href="#dht"><code>[dht]</code></a></h3>
<p>Kademlia DHT tuning parameters. The defaults work well for most deployments.</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key</th><th>Type</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>k</code></td><td>integer</td><td><code>20</code></td><td>Maximum entries per routing table bucket</td></tr>
<tr><td><code>alpha</code></td><td>integer</td><td><code>3</code></td><td>Parallelism for iterative lookups</td></tr>
<tr><td><code>bucket_refresh_interval_secs</code></td><td>integer</td><td><code>3600</code></td><td>How often to refresh routing table buckets (seconds)</td></tr>
<tr><td><code>republish_interval_secs</code></td><td>integer</td><td><code>3600</code></td><td>How often to republish stored pointers (seconds)</td></tr>
<tr><td><code>pointer_ttl_secs</code></td><td>integer</td><td><code>86400</code></td><td>How long to keep a pointer before it expires (seconds)</td></tr>
<tr><td><code>max_stored_pointers</code></td><td>integer</td><td><code>100000</code></td><td>Maximum number of pointers to store locally</td></tr>
<tr><td><code>ping_failure_threshold</code></td><td>integer</td><td><code>3</code></td><td>How many consecutive ping failures before removing a peer</td></tr>
</tbody>
</table>
</div>
<h3 id="bootstrap"><a class="header" href="#bootstrap"><code>[bootstrap]</code></a></h3>
<p>How the node discovers its first peers when joining the network.</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key</th><th>Type</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>dns_domain</code></td><td>string</td><td><code>_tesseras._udp.tesseras.net</code></td><td>DNS domain for TXT-record-based peer discovery</td></tr>
<tr><td><code>hardcoded</code></td><td>list of strings</td><td><code>["boot1.tesseras.net:4433", "boot2.tesseras.net:4433"]</code></td><td>Fallback bootstrap addresses</td></tr>
</tbody>
</table>
</div>
<h3 id="network"><a class="header" href="#network"><code>[network]</code></a></h3>
<p>Network-level features.</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key</th><th>Type</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>enable_mdns</code></td><td>boolean</td><td><code>true</code></td><td>Enable local network discovery via mDNS</td></tr>
</tbody>
</table>
</div>
<h3 id="observability"><a class="header" href="#observability"><code>[observability]</code></a></h3>
<p>Monitoring and logging.</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key</th><th>Type</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td><code>metrics_addr</code></td><td>address</td><td><code>127.0.0.1:9190</code></td><td>Address for the Prometheus metrics endpoint</td></tr>
<tr><td><code>log_format</code></td><td>string</td><td><code>json</code></td><td>Log output format (<code>json</code> or <code>text</code>)</td></tr>
</tbody>
</table>
</div>
<h2 id="ipv6-support"><a class="header" href="#ipv6-support">IPv6 Support</a></h2>
<p>Tesseras supports IPv6 natively. The <code>listen_addr</code> and <code>listen_addrs</code> fields accept both IPv4 and IPv6 addresses.</p>
<h3 id="listening-on-ipv6"><a class="header" href="#listening-on-ipv6">Listening on IPv6</a></h3>
<p>To listen on all IPv6 interfaces:</p>
<pre><code class="language-toml">[node]
listen_addr = "[::]:4433"
</code></pre>
<p>On Linux and most BSDs, binding to <code>[::]</code> also accepts IPv4 connections (dual-stack) by default. On some systems (notably OpenBSD), <code>[::]</code> is IPv6-only due to <code>IPV6_V6ONLY</code> being enabled by default. To guarantee both IPv4 and IPv6 on all platforms, use <code>listen_addrs</code> with explicit addresses:</p>
<pre><code class="language-toml">[node]
listen_addrs = ["0.0.0.0:4433", "[::]:4433"]
</code></pre>
<p>For IPv6 loopback only (testing):</p>
<pre><code class="language-toml">[node]
listen_addr = "[::1]:4433"
</code></pre>
<h3 id="bootstrap-with-ipv6"><a class="header" href="#bootstrap-with-ipv6">Bootstrap with IPv6</a></h3>
<p>Bootstrap addresses can be IPv6:</p>
<pre><code class="language-toml">[bootstrap]
hardcoded = [
"boot1.tesseras.net:4433",
"[2001:db8::1]:4433",
]
</code></pre>
<p>DNS hostnames with both A and AAAA records are resolved to all addresses, so the daemon will connect over whichever protocol is reachable.</p>
<h3 id="ipv6_v6only-behavior-by-os"><a class="header" href="#ipv6_v6only-behavior-by-os"><code>IPV6_V6ONLY</code> behavior by OS</a></h3>
<div class="table-wrapper">
<table>
<thead>
<tr><th>OS</th><th><code>[::]</code> accepts IPv4?</th><th>Notes</th></tr>
</thead>
<tbody>
<tr><td>Linux</td><td>Yes (dual-stack)</td><td><code>IPV6_V6ONLY</code> defaults to 0</td></tr>
<tr><td>macOS</td><td>Yes (dual-stack)</td><td><code>IPV6_V6ONLY</code> defaults to 0</td></tr>
<tr><td>FreeBSD</td><td>Yes (dual-stack)</td><td><code>IPV6_V6ONLY</code> defaults to 0</td></tr>
<tr><td>OpenBSD</td><td>No (IPv6-only)</td><td><code>IPV6_V6ONLY</code> always 1</td></tr>
<tr><td>Windows</td><td>Yes (dual-stack)</td><td><code>IPV6_V6ONLY</code> defaults to 0</td></tr>
</tbody>
</table>
</div>
<p>If you need explicit control, use <code>listen_addrs</code> with both an IPv4 and IPv6 address.</p>
<h2 id="minimal-config"><a class="header" href="#minimal-config">Minimal config</a></h2>
<p>Most users don’t need a config file at all. If you do, a minimal config overriding only what you need is enough:</p>
<pre><code class="language-toml">[node]
listen_addr = "0.0.0.0:5000"
[bootstrap]
hardcoded = ["192.168.1.10:4433"]
</code></pre>
<p>All other values use their defaults.</p>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="network-concepts"><a class="header" href="#network-concepts">Network Concepts</a></h1>
<p>This chapter explains how Tesseras nodes find each other and locate tessera pointers on the network. You don’t need to understand these details to use Tesseras, but they help explain what the daemon is doing in the background.</p>
<h2 id="how-nodes-find-each-other"><a class="header" href="#how-nodes-find-each-other">How nodes find each other</a></h2>
<p>Tesseras uses a <strong>Kademlia distributed hash table (DHT)</strong> — a proven algorithm used by BitTorrent and other P2P systems for over 20 years. There is no central server. Each node maintains a routing table of peers it knows about, and nodes cooperate to route queries to the right place.</p>
<p>When your node starts, it contacts one or more <strong>bootstrap nodes</strong> (seed nodes with known addresses). Through these initial connections, your node discovers other peers and builds up its routing table. Over time, your node naturally learns about more peers as it participates in the network.</p>
<h2 id="what-the-dht-stores"><a class="header" href="#what-the-dht-stores">What the DHT stores</a></h2>
<p>The DHT stores <strong>pointers</strong>, not data. A pointer is a lightweight record that says “tessera X is held by nodes Y and Z.” When someone wants to retrieve a tessera, they first look up its pointer in the DHT to find out which nodes have it, then connect directly to those nodes to download the actual data.</p>
<p>This means the DHT stays small and fast — it only tracks who has what, not the content itself.</p>
<h2 id="node-identity-and-proof-of-work"><a class="header" href="#node-identity-and-proof-of-work">Node identity and proof-of-work</a></h2>
<p>Every node has a 160-bit <strong>node ID</strong> derived from its public key. To prevent an attacker from cheaply creating thousands of fake nodes (a <strong>Sybil attack</strong>), generating a node ID requires a small proof-of-work: the node must find a nonce such that <code>BLAKE3(public_key || nonce)</code> starts with 8 zero bits.</p>
<p>This takes about 256 hash attempts — under a second on any device, including a Raspberry Pi. But an attacker trying to create 10,000 fake identities would need millions of attempts, making the attack impractical.</p>
<h2 id="xor-distance"><a class="header" href="#xor-distance">XOR distance</a></h2>
<p>Kademlia defines “closeness” between nodes using the <strong>XOR metric</strong>: the distance between two node IDs is their bitwise XOR. Nodes are responsible for storing pointers whose keys are close to their own ID (in XOR distance). This distributes data evenly across the network without any coordination.</p>
<p>When looking up a tessera pointer, your node asks the peers it knows that are closest to the target key. Those peers point to even closer ones, and so on, until the pointer is found. This <strong>iterative lookup</strong> typically reaches any node in the network within a few hops.</p>
<h2 id="transport-quic"><a class="header" href="#transport-quic">Transport: QUIC</a></h2>
<p>All communication between nodes uses <strong>QUIC</strong>, a modern transport protocol built on UDP. QUIC provides:</p>
<ul>
<li><strong>Built-in encryption</strong> — every connection uses TLS 1.3</li>
<li><strong>NAT-friendly</strong> — works through most network address translators since it’s UDP-based</li>
<li><strong>Multiplexing</strong> — multiple independent operations over one connection without head-of-line blocking</li>
<li><strong>Connection migration</strong> — survives network changes (e.g., switching from Wi-Fi to mobile data)</li>
</ul>
<p>The daemon listens on UDP port <strong>4433</strong> by default.</p>
<h2 id="bootstrap-process"><a class="header" href="#bootstrap-process">Bootstrap process</a></h2>
<p>When a node starts, it follows this sequence:</p>
<ol>
<li><strong>Contact seed nodes</strong> — connect to one or more known bootstrap addresses</li>
<li><strong>Exchange pings</strong> — verify the seed is alive and exchange node identities</li>
<li><strong>Self-lookup</strong> — ask the seed for nodes close to your own ID, to populate your routing table</li>
<li><strong>Iterative discovery</strong> — contact the newly discovered nodes, which point you to even more peers</li>
</ol>
<p>After bootstrap, the node maintains its routing table automatically: it refreshes buckets periodically and replaces unresponsive peers with new ones.</p>
<h2 id="node-types"><a class="header" href="#node-types">Node types</a></h2>
<p>Not every device participates in the network the same way:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Type</th><th>Description</th><th>Always on?</th></tr>
</thead>
<tbody>
<tr><td><strong>Full node</strong></td><td>Desktop, server, or Raspberry Pi running <code>tesseras-daemon</code>. Participates fully in the DHT and stores data for other nodes.</td><td>Yes</td></tr>
<tr><td><strong>Mobile node</strong></td><td>Phone or tablet running the Tesseras app. Participates in the DHT when the app is active.</td><td>No</td></tr>
<tr><td><strong>Browser node</strong></td><td>Web browser running the WASM client. Connects via a relay node. Read-only.</td><td>No</td></tr>
<tr><td><strong>IoT node</strong></td><td>ESP32 or similar device on the local network. Stores fragments passively, does not participate in the DHT.</td><td>Yes</td></tr>
</tbody>
</table>
</div>
<p>The full node daemon is the backbone of the network. The more full nodes running, the more resilient the network becomes.</p>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="replication-and-repair"><a class="header" href="#replication-and-repair">Replication and Repair</a></h1>
<p>This chapter explains how Tesseras keeps your memories safe even when individual nodes go offline or suffer hardware failures. You don’t need to understand these details to use Tesseras — the daemon handles everything automatically.</p>
<h2 id="why-replication-matters"><a class="header" href="#why-replication-matters">Why replication matters</a></h2>
<p>A tessera stored on a single machine dies when that machine dies. Tesseras solves this by splitting data into fragments, spreading them across multiple peers, and continuously verifying that enough copies exist. If some fragments disappear, the network repairs itself automatically.</p>
<h2 id="erasure-coding"><a class="header" href="#erasure-coding">Erasure coding</a></h2>
<p>Tesseras uses <strong>Reed-Solomon erasure coding</strong> to create redundant fragments. The idea is simple: from N data fragments, generate M extra parity fragments. Any N of the N+M total fragments can reconstruct the original data.</p>
<p>This is far more storage-efficient than simple replication. Storing 3 complete copies of a 100 MB file costs 300 MB. With 16 data + 8 parity fragments, you get stronger protection (can lose up to 8 of 24 fragments — 33%) for only 150 MB total.</p>
<h2 id="fragmentation-tiers"><a class="header" href="#fragmentation-tiers">Fragmentation tiers</a></h2>
<p>Not every tessera is treated the same way. Small files don’t benefit from erasure coding overhead, so Tesseras uses three tiers:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Tier</th><th>Size</th><th>Strategy</th><th>Fragments</th></tr>
</thead>
<tbody>
<tr><td><strong>Small</strong></td><td>< 4 MB</td><td>Whole-file replication</td><td>7 copies of the complete file</td></tr>
<tr><td><strong>Medium</strong></td><td>4–256 MB</td><td>Reed-Solomon 16+8</td><td>16 data + 8 parity = 24 fragments</td></tr>
<tr><td><strong>Large</strong></td><td>≥ 256 MB</td><td>Reed-Solomon 48+24</td><td>48 data + 24 parity = 72 fragments</td></tr>
</tbody>
</table>
</div>
<p>All tiers target a <strong>replication factor of 7</strong> — meaning fragments are distributed to 7 different peers.</p>
<h2 id="how-distribution-works"><a class="header" href="#how-distribution-works">How distribution works</a></h2>
<p>When you create a tessera and the daemon replicates it, this is what happens:</p>
<ol>
<li><strong>Encode</strong> — the tessera data is split into fragments according to its size tier</li>
<li><strong>Find peers</strong> — the daemon queries the DHT for the closest nodes to the tessera’s hash</li>
<li><strong>Subnet diversity</strong> — peers are filtered so that no more than a few come from the same network subnet (to avoid correlated failures if a datacenter goes down)</li>
<li><strong>Distribute</strong> — fragments are pushed to the selected peers in round-robin order</li>
<li><strong>Acknowledge</strong> — each peer validates the fragment’s checksum and confirms receipt</li>
</ol>
<p>The tessera owner pushes fragments to peers. Peers don’t pull — this keeps the protocol simple and ensures immediate distribution.</p>
<h2 id="fragment-verification"><a class="header" href="#fragment-verification">Fragment verification</a></h2>
<p>Every fragment carries a BLAKE3 checksum. When a node receives a fragment, it recomputes the hash and compares it to the expected checksum. If they don’t match, the fragment is rejected. This catches both transmission errors and deliberate tampering.</p>
<p>Fragments are stored in a <strong>content-addressable store (CAS)</strong> where each unique piece of data exists exactly once on disk, keyed by its BLAKE3 hash. A SQLite reference table maps logical fragment identifiers to CAS hashes, enabling automatic deduplication — if two tesseras share identical fragment data, only one copy is stored. Reference counting ensures data is cleaned up only when no tessera references it.</p>
<h2 id="repair-loop"><a class="header" href="#repair-loop">Repair loop</a></h2>
<p>The daemon runs a background repair loop every 24 hours (with random jitter to avoid network-wide storms). For each tessera it’s responsible for, the repair loop:</p>
<ol>
<li><strong>Requests attestations</strong> from known holders — each holder proves it still has the fragments by reporting their checksums</li>
<li><strong>Falls back to ping</strong> if attestation fails — to distinguish between “node is down” and “node lost the data”</li>
<li><strong>Checks local fragments</strong> — verifies integrity of any fragments stored locally by recomputing BLAKE3 checksums</li>
<li><strong>Decides action</strong>:
<ul>
<li><strong>Healthy</strong> — all holders responded, all checksums valid, nothing to do</li>
<li><strong>Needs replication</strong> — some holders are gone, find new peers and redistribute missing fragments</li>
<li><strong>Corrupt local</strong> — a local fragment has bad data, fetch a replacement from the network</li>
</ul>
</li>
</ol>
<h2 id="reciprocity"><a class="header" href="#reciprocity">Reciprocity</a></h2>
<p>Tesseras uses a <strong>bilateral reciprocity ledger</strong> to ensure fair storage exchange. There is no cryptocurrency, no blockchain, no global consensus — each node simply tracks its balance with each peer locally:</p>
<pre><code>peer_a: +500 MB (they store 500 MB of mine)
peer_b: -200 MB (I store 200 MB more of theirs than they store of mine)
peer_c: 0 MB (balanced)
</code></pre>
<p>The rules are simple:</p>
<ul>
<li>Store 1 GB on the network → you should store roughly 1 GB for others</li>
<li>Nodes with a positive balance (they store more for you) get priority when you need to distribute new fragments</li>
<li>Free riders gradually lose redundancy — their fragments are deprioritized for repair, but never deleted</li>
<li>When receiving a fragment, a node checks the sender’s deficit. If the sender owes too much storage, the fragment is rejected</li>
<li>Institutional nodes (universities, archives) can operate altruistically with imbalanced ratios</li>
</ul>
<h2 id="maximum-tessera-size"><a class="header" href="#maximum-tessera-size">Maximum tessera size</a></h2>
<p>The maximum tessera size is <strong>1 GB</strong>. This is a practical limit that keeps fragment sizes manageable and replication fast. For larger collections of memories, create multiple tesseras.</p>
<h2 id="configuration-1"><a class="header" href="#configuration-1">Configuration</a></h2>
<p>The daemon’s replication behavior can be tuned through configuration:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Parameter</th><th>Default</th><th>Description</th></tr>
</thead>
<tbody>
<tr><td>Repair interval</td><td>24 hours</td><td>How often the repair loop runs</td></tr>
<tr><td>Repair jitter</td><td>2 hours</td><td>Random delay added to avoid network-wide storms</td></tr>
<tr><td>Concurrent transfers</td><td>4</td><td>Maximum parallel fragment transfers</td></tr>
<tr><td>Minimum free space</td><td>1 GB</td><td>Stop accepting fragments below this threshold</td></tr>
<tr><td>Deficit allowance</td><td>256 MB</td><td>Maximum storage deficit before rejecting a peer’s fragments</td></tr>
<tr><td>Per-peer limit</td><td>1 GB</td><td>Maximum total storage for any single peer</td></tr>
</tbody>
</table>
</div>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="encryption-and-sealed-tesseras"><a class="header" href="#encryption-and-sealed-tesseras">Encryption and Sealed Tesseras</a></h1>
<p>Most tesseras are public — designed to be accessible to anyone, forever. But some memories need privacy. Tesseras supports two encrypted visibility modes:</p>
<ul>
<li><strong>Private</strong> — only the creator (and their heirs) can ever access the content</li>
<li><strong>Sealed</strong> — the content is time-locked and becomes accessible after a specific date</li>
</ul>
<p>Public tesseras are never encrypted. Availability is more important than secrecy for preservation.</p>
<h2 id="how-encryption-works"><a class="header" href="#how-encryption-works">How encryption works</a></h2>
<p>When you create a private or sealed tessera, the following happens:</p>
<ol>
<li>A random <strong>content key</strong> (256-bit) is generated</li>
<li>Each memory file is encrypted with <strong>AES-256-GCM</strong> using that content key</li>
<li>The content key is wrapped in a <strong>sealed key envelope</strong> using your encryption public key</li>
<li>The wrapped key is stored alongside the encrypted content</li>
</ol>
<p>Only the holder of the corresponding private key can unwrap the content key and decrypt the content.</p>
<h2 id="hybrid-post-quantum-key-encapsulation"><a class="header" href="#hybrid-post-quantum-key-encapsulation">Hybrid post-quantum key encapsulation</a></h2>
<p>The sealed key envelope uses a <strong>hybrid Key Encapsulation Mechanism (KEM)</strong> combining two algorithms:</p>
<ul>
<li><strong>X25519</strong> — a well-tested classical elliptic curve key exchange</li>
<li><strong>ML-KEM-768</strong> — a NIST-standardized post-quantum lattice-based KEM (formerly Kyber)</li>
</ul>
<p>Both algorithms produce shared secrets that are combined using BLAKE3 key derivation. An attacker must break <strong>both</strong> algorithms to recover the content key. This follows the same principle as Tesseras’ dual signatures (Ed25519 + ML-DSA): we don’t know which cryptographic assumptions will hold over centuries, so we hedge our bets.</p>
<h2 id="authenticated-associated-data-aad"><a class="header" href="#authenticated-associated-data-aad">Authenticated associated data (AAD)</a></h2>
<p>AES-256-GCM supports authenticated associated data — extra information that is verified during decryption but not encrypted. Tesseras binds the following into the AAD:</p>
<ul>
<li>The <strong>content hash</strong> of the tessera (always)</li>
<li>The <strong>open_after timestamp</strong> (for sealed tesseras only)</li>
</ul>
<p>This prevents <strong>ciphertext swapping attacks</strong>: an attacker cannot copy encrypted content from one tessera to another, because the AAD will not match and decryption will fail. For sealed tesseras, this also means you cannot change the seal date — the timestamp is cryptographically bound to the ciphertext.</p>
<h2 id="sealed-tesseras-time-capsules"><a class="header" href="#sealed-tesseras-time-capsules">Sealed tesseras: time capsules</a></h2>
<p>A sealed tessera is a true time capsule. When you create one, you specify an <code>open_after</code> date. The content is encrypted and the key is sealed in an envelope that only you can open.</p>
<p>When the <code>open_after</code> date passes, the owner publishes the content key as a signed <strong>Key Publication</strong> — a standalone artifact containing the key, the tessera hash, and the owner’s signature. Other nodes can verify the signature and use the published key to decrypt the content.</p>
<p>The tessera’s manifest is never modified. The Key Publication is a separate document, preserving the immutable, content-addressed nature of tesseras.</p>
<h2 id="what-about-the-keys"><a class="header" href="#what-about-the-keys">What about the keys?</a></h2>
<p>Each identity now includes an <strong>encryption keypair</strong> alongside the signing keypair:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>Key type</th><th>Algorithm</th><th>Purpose</th></tr>
</thead>
<tbody>
<tr><td>Ed25519</td><td>Classical</td><td>Signing manifests and key publications</td></tr>
<tr><td>ML-DSA</td><td>Post-quantum</td><td>Signing (when enabled)</td></tr>
<tr><td>X25519</td><td>Classical</td><td>Key encapsulation (encryption)</td></tr>
<tr><td>ML-KEM-768</td><td>Post-quantum</td><td>Key encapsulation (encryption)</td></tr>
</tbody>
</table>
</div>
<p>The encryption keypair is generated when the identity is created. The public half is stored in the tessera’s identity directory; the private half stays on the owner’s device.</p>
<h2 id="design-principles"><a class="header" href="#design-principles">Design principles</a></h2>
<ul>
<li><strong>Encrypt as little as possible</strong> — only private and sealed content is encrypted. Public memories stay open for long-term accessibility.</li>
<li><strong>Dual algorithms from day one</strong> — both classical and post-quantum cryptography, so content is protected even if one algorithm is broken.</li>
<li><strong>Immutable manifests</strong> — keys are published separately, never by modifying existing data.</li>
<li><strong>Fail closed</strong> — the system rejects attempts to create private or sealed tesseras without encryption keys.</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="heir-key-recovery"><a class="header" href="#heir-key-recovery">Heir Key Recovery</a></h1>
<p>Your tesseras can survive infrastructure failures, quantum computers, and centuries of time. But what happens when you can no longer access your own keys? Tesseras uses <strong>Shamir’s Secret Sharing</strong> to let you distribute your cryptographic identity to trusted heirs.</p>
<h2 id="how-it-works"><a class="header" href="#how-it-works">How it works</a></h2>
<p>Shamir’s Secret Sharing splits a secret into N shares with a threshold T. Any T shares can reconstruct the original secret. Fewer than T shares reveal <strong>nothing</strong> — this is information-theoretically secure, not just computationally hard to break.</p>
<p>For example, with threshold 2 and 3 total shares:</p>
<ul>
<li>Give share 1 to your spouse</li>
<li>Give share 2 to your sibling</li>
<li>Give share 3 to your lawyer</li>
</ul>
<p>Any two of them can recover your identity. A single share alone is useless.</p>
<h2 id="creating-heir-shares"><a class="header" href="#creating-heir-shares">Creating heir shares</a></h2>
<pre><code class="language-bash">tes heir create --threshold 2 --shares 3
</code></pre>
<p>This splits your Ed25519 identity key into 3 shares (requiring 2 to reconstruct) and saves them to <code>./heir-shares/</code>:</p>
<pre><code>heir-shares/
├── heir_share_1.bin # MessagePack binary
├── heir_share_1.txt # Human-readable base64 text
├── heir_share_2.bin
├── heir_share_2.txt
├── heir_share_3.bin
└── heir_share_3.txt
</code></pre>
<p>Each share is generated in two formats:</p>
<ul>
<li><strong>Binary</strong> (<code>.bin</code>) — compact MessagePack, suitable for USB drives or digital storage</li>
<li><strong>Text</strong> (<code>.txt</code>) — base64 with human-readable header, suitable for printing on paper</li>
</ul>
<p>The text format looks like this:</p>
<pre><code>--- TESSERAS HEIR SHARE ---
Format: v1
Owner: a1b2c3d4e5f6a7b8 (fingerprint)
Share: 1 of 3 (threshold: 2)
Session: 9f8e7d6c5b4a3210
Created: 2026-02-15
<base64-encoded data>
--- END HEIR SHARE ---
</code></pre>
<h2 id="reconstructing-from-shares"><a class="header" href="#reconstructing-from-shares">Reconstructing from shares</a></h2>
<p>When heirs need to recover the identity:</p>
<pre><code class="language-bash">tes heir reconstruct heir_share_1.txt heir_share_2.bin --output-dir ./recovered-keys
</code></pre>
<p>The command auto-detects whether each file is binary or text format. It validates that all shares belong to the same session and owner, verifies checksums, and reconstructs the Ed25519 keypair.</p>
<p>To install the recovered keys as the active identity:</p>
<pre><code class="language-bash">tes heir reconstruct share1.txt share2.txt --output-dir ./recovered --install
</code></pre>
<p>This backs up the current identity before replacing it.</p>
<h2 id="inspecting-a-share"><a class="header" href="#inspecting-a-share">Inspecting a share</a></h2>
<p>To view metadata about a share without exposing secret data:</p>
<pre><code class="language-bash">tes heir info heir_share_1.txt
</code></pre>
<p>Output:</p>
<pre><code>Heir Share Information:
Format version: 1
Share: 1 of 3 (threshold: 2)
Session: 9f8e7d6c5b4a3210
Owner fingerprint: a1b2c3d4e5f6a7b8
Share data size: 34 bytes
Checksum: valid
</code></pre>
<h2 id="security-considerations"><a class="header" href="#security-considerations">Security considerations</a></h2>
<ul>
<li><strong>Threshold choice</strong>: a threshold of 2-of-3 or 3-of-5 is recommended for most people. Higher thresholds are more secure but require more heirs to cooperate.</li>
<li><strong>Physical storage</strong>: print the <code>.txt</code> files on acid-free paper and store in separate physical locations (safe deposit boxes, different homes). Paper survives decades without degradation.</li>
<li><strong>Never store shares together</strong>: the entire point of splitting is distribution. Keeping all shares in one place defeats the purpose.</li>
<li><strong>Session isolation</strong>: each <code>heir create</code> call generates a fresh session ID. Shares from different sessions cannot be mixed — this prevents confusion after key rotations.</li>
<li><strong>Checksum verification</strong>: each share includes a BLAKE3 checksum. Corrupted shares (OCR errors, bit rot) are detected before reconstruction is attempted.</li>
<li><strong>Re-split after key changes</strong>: if you regenerate your identity, create new heir shares and securely destroy the old ones.</li>
</ul>
<h2 id="design-principles-1"><a class="header" href="#design-principles-1">Design principles</a></h2>
<ul>
<li><strong>Information-theoretic security</strong> — T-1 shares reveal exactly zero information about the secret. This is not a computational assumption; it is mathematically proven.</li>
<li><strong>Corruption detection</strong> — BLAKE3 checksums catch bit rot, OCR errors, and truncation before any reconstruction attempt.</li>
<li><strong>Format resilience</strong> — dual output (binary + text) ensures shares survive different storage media failure modes.</li>
<li><strong>Backward compatibility</strong> — the secret blob is versioned, so future versions can include additional key material without breaking existing shares.</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="nat-traversal"><a class="header" href="#nat-traversal">NAT Traversal</a></h1>
<p>Most devices on the internet sit behind a <strong>NAT</strong> (Network Address Translator). Your router assigns your device a private address (like <code>192.168.1.100</code>) and translates it to a public address when you connect outward. This works fine for browsing the web, but it creates a problem for P2P networks: two devices behind different NATs cannot directly connect to each other without help.</p>
<p>Tesseras solves this with a three-tier approach, trying the cheapest option first:</p>
<ol>
<li><strong>Direct connection</strong> — if both nodes have public IPs, they connect directly</li>
<li><strong>UDP hole punching</strong> — a third node introduces the two peers so they can punch through their NATs</li>
<li><strong>Relay</strong> — a public-IP node forwards packets between the two peers</li>
</ol>
<h2 id="nat-type-discovery"><a class="header" href="#nat-type-discovery">NAT type discovery</a></h2>
<p>When a node starts, it sends STUN (Session Traversal Utilities for NAT) requests to multiple public servers. By comparing the external addresses these servers report back, the node classifies its NAT:</p>
<div class="table-wrapper">
<table>
<thead>
<tr><th>NAT Type</th><th>What it means</th><th>Hole punching?</th></tr>
</thead>
<tbody>
<tr><td><strong>Public</strong></td><td>No NAT — your device has a public IP</td><td>Not needed</td></tr>
<tr><td><strong>Cone</strong></td><td>NAT maps the same internal port to the same external port regardless of destination</td><td>Works well (~80%)</td></tr>
<tr><td><strong>Symmetric</strong></td><td>NAT assigns a different external port for each destination</td><td>Unreliable</td></tr>
<tr><td><strong>Unknown</strong></td><td>Could not reach STUN servers</td><td>Relay needed</td></tr>
</tbody>
</table>
</div>
<p>Your node advertises its NAT type in DHT Pong messages, so other nodes know whether hole punching is worth attempting.</p>
<h2 id="hole-punching"><a class="header" href="#hole-punching">Hole punching</a></h2>
<p>When node A (behind a Cone NAT) wants to connect to node B (also behind a Cone NAT), neither can directly reach the other. The solution:</p>
<ol>
<li>
<p>A sends a <strong>PunchIntro</strong> message to node I (an introducer — any public-IP node they both know). The message includes A’s external address (from STUN) and an Ed25519 signature proving A’s identity.</p>
</li>
<li>
<p>I verifies the signature and forwards a <strong>PunchRequest</strong> to B, including A’s address and the original signature.</p>
</li>
<li>
<p>B verifies the signature (proving the request really came from A, not a spoofed source). B then sends a UDP packet to A’s external address — this opens a pinhole in B’s NAT. B also sends a <strong>PunchReady</strong> message back to A with B’s external address.</p>
</li>
<li>
<p>A sends a UDP packet to B’s external address. Both NATs now have pinholes, and the two nodes can communicate directly.</p>
</li>
</ol>
<p>The entire process takes 2-5 seconds. The Ed25519 signatures prevent <strong>reflection attacks</strong>, where an attacker replays an old introduction to redirect traffic.</p>
<h2 id="relay-fallback"><a class="header" href="#relay-fallback">Relay fallback</a></h2>
<p>When hole punching fails (Symmetric NAT, strict firewalls, or corporate networks), nodes fall back to relaying through a public-IP node:</p>
<ol>
<li>A sends a <strong>RelayRequest</strong> to node R (a public-IP node with relay enabled).</li>
<li>R creates a session and sends a <strong>RelayOffer</strong> to both A and B, containing the relay address and a session token.</li>
<li>A and B send their packets to R, prefixed with the session token. R strips the token and forwards the payload to the other peer.</li>
</ol>
<p>Relay sessions have bandwidth limits:</p>
<ul>
<li><strong>256 KB/s</strong> for peers with good reciprocity (they store fragments for others)</li>
<li><strong>64 KB/s</strong> for peers without reciprocity</li>
<li>Non-reciprocal sessions are limited to 10 minutes</li>
</ul>
<p>This encourages nodes to contribute storage — good network citizens get better relay service.</p>
<h2 id="address-migration"><a class="header" href="#address-migration">Address migration</a></h2>
<p>When a mobile device switches networks (Wi-Fi to cellular), its IP address changes. Rather than tearing down and rebuilding relay sessions, the node sends a signed <strong>RelayMigrate</strong> message to update its address in the existing session. This avoids re-establishing connections from scratch.</p>
<h2 id="configuration-2"><a class="header" href="#configuration-2">Configuration</a></h2>
<p>The <code>[nat]</code> section in the daemon config controls NAT traversal:</p>
<pre><code class="language-toml">[nat]
# STUN servers for NAT type detection
stun_servers = ["stun.l.google.com:19302", "stun.cloudflare.com:3478"]
# Enable relay (forward traffic for other NATed peers)
relay_enabled = false
# Maximum simultaneous relay sessions
relay_max_sessions = 50
# Bandwidth limit for reciprocal peers (KB/s)
relay_reciprocal_kbps = 256
# Bandwidth limit for non-reciprocal peers (KB/s)
relay_bootstrap_kbps = 64
# Relay session idle timeout (seconds)
relay_idle_timeout_secs = 60
</code></pre>
<p>To run a relay node, set <code>relay_enabled = true</code>. Your node must have a public IP (or a port-forwarded router) to serve as a relay.</p>
<h2 id="mobile-reconnection"><a class="header" href="#mobile-reconnection">Mobile reconnection</a></h2>
<p>When the Tesseras app detects a network change on a mobile device, it runs a three-phase reconnection sequence:</p>
<ol>
<li><strong>QUIC migration</strong> (0-2s) — QUIC supports connection migration natively. The app tries to migrate all active connections to the new address.</li>
<li><strong>Re-STUN</strong> (2-5s) — discover the new external address and re-announce to the DHT.</li>
<li><strong>Re-establish</strong> (5-10s) — reconnect peers that migration couldn’t save, in priority order: bootstrap nodes first, then nodes holding your fragments, then nodes whose fragments you hold.</li>
</ol>
<p>The app shows reconnection progress through the <code>NetworkChanged</code> event stream.</p>
<h2 id="monitoring"><a class="header" href="#monitoring">Monitoring</a></h2>
<p>NAT traversal exposes Prometheus metrics at <code>/metrics</code>:</p>
<ul>
<li><code>tesseras_nat_type</code> — current detected NAT type</li>
<li><code>tesseras_stun_requests_total</code> / <code>tesseras_stun_failures_total</code> — STUN reliability</li>
<li><code>tesseras_punch_attempts_total{initiator_nat, target_nat}</code> — punch success rate by NAT pair</li>
<li><code>tesseras_relay_sessions_active</code> — current relay load</li>
<li><code>tesseras_relay_bytes_forwarded</code> — total relay bandwidth</li>
<li><code>tesseras_network_change_total</code> — network change frequency on mobile</li>
</ul>
<div style="break-before: page; page-break-before: always;"></div>
<h1 id="docker"><a class="header" href="#docker">Docker</a></h1>
<p>Tesseras provides a Docker image for running the daemon in containers. This is useful for servers, testing multi-node networks, and CI environments.</p>
<h2 id="building-the-image"><a class="header" href="#building-the-image">Building the image</a></h2>
<p>From the repository root:</p>
<pre><code class="language-bash">docker build -t tesseras-daemon .
</code></pre>
<p>The multi-stage Dockerfile uses <code>rust:1.85</code> to compile and <code>debian:bookworm-slim</code> as the runtime base. The resulting image is small and contains only the daemon binary and CA certificates.</p>
<h2 id="running-a-single-node"><a class="header" href="#running-a-single-node">Running a single node</a></h2>
<pre><code class="language-bash">docker run -d \
--name tesseras \
-p 4433:4433/udp \
tesseras-daemon
</code></pre>
<p>This starts a node that:</p>
<ul>
<li>Listens on UDP port 4433</li>
<li>Bootstraps from the default seed nodes</li>
<li>Stores data inside the container (ephemeral)</li>
</ul>
<p>To persist data across container restarts, mount a volume:</p>
<pre><code class="language-bash">docker run -d \
--name tesseras \
-p 4433:4433/udp \
-v tesseras-data:/root/.local/share/tesseras \
tesseras-daemon
</code></pre>
<h2 id="running-as-a-seed-node"><a class="header" href="#running-as-a-seed-node">Running as a seed node</a></h2>
<p>To run a seed node that doesn’t bootstrap from anyone else:</p>
<pre><code class="language-bash">docker run -d \
--name tesseras-seed \
-p 4433:4433/udp \
tesseras-daemon --listen 0.0.0.0:4433 --bootstrap ""
</code></pre>
<h2 id="multi-node-network-with-docker-compose"><a class="header" href="#multi-node-network-with-docker-compose">Multi-node network with Docker Compose</a></h2>
<p>The repository includes a Docker Compose file for testing a 3-node network:</p>
<pre><code class="language-yaml">services:
boot1:
build: ../..
command: ["--listen", "0.0.0.0:4433", "--bootstrap", ""]
ports: ["4433:4433/udp"]
boot2:
build: ../..
command: ["--listen", "0.0.0.0:4433", "--bootstrap", "boot1:4433"]
depends_on: [boot1]
client:
build: ../..
command: ["--listen", "0.0.0.0:4433", "--bootstrap", "boot2:4433"]
depends_on: [boot2]
</code></pre>
<p>Start the network:</p>
<pre><code class="language-bash">cd tests/smoke
docker compose up --build -d
</code></pre>
<p>Check that all nodes are running:</p>
<pre><code class="language-bash">docker compose logs --tail=5
</code></pre>
<p>You should see <code>daemon ready</code> in the logs for each node, and <code>bootstrap successful</code> for <code>boot2</code> and <code>client</code>.</p>
<p>Stop the network:</p>
<pre><code class="language-bash">docker compose down
</code></pre>
<h2 id="custom-configuration"><a class="header" href="#custom-configuration">Custom configuration</a></h2>
<p>To use a config file with Docker, mount it into the container:</p>
<pre><code class="language-bash">docker run -d \
--name tesseras \
-p 4433:4433/udp \
-v ./config.toml:/etc/tesseras/config.toml:ro \
-v tesseras-data:/root/.local/share/tesseras \
tesseras-daemon --config /etc/tesseras/config.toml
</code></pre>
<p>See the <a href="#configuration">Configuration</a> chapter for all available options.</p>
</main>
<nav class="nav-wrapper" aria-label="Page navigation">
<!-- Mobile navigation buttons -->
<div style="clear: both"></div>
</nav>
</div>
</div>
<nav class="nav-wide-wrapper" aria-label="Page navigation">
</nav>
</div>
<template id=fa-eye><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M288 32c-80.8 0-145.5 36.8-192.6 80.6C48.6 156 17.3 208 2.5 243.7c-3.3 7.9-3.3 16.7 0 24.6C17.3 304 48.6 356 95.4 399.4C142.5 443.2 207.2 480 288 480s145.5-36.8 192.6-80.6c46.8-43.5 78.1-95.4 93-131.1c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C433.5 68.8 368.8 32 288 32zM432 256c0 79.5-64.5 144-144 144s-144-64.5-144-144s64.5-144 144-144s144 64.5 144 144zM288 192c0 35.3-28.7 64-64 64c-11.5 0-22.3-3-31.6-8.4c-.2 2.8-.4 5.5-.4 8.4c0 53 43 96 96 96s96-43 96-96s-43-96-96-96c-2.8 0-5.6 .1-8.4 .4c5.3 9.3 8.4 20.1 8.4 31.6z"/></svg></span></template>
<template id=fa-eye-slash><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M38.8 5.1C28.4-3.1 13.3-1.2 5.1 9.2S-1.2 34.7 9.2 42.9l592 464c10.4 8.2 25.5 6.3 33.7-4.1s6.3-25.5-4.1-33.7L525.6 386.7c39.6-40.6 66.4-86.1 79.9-118.4c3.3-7.9 3.3-16.7 0-24.6c-14.9-35.7-46.2-87.7-93-131.1C465.5 68.8 400.8 32 320 32c-68.2 0-125 26.3-169.3 60.8L38.8 5.1zM223.1 149.5C248.6 126.2 282.7 112 320 112c79.5 0 144 64.5 144 144c0 24.9-6.3 48.3-17.4 68.7L408 294.5c5.2-11.8 8-24.8 8-38.5c0-53-43-96-96-96c-2.8 0-5.6 .1-8.4 .4c5.3 9.3 8.4 20.1 8.4 31.6c0 10.2-2.4 19.8-6.6 28.3l-90.3-70.8zm223.1 298L373 389.9c-16.4 6.5-34.3 10.1-53 10.1c-79.5 0-144-64.5-144-144c0-6.9 .5-13.6 1.4-20.2L83.1 161.5C60.3 191.2 44 220.8 34.5 243.7c-3.3 7.9-3.3 16.7 0 24.6c14.9 35.7 46.2 87.7 93 131.1C174.5 443.2 239.2 480 320 480c47.8 0 89.9-12.9 126.2-32.5z"/></svg></span></template>
<template id=fa-copy><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M502.6 70.63l-61.25-61.25C435.4 3.371 427.2 0 418.7 0H255.1c-35.35 0-64 28.66-64 64l.0195 256C192 355.4 220.7 384 256 384h192c35.2 0 64-28.8 64-64V93.25C512 84.77 508.6 76.63 502.6 70.63zM464 320c0 8.836-7.164 16-16 16H255.1c-8.838 0-16-7.164-16-16L239.1 64.13c0-8.836 7.164-16 16-16h128L384 96c0 17.67 14.33 32 32 32h47.1V320zM272 448c0 8.836-7.164 16-16 16H63.1c-8.838 0-16-7.164-16-16L47.98 192.1c0-8.836 7.164-16 16-16H160V128H63.99c-35.35 0-64 28.65-64 64l.0098 256C.002 483.3 28.66 512 64 512h192c35.2 0 64-28.8 64-64v-32h-47.1L272 448z"/></svg></span></template>
<template id=fa-play><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 384 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M73 39c-14.8-9.1-33.4-9.4-48.5-.9S0 62.6 0 80V432c0 17.4 9.4 33.4 24.5 41.9s33.7 8.1 48.5-.9L361 297c14.3-8.7 23-24.2 23-41s-8.7-32.2-23-41L73 39z"/></svg></span></template>
<template id=fa-clock-rotate-left><span class=fa-svg><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><!--! Font Awesome Free 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2022 Fonticons, Inc. --><path d="M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z"/></svg></span></template>
<script>
window.playground_copyable = true;
</script>
<script src="elasticlunr-ef4e11c1.min.js"></script>
<script src="mark-09e88c2c.min.js"></script>
<script src="searcher-c2a407aa.js"></script>
<script src="clipboard-1626706a.min.js"></script>
<script src="highlight-abc7f01d.js"></script>
<script src="book-a0b12cfe.js"></script>
<!-- Custom JS scripts -->
<script>
window.addEventListener('load', function() {
window.setTimeout(window.print, 100);
});
</script>
</div>
</body>
</html>
|