% Compile with: latexmk -pdf introspection-pqsb.tex % The bibliography is in references.bib. No figure files are required. \documentclass[11pt]{article} \usepackage[T1]{fontenc} \usepackage{lmodern} \usepackage[margin=1in]{geometry} \usepackage{amsmath,amssymb,amsthm,microtype} \usepackage{booktabs,array,enumitem,needspace,xurl,pgfplots} \usepgfplotslibrary{groupplots} \usetikzlibrary{arrows.meta,positioning,fit} \pgfplotsset{compat=1.18} \usepackage[colorlinks=true,linkcolor=blue,citecolor=blue,urlcolor=blue, pdftitle={Practical Quantum Safe Bitcoin}, pdfsubject={Introspection Signatures for Bitcoin Script}]{hyperref} \setlength{\emergencystretch}{3em} \setlist{itemsep=3pt,topsep=4pt,leftmargin=1.5em} \renewcommand{\arraystretch}{1.13} \newtheorem{theorem}{Theorem} \newtheorem{lemma}{Lemma} \newtheorem{proposition}{Proposition} \newtheorem{corollary}{Corollary} \newtheorem{claim}{Claim} \theoremstyle{definition} \newtheorem{definition}{Definition} \newtheorem{construction}{Construction} \theoremstyle{remark} \newtheorem{remark}{Remark} \newcommand{\F}{\mathbb F_q} \newcommand{\distq}{\operatorname{dist}_q} \newcommand{\Hcom}{H_{\mathrm{com}}} \newcommand{\Hmsg}{H_{\mathrm{msg}}} \newcommand{\KeyGen}{\mathsf{KeyGen}} \newcommand{\Sign}{\mathsf{Sign}} \newcommand{\Verify}{\mathsf{Verify}} \newcommand{\Len}{\operatorname{Len}} \newcommand{\xcoord}{\operatorname{xcoord}} \newcommand{\ECV}{\mathsf{ECV}} % One-time signature of Section 3 and the introspection signature built from it (primed). \newcommand{\bG}{\KeyGen} \newcommand{\bS}{\Sign} \newcommand{\bV}{\Verify} \newcommand{\nG}{\KeyGen'} \newcommand{\nS}{\Sign'} \newcommand{\nV}{\Verify'} % Malleable multi-time signature of Section 4 (subscript m) and its introspection signature. \newcommand{\mPi}{\Pi_{\mathsf{m}}} \newcommand{\mG}{\KeyGen_{\mathsf{m}}} \newcommand{\mS}{\Sign_{\mathsf{m}}} \newcommand{\mV}{\Verify_{\mathsf{m}}} \newcommand{\mnPi}{\Pi'_{\mathsf{m}}} \newcommand{\mnG}{\KeyGen'_{\mathsf{m}}} \newcommand{\mnS}{\Sign'_{\mathsf{m}}} \newcommand{\mnV}{\Verify'_{\mathsf{m}}} \newcommand{\pk}{\mathsf{pk}} \newcommand{\sk}{\mathsf{sk}} \newcommand{\pp}{\mathsf{pp}} \newcommand{\Puz}{\mathsf{Puzzle}} \newcommand{\PuzV}{\mathsf{Puzzle.Verify}} \newcommand{\PuzSetup}{\mathsf{Puzzle.Setup}} \newcommand{\Orc}{\mathcal{O}} \newcommand{\cA}{\mathcal{A}} \newcommand{\cB}{\mathcal{B}} \newcommand{\cC}{\mathcal{C}} \newcommand{\Adv}{\mathsf{Adv}} \newcommand{\AdvUF}{\Adv^{1\text{-}\mathsf{uf}}_{\cA}(Q)} \newcommand{\getsr}{\leftarrow_{\$}} \newcommand{\bit}{\{0,1\}} \newcommand{\Coll}{\mathsf{Coll}} \newcommand{\Hit}{\mathsf{Hit}} \newcommand{\Fresh}{\mathsf{F}} \newcommand{\E}{\mathbb{E}} \newcommand{\Adm}{\mathsf{Adm}} \newcommand{\lean}{\path} \newcommand{\op}[1]{\texttt{#1}} \title{Practical Quantum Safe Bitcoin\\[6pt] \large Introspection Signatures: Hash-Based One-Time Signatures for Bitcoin Script} \author{Espresso Systems} \date{December 2026} \begin{document} \maketitle \begin{abstract} We present the first truly practical construction for quantum-safe Bitcoin transactions that works today without protocol changes. It signs transactions to spend BTC in under 20 seconds on average on an ordinary Apple M3 laptop and a bit over 2 seconds on an NVIDIA RTX 5090, while achieving 124-bit classical forgery security. We also give a SegWit-compatible construction. Its transactions can be broadcast through the regular Bitcoin network and included in blocks without special arrangements with miners. Like all of our constructions it has about 150-bit security for unspent coins. It can be parameterized at various security levels for an in-flight attack. At 91-bit classical forgery security a transaction can be signed in half an hour on an RTX 5090. At 80 bits it signs in about a second, or in about a minute on a laptop. We conservatively estimate the cost and runtime of a forgery, assuming an attacker with forging power equivalent to the entire Bitcoin mining network: at 91 bits an expected forgery costs over 30,000 BTC and requires holding a transaction in the mempool for over 10,000 blocks; at 124 bits the cost exceeds all bitcoin that can ever be issued many times over. We validated our constructions by submitting transactions to the Bitcoin mainnet. The constructions are instances of one framework, the \emph{introspection signature}: a signature on a message $M$ built from a one-time signature scheme and a puzzle predicate that is the verifier's only access to $M$, as in Bitcoin Script. Substantial portions of the security analysis are machine-checked in Lean; Appendix~\ref{sec:status} gives the details. \end{abstract} \section{Introduction}\label{sec:intro} Bitcoin authorizes spending with elliptic-curve signatures, whose security rests on the hardness of discrete logarithms. Hash-based one-time signatures avoid that assumption, but Bitcoin Script cannot verify one directly. A script never sees the transaction that it authorizes, so it cannot hash the transaction and compare the digest with revealed secrets. Giving Script that ability would require a protocol change. Binohash~\cite{binohash} and QSB~\cite{Levy2026QSB} showed that existing Script instructions suffice. ECDSA verification does read a digest of the transaction, and a script can make acceptance depend on a relation between that digest and data it has authenticated. The relation holds only rarely, so the signer must search for a signature, much like proof of work, and signing time has high variance. PQB~\cite{pqb} reduces QSB's signing cost and script size. Both remain expensive to sign with, and both require nonstandard legacy Script. \paragraph{Contributions.} \emph{A framework.} We abstract the idea as an \emph{introspection signature} (Section~\ref{sec:simple}). A signer holds $k$ one-time keys, one per \emph{slot}. For each key it signs fresh strings until one of the resulting base signatures, together with the message and a nonce, solves a puzzle. The $k$ puzzle-solving base signatures are the signature. If a slot runs out of attempts, the signer starts again with a new nonce. Signing costs about $k/p$ puzzle evaluations and forging about $p^{-k}$, where $p$ is the probability that one input passes the puzzle. Theorem~\ref{thm:main} proves the forgery bound for one nonce and is machine-checked; Corollary~\ref{cor:retry} extends it to the retrying signer. Section~\ref{sec:adapt} states the two changes that Script forces on the construction: the puzzle becomes a predicate with separate success probabilities for signer and forger, and the base scheme becomes a \emph{malleable multi-time} signature, in which one key signs the selections of all slots and a released signature has a bounded number of variants. Theorem~\ref{thm:script} bounds forgeries against the resulting schemes. QSB and PQB are instances. \emph{A new puzzle.} The distance predicate (Section~\ref{sec:distance}) asks that a committed secret scalar lie close to a number derived from two digests of the transaction. The signer tests one challenge against all of its scalars with a sorted lookup and no curve operations, while a forger can test only the scalars that have been disclosed. The hardness is tunable in factors of 256. Lemma~\ref{lem:relaxed} bounds the acceptance probability of the relation that Script actually checks, without any assumption on discrete logarithms. \emph{Two constructions.} PQSB-legacy (Section~\ref{sec:subset}) depends on legacy Bitcoin Script, and PQSB-segwit (Section~\ref{sec:pqsb-segwit}) supports SegWit~v0. They give three improvements: \begin{enumerate}[label=(\alph*),itemsep=2pt,topsep=3pt] \item \textbf{Faster signing.} At an approximately 124-bit classical forgery target, PQSB-legacy requires about $2^{28.7}$ expected signing trials. Measured signing time averaged 2.36 seconds over thirty runs on one RTX 5090 and 17.1 seconds over five runs on an Apple M3 laptop. Relative to the 3,100 GPU-hours reported for QSB's original mainnet demonstration at approximately 118-bit classical security~\cite{qsb-mainnet} and PQB's expected 8 RTX 4090-hours at 128-bit classical security~\cite{pqb}, signing on the laptop is about $650{,}000\times$ and $1{,}700\times$ faster, respectively. \item \textbf{A tradeoff between signing time and forgery resistance.} Raising PQSB-legacy's forgery target to approximately 132 bits requires about $2^{35.2}$ signing trials. Three signing runs on the RTX 5090 took 10.9, 16.7, and 27.6 seconds. \item \textbf{SegWit compatibility.} PQSB-segwit supports SegWit v0 and fits standard P2WSH relay constraints, whereas QSB and PQB require nonstandard legacy Script. A lock with pins at a 91-bit classical forgery target (Section~\ref{sec:segwit-inst}) was funded and spent on Bitcoin mainnet after about 30 minutes of solver search on one RTX 5090. A second lock was spent on mainnet at 88 bits after 147 seconds, and at an 80-bit target five signing runs averaged 0.30 seconds. \end{enumerate} Table~\ref{tab:comparison} gives the concrete parameters and Script costs. Section~\ref{sec:timing} reports the measurement details, including the laptop results~\cite{pqsb-benchmarks}. The time and cost estimates in Appendix~\ref{app:performance} use measured trial rates. Timings exclude final signature assembly, and computation costs are separate from Bitcoin transaction fees. A classical security level of about 90 bits may be enough for some Bitcoin uses. This level applies only while a spend is in flight: until the owner spends, no opening is public, and unspent coins have about 150-bit security. The forger's search is closely related to mining, so an attacker that can forge could also mine, and the mining reward that it gives up measures the cost of a forgery. At current rewards an expected forgery at 91 bits is worth about 33,000 BTC, so attacking an address that holds less does not pay, and larger amounts can be split across addresses. At 124 bits the same estimate exceeds all bitcoin that can ever be issued many times over. Section~\ref{sec:interpretation} gives these arguments and discusses quantum attacks. We have not formally established when a security level is sufficient for Bitcoin. That needs further study. \paragraph{Organization.} Section~\ref{sec:background} recalls one-time signatures and what Bitcoin Script can check. In Section~\ref{sec:simple} we first present a simple general framework, the introspection signature. It combines a one-time signature with a puzzle that ties each signature to the message, so that signing costs about $k/p$ puzzle evaluations and forging about $p^{-k}$, and we prove its security (Theorem~\ref{thm:main}). Section~\ref{sec:adapt} shows which modifications are needed to make this work in Script. The puzzle becomes a predicate that Script can verify, with different success probabilities for signer and forger, the base scheme becomes a malleable multi-time signature, and the nonce takes on a larger role. Theorem~\ref{thm:script} gives the resulting security bound, and QSB and PQB are instances. Section~\ref{sec:predicates} presents the puzzles. After recalling the hash-to-signature puzzle of QSB and PQB, it introduces our new distance puzzle, which is at the core of PQSB. Sections~\ref{sec:pqsb-segwit} and~\ref{sec:subset} present PQSB-segwit and PQSB-legacy, respectively. PQSB-segwit runs in standard SegWit Script, and its pins limit what a forger can do with a released signature. PQSB-legacy uses legacy Script to give each slot fresh attempts and reaches 124 bits. Section~\ref{sec:comparison} reports parameters, measurements and fees, and estimates the cost of a forgery through mining rewards. The appendices contain the remaining proofs, the Script layouts and the cost projections, and Appendix~\ref{sec:status} lists what is machine-checked and what is not. \subsection{Notation}\label{sec:notation} \begin{center} \begin{tabular}{@{}l>{\raggedright\arraybackslash}p{0.64\textwidth}@{}} \toprule Symbol & Meaning\\ \midrule $\lambda$ & security parameter\\ $k$ & number of slots\\ $M$; $\rho$, $\eta$ & message; message nonce and its length in bits\\ $u$ & message of a round in Section~\ref{sec:simple}; the signer uses $u=(M,\rho)$\\ $\Pi=(\bG,\bS,\bV)$ & one-time signature scheme of Section~\ref{sec:simple}, with a key pair $(\pk_i,\sk_i)$ per slot\\ $\mu$; $\Gamma$ & number of variants of a base signature; loss of the search simulator\\ $\Pi'=(\nG,\nS,\nV)$ & the introspection signature built from $\Pi$, with keys $(\pk',\sk')$\\ $\mPi$, $\mnPi$ & the malleable multi-time signature of Section~\ref{sec:adapt}, with one key for all slots, and the introspection signature built from it; their algorithms carry the subscript $\mathsf m$\\ $n_i$ & selection: what the base scheme signs in slot $i$. A $\nu$-bit string in Section~\ref{sec:simple}; in the constructions a subset $S$ of committed entries, an index $j$, or a pair $(S,X)$\\ $\sigma_i$; $\varsigma$ & base signature of slot $i$; full signature\\ $P$, $P_i$; $p$ & puzzle predicate; probability that one input passes it\\ $z_i=H_i(M,\rho)$; $w$ & challenge of slot $i$ and its oracle $H_i$; witness of a predicate\\ $m$, $m_i$ & attempts available in a slot\\ $\alpha_i$ & bound on the forger's success in slot $i$ for one message\\ $\beta$ & forgery target in bits, $\beta=-\log_2\prod_i\alpha_i$\\ $\theta_{0,i}$, $\theta_i$ & signer's success in slot $i$ for one challenge, and for one nonce\\ $\theta=\prod_i\theta_i$ & probability that one round (one nonce) succeeds\\ $Q$ & number of random-oracle queries\\ $Q_{\mathrm{nonce}}$ & expected number of nonces that the signer tries, $1/\theta$\\ $E$, $b$, $\chi$ & number of commitments; hash bits; min-entropy of a secret\\ $N$, $h$, $c$; $K$, $t_i$ & list size, number of positions and number of pins; auxiliary list size and subset sizes\\ $W$, $f$ & ways to fill the positions; fraction with at most $\mu$ arrangements\\ $q$, $G$, $\kappa$ & order and generator of secp256k1; the constant $\kappa=2^{-1}\bmod q$\\ $\distq(a,b)$ & distance of $a$ and $b$ modulo $q$ (Section~\ref{sec:distance-one})\\ $\Sigma$, $T$; $A$, $B$ & encoded ECDSA signatures; public keys supplied in the witness\\ $L$, $D$ & distance threshold; byte limit, or exact length $D_\ell$, of the short signature $T$\\ $p_D$, $\Delta_D$ & distance-test probability at limit $D$; correction of Lemma~\ref{lem:relaxed}\\ $a_\ell$ & signer's probability at exact length $D_\ell$: $a_\ell=p_{D_\ell}-p_{D_\ell-1}$\\ \bottomrule \end{tabular} \end{center} The word \emph{nonce} always means the message nonce $\rho$, and $\ell$ indexes positions. \section{Background}\label{sec:background} \subsection{One-time signatures}\label{sec:ots} A Lamport- or HORS-style one-time signature (OTS) reveals a subset of committed secrets determined by the message. In the Lamport construction, let $\Hcom$ and $\Hmsg$ be hash functions. Choose two random secrets $s_{j,0},s_{j,1}$ for each bit index $j$ of the message digest and publish the commitments $C_{j,b}=\Hcom(s_{j,b})$ for $b\in\{0,1\}$. These commitments are the public key. To sign $M$, compute the digest bits $(b_j)_j=\Hmsg(M)$ and reveal the corresponding secrets $\sigma=(s_{j,b_j})_j$. The verifier recomputes the digest and checks $\Hcom(\sigma_j)=C_{j,b_j}$ for every $j$. A different digest changes at least one bit and requires an unrevealed secret. A forger must therefore invert $\Hcom$ on an unopened commitment or find a second message with the same digest. No number-theoretic assumption is involved. One-way functions are the minimal assumption for signatures~\cite{STOC:Rompel90}, and they are believed to resist quantum computers, unlike the hardness of elliptic-curve discrete logarithms. HORS~\cite{ACISP:ReyRey02} generalizes this pattern: the digest selects $h$ of $N$ committed secrets to reveal. Our constructions use this $h$-of-$N$ form, with one difference that the rest of this section explains: the signer, and not the digest, chooses which entries to open. \subsection{What Script can check}\label{sec:script} Let $M$ be the message being signed: a transaction spending BTC, apart from a nonce $\rho$ that the signer adds. The spending transaction consists of $M$ and $\rho$, and we write it $(M,\rho)$; $M$ alone does not include the nonce. The coins' locking conditions commit to the OTS public key, and the spending transaction supplies the signature. Script can hash a supplied opening and compare it with a commitment. The difficulty is connecting the choice of commitments to the actual spending transaction. Unlike an abstract verification algorithm, Script does not receive the transaction $(M,\rho)$ as a byte string that its hash instructions can process. Its ECDSA instruction, \op{CHECKSIG}, takes a signature and public key, computes the digest according to Bitcoin's transaction-signature hash rules, and returns whether the signature is valid. It does not put that digest on the Script stack for later use~\cite{core}. A script therefore cannot compute $\Hmsg(M)$ and use its bits to select the commitments. Figure~\ref{fig:introspection} illustrates this lack of introspection. Supplying a claimed digest alongside the openings does not help: without a check that it equals $\Hmsg(M)$, an attacker could reuse it and the openings in a different spending transaction. \begin{figure}[!ht] \centering \begin{tikzpicture}[ >={Stealth[length=2.2mm]}, box/.style={draw,rounded corners=2pt,align=center,inner sep=5pt, minimum height=1.3cm,minimum width=5cm,font=\small}, lbl/.style={font=\footnotesize,align=center}] \node[box] (tx) at (0,0) {\textbf{Spending transaction $(M,\rho)$}\\inputs, outputs, \ldots}; \node[box] (wit) at (0,-3.4) {\textbf{Witness data}\\signatures, public keys,\\openings, claimed values}; \node[box] (cs) at (10,0) {\texttt{CHECKSIG}\\computes the digest of $(M,\rho)$\\internally}; \node[box] (st) at (10,-3.4) {\textbf{Stack}\\hash and comparison\\instructions}; \node[draw,dashed,rounded corners=4pt,inner sep=9pt,fit=(cs)(st), label={[font=\small\bfseries]above:Script execution}] (script) {}; \draw[->,thick] (wit) -- node[lbl,below] {pushed as Script input} (st); \draw[->,thick,dashed] (tx) -- node[lbl,above] {signature hash only} (cs); \draw[->,thick] ([xshift=-4mm]st.north) -- node[lbl,left] {signature,\\public key} ([xshift=-4mm]cs.south); \draw[->,thick] ([xshift=4mm]cs.south) -- node[lbl,right] {valid /\\invalid} ([xshift=4mm]st.north); \draw[->,thick,red!75!black] (tx.south east) -- node[pos=0.5,font=\LARGE] {$\boldsymbol{\times}$} node[lbl,pos=0.5,below left=4pt and 2pt,text=red!75!black] {$(M,\rho)$ is not a Script input} (st.north west); \end{tikzpicture} \caption{Lack of introspection in Bitcoin Script. The witness data is pushed onto the stack, where Script can hash and compare it. The spending transaction $(M,\rho)$ is not: it enters only through the signature hash that \texttt{CHECKSIG} computes internally, and \texttt{CHECKSIG} returns only whether the supplied signature is valid. Neither $(M,\rho)$ nor its digest ever appears on the stack.} \label{fig:introspection} \end{figure} \paragraph{The handle: signature hashes.} The digest that \op{CHECKSIG} computes depends on three things: \begin{itemize}[nosep] \item the transaction $(M,\rho)$, whose 32-byte nonce $\rho$ our constructions carry in a zero-value \op{OP\_RETURN} output; \item the script context, that is, the part of the script that is hashed together with the transaction, which \op{OP\_CODESEPARATOR} changes, and the hash-type byte of the signature being checked; \item in legacy Script only, the signature pushes that \op{FindAndDelete} removes from the script copy before hashing. \end{itemize} A script can therefore check an ECDSA relation between one or more such digests and data that it has authenticated against its commitments. Two facts matter later. Different contexts give different digests of the same transaction, which we model as independent random oracles. And a digest is a function of the transaction, the script and \emph{which} pushes are deleted: no secret opening is hashed into it. \paragraph{Reversing the one-time signature.} Following Binohash~\cite{binohash} and QSB~\cite{Levy2026QSB}, we keep the commitments to secrets but reverse the direction of the OTS rule. The digest can no longer select which secrets to open. Instead, the signer chooses a subset to open, and Script checks, through ECDSA verification, a relation that ties this subset to the digest of the spending transaction. The relation holds only for a small fraction of subsets and digests, so the signer must search. After disclosure, an attacker knows only the opened secrets and must make this one subset satisfy the relation for a different message, which succeeds far less often per attempt. ECDSA supplies only the algebraic checks. Security does not assume that ECDSA signatures are hard to forge. The next section abstracts this idea. \section{Introspection signatures}\label{sec:simple} Let $\Pi=(\bG,\bS,\bV)$ be a one-time signature scheme that is strongly unforgeable, and let $\Puz$ be a puzzle in which a fresh input passes with probability $p$, independently of all other inputs. Its \emph{hardness} is $1/p$. We want a signature scheme for a setting in which the verifier can check base signatures on short strings that it is handed, but can reach the actual message only through the puzzle predicate, as is the case in Bitcoin Script. We call such a scheme an \emph{introspection signature}. Our introspection signature scheme $\Pi'=(\nG,\nS,\nV)$ has $k$ slots, each with its own base key pair $(\pk_i,\sk_i)$. To sign $M$, the signer first picks a random nonce $\rho$. For each slot $i=1,\dots,k$ it then repeatedly picks a random string $n_i$ and computes $\sigma_i\gets\bS(\sk_i,n_i)$ until $P\bigl((M,\rho),\sigma_i\bigr)=1$. We call $n_i$ a \emph{selection}, because in the constructions of Sections~\ref{sec:pqsb-segwit} and~\ref{sec:subset} it selects the committed entries that are opened; here it is just a random string. A slot gets at most $m$ attempts. If any slot exhausts its budget, the signer discards everything and starts again with a fresh nonce. We call one pass over the $k$ slots a \emph{round}. The signature on $M$ is $\bigl(\rho,(n_1,\sigma_1),\dots,(n_k,\sigma_k)\bigr)$. The verifier checks the $k$ base signatures on the selections, each under its own key, and the $k$ puzzles. The puzzle takes only the message, the nonce and a base signature as input. \paragraph{Summary.} \begin{itemize}[leftmargin=1.5em] \item \emph{Cost.} A round takes at most $km$ base signatures and puzzle evaluations, and about $k/p$ in expectation. Verification takes $k$ of each. The public key contains $k$ base public keys. \item \emph{Correctness.} Every returned signature verifies. A round succeeds with a probability $\theta$ that tends to $1$ as the cap $m$ grows, and signing takes $1/\theta$ rounds in expectation. \item \emph{Security of one round (Theorem~\ref{thm:main}).} A one-time chosen-message forger making $Q$ puzzle queries, against a signer that runs a single round, succeeds with probability at most \[ (Q+1)\,p^{k} +\frac{k^2}{p}\,\Adv^{1\text{-}\mathsf{suf}}_{\Pi}(\cB^*) +\frac{k}{p\,2^{\nu}} , \] where $\cB^*$ is a one-time strong unforgeability adversary against $\Pi$ and $\nu$ is the length of a selection. \item \emph{Security with retries (Corollary~\ref{cor:retry}).} Against the full signer the bound is the one above divided by $\theta$, plus a term $\varepsilon_\rho(Q)$ of order $Q/2^{\eta}$ for the $\eta$-bit nonce. \item \emph{Assumption on $\Pi$.} Each base key releases at most one signature, so one-time strong unforgeability suffices. \item \emph{Parameters.} For a puzzle term of at most $(Q+1)2^{-\lambda}$ take $k=\lceil \lambda/\log_2(1/p)\rceil$, so that $p^{k}\le2^{-\lambda}$. \end{itemize} \subsection{Preliminaries}\label{sec:prelim} We write $x\getsr X$ for uniform sampling from a finite set $X$ and $[k]=\{1,\dots,k\}$. The security parameter is $\lambda$. \paragraph{Base signature scheme.} $\Pi=(\bG,\bS,\bV)$ is a signature scheme whose message space contains $\bit^\nu$, where $\nu$ is the length of a selection. We assume that $\Pi$ is perfectly correct, that verification is deterministic, and that $\bS$ is stateless and uses fresh independent coins on each invocation. The base algorithms are independent of the puzzle oracle. \begin{definition}[One-time strong unforgeability]\label{def:suf} In the game $1\text{-}\mathsf{sUF}_\Pi(\cB)$, a key pair $(\pk,\sk)\gets\bG(1^\lambda)$ is generated and $\cB(\pk)$ may make at most one query $n$ to $\bS(\sk,\cdot)$, receiving $\sigma$. $\cB$ outputs $(n^*,\sigma^*)$ and wins if $\bV(\pk,n^*,\sigma^*)=1$ and $(n^*,\sigma^*)\ne(n,\sigma)$; if $\cB$ made no query, every valid pair wins. We write $\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cB)$ for the probability that $\cB$ wins. \end{definition} Note that the definition restricts only the signatures that the adversary \emph{sees}. An honest signer may compute many signatures under one key as long as at most one ever leaves it. \begin{definition}[Puzzle oracle]\label{def:puzzle} Fix a probability $p$ such that $1/p\ge2$ is an integer. The \emph{puzzle oracle} is a random function $\Orc:\bit^*\to\bit$ whose outputs are independent with $\Pr[\Orc(x)=1]=p$ for every $x$. $\PuzSetup(1^\lambda,p)$ outputs public parameters $\pp$ (the probability $p$ and a public domain separator), and \[ \PuzV(\pp,u,\sigma)\;:=\;\Orc(\pp,u,\sigma). \] The oracle interface is classical, tuples are encoded injectively, and the domain separator is sampled independently of the oracle. Since $\pp$ is fixed and public we drop it from the notation. We write $P(u,\sigma)$ for $\PuzV(\pp,u,\sigma)$, and $1$ for $\mathsf{true}$. \end{definition} When $1/p$ is a power of two, one can take $\Orc(x)=1$ iff the first $\log_2(1/p)$ bits of $H(x)$ are zero, for a hash function $H$ modeled as a random oracle. The idealization captures the two requirements on the puzzle: every input passes with the same a priori probability $p$, and finding a passing input takes $1/p$ evaluations in expectation. \begin{definition}[One-time unforgeability]\label{def:euf} Let $(\nG,\nS,\nV)$ be a signature scheme whose signing algorithm may return $\bot$. In the one-time unforgeability game, a key pair $(\pk',\sk')\gets\nG(1^\lambda)$ is generated and $\cA^{\Orc}(\pk')$ may make one query $M$ to $\nS(\sk',\cdot)$. $\cA$ outputs $(M^*,\varsigma^*)$ and wins if $\nV(\pk',M^*,\varsigma^*)=1$ and $M^*$ was never submitted for signing. A signing request consumes the one query even when it returns $\bot$. The adversary sees the reply and may continue after failure. For an adversary $\cA$ that makes at most $Q$ queries to $\Orc$, we write $\AdvUF$ for the probability that $\cA$ wins. \end{definition} \subsection{The construction}\label{sec:construction} \begin{construction}[Introspection signature]\label{con:main} Let $\Pi=(\bG,\bS,\bV)$ be a signature scheme, $\Puz$ a puzzle with pass probability $p$, $k\ge 1$ the number of slots, $\nu$ the length of a selection, $m\ge1$ the integer attempt cap per slot, and $\eta$ the length of the nonce. The introspection signature scheme $\Pi'=(\nG,\nS,\nV)$ is defined as follows. \begin{description}[leftmargin=1.5em] \item[$\nG(1^\lambda)$:] Run $(\pk_i,\sk_i)\gets\bG(1^\lambda)$ independently for $i=1,\dots,k$, and $\pp\gets\PuzSetup(1^\lambda,p)$. Output $\pk'=(\pk_1,\dots,\pk_k,\pp)$ and $\sk'=(\sk_1,\dots,\sk_k,\pp)$. \item[$\mathsf{Round}(\sk',u)$:] For $i=1,\dots,k$: \begin{enumerate}[label=(\alph*),nosep] \item sample $n_i\getsr\bit^\nu$ and compute $\sigma_i\gets\bS(\sk_i,n_i)$; \item if $P(u,\sigma_i)=1$, retain the pair and proceed to the next slot. Otherwise discard it. If this was attempt $m$ in the slot, return $\bot$ and release no pairs. Otherwise go back to (a). \end{enumerate} Output $\bigl((n_1,\sigma_1),\dots,(n_k,\sigma_k)\bigr)$. Discarded pairs are erased and never released. \item[$\nS(\sk',M)$:] Sample $\rho\getsr\bit^\eta$ and run $\mathsf{Round}\bigl(\sk',(M,\rho)\bigr)$. If it returns $\bot$, repeat with a fresh nonce. Output $\varsigma=\bigl(\rho,(n_1,\sigma_1),\dots,(n_k,\sigma_k)\bigr)$. \item[$\nV(\pk',M,\varsigma)$:] Parse $\varsigma=\bigl(\rho,(n_1,\sigma_1),\dots,(n_k,\sigma_k)\bigr)$. Accept iff for every $i\in[k]$ \[ \bV(\pk_i,n_i,\sigma_i)=1 \qquad\text{and}\qquad P\bigl((M,\rho),\sigma_i\bigr)=1 . \] \end{description} The key pair is used for at most one signing request. Only the final reply is visible to the caller. The nonce is not part of the message: a signature on $M$ with a different nonce is not a forgery. \end{construction} The base scheme signs only the selection $n_i$. The message enters only through the puzzle. Slot $i$ is tied to its base signature by the key $\pk_i$; the puzzle input does not contain the slot index. We also regard $\mathsf{Round}$ as a signing algorithm in its own right, for messages $u$, verified by the two checks above with $u$ in place of $(M,\rho)$. We call $(\nG,\mathsf{Round},\nV)$ the \emph{single-round scheme}. It may return $\bot$. \paragraph{Correctness.} Every returned signature verifies by perfect correctness of $\Pi$ and the signer's puzzle checks. A round can fail. Presample $m$ attempts for each slot, including those the signer would skip, and let $U_{i}$ count the distinct signature strings among the $m$ attempts for slot $i$. Conditional on those attempts, all puzzle checks of the slot fail with probability $(1-p)^{U_{i}}$ on a message that has not been queried. A union bound gives \[ \Pr[\mathsf{Round}(\sk',u)=\bot]\le \sum_{i=1}^{k} \E\!\left[(1-p)^{U_{i}}\right]. \] If the $m$ inputs within each slot are guaranteed distinct, this is at most $k(1-p)^m\le k e^{-pm}$, so $m\ge\ln(2k)/p$ makes a round succeed with probability at least $1/2$. The construction samples selections with replacement, so a finite selection space alone gives no such guarantee. The security statements hold for every $m$. \paragraph{Cost.} A round uses at most $km$ calls each to $\bS$ and $P$. If the $m$ puzzle inputs within each slot are distinct, the expected number of calls to each is at most $k\sum_{j=0}^{m-1}(1-p)^j=(k/p)\bigl(1-(1-p)^m\bigr)$, since each slot stops at its first success and later slots may be skipped. If a round succeeds with probability $\theta$, signing takes $1/\theta$ rounds in expectation. A signature consists of the nonce, $k$ selections and $k$ base signatures. Verification takes $k$ evaluations each of $\bV$ and $P$. \begin{remark}[Where the signer's advantage comes from]\label{rem:advantage} A new base signature gives a new puzzle instance in its own slot and leaves the other slots as they are, so the signer solves the $k$ slots one after another. The forger holds one base signature per slot. The only thing it can vary is the message, and a new message changes all $k$ puzzle instances at once. This is the whole asymmetry: about $k/p$ evaluations to sign and about $p^{-k}$ to forge. \end{remark} \subsection{Security of one round} \begin{theorem}\label{thm:main} Let $\Pi$ satisfy the base-scheme assumptions of Section~\ref{sec:prelim}, and let the puzzle be modeled as in Definition~\ref{def:puzzle}. For every adversary $\cA$ against the one-time unforgeability of the single-round scheme $(\nG,\mathsf{Round},\nV)$ of Construction~\ref{con:main} that makes at most $Q$ queries to $\Orc$ there is an adversary $\cB^*$ against the one-time strong unforgeability of $\Pi$ such that \[ \AdvUF\;\le\; (Q+1)\,p^{k} +\frac{k^2}{p}\,\Adv^{1\text{-}\mathsf{suf}}_{\Pi}(\cB^*) +\frac{k}{p\,2^{\nu}}. \] $\cB^*$ makes at most one signing query. In addition to running $\cA$ and simulating its puzzle oracle, it uses at most $k$ local calls each to $\bG$ and $\bS$, and at most $Qm+1$ calls to $\bV$ ($Q/p+1$ in expectation). \end{theorem} The first term bounds the probability of finding another message that passes all $k$ released puzzles. In this theorem the adversary chooses the whole message $u$ that the round signs, and the signing request may return $\bot$. The theorem is machine-checked (Appendix~\ref{sec:status}). The proof below is condensed into four claims. A reduction to the one-time security of $\Pi$ obtains only one base signature per key and cannot compute the discarded ones, which is why the simulated game programs the puzzle oracle on the released signatures. \begin{proof} In the simulated game, independently give each slot up to $m$ Bernoulli($p$) coins, stopping at the first $1$ or at the cap. Associate an independent uniform selection and its base signature to each retained coin. Call the attempt carrying a $1$ \emph{marked}, if there is one. The tapes are independent of the puzzle table and the adversary's private coins. If any slot is unmarked, the signing query returns $\bot$ and writes nothing. Otherwise the simulator sets $\Orc(u,\sigma_i):=1$ for the marked signatures and releases all marked pairs together. The adversary makes at most $Q$ puzzle queries. Verification of its final output is performed by the game. \begin{itemize}[leftmargin=1.5em,nosep] \item $\Coll$: a marked signature equals the signature of another attempt on the stopped tapes, in its own slot or another slot. \item $\Hit$: a puzzle query with second component $\sigma'$ has $\bV(\pk_i,n,\sigma')=1$ for some tape selection $n$ in slot $i$, and the pair $(n,\sigma')$ has not been released in that slot at query time. \item $\Fresh$: an output pair is valid for its slot and was never released in that slot. If the signer returned $\bot$ or no signing query occurred, every valid output pair is fresh. \end{itemize} \begin{claim}\label{cl:hop} The real winning probability is at most the simulated probability of winning outside $\Coll\vee\Hit$, plus $\Pr[\Coll\vee\Hit]$ in the simulated game. \end{claim} Couple the real signer to the tapes by using the attempt's coin whenever its puzzle point is new. A point previously queried by $\cA$ gives $\Hit$. Repeated attempts have matching zero coins unless one is marked, in which case $\Coll$ holds. Thus the games agree on the signing reply, including $\bot$, until a bad event. Subsequent queries to hidden signer-written points give $\Hit$. Final verification on a fresh message uses a row that the signer never wrote. \begin{claim}\label{cl:coll} There are adversaries $\cC$ and $\cC'$ with \[ \Pr[\Coll]\le k\Bigl(\frac1p-1\Bigr) \bigl(\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cC)+2^{-\nu}\bigr) +\frac{k(k-1)}{p}\,\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cC'). \] \end{claim} The expected number of attempts preceding a mark, counted as zero when there is no mark, is at most $1/p-1$. The coins select the mark independently of the selections and signing randomness, so a collision within a slot has probability at most $k(1/p-1)\gamma$, where $\gamma$ is the probability that $\bS(\sk,n)=\bS(\sk,n')$ for independent uniform selections $n,n'$. Let $\cC$ query its signing oracle on $n$ and output $(n',\sigma)$. If an independent signing on $n'$ would return the same $\sigma$, correctness makes $\sigma$ valid for $n'$, so $\cC$ wins unless $n=n'$. Hence $\gamma\le\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cC)+2^{-\nu}$. For two different slots $i,j$, compare the mark of $i$, if present, with all attempts of $j$. There are at most $1/p$ such comparisons in expectation per ordered pair, so a collision across slots has probability at most $k(k-1)\gamma'/p$, where $\gamma'$ is the probability that $\bS(\sk,n)=\bS(\widetilde{\sk},n')$ for independent key pairs and independent uniform selections. Let $\cC'$ generate a key pair $(\widetilde{\pk},\widetilde{\sk})$ of its own and output $(n,\bS(\widetilde{\sk},n'))$ without a signing query. If $\bS(\sk,n)$ would have returned the same signature, the output is valid, so $\gamma'\le\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cC')$. \begin{claim}\label{cl:red} There is an adversary $\cB$ with $\Pr[\Hit\vee\Fresh]\le k\cdot\Adv^{1\text{-}\mathsf{suf}}_\Pi(\cB)$ in the simulated game. \end{claim} $\cB$ embeds its challenge key in a uniform slot $i^*$, samples the stopped coins for each slot, and presamples the list $\mathcal N$ of selections for slot $i^*$. It keeps a register $\mathcal R$, initially empty. On any puzzle query with second component $\sigma'$, it checks each $n\in\mathcal N$. If $\bV(\pk_{i^*},n,\sigma')=1$ and $(n,\sigma')\notin\mathcal R$, it outputs $(n,\sigma')$ and halts. In particular a hit before signing wins with zero signing queries, even if the same pair would later be released. If any slot is unmarked, $\cB$ returns $\bot$ and keeps $\mathcal R$ empty. Only on a successful simulated signing request does it use its one signing query, on the marked selection, record the returned pair in $\mathcal R$, and release the vector. At final output it also checks the candidate for its slot against $\mathcal R$. In an uninterrupted simulated run the uniform index is independent of the full transcript and tapes. If any slot witnesses $\Hit$ or $\Fresh$, $\cB$ therefore wins with probability at least $1/k$ over its choice of slot. \begin{claim}\label{cl:count} In the simulated game, the probability of winning outside $\Fresh\vee\Coll$ is at most $(Q+1)\,p^{k}$. \end{claim} Fix the keys and attempt tapes before sampling the underlying oracle $\Orc_0$. A win outside $\Fresh\vee\Coll$ requires a successful reply with $k$ distinct marked signatures $\sigma_i$. Whenever a message $u'$ first appears in a puzzle query, privately sample its $k$ underlying bits $\Orc_0(u',\sigma_i)$ together. Also do this for the final output message if new. Conditional on the history before each new row is sampled, its bits are independent Bernoulli($p$). The signing reply depends only on the tapes and programs a separate overlay for its message, without reading the underlying bits. The forged message is fresh, so its entire underlying row must be $1$. There are at most $Q+1$ rows to count, including the output even if it was never queried. A union bound proves the claim. \medskip\noindent\emph{Conclusion.} Charge a simulated execution to $\Coll$, to $\Hit\vee\Fresh$, or to a win outside all three. The base advantage coefficients in Claims~\ref{cl:coll} and~\ref{cl:red} sum to $k+k(1/p-1)+k(k-1)/p=k^2/p$. Take $\cB^*$ to have the largest advantage among the three reductions and round $k(1/p-1)\,2^{-\nu}$ up to $k/(p\,2^{\nu})$. \end{proof} \begin{remark}[Why strong unforgeability]\label{rem:suf} Plain unforgeability of $\Pi$ is not enough. Suppose that, given $(n,\sigma)$, one can efficiently produce further signatures $\sigma'\ne\sigma$ that are valid for the same $n$ under the same key, as for re-randomizable signatures. Each such $\sigma'$ is a new puzzle input, so a forger can grind over mauled signatures in each slot independently and forge on any $M^*$ with about $k/p$ puzzle evaluations, assuming enough distinct variants are available. If the forger can compute at most $\mu_i$ valid signatures per selection in slot $i$, it has at most $\mu_i$ puzzle inputs in that slot, and the per-candidate success probability grows from $p^{k}$ to at most $\mu\,p^{k}$, where $\mu=\prod_i\mu_i$. Section~\ref{sec:adapt-base} turns this into a definition, the malleable multi-time signature. \end{remark} \subsection{Security with retries}\label{sec:retry} Theorem~\ref{thm:main} is about one round, which may fail. The signer of Construction~\ref{con:main} retries with a fresh nonce, so it computes base signatures in several rounds under the same one-time keys. The failed rounds release nothing, and their nonces stay hidden. This is enough. \begin{corollary}\label{cor:retry} Call a message $u$ \emph{fresh} if no query to $\Orc$ with message component $u$ has been made. Let $\theta>0$ be a lower bound, over all key pairs, on the probability that one round on a fresh message succeeds. Let $T_\rho$ be the number of rounds in an ideal signing execution, in which the message of every round is fresh. For every adversary $\cA$ against the one-time unforgeability of $\Pi'$ that makes at most $Q$ queries to $\Orc$ there is an adversary $\cA'$ against the single-round scheme, also making at most $Q$ queries, such that \[ \AdvUF\;\le\;\frac{1}{\theta}\,\Adv^{1\text{-}\mathsf{uf}}_{\cA'}(Q)+\varepsilon_\rho(Q), \qquad \varepsilon_\rho(Q)=\frac{Q\,\E[T_\rho]+\E[T_\rho(T_\rho-1)]/2}{2^{\eta}} . \] With Theorem~\ref{thm:main}, \[ \AdvUF\;\le\;\frac1\theta\Bigl((Q+1)\,p^{k} +\frac{k^2}{p}\,\Adv^{1\text{-}\mathsf{suf}}_{\Pi}(\cB^*) +\frac{k}{p\,2^{\nu}}\Bigr)+\varepsilon_\rho(Q). \] \end{corollary} \begin{proof}[Proof idea] Failed rounds are invisible. They release nothing, and their puzzle points carry a nonce that $\cA$ never sees, so $\cA$ can query such a point only by guessing the nonce. For the same reason $\cA$ is unlikely to have queried the nonce of any round in advance, and two rounds rarely share a nonce. These events have total probability at most $\varepsilon_\rho(Q)$, by a union bound over the queries and the rounds. When none of them occurs, every round runs on a fresh message. The rounds are then independent and identically distributed, and the signature that $\cA$ receives is distributed as the output of a single round, conditioned on success. The reduction $\cA'$ therefore answers the signing request of $\cA$ with one round on $(M,\rho)$ for a random fresh nonce $\rho$, and gives up if that round fails. It continues with probability at least $\theta$, and the view of $\cA$ is then as in the real game. A forgery by $\cA$ on $M^*\ne M$ with nonce $\rho^*$ is a forgery on the new message $(M^*,\rho^*)$ for the single-round scheme. Hence $\cA'$ wins with probability at least $\theta\,\bigl(\AdvUF-\varepsilon_\rho(Q)\bigr)$. \end{proof} The factor $1/\theta$ is harmless when the cap $m$ makes rounds succeed with constant probability. It cannot be removed from a statement of this black-box form: a single-round scheme whose signatures are trivially reusable, but whose rounds almost never succeed, is one-time secure, and with retries it is not. Since $T_\rho$ is dominated by a geometric variable with parameter $\theta$, we have $\varepsilon_\rho(Q)\le(Q/\theta+1/\theta^2)/2^{\eta}$. \paragraph{Parameters.} For a puzzle term at most $(Q+1)2^{-\lambda}$, take $k=\lceil\lambda/\log_2(1/p)\rceil$. For instance, $p=2^{-20}$ and $\lambda=128$ give $k=7$ and $p^{-k}=2^{140}$. The cap $m$ sets the per-round success probability separately. The term $k/(p\,2^{\nu})$ pays for selections that repeat. For it to be at most $2^{-\lambda}$ one needs $\nu\ge\lambda+\log_2(k/p)$, so the base scheme must be able to sign that many distinct selections under one key. \section{The construction in Bitcoin Script}\label{sec:adapt} Construction~\ref{con:main} cannot be verified in Script as it stands. Its puzzle is a random oracle on the base signature, and Script cannot hash a witness item together with the transaction (Section~\ref{sec:script}). What Script offers is ECDSA verification at digests of the transaction, and base signatures in which the signer reveals secrets whose hashes are written into the script. This forces two changes to the construction: the puzzle becomes a predicate with two probabilities, and the base scheme becomes a \emph{malleable multi-time} signature. It also changes what the nonce is needed for. We describe the changes, then state the resulting construction, its cost, and its security. QSB, PQB and our two constructions are instances. \subsection{Change 1: a puzzle for each slot, with two probabilities}\label{sec:adapt-puzzle} \paragraph{Challenges.} In slot $i$ the message enters through transaction digests taken in script contexts that belong to that slot. We model them as a challenge $z_i=H_i(M,\rho)$, where $H_1,\ldots,H_k$ are independent random oracles. The puzzle of slot $i$ is a predicate $P_i(z,n,w)\in\{0,1\}$ on a challenge $z$, a selection $n$ and a witness $w$. The witness contains the base signature on $n$ and whatever further data the check needs. This replaces $P\bigl((M,\rho),\sigma_i\bigr)$. In Construction~\ref{con:main} the slots are kept apart only because base signatures under different keys differ. Here each slot has its own challenge. \paragraph{Two probabilities.} The puzzle of Construction~\ref{con:main} hashes the base signature. Every base signature is a separate, independent attempt, and an attempt succeeds with probability $p$ for signer and forger alike. A puzzle in Script need not have this property. The distance predicate of Section~\ref{sec:distance} compares a committed secret scalar with a number derived from the digests. For one challenge the signer checks all $N$ scalars of its key with a single sorted lookup, and at most one of them can match. The forger, who holds one disclosed scalar, can test only that one. A pair (challenge, scalar) passes with the same probability whoever looks at it; what differs is how many scalars each party can hold against one challenge. We therefore describe a slot by two numbers. \begin{itemize}[nosep] \item $\alpha_i$ bounds the forger. For every released base signature, a uniform challenge $z$ admits a witness $w$ with $P_i(z,n,w)=1$ that contains this base signature or a variant of it (Section~\ref{sec:adapt-base}) with probability at most $\alpha_i$. \item $\theta_{0,i}$ is the signer's success: the probability that, for a uniform challenge, the key holder finds a selection and a witness that pass. \end{itemize} Construction~\ref{con:main} has $\alpha=\theta_0=p$. We call $\theta_{0,i}/\alpha_i$ the \emph{selection factor} of the slot. It is a second source of advantage for the signer, in addition to the one of Remark~\ref{rem:advantage}. \paragraph{Witness freedom.} Script verifies a slightly weaker relation than the intended one, because it cannot inspect the components of a signature (Section~\ref{sec:ecdsa}). The predicate as verified says ``there exists a witness that the checks accept'', and the forger may choose the witness after it sees the challenge. So $\alpha_i$ is an upper bound that has to be proved for each predicate, while the honest signer uses a subset of the accepting witnesses. This is the puzzle half of the analysis. It is separate from the signature half, as the framework intends. \subsection{Change 2: a malleable multi-time signature}\label{sec:adapt-base} \paragraph{Commit-and-reveal signatures.} The base public key is a list of commitments written into the script, each the hash of a secret. A selection names entries of the list: a subset $S$, an index $j$, or a pair of the two. The base signature on a selection opens the selected entries by revealing their secrets, and $\bV$ hashes what is revealed and compares. We call a scheme of this form a \emph{commit-and-reveal signature}. It is the common form of the Lamport-style one-time signatures: the schemes of Lamport and HORS (Section~\ref{sec:ots}) and of Winternitz~\cite{C:Merkle89a} are of this kind, and they differ in how the message determines the selection. Here the signer chooses the selection, and the puzzle ties the choice to the message. \paragraph{One key for all slots.} To save script space, slots may share a list of commitments, for example by opening one hash chain at different depths, and a slot with several positions opens one entry per position from a single list. One key therefore signs several selections. We treat the base layer as a single multi-time signature scheme $\mPi$. Its message is the tuple $n=(n_1,\ldots,n_t)$ of all selections, with one component for each slot, or for each position of a slot, and its signature consists of the openings $\sigma=(\sigma_1,\ldots,\sigma_t)$. Its verification includes an admissibility condition $\Adm(n_1,\ldots,n_t)$, which fixes the sizes and permitted indices of the selections and forbids reuse. \paragraph{Malleability.} A base signature of this kind is not strongly unforgeable in general. Whoever holds the openings of some entries can present them in other ways, for example by assigning opened scalars to the positions of a puzzle in a different order. We allow this, as long as the number of ways is bounded. \begin{definition}[Malleable multi-time signature]\label{def:muf} A \emph{malleable $t$-time signature} is a signature scheme $\mPi=(\mG,\mS,\mV)$ with deterministic signing, whose messages are tuples $n=(n_1,\ldots,n_t)$ of selections and whose signatures $\sigma=(\sigma_1,\ldots,\sigma_t)$ have one component per selection. It comes with a \emph{malleability set} $\mathsf{Mall}(\pk,\tau)$ for every set $\tau$ of answered requests $(i,n_i,\sigma_i)$: a set of at most $\mu$ pairs that grows with $\tau$, is empty when $\tau$ is empty, and contains $(n,\sigma)$ when $\tau$ consists of the $t$ components of a signature $\sigma$ on $n$. In the game $\mathsf{mUF}_{\mPi}(\cB)$, a key pair $(\pk,\sk)\gets\mG(1^\lambda)$ is generated, and $\cB(\pk)$ may request, once for each component $i\in[t]$ and adaptively, the signature component $\sigma_i$ for a selection $n_i$ of its choice, as long as its requests extend to a valid tuple. $\cB$ outputs $(n^*,\sigma^*)$ and wins if $\mV(\pk,n^*,\sigma^*)=1$ and $(n^*,\sigma^*)\notin\mathsf{Mall}(\pk,\tau)$, where $\tau$ collects its requests and the replies. We write $\Adv^{\mathsf{muf}}_{\mPi}(\cB)$ for the probability that $\cB$ wins. \end{definition} We call the pairs in $\mathsf{Mall}(\pk,\tau)$ the \emph{variants} of $\tau$, and of $(n,\sigma)$ when $\tau$ is a full signature. An adversary that stops after some of its requests still has to produce an opening that it has not received, and with no request every valid pair wins. The strongly unforgeable one-time signature of Definition~\ref{def:suf} is the case $t=1$ and $\mu=1$. Variants can be counted component by component: if component $i$ has at most $\mu_i$ variants once the components before it are fixed, then $\mu\le\prod_i\mu_i$. Variants are harmless as long as they are counted. Each one that the forger can use is one more puzzle input, as in Remark~\ref{rem:suf}, and the bounds $\alpha_i$ have to cover all of them. \paragraph{Example: HORS.} The key example is HORS~\cite{ACISP:ReyRey02} without its message digest (Section~\ref{sec:ots}). The public key consists of $N$ commitments $C_e=\Hcom(x_e)$, a message is a tuple of $h$ indices, and the signature component for the index $n_i$ is the secret $x_{n_i}$. This is a malleable $h$-time signature. Whoever has seen a signature can present its openings again in any order and with repetitions, and can do nothing else without breaking $\Hcom$. Every component therefore has at most $h$ variants and $\mu\le h^h$. If admissibility requires distinct indices, then $\mu=h!$. PQSB-segwit starts from this base layer and adds pins, which leave fewer variants (Section~\ref{sec:pins}). HORS itself derives the indices from a digest of the message, and its security rests on two properties. The first is the one-wayness of $\Hcom$. The second is \emph{subset resilience}: the digest of a new message rarely selects only entries that are already open, which in our terms means that it rarely hits a variant. Our analysis divides in the same way. The puzzle takes the place of the digest, and the bounds $\alpha_i$ take the place of subset resilience. HORS without its digest, and the base layers of QSB, PQB and our constructions, are commit-and-reveal signatures. By the classical argument for hash-based signatures, these are malleable multi-time signatures: \begin{proposition}[Commit-and-reveal signatures]\label{prop:hash} Let $\mPi$ be a commit-and-reveal signature: its public key consists of $E$ commitments $C_e=\Hcom(x_e)$, its signatures reveal, for each selected entry, the secret $x_e$ or a prescribed iterated hash of it, and its verification recomputes the commitments. Let the variants of $\tau$ be the valid pairs all of whose openings are contained in $\tau$ or follow from openings in $\tau$ by hashing forward, and suppose there are at most $\mu$ of them. Model $\Hcom$, and every hash of a chain, as a random oracle with outputs of at least $b$ bits. Let the secrets be pairwise distinct, and let every secret have min-entropy at least $\chi$ given the other secrets. Then $\mPi$ is a malleable multi-time signature: for every adversary $\cB$ in the game $\mathsf{mUF}_{\mPi}$ that makes at most $Q_{\mathrm c}$ queries to $\Hcom$, \[ \Adv^{\mathsf{muf}}_{\mPi}(\cB)\le (Q_{\mathrm c}+1)\,E\,\bigl(2^{1-b}+2^{-\chi}\bigr), \] where for hash chains $E$ counts the links. \end{proposition} \begin{proof}[Proof idea] A winning output contains an opening that is not in $\tau$ and does not follow from $\tau$. It hashes, possibly in several steps, to a value that the adversary knows only as an output of the oracle: a commitment, or a later link of a chain. Either the opening is the committed value itself, which the adversary can only guess, or it is a different preimage. A query equals the committed value of a given entry with probability at most $2^{-\chi}$ for a secret and $2^{-b}$ for a link, and it is another preimage of a given value with probability $2^{-b}$. Sum over the entries, the queries and the final output. \end{proof} The distribution of the secrets enters only through $\chi$. They need not be uniform or independent. If two secrets can coincide, their commitments show it, and the bound gains the probability of that event. In our constructions $b=160$, and the secrets are scalars or 32-byte strings with $\chi$ close to $256$. \paragraph{A small selection space.} Theorem~\ref{thm:main} samples selections with replacement from $2^\nu$ strings and needs $\nu\ge\lambda+\log_2(k/p)$ (Section~\ref{sec:retry}). In Script every selectable entry costs script bytes, and a slot of our constructions has between a few dozen and about $2^{55}$ selections. The signer therefore enumerates the distinct selections of a slot in a fixed order. Signing is deterministic and distinct selections have distinct openings, so a base signature cannot repeat within a slot. \paragraph{Attempts.} In Construction~\ref{con:main} a new base signature is a new attempt, because the puzzle hashes it. Here a new selection is a new attempt only if it changes a digest of its slot. In legacy Script it can: \op{FindAndDelete} makes a digest depend on which pushes the selection deletes, and the predicate then derives its challenge from $z_i$ and that part of the selection through a further random oracle (Sections~\ref{sec:hash-signature} and~\ref{sec:distance-subset}). Write $m_i$ for the number of fresh challenges that slot $i$ can obtain at one nonce. If each succeeds independently with probability $\theta_{0,i}$, the slot is solved at that nonce with probability \[ \theta_i=1-(1-\theta_{0,i})^{m_i}. \] The number $m_i$ is the attempt cap $m$ of Construction~\ref{con:main}, now one per slot. It is not a free parameter: it is what the size of the script pays for. Where a selection cannot change a digest, as in SegWit, $m_i=1$. \subsection{What changes for the nonce}\label{sec:adapt-nonce} The nonce and the retry loop of Construction~\ref{con:main} stay as they are. Both of our constructions carry a uniform 256-bit nonce in a zero-value \op{OP\_RETURN} output. Its role grows in two ways. \paragraph{Rounds usually fail.} In Construction~\ref{con:main} the cap $m$ can be raised until a round succeeds with constant probability. In Script the script bounds the attempts of a slot, and every construction has a slot that is solved mainly by searching over the nonce: the transaction-only puzzle of QSB, the first slot of PQB and of PQSB-legacy, and the single slot of PQSB-segwit. The probability $\theta=\prod_i\theta_i$ that one nonce leads to a signature is about $2^{-27.57}$ for PQSB-legacy at 124 bits and $2^{-39.79}$ for PQSB-segwit at 88 bits. The nonce search carries nearly half of the signing work in the first case and all of it in the second. The factor $1/\theta$ of Corollary~\ref{cor:retry} would then erase most of the bound, so the retry loop has to be analysed directly (Theorem~\ref{thm:script}). \paragraph{The nonce as randomizer.} Since the signer chooses $\rho$ after the message is fixed, a chosen-message attacker cannot predict the challenges that the signer will use. Construction~\ref{con:main} does not need this: its puzzle hashes the base signature, which nobody but the signer can do before the signature is released, and the nonce only hides the failed rounds. In Script no secret is hashed into a digest (Section~\ref{sec:script}), and the nonce takes over that role. In both settings the price is the same term $\varepsilon_\rho(Q)$: the probability that the adversary's queries meet a nonce that the signer uses, or that the signer repeats a nonce. \begin{remark}[Predictable nonces; unverified]\label{rem:predictable} The measured implementations vary the nonce through locktime and sequence fields, which is outside the model of the proof (Section~\ref{sec:timing}). Two rough estimates follow, neither of them checked. For a puzzle whose outcome anyone can compute, such as the hash-to-signature puzzle of QSB, a predictable nonce lets a chosen-message attacker compute in advance the selections with which a message will be signed, and search for a second message that the same selections satisfy. This is a collision-type search, well below the forgery bound. For PQB and for the distance predicate the outcome depends on committed secret scalars, the attacker cannot tell which nonce will succeed, and we see no such gain. \end{remark} \subsection{The resulting construction}\label{sec:framework} \begin{construction}[Introspection signature in Script]\label{con:script} The scheme $\mnPi=(\mnG,\mnS,\mnV)$ is Construction~\ref{con:main} with the following changes. \begin{description}[leftmargin=1.5em] \item[Parameters.] A malleable multi-time signature $\mPi=(\mG,\mS,\mV)$ whose message is the tuple $(n_1,\ldots,n_k)$ of the selections of all slots, where a selection may itself have several components, and for each slot $i\in[k]$ a challenge oracle $H_i$ and a predicate $P_i$. \item[$\mnG(1^\lambda)$:] Run $\mG(1^\lambda)$ and output its key pair as $(\pk',\sk')$. \item[$\mnS(\sk',M)$:] Sample $\rho\getsr\bit^\eta$. For $i=1,\dots,k$, compute $z_i=H_i(M,\rho)$ and go through the candidates $n$ for slot $i$ that are admissible given $n_1,\dots,n_{i-1}$, in a fixed order. For each, look for a witness $w$, containing the base signature of slot $i$ on $n$, with $P_i(z_i,n,w)=1$. Keep the first candidate that passes, with its witness, as $(n_i,w_i)$. If no candidate of slot $i$ passes, discard everything and start again with a fresh nonce. Output $\varsigma=\bigl(\rho,(n_1,w_1),\dots,(n_k,w_k)\bigr)$. \item[$\mnV(\pk',M,\varsigma)$:] Accept iff the base signature $\sigma=(\sigma_1,\ldots,\sigma_k)$ contained in the witnesses satisfies $\mV\bigl(\pk',(n_1,\ldots,n_k),\sigma\bigr)=1$, and $P_i\bigl(H_i(M,\rho),n_i,w_i\bigr)=1$ for every $i\in[k]$. \end{description} The search order is fixed, and $M$ and $\rho$ affect the search only through the challenges. A predicate may consult further random oracles on values computed from its challenge, its selection and its witness; every such input retains the full label $(M,\rho)$. \end{construction} An implementation may organize the search within a slot differently, for example with a sorted lookup, provided it returns the same selection. The table summarizes the changes. \begin{center} \begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.34\textwidth}>{\raggedright\arraybackslash}p{0.27\textwidth}>{\raggedright\arraybackslash}p{0.27\textwidth}@{}} \toprule & Construction~\ref{con:main} & Construction~\ref{con:script}\\ \midrule puzzle check of slot $i$ & $P\bigl((M,\rho),\sigma_i\bigr)$ & $P_i\bigl(H_i(M,\rho),n_i,w_i\bigr)$\\ success of one attempt, forger and signer & $p$ and $p$ & $\alpha_i$ and $\theta_{0,i}$\\ attempts of a slot at one nonce & $m$ sampled selections & $m_i$ fresh challenges\\ selections & sampled from $\bit^\nu$ & enumerated in a fixed order\\ base scheme & one-time and strongly unforgeable, one key per slot & multi-time and malleable, one key for all slots\\ \bottomrule \end{tabular} \end{center} \paragraph{The instances at a glance.} For the hash-to-signature puzzle of Section~\ref{sec:hash-signature}, the 88-bit PQSB-segwit parameters and the 124-bit PQSB-legacy parameters: \begin{center} \begin{tabular}{@{}lccc@{}} \toprule Slot & $\alpha_i$ & $\theta_{0,i}$ & $m_i$\\ \midrule Construction~\ref{con:main} & $p$ & $p$ & $m$\\ QSB and PQB, a subset slot & $\approx2^{-46}$ & $\approx2^{-46}$ & number of selections\\ PQSB-segwit at 88 bits, its single slot & $2^{-88.09}$ & $2^{-39.79}$ & $1$\\ PQSB-legacy, slot 0 & $2^{-31}$ & $2^{-26.1}$ & $1$\\ PQSB-legacy, slots 1 to 3 & $2^{-31}$ & $2^{-25.8}$ to $2^{-25.6}$ & $2^{26.1}$ to $2^{25.9}$\\ \bottomrule \end{tabular} \end{center} \subsection{Cost}\label{sec:work} We count the work of testing candidates, in the random-oracle model. Let $c_i$ be the expected cost of searching slot $i$ at one nonce, where the signer stops at its first solution or after it has gone through all selections of the slot, and let $\theta_i$ be the probability that this search succeeds. \begin{proposition}[Expected signing work]\label{prop:work} If searching slot $i$ at one nonce costs $c_i$ on average and succeeds with probability $\theta_i$, independently across slots and nonces, then \[ \boxed{\E[T_{\mathrm{sign}}] =\sum_{i=1}^{k}\frac{c_i}{\prod_{j=i}^{k}\theta_j}.} \] For identical slots with cost $c_s$ and success probability $\theta_{\mathrm s}$, this is $\E[T_{\mathrm{sign}}]=c_s\sum_{j=1}^{k}\theta_{\mathrm s}^{-j}$. \end{proposition} \begin{proof} One round reaches slot $i$ with probability $\prod_{j