Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CIP-1855: add derivation path standard for forging tokens #96

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions CIP-1855/CIP-1855.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
---
CIP: 1855
Title: Forging policy keys for HD Wallets
Authors: Samuel Leathers <[email protected]>, John Lotoski <[email protected]>, Michael Bishop <[email protected]>
Comments-Summary: Multi-party transaction signing and key management for HD wallets.
Comments-URI: https://github.com/cardano-foundation/CIPs/wiki/Comments:CIP-1855
Status: Draft
Type: Standards
Created: 2021-06-02
License: CC-BY-4.0
---

# Abstract

This document describes how to derive forging policy keys used for minting/burning tokens.

## Glossary


Term | Definition
--- | ---
HD | Hierarchical Deterministic, refers to wallets as described in [BIP-0032].

# Motivation

## Overview

Forging tokens is derived from a script policy. The script policy includes hashes of keys needed to forge new tokens and must be witnessed by the keys with hashes listed.

# Specification

## HD Derivation

We consider the following HD derivation paths similarly to [CIP-1852]:

```
m / purpose' / coin_type' / policy_ix'
```
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually no 😶, the path considered is:

m / purpose' / coin_type' / policy_ix'



To associate policy keys to a wallet, we reserve however `purpose=1855'` to reserve for policy keys for forging tokens. The coin type remains `coin_type=1815'` to identify Ada as registered in [SLIP-0044]. We use a hardened index for each policy key as derivation is not needed.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as derivation is not needed -> as soft derivation is not needed.


We can summarize the various paths and their respective domain in the following table:

| `purpose` | `coin_type` | `policy_ix` |
| --- | --- | --- |
| `1855'` | `1815'` | `[2^31 .. 2^32-1]'` |


### Rationale

- ERC20 Converter IOHK is developing needs to keep track of policy keys. Rather than having randomly generated policy keys, a policy key can be associated with a mnemonic which is easier to backup.
- A 3rd party may want to have multiple tokens tied to same mnemonic, so we allow an index to specify the token.

- We use a different purpose for mainly two reasons:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would help to also state the reason(s) why those particular derivation indices were chosen, as opposed to other possible derivation indices. And why there are 3 levels of derivation when 2 should work equally well.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1855 is just the next number in numerical order.

How do you imagine having only 2 derivation levels? By removing the coin type? I guess it could be removed, but no real advantage either.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seemed a bit redundant to have a second branch for coin type that is always 1815´. Especially because these token policies will be used to mint new coin types.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I definitely see your point. For #56 we ended up keeping it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rvl The coin type is really here to prevent clashes across different crypto-currency projects (if someone else uses 1855 for something else for example). While this does not really matter for desktop wallets of our ecosystem like Daedalus who only care about a single crypto, Hardware wallets or generic wallets like Exodus do manipulate multiple currencies and multiple CIP/BIP/TIP/LIP (you name it) proposals.


- It prevents mixing up standard wallets with policy keys used for forging.

- Using a different purpose also fits well the use-case on hardware wallets who can still rely on a single root seed to manage many types of wallets.

### Examples

- `m/1855’/1815’/0’`
- `m/1855’/1815’/1’`
- `m/1855’/1815’/2’`


# Backwards Compatibility

N/A (no preceding implementation or design).

# Reference Implementation

None yet.

# Related Work

Description | Link
--- | ---
BIP-0032 - HD Wallets | https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
CIP-5 - Common Bech32 Prefixes | https://github.com/cardano-foundation/CIPs/tree/master/CIP-0005
CIP-1852 - Cardano HD Wallets | https://github.com/cardano-foundation/CIPs/tree/master/CIP-1852
A Formal Specification of the Cardano Ledger | https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/shelleyLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec


# Copyright

CC-BY-4.0

[BIP-0032]: https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki
[CIP-5]: https://github.com/cardano-foundation/CIPs/tree/master/CIP5
[CIP-1852]: https://github.com/cardano-foundation/CIPs/blob/master/CIP-1852/CIP-1852.md
[ledger-spec.pdf]: https://hydra.iohk.io/job/Cardano/cardano-ledger-specs/shelleyLedgerSpec/latest/download-by-type/doc-pdf/ledger-spec
[SLIP-0044]: https://github.com/satoshilabs/slips/blob/master/slip-0044.md