Skip to main content

Module rpc_response

Module rpc_response 

Source
Expand description

§RPC response packet encode / decode

The outbound-server and inbound-client halves of a response, symmetric to crate::protocol::rpc::rpc_request:

  • RpcResponsePacketTx — server side. encode picks a fresh random pow_content_hash_salt and signs hash(pow_content_hash_salt || pow_content_hash) with the server’s private key, embedding both the signature and the salt in the header. The signature binds the response to this specific request and this specific server identity, so clients can reject replays across servers or across requests. Payload is optionally compressed.

    The salt matters: pow_content_hash is chosen by the caller, and every other server-key signature in the protocol (peers, bundle headers, tokens) is a signature over a 32-byte blake3 digest. Signing the caller’s hash directly would turn every server into a signing oracle for arbitrary structures under its identity key.

  • RpcResponsePacketRx — client side. Parses the server-identity fields (verification key, PQ commitment, sponsor id, PoW timestamp, PoW hash, salt) from the header, re-derives the server id PoW to check it is sufficient, and verifies the signature against the request’s content hash — all statelessly, so no peer database is required to validate the response of a freshly-discovered server.

Structs§

RpcResponsePacketRx
The client-side view of an inbound RPC response, after header parsing, PoW checks, and signature verification.
RpcResponsePacketTx
The encoder for an outbound RPC response.
RpcResponsePacketTxFlags

Constants§

RPC_RESPONSE_PACKET_VERSION
Version 2 added pow_content_hash_salt after the signature (the signature covers hash(pow_content_hash_salt || pow_content_hash) instead of the raw pow_content_hash).