> For the complete documentation index, see [llms.txt](https://bsv.brc.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bsv.brc.dev/key-derivation/0086.md).

# Bidirectionally Authenticated Derivation of Privacy Restricted Type 42 Keys

Ty Everett (<ty@projectbabbage.com>)

## Abstract

Sometimes, there's a need for a third party to validate the linkage and key derivation process between two transacting parties. Type-42 derivation enables the private use of child keys between the parties based on an invoice number, but doesn't allow for third-party servers to verify the linkage of the keys. Proposals like BRC-84 describe ways to enable third-party verification while keeping the sender's key linked to the derivation process, but lack a means of sender authentication. By their nature, privacy is lacking in all of thes proposals, but more can be done to preserve it. When Bitcoin is not exchanged in a peer-to-peer manner, this specification outlines the most robust approach to Bidirectionally Authenticated Derivation with Privacy Restrictions (BAD Privacy).

## Specification

Senders use type-42 with the anyone key as counterparty and an invoice number in this format:

`2-BAD Privacy-<key> <nonce> <sig> <keyID>`

The format of the signed data is:

```
BRC-86 BAD Privacy
<key>
<nonce>
<key ID>
```

Verifiers (and servers) check:

* The signature
* The nonce
* The child key is derivable with the invoice number and the anyone key

The signature verification process for the signature embedded in the invoice number is:

1. Extract the identity key of the sender from the message
2. Invoice number is `2-BAD Signature-<nonce>`
3. Verification counterparty is `anyone` (see BRC-3 for signature verification on public signatures)
4. Message to verify is specified above


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://bsv.brc.dev/key-derivation/0086.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
