Re: [bitcoin-dev] Introducing a version field to BIP39 mnemonic phrases

2024-01-13 Thread Leslie via bitcoin-dev
Dear Pavol,

Thank you for your valuable perspective on the subject.
I fully appreciate the original design intentions of BIP39 and the importance 
of maintaining interoperability and simplicity.
However, I'd like to share some thoughts in light of the concerns you've raised.

Regarding the potential fragmentation of the ecosystem, there are instances 
where wallets use non-standard derivation paths, which can be a challenge for 
users in terms of fund recovery.
Introducing a versioned mnemonic phrase, in my view, wouldn't necessarily 
exacerbate this issue.
Instead, it might offer a more structured way to manage these variations.

In my proposal, I am not pushing for a change of the KDF.
Rather, I consider it as a possible route for future developments or adapting 
to emerging standards.
I understand and share your concerns about the implications of such changes, 
particularly in relation to hardware wallets.
I recognize the necessity of proceeding with caution to ensure that any 
modifications do not compromise the interoperability and practical utility that 
are central to the success of BIP39.
The goal is to initiate a discussion on evolving while preserving the integrity 
and core functionality of BIP39.

I advocate for the evolution of mnemonic phrases in line with the standards 
they aim to support.
This could include facilitating updates of versioned mnemonic phrases, by 
either changing the KDF or by omitting the 32-bit version field when deriving 
the seed.
Such flexibility could be essential for adapting to future needs and 
technological advancements.

Moreover, it's apparent that many users are already managing multiple mnemonics 
for different applications.
This reflects the varied needs and practices of users.
Developments like aezeed[1] or Electrum V2[2] also demonstrate that the 
standard BIP39 entropy might not always suffice for specific applications, 
leading to alternative standards being developed.
This reality underscores the need to consider ways to enhance the existing 
system to more effectively accommodate these evolving requirements.

In summary, while I hold deep respect for the fundamental principles of BIP39, 
I firmly believe that exploring the potential of versioned mnemonics can 
effectively address the dynamic nature of user practices and application 
demands, all while preserving the core strengths of the BIP39 standard.

References:
[1] (https://pkg.go.dev/github.com/lightningnetwork/lnd/aezeed#section-readme)
[2] (https://electrum.readthedocs.io/en/latest/seedphrase.html)

Best Regards,
Leslie

On Saturday, January 13th, 2024 at 15:12, Pavol Rusnak  
wrote:

> Hi Leslie, hi list!
>
> BIP39 author here. Not having version was a design decision, not accidental 
> omission.
>
> When designing BIP39 we were striving for maximum interoperability. There are 
> thousands of BIP39 applications and all of them have 100% interoperable way 
> how to share entropy using a single seed.
>
> If there was a version field involved in BIP39 allowing different key 
> stretching methods, all these implementations would choose to implement only 
> different subsets which would lead to interoperability disaster.
>
> To give some examples of what I mean:
> - there is no way hardware wallets would be able to keystretch using Argon2 
> or other methods that require lot of memory and/or CPU bandwidth
> - having version paves the way to proprietary key stretching algorithms
> BIP39 is the universal base layer for sharing entropy. Everything else is 
> delegated to upper layers.
>
> Adding version that encodes derivation paths is making the scheme less future 
> proof, not more future proof.
>
> Imagine you created the seed in 2014 that includes version that prescribes 
> using BIP44 as a derivation path. Now everytime there is a new standard 
> (Segwit, Compat Segwit, Taproot, etc.). You need to generate (and backup!) 
> the new seed.
>
> What if you want to use the seed for Nostr? Lightning? Cashu? Ark? User would 
> be forced to backup multiple seeds for every single application, leading to 
> sloppy backups.
>
> With BIP39 you can just use the single seed for everything.
>
> —
>
> Best Regards / S pozdravom,
>
> Pavol "Stick" Rusnak
> Co-Founder, SatoshiLabs
>
> On Thu 11. 1. 2024 at 6:17, Leslie via bitcoin-dev 
>  wrote:
>
>> 
>> BIP:
>> Layer: Applications
>> Title: Versioned BIP39 Mnemonic Phrases
>> Author: Leslie <0300dbd...@protonmail.com>
>> Status: None
>> Type: Standards Track
>> Created: 2024-01-10
>> 
>>
>> ## Abstract
>>
>> This BIP proposes an enhancement to the BIP39 mnemonic phrases by 
>> introducing a version field.
>> The version field will be a 32-bit field, prepended to the entropy of the 
>> BIP39 mnemonic phrase.
>> The first 24 bits are for general purposes, and the subsequent 8 bits are 
>> for defining the version used.
>>
>> ## Motivation
>> The current implementation of BIP39 mnemonic phrases lacks a crucial 
>> feature: versioning.
>> This omission has been 

Re: [bitcoin-dev] [BUG]: Bitcoin blockspace price discrimination put simple transactions at disadvantage

2024-01-13 Thread Greg Tonoski via bitcoin-dev
On Wed, Dec 27, 2023 at 8:06 PM Nagaev Boris  wrote:
>
> On Wed, Dec 27, 2023 at 2:26 PM Greg Tonoski via bitcoin-dev
>  wrote:
> > As a result, there are incentives structure distorted and critical
> > inefficiencies/vulnerabilities (e.g. misallocation of block space,
> > blockspace value destruction, disincentivized simple transaction,
> > centralization around complex transactions originators).
> >
> > Price of blockspace should be the same for any data (1 byte = 1 byte,
> > irrespectively of location inside or outside of witness), e.g. 205/205
> > and 767/767 bytes in the examples above.
>
> Witness data does not contribute to utxo set. The discount on storing
> data in witness creates an incentive to store data exactly in the
> witness and not in the parts contributing to utxo set.
>
> $ du -sh blocks/ chainstate/
> 569Gblocks/
> 9.3Gchainstate/
>
> Witness data is part of the "blocks" directory which is not
> latency-critical and can be stored on a slow and cheap storage device.
> Directory "chainstate" contains the data needed to validate new
> transactions and should fit into a fast storage device otherwise
> initial block download takes weeks. It is important to maintain the
> incentives structure, resulting in a small chainstate.

I think that the argument "discount on storing data in witness creates
an incentive to store data exactly in the witness (...)" is
fallacious. The "witness discount" does not affect the cost of data
storage in a Bitcoin node. What the "witness discount" affects is the
priority of a transaction pending confirmation only. For example, a
SegWit type of transaction of size of 1MB is prioritized (by miners)
over a non-SegWit transaction of the same size and fee. "Segwit
discount" benefits bloated transactions and puts simple transactions
at disadvantage (demonstrated at
"https://gregtonoski.github.io/bitcoin/segwit-mispricing/comparison-of-costs.html;
and 
"https://gregtonoski.github.io/bitcoin/segwit-mispricing/Comparison_of_4MB_and_1.33MB_blocks_in_Bitcoin.pdf;).

The Bitcoin fee is not charged per UTXO set size. It is not charged
from a node operator. Nodes are up and running independently of
Bitcoin fees.

Any relation between UTXO set size and discount would be artificial
and inefficient, wouldn't it?
___
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


Re: [bitcoin-dev] Introducing a version field to BIP39 mnemonic phrases

2024-01-13 Thread Pavol Rusnak via bitcoin-dev
On Sat, 13 Jan 2024 at 10:53, Leslie <0300dbd...@protonmail.com> wrote:

> Developments like aezeed[1] or Electrum V2[2] also demonstrate that the
> standard BIP39 entropy might not always suffice for specific applications,
> leading to alternative standards being developed.
> This reality underscores the need to consider ways to enhance the existing
> system to more effectively accommodate these evolving requirements.
>

It is a very unrealistic that any kind of seed standard with extra metadata
will cover all possible future usecases.
Therefore new standards will always keep emerging.

LND coming up with a new aezeed standard and not using Electrum v2 are good
example of this.

For LND, the documentation[1] tells you to convert the seed using a website
(not great) AND on top of that you also need to provide the derivation path
for the funds(!) because the aezeed version is not used to encode the
derivation path used.
Probably the LND folks also realized it is not feasible to regenerate the
seed (and bother user with the backup)
every time wallet starts to use the new address format.

On the other side, CLN is perfectly fine with using BIP39, making it very
easy to recover CLN funds in any BIP39 compatible wallet.

[1]
https://www.lightningnode.info/technicals/restorelndonchainfundsinelectrum

In summary, while I hold deep respect for the fundamental principles of
> BIP39, I firmly believe that exploring the potential of versioned mnemonics
> can effectively address the dynamic nature of user practices and
> application demands, all while preserving the core strengths of the BIP39
> standard.
>

>From where I stand, adding metadata to seed is a fool's errand.
Every year, new people coming to Bitcoin try it and fail.

Everything said, feel free to experiment, but your experiments should be
different standard than BIP39.
I would like to keep the BIP39 base entropy layer "ossified".
Moreover, it would be best if your experiments do not interfere with BIP39
to avoid confusion.
That is, your seeds should not be of lengths 12, 15, 18, 21 or 24 words.

-- 
Best Regards / S pozdravom,

Pavol "Stick" Rusnak
Co-Founder, SatoshiLabs
___
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


Re: [bitcoin-dev] Introducing a version field to BIP39 mnemonic phrases

2024-01-13 Thread Leslie via bitcoin-dev
Dear Pavol,

>It is a very unrealistic that any kind of seed standard with extra metadata
>will cover all possible future usecases.
>Therefore new standards will always keep emerging.
>

Indeed, this proposal does not aim to cover *all* usecases, but rather to 
provide a backward-compatible way to introduce new features (such as wallet 
birthdate, for example).

>From where I stand, adding metadata to seed is a fool's errand.
>Every year, new people coming to Bitcoin try it and fail.
>

Could you provide references to such attempts?
I'd like to take a look at these proposal and find out why it did fail.

>Everything said, feel free to experiment, but your experiments should be
>different standard than BIP39.
>I would like to keep the BIP39 base entropy layer "ossified".
>Moreover, it would be best if your experiments do not interfere with BIP39
>to avoid confusion.
>That is, your seeds should not be of lengths 12, 15, 18, 21 or 24 words.
>

Considering the fact that my proposal aims to be compatible with BIP39, I'm 
afraid that this wont be possible for obvious reasons.
Fortunately, the 24-bit general purpose field provide space to prevent false 
positive[1], so it wont interfere with existing BIP39 mnemonics.
As for the mnemonic phrase length, to ensure compatibility with BIP39 (which is 
the primary goal), the mnemonic phrases will likely remain within the range of 
12 to 24 words.

References:
[1] 
(https://github.com/lukechilds/bip39-versioned?tab=readme-ov-file#false-positives)

Best Regards,
Leslie
On Saturday, January 13th, 2024 at 17:31, Pavol Rusnak  
wrote:

> On Sat, 13 Jan 2024 at 10:53, Leslie <0300dbd...@protonmail.com> wrote:
>
>> Developments like aezeed[1] or Electrum V2[2] also demonstrate that the 
>> standard BIP39 entropy might not always suffice for specific applications, 
>> leading to alternative standards being developed.
>> This reality underscores the need to consider ways to enhance the existing 
>> system to more effectively accommodate these evolving requirements.
>
> It is a very unrealistic that any kind of seed standard with extra metadata 
> will cover all possible future usecases.
> Therefore new standards will always keep emerging.
>
> LND coming up with a new aezeed standard and not using Electrum v2 are good 
> example of this.
>
> For LND, the documentation[1] tells you to convert the seed using a website 
> (not great) AND on top of that you also need to provide the derivation path 
> for the funds(!) because the aezeed version is not used to encode the 
> derivation path used.
> Probably the LND folks also realized it is not feasible to regenerate the 
> seed (and bother user with the backup)
> every time wallet starts to use the new address format.
>
> On the other side, CLN is perfectly fine with using BIP39, making it very 
> easy to recover CLN funds in any BIP39 compatible wallet.
>
> [1] https://www.lightningnode.info/technicals/restorelndonchainfundsinelectrum
>
>> In summary, while I hold deep respect for the fundamental principles of 
>> BIP39, I firmly believe that exploring the potential of versioned mnemonics 
>> can effectively address the dynamic nature of user practices and application 
>> demands, all while preserving the core strengths of the BIP39 standard.
>
> From where I stand, adding metadata to seed is a fool's errand.
> Every year, new people coming to Bitcoin try it and fail.
>
> Everything said, feel free to experiment, but your experiments should be 
> different standard than BIP39.
> I would like to keep the BIP39 base entropy layer "ossified".
> Moreover, it would be best if your experiments do not interfere with BIP39 to 
> avoid confusion.
> That is, your seeds should not be of lengths 12, 15, 18, 21 or 24 words.
> --
>
> Best Regards / S pozdravom,
>
> Pavol "Stick" Rusnak
> Co-Founder, SatoshiLabs___
bitcoin-dev mailing list
bitcoin-dev@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/bitcoin-dev


Re: [bitcoin-dev] Introducing a version field to BIP39 mnemonic phrases

2024-01-13 Thread Pavol Rusnak via bitcoin-dev
Hi Leslie, hi list!

BIP39 author here. Not having version was a design decision, not accidental
omission.

When designing BIP39 we were striving for maximum interoperability. There
are thousands of BIP39 applications and all of them have 100% interoperable
way how to share entropy using a single seed.

If there was a version field involved in BIP39 allowing different key
stretching methods, all these implementations would choose to implement
only different subsets which would lead to interoperability disaster.

To give some examples of what I mean:
- there is no way hardware wallets would be able to keystretch using Argon2
or other methods that require lot of memory and/or CPU bandwidth
- having version paves the way to proprietary key stretching algorithms

BIP39 is the universal base layer for sharing entropy. Everything else is
delegated to upper layers.

Adding version that encodes derivation paths is making the scheme less
future proof, not more future proof.

Imagine you created the seed in 2014 that includes version that prescribes
using BIP44 as a derivation path. Now everytime there is a new standard
(Segwit, Compat Segwit, Taproot, etc.). You need to generate (and backup!)
the new seed.

What if you want to use the seed for Nostr? Lightning? Cashu? Ark? User
would be forced to backup multiple seeds for every single application,
leading to sloppy backups.

With BIP39 you can just use the single seed for everything.


—

Best Regards / S pozdravom,

Pavol "Stick" Rusnak
Co-Founder, SatoshiLabs


On Thu 11. 1. 2024 at 6:17, Leslie via bitcoin-dev <
bitcoin-dev@lists.linuxfoundation.org> wrote:

> 
>   BIP:
>   Layer: Applications
>   Title: Versioned BIP39 Mnemonic Phrases
>   Author: Leslie <0300dbd...@protonmail.com>
>   Status: None
>   Type: Standards Track
>   Created: 2024-01-10
> 
>
> ## Abstract
>
> This BIP proposes an enhancement to the BIP39 mnemonic phrases by
> introducing a version field.
> The version field will be a 32-bit field, prepended to the entropy of the
> BIP39 mnemonic phrase.
> The first 24 bits are for general purposes, and the subsequent 8 bits are
> for defining the version used.
>
> ## Motivation
> The current implementation of BIP39 mnemonic phrases lacks a crucial
> feature: versioning.
> This omission has been identified as a significant design flaw, affecting
> the robustness and future-proofness of the mnemonic phrase generation and
> usage.
> Notable community members and projects have expressed concerns over this
> shortcoming:
>
> >The lack of versioning is a serious design flaw in this proposal. On this
> basis alone I would recommend against use of this proposal.
>
> \- [Greg Maxwell 2017-03-14](
> https://github.com/bitcoin/bips/wiki/Comments:BIP-0039/fd2ddb6d840c6a91c98a29146b9a62d6a65d03bf
> )
>
>
> Furthermore, the absence of a version number in BIP39 seed phrases poses
> risks and inefficiencies in wallet software development and backward
> compatibility:
>
> >BIP39 seed phrases do not include a version number. This means that
> software should always know how to generate keys and addresses. BIP43
> suggests that wallet software will try various existing derivation schemes
> within the BIP32 framework. This is extremely inefficient and rests on the
> assumption that future wallets will support all previously accepted
> derivation methods. If, in the future, a wallet developer decides not to
> implement a particular derivation method because it is deprecated, then the
> software will not be able to detect that the corresponding seed phrases are
> not supported, and it will return an empty wallet instead. This threatens
> users funds.
> >
> >For these reasons, Electrum does not generate BIP39 seeds.
>
> \- [Electrum Documentation 2017-01-27](
> https://electrum.readthedocs.io/en/latest/seedphrase.html#motivation)
>
> The proposed BIP aims to address these concerns by introducing a version
> field in the BIP39 mnemonic phrases.
> The introduction of versioning is expected to enhance the mnemonic's
> adaptability to future changes, improve the efficiency of wallet software
> in handling different derivation methods, and secure users funds by
> reducing the risk of incompatibilities between mnemonic phrases and wallet
> implementations.
>
> ## Generating the Mnemonic
>
> In this proposal, we build upon the structure of BIP39 to include a
> versioned enhancement in the mnemonic generation process. The mnemonic
> encodes entropy, as in BIP39, but with a flexible approach to the size of
> the initial entropy (ENT).
>
> ### Version Field Inclusion:
>
> 1. **Initial Entropy Generation:**
>The initial entropy of ENT bits is generated, where ENT can be any size
> as long as it is a multiple of 32 bits.
>
> 2. **Version Field Prepending:**
>A crucial addition to this process is the prepending of a 32-bit
> version field to the initial entropy. This field is composed of:
>- The first 24 bits are reserved for general purposes, which can be
> utilized for