Andrew Chow [ARCHIVE] on Nostr: 📅 Original date posted:2019-07-30 📝 Original message:Hi All, I would like to ...
📅 Original date posted:2019-07-30
📝 Original message:Hi All,
I would like to propose some types that allow for BIP 174 PSBT to be
extended more in the future.
Firstly, I would like to propose that some types be reserved for
proprietary use. These proprietary use types are, in general, for
private use by individuals and organizations who want to use PSBT in
their processes. These are usefule when there are additional data that
they need attached to a PSBT but such data are not useful (or available)
for the general public.
These types will be guaranteed to not be used by the public
specification and there is no expectation that any publicly available
software be able to understand any specific meanings of these types.
These types should be used for internal processes only.
The types I would like to reserve for proprietary use are the 15 types
from 0xF0 to 0xFE inclusive. These 15 type values will be the same for
global, per-input, and per-output types. If 15 types are not enough,
additional types can be obtained using the multi-byte type method
described later.
Next, I would like to propose a global version type and field. The
version type is 0xEF with only the type as the key, and the value is a
32-bit unsigned little endian integer representing the version number. A
PSBT without a version number is to be considered version 0. If a parser
sees a version number that it does not understand, it should exit
immediately as the PSBT will contain types that are not safe to ignore.
This version number is a safeguard in the event that a backwards
incompatible change is introduce to PSBT. While PSBT is designed and
intended to be forwards compatible by allowing parsers to ignore types
that they do not understand, it is possible that at ype is added in the
future which breaks this assumption and it would be unsafe for a type to
be ignored.
Updaters and combiners that need to add a version number to a PSBT
should use the highest version number required. For example, if a
combiner sees two PSBTs for the same transaction, one with version 0,
and the other with version 1, then it should combine them and produce a
PSBT with version 1. If an updater is updating a PSBT and needs to add a
field that is only available in version 1, then it should set the PSBT
version number to 1 unless a version higher than that is already specified.
It is not expected that the version number will ever be used. We try to
make PSBT fields safe to ignore. The version number is only being
included here as a safeguard in the event that breaking compatibilty is
required.
Lastly, I would like to propose the canonical method for mult-byte
types. We designate a specific type to indicate that the type is
multiple bytes. When such types are observed, parsers should move onto
the next byte and interpret that as the type, keeping in mind the number
of bytes that were read in for the type.
I propose that we use 0xFF as this designated type. When a parser sees
an 0xFF value as the type, it reads the next byte as being part of the
type. So two byte types will be of the form 0xFFXX. This method allows
us to do a prefix match in order to quickly identify the type being
used. For types with more bytes, simply use another 0xFF byte. So three
byte types would be of the form 0xFFFFXX, four byte, 0xFFFFFFXX, and so
on. When multi-byte types are specified in the BIP, they should be
specified in this full length form, i.e. two byte types as 0xFFXX.
The same mechanism can be used for the proprietary use types, just with
a different value as the designated multi-byte indicator. For example,
one could use 0xFE as the designated type as that is in the proprietary
types range. Of course any type within the proprietary type range could
be used as the indicator, it is up to the users to determine this
themselves.
While other methods of indicating multiple bytes and lengths may be more
space efficient and allow us to have more types represented in a smaller
space, I am choosing this method because of its simplicity. This is easy
to understand and implement. Furthermore, I do not expect that we will
use so many types. I don't think that we will need to have more than one
byte types for a very long time.
Please let me know your thoughts on these extensions. I will open a PR
to the bips repo to add these to BIP 174 if there are no objections.
Andrew Chow
Published at
2023-06-07 18:19:45Event JSON
{
"id": "49e263f13b1d01ec1bd8ecda51182dffda31d915354833d7ea67eb53e73bd464",
"pubkey": "4a273da3c9ab85c096f859e6ca066d2fdfe762406cadc2f4d58aa75468aca8d0",
"created_at": 1686161985,
"kind": 1,
"tags": [
[
"e",
"956f6265a8c9ceac600b604046bb23a1593523623adad8fb5fe377e26fe5d166",
"",
"reply"
],
[
"p",
"a23dbf6c6cc83e14cc3df4e56cc71845f611908084cfe620e83e40c06ccdd3d0"
]
],
"content": "📅 Original date posted:2019-07-30\n📝 Original message:Hi All,\n\nI would like to propose some types that allow for BIP 174 PSBT to be\nextended more in the future.\n\n\nFirstly, I would like to propose that some types be reserved for\nproprietary use. These proprietary use types are, in general, for\nprivate use by individuals and organizations who want to use PSBT in\ntheir processes. These are usefule when there are additional data that\nthey need attached to a PSBT but such data are not useful (or available)\nfor the general public.\n\nThese types will be guaranteed to not be used by the public\nspecification and there is no expectation that any publicly available\nsoftware be able to understand any specific meanings of these types.\nThese types should be used for internal processes only.\n\nThe types I would like to reserve for proprietary use are the 15 types\nfrom 0xF0 to 0xFE inclusive. These 15 type values will be the same for\nglobal, per-input, and per-output types. If 15 types are not enough,\nadditional types can be obtained using the multi-byte type method\ndescribed later.\n\n\nNext, I would like to propose a global version type and field. The\nversion type is 0xEF with only the type as the key, and the value is a\n32-bit unsigned little endian integer representing the version number. A\nPSBT without a version number is to be considered version 0. If a parser\nsees a version number that it does not understand, it should exit\nimmediately as the PSBT will contain types that are not safe to ignore.\n\nThis version number is a safeguard in the event that a backwards\nincompatible change is introduce to PSBT. While PSBT is designed and\nintended to be forwards compatible by allowing parsers to ignore types\nthat they do not understand, it is possible that at ype is added in the\nfuture which breaks this assumption and it would be unsafe for a type to\nbe ignored.\n\nUpdaters and combiners that need to add a version number to a PSBT\nshould use the highest version number required. For example, if a\ncombiner sees two PSBTs for the same transaction, one with version 0,\nand the other with version 1, then it should combine them and produce a\nPSBT with version 1. If an updater is updating a PSBT and needs to add a\nfield that is only available in version 1, then it should set the PSBT\nversion number to 1 unless a version higher than that is already specified.\n\nIt is not expected that the version number will ever be used. We try to\nmake PSBT fields safe to ignore. The version number is only being\nincluded here as a safeguard in the event that breaking compatibilty is\nrequired.\n\n\nLastly, I would like to propose the canonical method for mult-byte\ntypes. We designate a specific type to indicate that the type is\nmultiple bytes. When such types are observed, parsers should move onto\nthe next byte and interpret that as the type, keeping in mind the number\nof bytes that were read in for the type.\n\nI propose that we use 0xFF as this designated type. When a parser sees\nan 0xFF value as the type, it reads the next byte as being part of the\ntype. So two byte types will be of the form 0xFFXX. This method allows\nus to do a prefix match in order to quickly identify the type being\nused. For types with more bytes, simply use another 0xFF byte. So three\nbyte types would be of the form 0xFFFFXX, four byte, 0xFFFFFFXX, and so\non. When multi-byte types are specified in the BIP, they should be\nspecified in this full length form, i.e. two byte types as 0xFFXX.\n\nThe same mechanism can be used for the proprietary use types, just with\na different value as the designated multi-byte indicator. For example,\none could use 0xFE as the designated type as that is in the proprietary\ntypes range. Of course any type within the proprietary type range could\nbe used as the indicator, it is up to the users to determine this\nthemselves.\n\nWhile other methods of indicating multiple bytes and lengths may be more\nspace efficient and allow us to have more types represented in a smaller\nspace, I am choosing this method because of its simplicity. This is easy\nto understand and implement. Furthermore, I do not expect that we will\nuse so many types. I don't think that we will need to have more than one\nbyte types for a very long time.\n\n\nPlease let me know your thoughts on these extensions. I will open a PR\nto the bips repo to add these to BIP 174 if there are no objections.\n\n\nAndrew Chow",
"sig": "1cfb01c571165fc74eb4f5e500e9d6af22a680f65bca0a9d90b767ad49ac7e444ca6515c28a59562044c6248752f98951706c2e84083250999c2cbcffba5a0b1"
}