bitcoinjs / bitcoinjs-lib

A javascript Bitcoin library for node.js and browsers.
MIT License
5.61k stars 2.08k forks source link

Migrate from Buffer to native Uint8Array #1855

Open tiero opened 1 year ago

tiero commented 1 year ago

Since Buffer is a subclass of Uint8Array, is there any plans to migrate the library to use them to have native support in browsers without polyfills? https://nodejs.dev/en/api/v18/buffer/

ChrisCho-H commented 6 months ago

This would be a good feature. I might work on it, if others think this is necessary.

junderw commented 6 months ago

Feel free to work on it.

I think the biggest hold out is bip174 which might be tough.

I made a few tools in uint8array-tools (we use them in tiny-secp256k1) that can help with some of the Buffer APIs we use. You can add more tools to that if needed.

Switching away from Buffers should probably be a major version bump, and I think we can also move OPS to enum etc.

Whatever you want to work on, feel free.

If you have questions, asking here is fine. I am also available on Matrix (see the README)