feat(depin-attest): T1 Solana DePIN attestation plugin with durable-nonce replay guard#107
Open
Emran-goat wants to merge 1 commit into
Open
feat(depin-attest): T1 Solana DePIN attestation plugin with durable-nonce replay guard#107Emran-goat wants to merge 1 commit into
Emran-goat wants to merge 1 commit into
Conversation
…once replay guard Adds depin-attest, a read-only T1 tool plugin that builds unsigned Solana versioned transactions committing a DePIN device attestation on-chain via a memo instruction with a durable-nonce advance as replay guard. Track C (DePIN & physical edge) submission for Superteam Brasil bounty. - Pure core (no wasm deps): hand-encoded Solana message v0, base58, borsh-free - Wasm shim: WIT tool-plugin world, WasmRpc over waki, structured logging - 29 host tests (13 lib + 16 integration), all mocked RPC, no live network - wasm32-wasip2 release build clean (363 KB component) - Custody T1: no signing, no secret keys, no private key in config - Fail-closed: replay guard, clock skew, memo overflow, missing config - Prompt-injection transcript in README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds depin-attest, a read-only T1 tool plugin that builds unsigned Solana versioned transactions committing a DePIN device attestation on-chain via a memo instruction with a durable-nonce advance as replay guard.
Track C (DePIN & the physical edge) — the bounty's stated favorite.
What it does
The agent calls
depin_attestwith a device identifier, a sensor reading (kind, value, timestamp, device signature), and a monotonic nonce counter. The plugin:nonce_counter <= last_committed_counter|now - ts| > 300s[advance-nonce, memo]instructionsKey design decisions
solana-sdk— hand-encoded Solana message v0 format, base58 constants, zero wasm frictioncore.rshas zero wasm deps, tests run with plaincargo testTest results
Tests cover: happy path, nonce replay, counter regression, clock skew (old/future/zero), RPC failure, missing config, memo overflow, prompt injection (2 cases), base64 decodability, cold-start guard.
Custody tier: T1 (Build)
Returns unsigned transaction. No signing, no secret keys. The human always signs. T0 is too limited for real DePIN flows; T2 carries unacceptable prompt-injection risk for a reference implementation.
Threat model (8 threats, each with named error variant)
AttestError::NonceReplay— strict advance requiredAttestError::TsSkew— 5min maxAttestError::MemoTooLarge— 1024 byte limitAttestError::RpcError— never panicsAttestError::MissingRpcUrl/NonceAccountPrompt-injection transcript
See README.md — two scenarios: (a) counter advances → tx built, summary reveals attack, human rejects; (b) counter already maxed →
NonceReplayrejected.Permissions
["http_client", "config_read"]— minimal. Only outbound HTTPS to Solana RPC and read access to own config section.What's next
cryptocapability ships)sensorWIT capability for real GPIO/I2C/SPI readsBuild
Superteam Earn submission: depin-attest (Track C, T1)
Building in public: updates on X during the bounty period