sigil-sdk · evidence
Source declarations, signatures and documentation for evidence.
Source: sigil/node/sigil-sdk/src/evidence.rs. SHA-256: 883a73943ae57bfa7f79d201349498b104f8c971e070540c8d1a6f1ac63eee47.
This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.
Module condition:
#[cfg(feature = "evidence")]evidence::EvidenceError
Fail-closed errors for the evidence anchoring client.
#[cfg(feature = "evidence")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize, thiserror::Error)]
pub enum EvidenceError {
/// The digest or payload failed validation before submission.
#[error("invalid anchor payload: {0}")]
InvalidPayload(String),
/// Network transport failure (connect, read, HTTP status).
#[error("transport error: {0}")]
Transport(String),
/// The node returned a JSON-RPC error.
#[error("rpc error {code}: {message}")]
Rpc {
/// JSON-RPC error code.
code: i64,
/// Server-provided message.
message: String,
},
/// The node returned a structurally unexpected response.
#[error("malformed response: {0}")]
MalformedResponse(String),
/// The transaction was included but execution failed.
#[error("anchor transaction failed on-chain: {0}")]
ExecutionFailed(String),
/// Inclusion was not observed within the confirmation budget.
#[error("confirmation timed out after {0:?}")]
ConfirmTimeout(Duration),
/// No anchor exists for the queried digest.
#[error("no evidence anchor found for digest {0}")]
NotFound(String),
}Source line: 39.
evidence::AnchorParams
Parameters for anchoring a digest on-chain.
#[cfg(feature = "evidence")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnchorParams {
/// Lowercase hex BLAKE3 digest (64 chars) of the artifact.
pub digest: String,
/// Classification label, e.g. `"one.harness-archive.v1"`.
pub label: String,
/// Optional content-addressed URI for retrieval.
pub uri: Option<String>,
/// Small JSON metadata object.
pub metadata: serde_json::Value,
/// Client nonce for deterministic anchor IDs / duplicate rejection.
pub client_nonce: String
}Source line: 86.
evidence::AnchorParams::from_digest_bytes
Create params for a raw 32-byte BLAKE3 digest.
#[cfg(feature = "evidence")]
pub fn from_digest_bytes(
digest: [u8; 32],
label: impl Into<String>,
client_nonce: impl Into<String>,
) -> Self;Source line: 101.
evidence::AnchorParams::with_uri
Attach a content URI.
#[cfg(feature = "evidence")]
pub fn with_uri(mut self, uri: impl Into<String>) -> Self;Source line: 116.
evidence::AnchorParams::with_metadata
Attach metadata.
#[cfg(feature = "evidence")]
pub fn with_metadata(mut self, metadata: serde_json::Value) -> Self;Source line: 122.
evidence::AnchorParams::anchor_id
The deterministic anchor ID for (chain, sender, digest, nonce).
#[cfg(feature = "evidence")]
pub fn anchor_id(&self, chain_id: &str, anchor_did: &str) -> Result<String, EvidenceError>;Source line: 128.
evidence::anchor_digest_tx
Build an unsigned EvidenceAnchor transaction from validated params.
Errors
Returns [EvidenceError::InvalidPayload] if the digest is not 64
lowercase hex chars, the label/nonce bounds are exceeded, or the metadata
exceeds the on-chain size cap.
#[cfg(feature = "evidence")]
pub fn anchor_digest_tx(
builder: TransactionBuilder,
params: &AnchorParams,
) -> Result<Transaction, EvidenceError>;Source line: 151.
evidence::digest_artifact
Compute the BLAKE3 digest of artifact bytes in the canonical lowercase
hex form expected by [AnchorParams].
#[cfg(feature = "evidence")]
pub fn digest_artifact(bytes: &[u8]) -> String;Source line: 163.
evidence::AnchorSubmission
Outcome of a successful anchor submission (pre-inclusion).
#[cfg(feature = "evidence")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnchorSubmission {
/// Hash of the submitted anchor transaction.
pub tx_hash: String,
/// Deterministic anchor ID the record will have once included.
pub anchor_id: String
}Source line: 169.
evidence::AnchorProof
A confirmed on-chain anchor — the verification artifact returned by
confirm_inclusion / verify_anchor.
#[cfg(feature = "evidence")]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct AnchorProof {
/// Deterministic anchor ID (`evidence:anchor:<hex>`).
pub anchor_id: String,
/// Anchored digest (lowercase hex BLAKE3).
pub digest: String,
/// Classification label.
pub label: String,
/// DID that anchored the digest.
pub anchor_did: String,
/// Hash of the anchor transaction.
pub tx_hash: String,
/// Block height at which the anchor executed.
pub block_height: u64
}Source line: 179.
evidence::ConfirmPolicy
Polling policy for inclusion confirmation.
#[cfg(feature = "evidence")]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct ConfirmPolicy {
/// Interval between `sigil_getTransaction` polls.
pub poll_interval: Duration,
/// Maximum total wait before [`EvidenceError::ConfirmTimeout`].
pub timeout: Duration
}Source line: 209.
evidence::EvidenceTransport
JSON-RPC transport used by [EvidenceAnchorClient].
Implementations must apply their own per-request timeout. Return
Ok(None) for a JSON-RPC null result.
#[cfg(feature = "evidence")]
#[async_trait]
pub trait EvidenceTransport: Send + Sync {
/// Issue a JSON-RPC 2.0 call and return the `result` field.
async fn rpc_call(
&self,
method: &str,
params: serde_json::Value,
) -> Result<Option<serde_json::Value>, EvidenceError>;
}Source line: 230.
evidence::EvidenceAnchorClient
Thin async client for the evidence anchoring path.
Generic over [EvidenceTransport] so tests can substitute a mock node;
the reqwest-backed transport lives in evidence_http behind the
evidence-http feature.
#[cfg(feature = "evidence")]
pub struct EvidenceAnchorClient<T: EvidenceTransport> {
}Source line: 244.
evidence::EvidenceAnchorClient<T>::new
Create a client for a chain and anchorer identity.
#[cfg(feature = "evidence")]
pub fn new(transport: T, chain_id: impl Into<String>, sender_did: impl Into<String>) -> Self;Source line: 252.
evidence::EvidenceAnchorClient<T>::chain_id
The chain this client anchors to.
#[cfg(feature = "evidence")]
pub fn chain_id(&self) -> &str;Source line: 261.
evidence::EvidenceAnchorClient<T>::sender_did
The DID this client anchors as.
#[cfg(feature = "evidence")]
pub fn sender_did(&self) -> &str;Source line: 266.
evidence::EvidenceAnchorClient<T>::submit_anchor
Submit a signed anchor transaction built with [anchor_digest_tx].
Returns the transaction hash and deterministic anchor ID. Inclusion
is not guaranteed yet — call [Self::confirm_inclusion].
#[cfg(feature = "evidence")]
pub async fn submit_anchor(
&self,
signed: &SignedTransaction,
params: &AnchorParams,
) -> Result<AnchorSubmission, EvidenceError>;Source line: 274.
evidence::EvidenceAnchorClient<T>::confirm_inclusion
Confirm that a submitted anchor transaction is included and executed
successfully. Polls sigil_getTransaction until the transaction
appears or the confirmation budget elapses.
#[cfg(feature = "evidence")]
pub async fn confirm_inclusion(
&self,
submission: &AnchorSubmission,
policy: ConfirmPolicy,
) -> Result<AnchorProof, EvidenceError>;Source line: 296.
evidence::EvidenceAnchorClient<T>::verify_anchor
Verify anchors for a digest by reading the on-chain evidence index
(sigil_listEvidenceAnchorsByDigest). Returns every anchor record
for the digest, oldest semantics preserved by anchor ID ordering.
#[cfg(feature = "evidence")]
pub async fn verify_anchor(&self, digest: &str) -> Result<Vec<AnchorProof>, EvidenceError>;Source line: 331.
evidence::EvidenceAnchorClient<T>::get_anchor
Fetch a single anchor by its deterministic anchor ID.
#[cfg(feature = "evidence")]
pub async fn get_anchor(&self, anchor_id: &str) -> Result<Option<AnchorProof>, EvidenceError>;Source line: 349.