mirror of
https://github.com/lux-apps/papers.git
synced 2026-10-30 18:15:21 +00:00
Restructured from flat .tex/.pdf files into per-paper subdirectories. Added Antje Worring as co-author on all papers. Synced PDFs to pdfs/ for download site.
34 lines
1.1 KiB
TeX
34 lines
1.1 KiB
TeX
\section{Implementation}
|
|
|
|
\label{sec:implementation}
|
|
|
|
\subsection{Precompile}
|
|
|
|
The precompile is implemented as a Go module at
|
|
\texttt{github.com/luxfi/precompile/anchor}, registered in the Lux
|
|
precompile registry. It implements
|
|
\texttt{contract.StatefulPrecompiledContract} with four ABI-dispatched
|
|
functions.
|
|
|
|
Storage keys use \texttt{keccak256(appID || height)} for root storage
|
|
and \texttt{keccak256(appID || 0xFF..FF)} for the latest-height slot.
|
|
The sentinel \texttt{0xFF..FF} avoids collision with any valid height
|
|
(uint64 max is $2^{64}-1$, which fits in 8 bytes and does not collide
|
|
with the 32-byte sentinel).
|
|
|
|
\subsection{Client SDK}
|
|
|
|
The client SDK at \texttt{github.com/hanzoai/base/crdt} provides:
|
|
|
|
\begin{lstlisting}
|
|
type Anchorer interface {
|
|
Submit(ctx context.Context, root [32]byte) error
|
|
Verify(ctx context.Context, height uint64, root [32]byte) (bool, error)
|
|
}
|
|
\end{lstlisting}
|
|
|
|
An \texttt{RPCAnchorer} implementation talks to the chain via JSON-RPC.
|
|
A background goroutine anchors on a configurable interval.
|
|
|
|
% ============================================================================
|