ERC-8260: Dive Log
Defines a compact onchain dive-log header, a content hash of a UDDF profile, and optional typed attestations.
Abstract
ERC-8260 defines a sovereign, append-only dive logbook: one contract per book, with a single fixed owner. Each entry pairs a compact onchain header, self-sufficient enough to remain a meaningful logbook entry if the profile file is lost, with a required contentHash (SHA-256 over the exact bytes of a UDDF (Universal Dive Data Format) 3.x dive profile) and an optional content-addressed profileURI. Third parties can attest an entry with an EIP-712 signature over its id and hash; unattested dives remain valid self-reported records. Corrections use void/supersede, and compliant contracts are discoverable via ERC-165. Multi-gas mixes, decompression stop lists, depth-time samples, and precise location stay in the off-chain profile, not in contract storage.
Motivation
A diver's logbook is the evidence behind their experience: training agencies gate professional ratings on a minimum number of logged dives, regulations for diving at work require divers and employers to keep dive records, and those records are consulted when decompression illness or other incidents are investigated or claimed. Yet most logs are still paper or app entries the diver controls, attested by a signature, stamp, or initials that are easy to fabricate and hard for a third party to check. Dive computers already record depth, time, and gas data, and UDDF already gives that data a common export format, but nothing cryptographically binds a specific dive file to the buddy, instructor, device, or agency vouching for it.
This ERC supplies that binding without requiring a witness on every entry: unattested historic and recreational dives remain valid self-reported records, and the trust signal is which attesters signed, as resolved by the consumer against an allow-list or registry it trusts, not how many signatures exist. A signed file or a vendor database can prove who signed, but not when the record existed, whether it was later edited, or whether a correction replaced it; a public append-only log gives every verifier the same ordered, timestamped, correction-preserving history without trusting whoever runs the database. Interoperability needs a shared header (with both commercial bottom time and scuba total duration), a shared content hash, and a shared optional attestation type, not an onchain copy of every computer field.
Why a dedicated ERC
A dive record is created by one party and verified by another, often in a different country and software stack: a dive computer from one manufacturer, a buddy or instructor using a logbook app from another, and an agency, employer, or insurer that must check the result. Without a common interface, every verifier must integrate every issuer, the problem that motivated ERC-4626, where the lack of a standard "forces each protocol to implement their own adapters which are error prone and waste development resources." ERC-3643 and ERC-7943 are precedents for domain-specific interfaces in regulated real-world settings; this ERC follows ERC-7943's approach of defining only the essential surface and leaving implementation open. Generic data containers and attestation registries can record that someone signed something, but they do not define what a dive attestation commits to. As ERC-8326 observes for documents, without a shared commitment rule "two systems can hold the same canonical document representations but derive incompatible bundle commitments." This ERC therefore standardizes only what generic tools leave undefined: a minimal dive header, a canonical hash of the dive's existing UDDF export, typed-data attestations over that hash, and void and supersede semantics that preserve history. The full profile stays off-chain in the format dive computers and logbook software already exchange.
Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
A dive logbook is a sovereign, append-only contract owned by one account (the diver, or an employer keeping that diver's log). A book records the dives of exactly one diver; an employer keeps one book per diver. Every ERC-8260 compliant contract MUST implement IDiveLog (below) and IERC165. Each record consists of:
- A self-sufficient onchain header that remains a meaningful logbook entry if the profile file is lost.
- A required
contentHash: SHA-256 of the exact octet stream of the UDDF 3.x file being committed. That octet stream MUST be UTF-8 encoded Extensible Markup Language (XML). A leading UTF-8 byte order mark (BOM) is NOT RECOMMENDED. The hash is over the exact stored bytes, with no XML canonicalization, and MUST NOT be taken from a later re-export. - An optional
profileURIlocating that exact byte string; it SHOULD be content-addressed (ipfs://orar://). The hash, not the uniform resource identifier (URI), is authoritative. - Optional attestations: EIP-712 signatures that bind
diveIdandcontentHash. Zero attestations is a valid self-report.
Everything else a commercial, military, or recreational record needs (stops, samples, environment, work performed, equipment, notes, names) lives in the hashed UDDF profile or off-chain.
Contract model. The owner MUST be set at deployment and MUST NOT change afterwards. Compliant contracts MUST NOT provide any path that mutates a stored header, contentHash, or recorded attestation after it is written, including through a proxy upgrade, delegatecall, or selfdestruct-and-redeploy.
Data Types
enum UnitSystem { Imperial, Metric }
enum DiveMode {
OCRecreational,
OCTechnical,
CCR,
SCR,
Freedive,
SurfaceSupplied,
Saturation
}
struct DiveInput {
uint32 diveDate; // UTC calendar date as YYYYMMDD, e.g. 20260514
uint64 startTime; // Unix seconds UTC: leave surface
uint32 maxDepth; // tenths of feet of seawater (fsw, Imperial) or metres of seawater (msw, Metric)
uint32 durationSeconds; // total time surface-to-surface, MUST be > 0
uint32 bottomTimeSeconds; // leave surface to beginning of ascent; 0 = not recorded
DiveMode mode;
UnitSystem units;
uint16 o2Bps; // O2 in basis points (2100 = 21.00%)
uint16 heBps; // He in basis points; N2 implied as 10000 - o2Bps - heBps
bytes16 tableSchedule; // ASCII family+schedule, right-NUL-padded; bytes16(0) = not recorded
uint32 surfaceIntervalSeconds; // surface interval before this dive; 0 = not recorded / not applicable
bytes1 repetitiveGroup; // ASCII 'A'-'Z' at end of this dive; 0x00 = not recorded
bytes1 repetitiveGroupAfterSI; // ASCII 'A'-'Z' after the surface interval (SI) preceding this dive; 0x00 = not recorded
bytes4 coarseGeohash; // geohash precision 4, or bytes4(0) if not recorded
bytes32 contentHash; // REQUIRED; SHA-256 of the exact attested UDDF bytes
string profileURI; // MAY be empty; SHOULD be content-addressed (ipfs:// or ar://)
}
struct DiveHeader {
uint256 id; // contract-assigned sequence, starting at 1
uint32 diveDate;
uint64 startTime;
uint32 maxDepth;
uint32 durationSeconds;
uint32 bottomTimeSeconds;
DiveMode mode;
UnitSystem units;
uint16 o2Bps;
uint16 heBps;
bytes16 tableSchedule;
uint32 surfaceIntervalSeconds;
bytes1 repetitiveGroup;
bytes1 repetitiveGroupAfterSI;
bytes4 coarseGeohash;
bytes32 contentHash;
string profileURI;
}
struct VoidInfo {
uint256 supersededById; // 0 = voided without replacement
bool isVoided;
address voidedBy;
uint64 voidedAt;
string reason;
}
struct AttestationRecord {
address attester;
uint64 attestedAt;
uint256 nonce;
}
Interface Definition
The ERC-165 identifier for IDiveLog is 0x4d89a8f9: the XOR of the 13 function selectors declared in IDiveLog, excluding the inherited supportsInterface.
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
/// @title ERC-8260 Dive Log Interface
/// @notice The ERC-165 identifier for this interface is 0x4d89a8f9.
interface IDiveLog is IERC165 {
event DiveLogged(uint256 indexed diveId, uint32 indexed diveDate, bytes32 contentHash);
event DiveVoided(
uint256 indexed diveId,
uint256 indexed supersededById,
address indexed voidedBy,
string reason
);
event DiveAttested(uint256 indexed diveId, address indexed attester, bytes32 contentHash);
event AttestationNonceCancelled(address indexed attester, uint256 newNonce);
error NotOwner();
error InvalidDepth();
error InvalidTimes();
error InvalidDate();
error InvalidContentHash();
error InvalidGasMix();
error InvalidTableSchedule();
error InvalidRepetitiveGroup();
error InvalidBatchSize(uint256 length);
error DiveNotFound(uint256 diveId);
error DiveAlreadyVoided(uint256 diveId);
error InvalidSupersede(uint256 voidedId, uint256 supersededId);
error AlreadyAttested(uint256 diveId, address attester);
error InvalidSignature();
error NonceMismatch(uint256 expected, uint256 provided);
error InvalidAttestationIndex(uint256 index);
function owner() external view returns (address);
function logDive(DiveInput calldata input) external returns (uint256 diveId);
function batchLogDives(DiveInput[] calldata inputs) external returns (uint256[] memory diveIds);
function voidDive(uint256 diveId, uint256 supersededById, string calldata reason) external;
function attestDive(
uint256 diveId,
bytes32 contentHash,
uint256 nonce,
bytes calldata signature
) external;
function cancelAttestationNonce() external;
function getDive(uint256 diveId) external view returns (DiveHeader memory);
function getDiveCount() external view returns (uint256);
function isDiveVoided(uint256 diveId) external view returns (bool);
function getVoidInfo(uint256 diveId) external view returns (VoidInfo memory);
function attestationCount(uint256 diveId) external view returns (uint256);
function getAttestation(uint256 diveId, uint256 index) external view returns (AttestationRecord memory);
function attesterNonce(address attester) external view returns (uint256);
}
MAX_BATCH_SIZE MUST be 20. It is fixed by this specification and is not exposed by IDiveLog.
Units
UnitSystem disambiguates the header's depth field only; UDDF file content follows UDDF's own units (metres, seconds).
| Field | Imperial | Metric |
|---|---|---|
maxDepth | Tenths of feet of seawater (fsw); 33 fsw = 1 standard atmosphere (101.325 kPa) | Tenths of metres of seawater (msw); 10 msw = 1 bar (100 kPa) |
Both are pressure units, as used in decompression tables and depth gauges, not lengths. Publishers converting UDDF greatestdepth (metres, read as msw) MUST use maxDepth = round(greatestdepth × 10) for Metric and maxDepth = round(greatestdepth × 10 × 330 / 101.325) for Imperial (1 msw ≈ 3.2568 fsw), rounding half up; for example 18.2 m is 182 (Metric) or 593 (Imperial). Publishers MUST NOT convert with the length factor 0.3048 m/ft. Consumers comparing header and UDDF MUST allow a difference of 1.
Field Encodings
| Field | Encoding |
|---|---|
id | Assigned sequentially from 1; 1..getDiveCount() is a complete scan. This is the dive number; original paper numbers, if any, live in the UDDF. |
diveDate | uint32 YYYYMMDD, a valid Gregorian calendar date with year >= 1970; not a Unix timestamp. The UTC calendar date of startTime MUST equal diveDate. |
startTime | Unix seconds UTC, MUST be > 0, and startTime + durationSeconds MUST be <= block.timestamp (a dive is logged after it ends): the instant the diver leaves the surface. Reach-surface is startTime + durationSeconds; leave-bottom is startTime + bottomTimeSeconds when bottom time is recorded. Reach-bottom is profile detail and lives in UDDF waypoints. |
maxDepth | Tenths of fsw or msw per units. MUST be > 0. |
durationSeconds | Total dive time, surface to surface, in whole seconds. MUST be > 0. |
bottomTimeSeconds | Time from leaving the surface in descent to beginning ascent, in whole seconds. 0 means not recorded (typical recreational computer logs that store only total time). If nonzero, MUST be <= durationSeconds. |
mode | One of the closed DiveMode set; further apparatus detail lives in UDDF <apparatus>. |
units | Selects the interpretation of maxDepth. |
o2Bps / heBps | Basis points of the primary breathing gas. 0/0 means not recorded, or no breathing gas for Freedive. Air is 2100/0; Nitrox 32 is 3200/0; Trimix 18/45 is 1800/4500. When either value is nonzero, o2Bps MUST be > 0 and o2Bps + heBps MUST be <= 10000; residual nitrogen is 10000 - o2Bps - heBps and is not stored. Multi-gas and deco mixes live in the UDDF. |
tableSchedule | bytes16 ASCII, right-NUL-padded (trailing 0x00, never spaces); bytes16(0) = not recorded. Format <TOKEN> or <TOKEN> <schedule>: a single space (0x20) separates token and schedule, with no leading, trailing, or consecutive spaces. Normative tokens map to UDDF <divetable> keywords: USN -> US-Navy, PADI -> PADI, NAUI -> NAUI, BSAC -> BSAC, BUEHL -> Buehlmann, DCIEM -> DCIEM, CSMD -> CSMD, COMEX -> COMEX, OTHER -> other. Printable ASCII 0x20-0x7E only, plus trailing NULs; no interior NULs. Examples: USN 60/40, USN 9/7, USN 60/40+10, PADI 60, DCIEM 15/50. Recreational logs that do not use a table leave this zero. |
surfaceIntervalSeconds | Surface interval before this dive, in seconds (UDDF <surfaceintervalbeforedive>/<passedtime>). 0 = not recorded or not applicable (first dive, or no reportable exposure in the window). Not derivable from other headers: the prior pressure exposure may be missing from this contract. |
repetitiveGroup | bytes1; 0x00 = not recorded, otherwise ASCII uppercase A-Z. The designator at the end of this dive (upon surfacing, after decompression). Letters are table-family-specific: the table in tableSchedule defines the alphabet. If nonzero, tableSchedule MUST be nonzero. |
repetitiveGroupAfterSI | bytes1; 0x00 = not recorded, first dive, or a surface interval long enough that the table in tableSchedule assigns no repetitive group; otherwise A-Z. The new repetitive group after the surface interval that precedes this dive, i.e. the letter the diver held at leave-surface. If nonzero, tableSchedule MUST be nonzero and surfaceIntervalSeconds MUST be > 0. The letter after a still-running interval following this dive is not stored; it is looked up from repetitiveGroup and elapsed time when the next dive is logged. |
coarseGeohash | bytes4 holding exactly four lowercase geohash base32 characters (0123456789bcdefghjkmnpqrstuvwxyz), a precision-4 cell of about 39 km × 20 km, or bytes4(0) if not recorded. No precise coordinates onchain. Contracts are not required to validate it; consumers MUST treat any other value as not recorded. |
contentHash | SHA-256 of the exact attested UDDF 3.x file bytes. MUST NOT be bytes32(0). Publishers MUST NOT hash a re-exported or pretty-printed copy; export tools may drop fields. |
profileURI | RFC 3986 URI or empty. SHOULD be content-addressed (ipfs:// or ar://). |
Multi-dive files. A committed UDDF file SHOULD contain exactly one <dive> element. If it contains more than one and profileURI is non-empty, the URI MUST end in a fragment #<id> naming the id attribute of the header's <dive>. An empty profileURI is allowed for a multi-dive file: the header's dive is then the unique <dive> whose informationbeforedive/datetime equals startTime, and a file with no unique match MUST NOT be committed. Different headers MAY share a contentHash only under this rule, and consumers MUST treat an attestation over a multi-dive file as vouching for every dive in it.
Header and UDDF agreement. Publishers MUST ensure the attested UDDF dive agrees with every nonzero header field, at the locations in the UDDF mapping table: startTime and diveDate with informationbeforedive/datetime; durationSeconds with informationafterdive/diveduration (±1 s); bottomTimeSeconds with the beginning of ascent in the waypoints, when the file has waypoints (±1 s); maxDepth with informationafterdive/greatestdepth after the conversion in Units (±1); mode with the apparatus and divemode values in the dive mode table below; o2Bps/heBps with the primary gasdefinitions/mix; <divetable> with the mapped keyword of tableSchedule; <surfaceintervalbeforedive>/<passedtime> with surfaceIntervalSeconds; the full tableSchedule string and both letters repeated in informationafterdive/notes in the notes syntax below; and coarseGeohash with the cell containing the site's latitude/longitude, when the file records them. The contract cannot check this. If header and UDDF differ beyond these tolerances, the record is inconsistent; consumers MUST NOT silently prefer one over the other. The header is the surviving summary when the file is unavailable: an availability rule, not an authority rule.
Notes syntax. When tableSchedule is nonzero, publishers MUST include, in informationafterdive/notes, a single <para> whose entire text is exactly:
ERC-8260 tableSchedule: <schedule>; repetitiveGroupAfterSI: <after>; repetitiveGroup: <end>
<schedule> is the tableSchedule value with trailing NULs removed. <after> and <end> are the corresponding ASCII letters, or empty if that field is 0x00. There is one space after each colon and one space after each semicolon, and no leading or trailing whitespace in the <para>. The fixture form is the example:
ERC-8260 tableSchedule: USN 60/40; repetitiveGroupAfterSI: C; repetitiveGroup: F
Published profiles. Publishers SHOULD strip <diver>/<personal>, buddy identities, and precise geography from any UDDF published at profileURI.
Behavior Requirements
Logging. logDive and batchLogDives MUST revert NotOwner unless msg.sender is owner(). They MUST revert InvalidDepth if maxDepth == 0; InvalidTimes if durationSeconds == 0, if bottomTimeSeconds != 0 && bottomTimeSeconds > durationSeconds, or if startTime + durationSeconds > block.timestamp; InvalidDate if startTime == 0, if diveDate is not a valid YYYYMMDD (year >= 1970, month 1-12, day valid for the month), or if diveDate does not match the UTC date of startTime; InvalidContentHash if contentHash == bytes32(0); InvalidGasMix if heBps != 0 && o2Bps == 0 or if o2Bps + heBps > 10000; InvalidTableSchedule if tableSchedule is nonzero but is not right-NUL-padded printable ASCII whose first token is in the normative set, or has a leading, trailing, or consecutive space; and InvalidRepetitiveGroup if either group letter is not 0x00 or A-Z, if a nonzero letter is logged with tableSchedule == 0, or if repetitiveGroupAfterSI != 0 while surfaceIntervalSeconds == 0. Ids MUST be sequential from 1; headers MUST be append-only (never mutated or deleted); each dive MUST emit DiveLogged. Logging MUST NOT require an attestation. bottomTimeSeconds == 0, tableSchedule == bytes16(0), both letters 0x00, and surfaceIntervalSeconds == 0 are valid and mean not recorded (for the surface interval: or not applicable, e.g. a first dive).
batchLogDives MUST validate each item identically to logDive, MUST revert the entire batch (no partial writes) if any item is invalid, MUST revert InvalidBatchSize if the length is 0 or exceeds MAX_BATCH_SIZE (20), and MUST emit one DiveLogged per dive. MAX_BATCH_SIZE is a ceiling, not a target. Callers MUST size each batch to fit the target chain's per-transaction and per-block gas limits and SHOULD stay well below the ceiling; wallet gas-estimation buffers and RPC provider limits also apply, and those caps are checked against the transaction's gas limit, not the gas it ends up using.
Historic and retroactive imports. A dive MAY be logged long after it was made. Contracts MUST NOT reject a startTime in the past. No retroactivity flag is stored: consumers MAY compare the block timestamp of DiveLogged with startTime to detect retrospective entry.
Trust. Unattested dives MUST remain readable and are self-reported. Any key can produce a valid attestation, so attestationCount is not a trust signal on its own; consumers MUST evaluate attestations by attester identity (for example against an agency, employer, or instructor allow-list they trust) and SHOULD ignore attestations from unrecognized addresses. Consumers SHOULD resolve attester identity through a source that supports revocation with an effective time, and SHOULD disregard an attestation whose attestedAt is at or after that attester key's revocation time.
Void and supersede. voidDive MUST revert NotOwner unless called by owner(), MUST revert DiveNotFound for an unknown diveId, DiveAlreadyVoided if the dive was already voided, and InvalidSupersede if a non-zero supersededById equals diveId, does not exist, or is itself already voided. supersededById == 0 voids without replacement. Voiding MUST NOT delete or mutate the header; it MUST emit DiveVoided. Consumers MUST check isDiveVoided before trusting a header or its attestations.
Attestation. See the EIP-712 typed data section. attestDive MUST revert DiveNotFound if diveId is 0 or greater than getDiveCount(), InvalidContentHash if the contentHash argument is not the stored hash, DiveAlreadyVoided for a voided dive, InvalidSignature if recovery fails or the signature is non-canonical, NonceMismatch on a stale nonce, and AlreadyAttested when the recovered attester has already attested that dive. On success it MUST increment the attester's nonce and emit DiveAttested including contentHash. cancelAttestationNonce MUST be callable by any address, MUST increment the caller's nonce by 1, and MUST emit AttestationNonceCancelled.
Reads. An unknown diveId (0 or greater than getDiveCount()) MUST revert DiveNotFound from getDive, isDiveVoided, getVoidInfo, attestationCount, and getAttestation. An out-of-range attestation index MUST revert InvalidAttestationIndex. attesterNonce starts at 0. Indexers list a career from DiveLogged events or by iterating getDive over 1..getDiveCount(); the standard intentionally provides no unbounded array getters.
ERC-165. supportsInterface MUST return true for the IDiveLog id (0x4d89a8f9) and for 0x01ffc9a7, and false for 0xffffffff.
Revert order. When more than one revert condition applies, implementations MUST check them in this order. logDive/batchLogDives: NotOwner, InvalidBatchSize, then per item InvalidDepth, InvalidTimes, InvalidContentHash, InvalidGasMix, InvalidDate, InvalidTableSchedule, InvalidRepetitiveGroup. voidDive: NotOwner, DiveNotFound, DiveAlreadyVoided, InvalidSupersede. attestDive: DiveNotFound, DiveAlreadyVoided, InvalidContentHash, InvalidSignature, NonceMismatch, AlreadyAttested.
EIP-712 Typed Data
Attestations use the EIP-712 domain name = "DiveLog", version = "1", chainId, and verifyingContract (the dive log contract), preventing replay across contracts and chains.
keccak256(
"Attestation(uint256 diveId,bytes32 contentHash,uint256 nonce)"
)
The EIP-712 type is named Attestation and has fields diveId, contentHash, and nonce. It is distinct from the onchain AttestationRecord struct (attester, attestedAt, nonce) returned by getAttestation.
The attester signs the EIP-712 typed hash of this structure, where contentHash is the stored SHA-256 digest carried as a bytes32 field; signers MUST NOT keccak256 the UDDF file itself. The digest is \x19\x01 ‖ domainSeparator ‖ structHash per EIP-712. A wallet displaying the message shows diveId, contentHash, and nonce, with verifyingContract shown from the domain. An attester MUST review the stored header and the UDDF profile committed by contentHash before signing.
attestDive recovers the attester from a 65-byte r ‖ s ‖ v signature. Implementations MUST accept v in {27, 28} and MUST accept v in {0, 1} as {27, 28} respectively. They MUST reject any other v, and MUST reject signatures where s > secp256k1n/2 (the EIP-2 non-canonical form). Any address MAY submit the transaction; the recorded attester is the recovered signer. The nonce MUST equal the attester's current onchain nonce (queryable via attesterNonce); it increments on every accepted attestation and on cancelAttestationNonce, which is how an attester invalidates signed-but-unsubmitted attestations. Nonces are per attester per contract and strictly sequential: a signature over nonce n + 1 is invalid until nonce n is consumed or cancelled, so an attester signing several dives in one book signs consecutive nonces and they are submitted in order. Signed attestations do not expire; an attester who wants a signature to lapse cancels its nonce.
attestDive supports only Elliptic Curve Digital Signature Algorithm (ECDSA) signatures from externally owned accounts. Implementations MAY add a separate function such as attestDiveFor(address attester, uint256 diveId, bytes32 contentHash, uint256 nonce, bytes calldata signature) that validates signature against attester via ERC-1271 isValidSignature over the same EIP-712 digest; such a function is not part of IDiveLog, MUST apply every check attestDive applies (dive exists, not voided, hash matches, nonce, one attestation per attester), and MUST record and emit attester.
UDDF mapping
The table gives the UDDF 3.x location of each header field. Paths that sit under a dive are relative to that dive element (profiledata/repetitiongroup/dive). gasdefinitions and divesite are top-level UDDF sections, reached from the dive by id links. The dive's site is the divesite/site whose id equals the ref of an informationbeforedive/link that names a site; coarseGeohash is derived from that site's geography (latitude/longitude) when present. The primary mix is the gasdefinitions/mix whose id equals the ref of the first samples/waypoint/switchmix in the dive, in document order. If the dive has no switchmix, the primary mix is the mix referenced by the first tankdata child of the dive. If neither is present, o2Bps/heBps MUST be 0/0 (not recorded), except that 0/0 is also the recorded value for Freedive. The agreement rule in Field Encodings uses these locations. Publishers MUST hash the exact attested file bytes, not a reconstructed mapping and not a re-export that may have dropped fields.
| ERC-8260 | UDDF 3.x |
|---|---|
diveDate / startTime | informationbeforedive/datetime. If the value carries Z or an offset, convert to UTC. If it carries no offset, publishers MUST apply the offset from the dive site's geography/timezone when present, and otherwise MUST write the file's datetime with an explicit offset before hashing. diveDate is the UTC YYYYMMDD of the resulting instant, which may differ from the diver's local calendar date |
durationSeconds | informationafterdive/diveduration (seconds) |
bottomTimeSeconds | Not a first-class UDDF element; derive from waypoints (leave surface to beginning of ascent) when known, otherwise 0 |
maxDepth | informationafterdive/greatestdepth (metres in UDDF), converted to tenths of fsw or msw per units as in Units |
o2Bps / heBps | Primary mix fractions (see the resolution rule above) multiplied by 10000 (UDDF <o2> is a 0-1 fraction, e.g. 0.375) |
coarseGeohash | Derived at precision 4 from the linked site's geography (see the resolution rule above) if the publisher chooses to publish a region; precise latitude/longitude stay in the UDDF or are omitted |
mode | informationbeforedive/apparatus and the type of samples/waypoint/divemode; see the dive mode table below |
tableSchedule | Family in informationafterdive/divetable (mapped keyword); full token+schedule string in informationafterdive/notes |
repetitiveGroup | informationafterdive/notes; do not use <repetitiongroup> for the letter; that element groups dives that belong together |
repetitiveGroupAfterSI | informationafterdive/notes |
surfaceIntervalSeconds | informationbeforedive/surfaceintervalbeforedive/passedtime (seconds) |
contentHash | SHA-256 of the entire attested file bytes, not of a single <dive> node and not of a later re-export |
profileURI | Where that exact byte string is published (SHOULD be content-addressed) |
| Multi-gas, tanks, samples, deco stops, buddy, computer | gasdefinitions, tankdata, samples/waypoint, after-dive deco data, buddy, equipment/divecomputer |
UDDF 3.2.3 <applicationdata> accepts only a fixed list of vendor elements, so ERC-8260 values with no UDDF element go in informationafterdive/notes.
Dive mode agreement uses this table and the first samples/waypoint/divemode in the dive, in document order. A later waypoint may change divemode (for example a closed-circuit dive that bails out to open circuit); those later values do not by themselves make the header mismatch. A dash means UDDF has no equivalent: that value is not checked, and publishers SHOULD state the mode in informationafterdive/notes as a <para> whose entire text is exactly:
ERC-8260 mode: <name>
where <name> is the DiveMode identifier (OCRecreational, OCTechnical, SurfaceSupplied, or Saturation). An element absent from the file is not checked either; a present element with a different value is a mismatch.
DiveMode | apparatus | divemode type |
|---|---|---|
OCRecreational | open-scuba | opencircuit |
OCTechnical | open-scuba | opencircuit |
CCR | rebreather | closedcircuit |
SCR | rebreather | semiclosedcircuit |
Freedive | - | apnea or apnoe |
SurfaceSupplied | surface-supplied | - |
Saturation | surface-supplied | - |
UDDF 3.2.3 enumerates both apnea and the earlier German spelling apnoe as divemode types; either value agrees with Freedive. UDDF does not distinguish recreational from technical open circuit, or saturation from other surface-supplied diving; those distinctions rest on the header and the notes.
Rationale
Prior Art
Generic data containers (ERC-7208) and attestation registries such as the Ethereum Attestation Service (EAS) can record that a party signed a payload. They do not define what a dive attestation commits to, how the dive file is hashed, who may void or supersede a record, or how a verifier lists a career. ERC-8326 drew this line for document bundles: a generic container is not a document-specific commitment and lifecycle. ERC-8328 and ERC-8329 similarly treat generic attestations as insufficient where correction chains and a queryable, domain-specific log are required. This ERC takes that same approach for dive records.
Header fields
id: the durable dive number, assigned sequentially so1..getDiveCount()is a complete scan.diveDate(YYYYMMDD): lists a career by day without parsing a UDDF or depending on a single Unix-second key.startTime: the leave-surface instant; orders same-day dives; must matchdiveDate.maxDepth: the depth every logbook already shows.durationSeconds: total time surface-to-surface, what recreational logs and UDDF<diveduration>record.bottomTimeSeconds: commercial and US regulatory logs are built around bottom time (leave surface to beginning of ascent);0lets recreational logs omit it.mode: classifies the dive (open-circuit recreational or technical, rebreather, freedive, surface-supplied, or saturation) from the header alone.units: makesmaxDepthunambiguous.o2Bps/heBps: a compact primary mix so the onchain entry names the breathing gas; further mixes stay in the UDDF.tableSchedule: the table and schedule actually used, including modification, must survive loss of the UDDF. The short token keeps the field unambiguous and inside one storage slot; a family enum plus schedule string is longer and ossifies; full keywords crowd out the schedule ("US-Navy 130/50+10" is 17 bytes).surfaceIntervalSeconds: US commercial logs must record elapsed time since the last pressure exposure when under 24 hours (or the repetitive designation) for decompression, deeper than 100 fsw, or mixed-gas dives; it cannot be derived unless the previous exposure is in this same book.repetitiveGroup: the end-of-dive letter materially changes residual nitrogen and next-dive planning (an F is not an A); it must be on the header. Its meaning is table-family-specific, hence thetableSchedulerequirement.repetitiveGroupAfterSI: standard worksheets record the new group after the surface interval, not only the ending letter; this is the letter the diver held at leave-surface of this dive.coarseGeohash: a privacy-safe region (precision 4) so the entry has a place without publishing a pinpoint.contentHash: a required binding to the exact attested UDDF bytes, even when nobody has attested yet.profileURI: optional locator; the hash, not the URI, is authoritative.
Functions
owner(): discloses who may log, batch-log, and void.logDive: the single-dive write path, including unattested self-reports.batchLogDives: the historic-import path: one transaction for up to 20 compact headers (~93,000 gas per dive without a URI, ~180,000 with a Content Identifier version 1 (CIDv1) URI; see Security Considerations). A full batch with URIs stays under a quarter of Ethereum's per-transaction cap, leaving room for longer URIs and wallet gas buffers.voidDive: corrections to a safety record must remain auditable.attestDive: an optional witness signature over the dive's bytes, not a bare id; the argument hash must equal the stored hash.cancelAttestationNonce: lets an attester invalidate a signature they signed but never saw submitted.getDive/getDiveCount: sufficient to read a whole book without unbounded array getters.isDiveVoided/getVoidInfo: void is an overlay; consumers must be able to query it separately.attestationCount/getAttestation: bounded reads of an optional trust signal.attesterNonce: required for signers to build a valid typed message.
Dual units apply only to header depth; UDDF content follows UDDF's own units. Header fields have to agree with the attested UDDF (see Field Encodings); a mismatch is a defect, not a tie to break. Only the header and hash need to be in state: the packed header occupies three storage slots without a URI, and event logs, not extra storage, show when a dive was imported.
Backwards Compatibility
No backward compatibility issues found.
Test Cases
The reference implementation ships a Foundry test suite at SovereignDiveLog.t.sol covering: the published interface id; sequential ids; full header round-trip and DiveLogged; bottom time and duration storage and the zero-bottom-time path; table/schedule encoding (padding, interior NUL, unknown token, spacing), both repetitive-group letters and their cross-field rules; saturation and freedive modes; date and time validation including historic startTime, rejection of startTime == 0, rejection of dives that end after the current block, and a startTime whose date would overflow uint32; gas-mix validation including helium without oxygen; content-hash validation; SHA-256 of the fixture file; batch logging, the cap (20 accepted, 21 rejected), and all-or-nothing reverts; void/supersede including cycle prevention; attestation recovery, content binding, nonces, malleability rejection, acceptance of v in {0, 1} as well as {27, 28}, replay rejection, and nonce cancellation; unknown-id and out-of-range reads; and the EIP-712 domain separator and digest. The fixture validates against the UDDF 3.2.3 XML Schema Definition (XSD), and its header and UDDF agree under the Field Encodings rule.
Vectors (asserted by the suite):
type(IDiveLog).interfaceId=0x4d89a8f9sha256(test/fixtures/minimal.uddf)=0x0196bf5e5049821384843793016c2cd45759153588b6662e46a5a9ac4cc03a9aATTESTATION_TYPEHASH=0xec5dbc2c6bd6b5522fd9c79c29536ed0fe5e1d8a01214b052d52fd5e9e9c33d2- Domain
("DiveLog", "1", chainId = 1, verifyingContract = 0x5FbDB2315678afecb367f032d93F642f64180aa3)separator =0x9c6aad190ffdb35b11deefe73919eff3426c0875eb8ddeb480d67715e479b987 Attestation(diveId = 1, contentHash = <fixture hash>, nonce = 0)struct hash =0x25d9c0e36e4c2e087633454f5b9f86808196da263027466f431683a2ef702c35- Digest =
0x3c251d0cb199fb76982d8a0eda33a2a7392dd30e179454e2e2445020a9222bf5 - Signature by private key
0x0a77e571(address0xA686c4fF4C347a8D6f8e39e78D0b9CD3cFEed6e2) =0xa10f57e686fdb7a84fc175cea5a4e0e4dd90f52126c37fb4cb993ed4129421a9138de9b9579fe6118fd1925721c56e107bba865c85f55443e486eb5f03768b4a1b
Reference Implementation
A reference implementation is provided at SovereignDiveLog.sol. It implements the complete IDiveLog interface with:
- Owner-gated
logDive,batchLogDives, andvoidDive; immutable owner set at construction. - Rejection of dives that end after the current block, which also bounds
startTime. - A packed three-slot header (without URI) with sequential append-only ids.
- EIP-712 attestation verification with
ecrecover, 65-byte signatures,vin {27, 28} or {0, 1}, and low-senforcement; SHA-256 is computed off-chain (the owner supplies the hash). cancelAttestationNonce,MAX_BATCH_SIZE = 20, and bounded read accessors only.
Security Considerations
Self-reported vs attested. An unattested header is the owner's claim. An attestation proves only that a given address vouched for that exact contentHash at that time, not that the dive physically happened. Attestation count alone is meaningless: anyone, including the owner, can create unlimited keys and attest, and the owner cannot remove unsolicited attestations. Consumers weigh attestations only by attester identity they can independently resolve, as required in Behavior Requirements (Trust). Resolving that identity is out of scope: an agency, employer, or regulator that wants its attestations recognized can publish the attester addresses it vouches for, with validity periods, through a channel consumers already trust, such as a signed list on its own domain or an onchain registry.
Header-to-profile binding. contentHash binds the UDDF bytes, not the header. No onchain mechanism proves that maxDepth, durationSeconds, startTime, diveDate, o2Bps/heBps, tableSchedule, the repetitive-group letters, surfaceIntervalSeconds, or coarseGeohash match the committed file, and the EIP-712 digest commits only to diveId, contentHash, and nonce, with chainId and verifyingContract in the domain. The header is bound to an attestation only because the attestation names (verifyingContract, diveId) and the header stored there cannot change. An unattested record may therefore carry a header that disagrees with its own profile; consumers that hold the profile should parse it and compare every field covered by the agreement rule in Field Encodings before relying on the header.
Attester diligence. An attestation vouches for the dive record as stored under that diveId on the verifyingContract: the stored header and the exact UDDF bytes its contentHash commits to. Attesters review both before signing, as required in EIP-712 Typed Data; a signature over a contentHash the attester never compared against the profile it claims to represent vouches for nothing. Clients requesting an attestation signature should surface the stored header fields next to the hash so this review is possible.
Content binding. Attestations that do not sign contentHash are not evidence of a witnessed profile. The contract rejects an attestation whose hash argument differs from stored state.
Access control and immutability. Only owner() can log, batch-log, or void, and the owner cannot change after deployment (see Contract model). Stored headers, contentHash, and recorded attestations cannot be modified by any party, including through proxy upgrades, delegatecall, or selfdestruct-and-redeploy; attestations derive their meaning from the header being fixed at (verifyingContract, diveId). A lost owner key means a frozen book, and continuity is an application concern.
Nonce cancellation. cancelAttestationNonce is the revocation path for signed-but-unsubmitted attestations.
Attester key compromise and withdrawal. Recorded attestations cannot be revoked by this interface. A leaked attester key can produce valid attestations for any dive in any ERC-8260 contract on any chain until the attester stops being trusted off-chain. Consumers should resolve attester identity through a source that supports revocation with an effective time (for example an agency key registry) and should disregard attestations whose attestedAt is at or after the key's revocation time, as provided in Behavior Requirements (Trust). Withdrawing a specific attestation is out of scope; the owner can void the dive, and attesters can publish a withdrawal through the same off-chain registry.
Malleability. High-s signatures are rejected (see EIP-712 Typed Data), following EIP-2.
Void semantics. Consumers check isDiveVoided before trusting a header or its attestations (see Behavior Requirements). Void does not erase data.
Privacy. No names and no precise coordinates or site strings onchain. coarseGeohash is optional and coarse; precise location, if recorded, stays in the UDDF. A wallet address plus a public dive history can still be identifying, and location data is personal data under privacy law; voiding does not make onchain data disappear.
Operational security. Operators may omit coarseGeohash and profileURI and keep the UDDF private; contentHash still commits to it. Publishers should strip <diver>/<personal>, buddy identities, and precise geography from any UDDF published at profileURI (see Published profiles); content-addressed storage cannot be deleted. Attester addresses reveal relationships between divers, instructors, and employers. Dive and decompression data may be health data in some jurisdictions. Header fields are personal data in the clear and cannot be erased; keeping the UDDF private does not change that. A controller subject to erasure obligations for data about other people (for example an employer) should not record those people's dives on a public chain. This standard makes no claim of compliance with any data-protection law.
Completeness. A book is append-only, but nothing prevents an owner from keeping several books or omitting dives entirely. An ERC-8260 contract proves what was logged in it, not that it is a complete history. Consumers that need completeness should obtain it from an issuer that controls the book (for example an employer-owned log) or from attester-side records.
False hashes. The owner can commit to any 32 bytes; attestation is the honesty mechanism, and consumers can compare the hash against any published file.
Gas. Measured end-to-end transaction gas for the reference implementation (solc 0.8.39, optimizer 200 runs, Ethereum Virtual Machine (EVM) target shanghai):
| Case | Gas |
|---|---|
logDive, empty profileURI | ~117,500 |
logDive, 15-byte URI | ~137,700 |
logDive, 66-byte CIDv1 ipfs:// URI | ~205,200 |
| First dive in a new contract | ~17,100 more than the above |
batchLogDives, 20 dives, empty URI | ~1.85 million |
batchLogDives, 20 dives, CIDv1 URI | ~3.61 million |
Batch rows use 20 distinct headers logged into a book that already holds a dive. On Ethereum mainnet, EIP-7825 caps a transaction's gas limit at 16,777,216; other chains set their own per-transaction and per-block limits, and those can change over time. Deployment on a layer 2 (L2) network is recommended for cost-sensitive careers.
ERC-1271. Contract-account attestations are optional and outside IDiveLog (see EIP-712 Typed Data). Because ERC-1271 validity can change over time, consumers should treat such attestations as valid as of attestedAt.
Copyright
Copyright and related rights waived via CC0.