Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines SLIP-0013, which proposes a standardized authentication method that derives distinct keys for individual services from a single secret and authenticates users through challenges.
This article translates, summarizes, and supplements the material linked below.
I have also covered other EIPs.
Overview
SLIP-0013 describes using a deterministic hierarchy to authenticate to websites and remote shells such as SSH.
A deterministic hierarchy derives multiple keys hierarchically from a single secret, such as a master key. Each service can have unique credentials, while all those credentials can be reproduced from the same underlying secret.
Users can therefore use separate credentials for multiple services and devices while needing to securely store and back up only one underlying secret.
Motivation
This mechanism simplifies the management and backup of authentication credentials.
It applies the same principle as deterministic cryptocurrency wallets: if the master secret is stored securely, the individual private keys can be regenerated from it.
Applying this principle to authentication allows important credentials, such as SSH keys, to be separated by service while supporting a unified backup and recovery process. The design combines service-specific key generation with centralized management of the underlying secret.
Service Identity
To derive a key for a particular service, the proposal introduces a service identity consisting of two elements.
The first is a URI (Uniform Resource Identifier), in the format defined by RFC 3986.
proto://[user@]host[:port][/path]For example, the following URIs can be used as service identities.
https://example.comftp://public@example.com/pubssh://root@example.com:2222
The second element is an index, represented as an unsigned 32-bit integer. It allows multiple keys to be derived for the same URI. For example, index = 0 identifies the first key and index = 1 the second key.
HD Structure
The mechanism derives a hierarchical deterministic (HD) key from the service identity using the following steps.
- Concatenate the little-endian byte representation of the index with the URI string.
- Apply SHA-256 to the concatenated data to obtain a hash.
- Take the first 128 bits (16 bytes) of the SHA-256 hash, referred to as
hash128. - Interpret
hash128as four 32-bit integers (A, B, C, and D), using little-endian byte order. - Set the most significant bit (bit 31) of each integer to 1. This is called hardening and prevents public-only derivation across these hardened levels.
- Construct the HD path in the form
m/13'/A'/B'/C'/D', following SLIP-0010. Deriving a private key along this path produces a reproducible service-specific key.
Little endian is a convention for representing a number as bytes, placing its least significant byte first.
Endianness determines the ordering of bytes when computers represent numbers in memory or transmit them.
Consider the following hexadecimal 32-bit integer (four bytes).
0x12345678Its individual bytes are:
- 0x12 (most significant byte)
- 0x34
- 0x56
- 0x78 (least significant byte)
Big Endian
Stores the bytes in this order, from most significant to least significant.
[0x12, 0x34, 0x56, 0x78]Little Endian
Stores the least significant byte first, reversing the order.
[0x78, 0x56, 0x34, 0x12]Worked Example
Consider the following service identity.
- URI:
https://satoshi@bitcoin.org/login - index:
0
First encode the index as little-endian bytes and concatenate those bytes with the URI string. Applying SHA-256 to the result yields the following hash.
d0e2389d4c8394a9f3e32de01104bf6e8db2d9e2bb0905d60fffa5a18fd696dbThe first 128 bits (16 bytes) are as follows.
d0e2389d4c8394a9f3e32de01104bf6eInterpreting this value as four little-endian 32-bit integers gives the following.
- A = 2637750992
- B = 2845082444
- C = 3761103859
- D = 1858012177
Only D has its most significant bit unset, so set that bit to harden the index.
- A' = 2637750992
- B' = 2845082444
- C' = 3761103859
- D' = 4005495825 (originally 1858012177)
The resulting HD path is as follows.
m/2147483661/2637750992/2845082444/3761103859/4005495825Deriving a key along this path makes it possible to reproduce the key associated with this service.
Additional Notes
This approach is based on SLIP-0010, which specifies a standardized mechanism for private key derivation and management.
A concrete Python implementation example is available in the following Trezor test code.
Python Example - test_msg_signidentity.py
Challenge-Response Authentication
Challenge-response authentication using keys derived from an HD hierarchy provides a reproducible way to authenticate users when they log in to a service or need to establish their identity.
Challenge Components
The service issues a challenge to a user requesting authentication. It consists of three elements.
Service Identity
As described above, the service identity consists of a URI and an index, identifying a particular service. An example representation is https://example.com 0.
This identity determines the private key to derive for the service.
Hidden Challenge
A random byte sequence of up to 64 bytes that is not displayed to the user. The service uses it internally during authentication.
Visual Challenge
A string of up to 64 characters displayed to the user. The proposal recommends showing information that users can recognize, such as a timestamp in the format YYYY-MM-DD HH:MM:SS.
Signature Generation
The user or signer receives the three pieces of information.
First, the signer derives the private key from the HD hierarchy using the service identity. The signer then constructs the data to be signed as follows.
- Compute the SHA-256 hash of the hidden challenge.
- Compute the SHA-256 hash of the visual challenge.
- Concatenate the two hashes.
- Sign the resulting bytes using the derived private key and the standard Bitcoin message signing procedure.
The signer then returns three items to the service.
- Signature.
- Public key.
- Address corresponding to the public key (node address).
Service-Side Handling
The service operator handles the result according to the received signature and public key.
- Invalid or missing signature Reject authentication and display an error.
- Valid signature with a previously unknown public key or address Create an account for the new user.
- Valid signature with an already registered address Authenticate the user to the associated existing account.
Conclusion
SLIP-0013 proposes a standardized authentication mechanism that derives distinct service-specific keys from a single secret and uses challenge-response authentication.
If you have questions, feel free to contact me on Twitter.
I also publish articles on the following platforms.


