Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

sbtc-bridge-web is statically configured #230

Open
EmbeddedAndroid opened this issue Oct 5, 2023 · 9 comments
Open

sbtc-bridge-web is statically configured #230

EmbeddedAndroid opened this issue Oct 5, 2023 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@EmbeddedAndroid
Copy link
Contributor

Expected Behavior

The sbtc-bridge-web app can be configured without source code changes

Actual Behavior

EmbeddedAndroid/sbtc-bridge-web@2b13c9b

Steps to Reproduce

Attempt to use the sbtc-bridge-web interface with leather wallet after a mint.

Screenshots or Videos

@EmbeddedAndroid
Copy link
Contributor Author

When I manually configure the bridge, the api explodes with

fetchUtxoSet: addressValidation: undefined : getAddressInfo internal error: undefined
Error: Unable to retrieve utxo set from mempool?
    at fetchUTXOs (file:///app/sbtc-bridge-api/dist/src/lib/bitcoin/api_mempool.js:79:19)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async WalletController.fetchUtxoSet (file:///app/sbtc-bridge-api/dist/src/routes/bitcoin/BitcoinRPCController.js:298:27)
    at async file:///app/sbtc-bridge-api/dist/src/routes/bitcoinRoutes.js:120:26
fetchUtxoSet: fetchUTXOs: undefined : utxos is not iterable
GET /bridge-api/testnet/v1/btc/wallet/address/undefined/utxos?verbose=true 304 - - 82.817 ms
/address/balances/:stxAddress/:cardinal/:ordinal
GET /bridge-api/testnet/v1/sbtc/address/balances/ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM/tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh/tb1pte5zmd7qzj4hdu45lh9mmdm0nwq3z35pwnxmzkwld6y0a8g83nnq6ts2d4 - - - - ms
Error fetching sbtc alpha data from sbtc contrcat
get-bitcoin-wallet-public-key: getting key: 0390a5cac7c33fda49f70bc1b0866fa0ba7a9440d9de647fecb8132ceb76a94dfa
Error fetching sbtc alpha data from sbtc contrcat
{
  type: 'principal',
  value: 'ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM'
}
Error in routes:  Error: private key must be 32 bytes, hex or bigint, not undefined
    at Object.normPrivateKeyToScalar (file:///app/sbtc-bridge-api/node_modules/@noble/curves/esm/abstract/weierstrass.js:158:19)
    at schnorrGetExtPubKey (file:///app/sbtc-bridge-api/node_modules/@noble/curves/esm/secp256k1.js:110:30)
    at Object.schnorrGetPublicKey [as getPublicKey] (file:///app/sbtc-bridge-api/node_modules/@noble/curves/esm/secp256k1.js:141:12)
    at TransactionController.getKeys (file:///app/sbtc-bridge-api/dist/src/routes/bitcoin/BitcoinRPCController.js:51:50)
    at file:///app/sbtc-bridge-api/dist/src/routes/sbtcRoutes.js:147:40
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
GET /bridge-api/testnet/v1/sbtc/init-ui 500 164 - 105.073 ms
An error occurred fetching sbtc data.
==========================================================================
getAddressInfo internal error: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh : -18 : Requested wallet does not exist or is not loaded
==========================================================================
fetchUtxoSet: addressValidation: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh : getAddressInfo internal error: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh
GET /bridge-api/testnet/v1/btc/wallet/address/tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh/utxos?verbose=true 200 7085 - 599.526 ms
==========================================================================
getAddressInfo internal error: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh : -18 : Requested wallet does not exist or is not loaded
==========================================================================
fetchUtxoSet: addressValidation: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh : getAddressInfo internal error: tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh
GET /bridge-api/testnet/v1/btc/wallet/address/tb1q3tj2fr9scwmcw3rq5m6jslva65f2rqjxt2t0zh/utxos?verbose=true 200 7085 - 590.720 ms

@EmbeddedAndroid
Copy link
Contributor Author

@radicleart I might need your help understanding these errors.

@radicleart
Copy link
Collaborator

radicleart commented Oct 6, 2023 via email

@radicleart
Copy link
Collaborator

@EmbeddedAndroid i just built but the http://stacks-api:3999 service isn't running - i think i saw an open issue for this?

Another issue is the containers for the web and maybe api are pretty old. Is there a way to remove or override the caching policy for these two containers - main changes regularly and the two apps are coupled?

Aside this there are dependence on contract deployment the bridge won't function until its linked to a contract and also on the leather on devnet issue - i think this is the cause of UTXO related errors as its using the testnet addresses in the wallet to fetch UTXOs.

.

@EmbeddedAndroid
Copy link
Contributor Author

@EmbeddedAndroid i just built but the http://stacks-api:3999 service isn't running - i think i saw an open issue for this?

stacks-api shouldn't have any issues, if the stacks-explorer is working the api is too. One thing to check, the stacks-api hostname only resolves when the containers are deployed together i.e. up.sh If it's running seperately, you'll want to use 127.0.0.1:3999.

Another issue is the containers for the web and maybe api are pretty old. Is there a way to remove or override the caching policy for these two containers - main changes regularly and the two apps are coupled?

The only way I think we can do this now is

docker compose build sbtc-bridge-web --no-cache
docker compose build sbtc-bridge-api --no-cache

However that isn't a fix for the issue your raising. Let me research a better solution.

Aside this there are dependence on contract deployment the bridge won't function until its linked to a contract and also on the leather on devnet issue - i think this is the cause of UTXO related errors as its using the testnet addresses in the wallet to fetch UTXOs.

What is the process to link the bridge to a contract?

I added this: EmbeddedAndroid/sbtc-bridge-web@2b13c9b#diff-0b4f5977a52cef50ed20e7cdf9761795df9ee1cb3b5e5ea45edeb9394e8a47ffL31 but wasn't sure if I needed to do something else.

@radicleart
Copy link
Collaborator

Thanks i can see stacks api now.

The contract is set on the API via environment parameter in docker compose. Bridge will see it once its deployed.

@AshtonStephens
Copy link
Collaborator

Thanks i can see stacks api now.

The contract is set on the API via environment parameter in docker compose. Bridge will see it once its deployed.

@radicleart I'm going to assign this to you. Are you unblocked on this now?

@radicleart
Copy link
Collaborator

radicleart commented Oct 10, 2023

Hey @AshtonStephens - i am looking at this but don't think the bridge will work on deven until the Leather wallet supports (this is closed bu the the work is ongoing?) regtest Bitcoin addresses - part of the error above is the bridge trying to fetch UTXOs from regtest using the testnet addresses in the wallet.

In meantime I've prioritised trying to run Romeo on testnet against the Bridge.

@AshtonStephens AshtonStephens moved this from Triage to In Progress in sBTC-Developer-Release Oct 10, 2023
@radicleart
Copy link
Collaborator

Working to fix this and stumbled on this issue getumbrel/umbrel-os#248 that affects the bridge on devnet. the mempool /:address/utxo, that the api relies on, is not implemented in mempool devnet (its only supported in testnet/mainnet).

Looking for workarounds for this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants