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

Feat/update bitcoinjs lib #544

Merged
merged 6 commits into from
Oct 25, 2023
Merged

Feat/update bitcoinjs lib #544

merged 6 commits into from
Oct 25, 2023

Conversation

RealGoodProgrammer
Copy link
Member

@RealGoodProgrammer RealGoodProgrammer commented Oct 23, 2023

  • getAccount() now uses ecpair and tiny-secp256k1 deps for generating bitcoin address
  • Replaced TrasnsactionBuilder with Psbt
  • Added vite-plugin-wasm and vite-plugin-top-level-await (required by tiny-secp256k1)

Since Psbt requires the full transaction in HEX, additional requests to GET /tx/${id}/hex are made.

@vercel
Copy link

vercel bot commented Oct 23, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
adamant-im ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 25, 2023 4:04pm

@github-actions
Copy link

github-actions bot commented Oct 23, 2023

Deployed to https://msg-adamant-pr-544.surge.sh 🚀

@bludnic
Copy link
Member

bludnic commented Oct 24, 2023

Update bitcoinjs-lib

src/lib/bitcoin/btc-base-api.js Outdated Show resolved Hide resolved
src/lib/bitcoin/btc-base-api.js Outdated Show resolved Hide resolved
package-lock.json Outdated Show resolved Hide resolved
Co-authored-by: bludnic <victorcpla@gmail.com>
package.json Outdated Show resolved Hide resolved
@RealGoodProgrammer RealGoodProgrammer temporarily deployed to testing October 25, 2023 16:02 — with GitHub Actions Inactive
@bludnic bludnic merged commit 2eb84c7 into dev Oct 25, 2023
3 checks passed
@bludnic bludnic deleted the feat/update_bitcoinjs-lib branch October 25, 2023 16:29
@bludnic bludnic temporarily deployed to testing October 25, 2023 16:29 — with GitHub Actions Inactive
@github-actions
Copy link

Successfully tore down https://msg-adamant-pr-544.surge.sh 🥲

Copy link
Member

@adamant-al adamant-al left a comment

Choose a reason for hiding this comment

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

  • Try to send txs (including taproot) through bitcoind, not an indexer. See 'Expose bitcoind API' https://trello.com/c/Pa45S7nJ (currently btcnode2 only).
    Probably, we can switch to bitcoind for most requests (except tx history by address). Is it possible to optimize tx creation and don't retrieve hexes for all of unspents with bitcoind?

  • What's the reason to add two more libs? ecpair, tiny-secp256k1 (plus vite-plugin-wasm and vite-plugin-top-level-await). Why can't we use bitcoin.ECPair.fromPrivateKey()? Doesn't 'bitcoinjs-lib' include ECPair or alternative anymore?

src/lib/bitcoin/btc-base-api.js Show resolved Hide resolved
@adamant-al
Copy link
Member

export default class DashApi extends BtcBaseApi
export default class DogeApi extends BtcBaseApi

Have you tested DOGE and DASH?

@bludnic
Copy link
Member

bludnic commented Oct 26, 2023

What's the reason to add two more libs? ecpair, tiny-secp256k1 (plus vite-plugin-wasm and vite-plugin-top-level-await). Why can't we use bitcoin.ECPair.fromPrivateKey()? Doesn't 'bitcoinjs-lib' include ECPair or alternative anymore?

The bitcoinjs-lib doesn't include ECPair in the new version, so we had to include ecpair and tiny-secp256k1 dependencies (this is what bitcoinjs-lib suggested).

Since tiny-secp256k1 uses WASM, additional Vite plugins are required: vite-plugin-wasm and vite-plugin-top-level-await). These are devDependencies, so it doesn't affect the bundle size.

@bludnic
Copy link
Member

bludnic commented Oct 26, 2023

Is it possible to optimize tx creation and don't retrieve hexes for all of unspents with bitcoind?

We will try.

@bludnic bludnic mentioned this pull request Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants