Skip to main content

Module gitmark

Module gitmark 

Source
Expand description

Repo-held git-mark trails and the NIP-34 anchor tags they feed.

A repository can carry its own Blocktrails trail: the agent that owns the repo marks each commit with the git mark CLI, using the repo’s own key, and commits the resulting blocktrails.json (profile gitmark). The forge then holds no key and records nothing. It reads the file at the default branch tip, re-derives every mark’s taproot address from the base key and the commits, links each mark to its chain’s explorer, serves the committed document, and names the latest on-chain mark in its NIP-34 events.

This is the Rust counterpart of the JSS forge plugin’s repo-held trail path (repoTrail, gitmarkStateHash, anchorTags, blocktrailsResp) and didShort. JSS is cited by function name only; the implementation is original, built on solid_pod_rs::blocktrail and solid_pod_rs::mrc20.

§State bytes

A git-mark trail hashes each state as SHA-256(commit hash as text). The forge’s own marks hash a JSON record instead. Both use the same chained BIP-341 TapTweak walk, so the walk is solid_pod_rs::mrc20’s and only the state strings differ: here they are the commits, verbatim.

§Features

Reading, validating and tagging a trail needs nothing optional. Re-deriving the per-mark addresses needs the Bitcoin stack and so the anchoring feature; without it RepoMark::address and RepoMark::program are None.

Structs§

AnchorFacts
The facts a NIP-34 event needs to name a trail’s on-chain frontier.
RepoMark
One mark of a repo-held trail.
RepoTrail
A git-mark trail committed to a repository, read and re-derived.

Constants§

MAX_TRAIL_BYTES
Largest blocktrails.json the forge will read, in bytes. A trail gains one short line per mark, so this admits thousands of marks while bounding the work a hostile push can ask of a page render.
TRAIL_FILE
The trail document’s name at the repository root.

Functions§

anchor_tags
The NIP-34 anchor tags both repository events (kinds 30617 and 30618) carry once a repository is anchored, in emission order.
did_short
Shorten a did:nostr public key for display: did:nostr: plus the first eight characters and an ellipsis. The hex stays canonical in every path and identifier; this is for rendering only (JSS didShort).
explorer_tx_url
The explorer page for one transaction, or None when the chain has no public explorer or txid is not 64 lowercase-or-uppercase hex characters.
explorer_web
The explorer web base for a chain token, for links a person clicks.
network_for_chain
The network name solid_pod_rs::mrc20::bt_address takes for a chain token, or None for a chain whose address prefix the encoder does not know (regtest uses bcrt, which it does not emit).
parse_repo_trail
Parse a committed blocktrails.json as a repo-held git-mark trail.
read_repo_trail
Read the repo-held trail at the tip of branch in a bare repository, or None when the repository has no valid blocktrails.json there.