{"id":22214770,"url":"https://github.com/getalby/bitcoin-connect","last_synced_at":"2026-02-05T18:02:12.131Z","repository":{"id":185304770,"uuid":"666271016","full_name":"getAlby/bitcoin-connect","owner":"getAlby","description":"Connecting lightning wallets to your webapp has never been easier. Enable WebLN in all browsers with a single button","archived":false,"fork":false,"pushed_at":"2025-12-04T05:41:53.000Z","size":28379,"stargazers_count":139,"open_issues_count":57,"forks_count":54,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-12-07T11:50:11.171Z","etag":null,"topics":["alpha","bitcoin","connect","lightning","nostr","nwc","wallet","webln"],"latest_commit_sha":null,"homepage":"https://bitcoin-connect.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/getAlby.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-07-14T05:39:06.000Z","updated_at":"2025-12-04T05:41:54.000Z","dependencies_parsed_at":"2023-11-18T16:31:47.453Z","dependency_job_id":"f95cd873-2918-45e5-8605-ca41b572920a","html_url":"https://github.com/getAlby/bitcoin-connect","commit_stats":null,"previous_names":["getalby/lightning-wallet-connect"],"tags_count":35,"template":false,"template_full_name":null,"purl":"pkg:github/getAlby/bitcoin-connect","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getAlby%2Fbitcoin-connect","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getAlby%2Fbitcoin-connect/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getAlby%2Fbitcoin-connect/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getAlby%2Fbitcoin-connect/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/getAlby","download_url":"https://codeload.github.com/getAlby/bitcoin-connect/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/getAlby%2Fbitcoin-connect/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29128621,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-05T17:12:17.649Z","status":"ssl_error","status_checked_at":"2026-02-05T17:11:23.670Z","response_time":65,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alpha","bitcoin","connect","lightning","nostr","nwc","wallet","webln"],"created_at":"2024-12-02T21:17:45.077Z","updated_at":"2026-02-05T18:02:12.124Z","avatar_url":"https://github.com/getAlby.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![image](https://github.com/getAlby/bitcoin-connect/assets/33993199/a0eaf887-2ef1-4369-b6bf-7ef977ca2b67)\n\n# Bitcoin Connect\n\nThis project includes web components for connecting to Lightning wallets and enabling [WebLN](https://webln.guide). Websites only need to interface with WebLN to connect with multiple wallets, just like the Alby extension. However, no extension is needed to be installed - Bitcoin Connect is provided by the website. Users can connect from both desktop and mobile devices, using their favorite browser. PWAs _just work_. Bitcoin Connect's components work with pure HTML and all Javascript libraries or frameworks, such as React, Angular, Vue, Solid.js, etc.\n\n🆕 Bitcoin Connect also supports a nice invoice payment UI that gives a multitude of options to a user to pay an invoice. Accept payments with a single line of code.\n\n🥇 Bitcoin Connect won the \"BOLT FUN Legends of Lightning vol.2\" hackathon on 17 December, 2023.\n\n🍯 Bitcoin Connect has some money for bounties. If you would like to contribute a new feature or add Bitcoin Connect to a popular webapp please contact hello@getalby.com.\n\n## 🛝 Try it out\n\n[Demo](https://bitcoin-connect.com)\n\n## 🧳 Migration Guide\n\nThere are multiple breaking changes in **v3**. See our migration guide [here](doc/MIGRATION_v3.md). Click [here](https://github.com/getAlby/bitcoin-connect/tree/v2.4.2-alpha) for v2.\n\n## 🚀 Quick Start\n\n\u003e 🚧WARNING🚧: this package is currently in Alpha. It's got awesome features, but is using new features of protocols such as WebLN and NWC which have not been finalized, and there may be breaking changes or bugs.\n\n### React Package\n\n`npm install @getalby/bitcoin-connect-react` or `yarn add @getalby/bitcoin-connect-react`\n\n### Web Components Package\n\n`npm install @getalby/bitcoin-connect` or `yarn add @getalby/bitcoin-connect`\n\n### HTML (CDN)\n\nYou can use Bitcoin Connect without any build tools:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {launchModal} from 'https://esm.sh/@getalby/bitcoin-connect@^3.12.0'; // jsdelivr.net, skypack.dev also work\n\n  // use Bitcoin connect API normally...\n  launchModal();\n\n  // or if you just want access to the web components:\n  import 'https://esm.sh/@getalby/bitcoin-connect@^3.12.0';\n\u003c/script\u003e\n\n\u003c!-- Bitcoin Connect components are now available --\u003e\n\u003cbc-button\u003e\u003c/bc-button\u003e\n```\n\n## 🤙 Usage\n\n### Pure JS\n\n```ts\nimport {\n  init,\n  launchModal,\n  launchPaymentModal,\n  requestProvider,\n} from '@getalby/bitcoin-connect';\n\n// Initialize Bitcoin Connect\ninit({\n  appName: 'My Lightning App', // your app name\n});\n\n// launch modal programmatically\nawait launchModal();\n\n// launch modal to receive a payment\nawait launchPaymentModal({\n  invoice: 'lnbc...',\n  onPaid: ({preimage}) =\u003e alert('Paid: ' + preimage), // NOTE: only fired if paid with WebLN - see full api documentation below\n});\n\n// or request a WebLN provider to use the full WebLN API\nconst weblnProvider = await requestProvider();\nconst {preimage} = await weblnProvider.sendPayment('lnbc...');\n```\n\n_Continue further down for the full Bitcoin Connect API._\n\n### React\n\n```jsx\nimport {Button, PayButton, init, launchModal, launchPaymentModal, closeModal, requestProvider, Connect, SendPayment} from '@getalby/bitcoin-connect-react';\n\n// Initialize Bitcoin Connect\ninit({\n  appName: \"My Lightning App\", // your app name\n})\n\n// render the Bitcoin Connect button\n\u003cButton onConnect={(provider) =\u003e {\n  const {preimage} = await provider.sendPayment(\"lnbc...\");\n}}/\u003e\n\n// render a \"Pay Now\" button\n// invoice can be unset initially - using the onClick function is a good time to fetch the invoice\n// set the `payment` prop to override the payment status if a payment was made externally\n\u003cPayButton invoice={invoice} onClick={() =\u003e {\n  invoice = fetchInvoice();\n  setInvoice(invoice)\n}} onPaid={(response) =\u003e alert(\"Paid! \" + response.preimage)} payment={{preimage: 'my-preimage'}}/\u003e\n\n// render the connect flow on its own without the modal\n\u003cConnect/\u003e\n\n// render the send payment flow on its own without the modal (for E-Commerce flows)\n// set the `payment` prop to override the payment status if a payment was made externally\n\u003cPayment invoice=\"lnbc...\" onPaid={(response) =\u003e alert(\"Paid! \" + response.preimage)} payment={{preimage: 'my-preimage'}}/\u003e\n\n// request a provider\n\u003cbutton onClick={() =\u003e {\n  // if no WebLN provider exists, it will launch the modal\n  const weblnProvider = await requestProvider();\n  const { preimage } = await weblnProvider.sendPayment(\"lnbc...\")\n}}\u003e\n  Request WebLN provider\n\u003c/button\u003e\n\n// open modal programmatically to connect a wallet\n\u003cbutton onClick={() =\u003e launchModal()}\u003e\n  Programmatically launch modal\n\u003c/button\u003e\n\n// open modal programmatically to pay an invoice (for one-off payments)\n\u003cbutton onClick={() =\u003e launchPaymentModal({invoice: \"lnbc...\", onPaid: ({preimage}) =\u003e alert(\"Paid: \" + preimage)})}\u003e\n  Programmatically launch payment modal\n\u003c/button\u003e\n\n// close modal programmatically\ncloseModal();\n```\n\n#### NextJS / SSR\n\nMake sure to only import and render the components **client side**. This can be done either by creating a wrapper component with using next/dynamic with `ssr: false` (and add the 'use client' directive when using the NextJS app router), or a dynamic import e.g.\n\n```tsx\n\"use client\"\nimport dynamic from 'next/dynamic';\nconst Button = dynamic(\n  () =\u003e import('@getalby/bitcoin-connect-react').then((mod) =\u003e mod.Button),\n  {\n    ssr: false,\n  }\n);\n\n// Render the Button normally\n\n\u003cButton /\u003e\n\n// or to use the API:\n\n\u003cbutton\n  onClick={async () =\u003e {\n    const launchModal = await import('@getalby/bitcoin-connect-react').then(\n      (mod) =\u003e mod.launchModal\n    );\n    launchModal();\n  }}\n\u003e\n  Launch modal\n\u003c/button\u003e\n\n// to set the global webln object:\n\nuseEffect(() =\u003e {\n  // init bitcoin connect to provide webln\n  const {onConnected} = await import('@getalby/bitcoin-connect-react').then(\n    (mod) =\u003e mod.onConnected\n  );\n  const unsub = onConnected((provider) =\u003e {\n    window.webln = provider;\n  });\n\n  return () =\u003e {\n    unsub();\n  };\n}, []);\n\n```\n\nSee [NextJS](./demos/nextjs/) and [NextJS legacy](./demos/nextjs-legacy/) demos for full examples.\n\n### Other Frameworks\n\n\u003e 💡 The core Bitcoin Connect package works on all frameworks because it is powered by web components. However, a wrapper can simplify usage of Bitcoin Connect.\n\n_Use another popular framework? please let us know or feel free to create a PR for a wrapper. See the React package for an example implementation._\n\n### Pure HTML\n\n#### Components\n\nBitcoin Connect exposes the following web components for allowing users to connect their desired Lightning wallet:\n\n- `\u003cbc-button/\u003e` - launches the Bitcoin Connect Modal on click\n  - Arguments:\n    - `title` - (optional) change the title of the button\n- `\u003cbc-pay-button/\u003e` - launches the Bitcoin Connect Payment Modal on click\n  - Arguments:\n    - `invoice` - BOLT11 invoice. Modal will only open if an invoice is set\n    - `payment-methods` (optional) \"all\" | \"external\" | \"internal\"\n    - `title` - (optional) change the title of the button\n    - `preimage` - (optional) set this if you received an external payment\n  - Events:\n    - `click` - fires when the button is clicked. You can load an invoice here and set it on the button using `setAttribute('invoice', 'lnbc...')` which will then automatically launch the modal\n    - `bc:onpaid` - fires event with WebLN payment response in `event.detail` (contains `preimage`)\n- `\u003cbc-connect/\u003e` - render connect wallet UI without modal\n- `\u003cbc-payment/\u003e` - render a payment request UI without modal\n  - Arguments:\n    - `invoice` - BOLT11 invoice\n    - `payment-methods` (optional) \"all\" | \"external\" | \"internal\"\n    - `paid` - **Experimental** set to true to mark payment was made externally (This will change to `preimage` in v4)\n  - Events:\n    - `bc:onpaid` - fires event with WebLN payment response in `event.detail` (contains `preimage`)\n\n### Bitcoin Connect API\n\n#### Initializing Bitcoin Connect\n\n```ts\nimport {init} from '@getalby/bitcoin-connect-react';\n\n// Initialize Bitcoin Connect\ninit({\n  appName: 'My Lightning App', // your app name\n  // filters: [\"nwc\"],\n  // showBalance: true,\n  // persistConnection: true, // if false, connection will not be saved to local storage\n  // providerConfig: {\n  //   nwc: {\n  //     authorizationUrlOptions: {\n  //       requestMethods: ['get_balance', 'make_invoice', 'lookup_invoice'],\n  //     },\n  //   },\n  // }\n});\n```\n\n- `appName` - Name of the app requesting access to wallet. Currently used for NWC connections (e.g. Alby Hub)\n- `filters` - Filter the type of connectors you want to show. Example: \"nwc\" (only show NWC connectors).\n- `showBalance` - If false, do not request the connected wallet's balance\n- `autoConnect` - If false, prevent automatically connect to a user's NWC wallet when the page load. NWC connection URL is passed as a hash `nwc` parameter (URL encoded). Example: `https://myapp.com/#/?nwc=nostr%2Bwalletconnect%3A%2F%2F...`\n- `providerConfig` - **Experimental**: add provider-specific configuration (for NWC, LNC, LNbits etc). Currently only `nwc.authorizationUrlOptions` is supported. `NWCAuthorizationUrlOptions` can be found in the [Alby JS SDK](https://github.com/getAlby/js-sdk).\n\n#### Requesting a provider\n\nWith one line of code you can ensure you have a WebLN provider available and ready to use. If one is not available, the Bitcoin connect modal will be launched. This should be called on a user interaction to avoid the modal unexpectedly being shown to the user.\n\n```ts\nimport {requestProvider} from '@getalby/bitcoin-connect';\n\nconst provider = await requestProvider();\nawait provider.sendPayment('lnbc...');\n```\n\n#### Programmatically launching the modal\n\nThe modal can then be launched with:\n\n```ts\nimport {launchModal} from '@getalby/bitcoin-connect';\n\nlaunchModal(); // A `\u003cbc-modal/\u003e` element will be injected into the DOM\n```\n\n#### Programmatically launching the modal to receive a payment\n\nTo receive a payment the modal can be programmatically opened with:\n\n```ts\nimport {launchPaymentModal} from '@getalby/bitcoin-connect';\n\nconst {setPaid} = launchPaymentModal({\n  invoice: 'lnbc...',\n  //paymentMethods: \"all\" // \"all\" | \"external\" | \"internal\"\n  onPaid: (response) =\u003e {\n    clearInterval(checkPaymentInterval);\n    alert('Received payment! ' + response.preimage);\n  },\n  onCancelled: () =\u003e {\n    clearInterval(checkPaymentInterval);\n    alert('Payment cancelled');\n  },\n});\n\n// below is an example of LNURL-verify from https://github.com/getAlby/js-lightning-tools\n// you can write your own polling function to check if your invoice has been paid\n// and then call the `setPaid` function.\nconst checkPaymentInterval = setInterval(async () =\u003e {\n  // Make sure your verifyPayment function ONLY verifies the payment.\n  // If there are any side effects they will only happen when the payment is made externally.\n  const paid = await invoice.verifyPayment();\n\n  if (paid \u0026\u0026 invoice.preimage) {\n    setPaid({\n      preimage: invoice.preimage,\n    });\n  }\n}, 1000);\n```\n\n\u003e Note: for P2P payments made externally there is no way for Bitcoin Connect to know when the payment has happened. `launchPaymentModal` is more for simplifying e-commerce usecases where you are able to check the invoice yourself.\n\n#### Programmatically closing the modal\n\n```ts\nimport {closeModal} from '@getalby/bitcoin-connect';\n\ncloseModal();\n```\n\n#### Connect to a user's wallet\n\n```ts\nimport {connect} from '@getalby/bitcoin-connect';\n\nconnect({\n  connectorName: 'NWC',\n  connectorType: 'nwc.generic',\n  nwcUrl: 'nostr+walletconnect://...',\n});\n```\n\n#### Connect to a user's NWC wallet\n\n```ts\nimport {connectNWC} from '@getalby/bitcoin-connect';\n\nconnectNWC('nostr+walletconnect://...');\n```\n\n#### Disconnect from wallet\n\n```ts\nimport {disconnect} from '@getalby/bitcoin-connect';\n\ndisconnect();\n```\n\n#### Get connector config\n\nReturns the saved configuration of the currently-connected connector (if connected)\n\n```ts\nimport {getConnectorConfig} from '@getalby/bitcoin-connect';\n\nconst connectorConfig = getConnectorConfig();\nif (connectorConfig) {\n  // can now access e.g. connectorConfig.connectorName\n}\n```\n\n#### Refresh balance\n\nProgrammatically trigger a balance refresh for all `\u003cbc-balance\u003e` components on the page. Useful after making a payment or receiving funds to update the displayed balance.\n\n```ts\nimport {refreshBalance} from '@getalby/bitcoin-connect';\n\nrefreshBalance();\n```\n\n#### Events\n\n##### onConnected\n\nThis event fires when a WebLN provider is made available.\n\n- When a user connects for the first time\n- On page reload when a user has previously connected\n\n```ts\nimport {onConnected} from '@getalby/bitcoin-connect';\n\nconst unsub = onConnected(async (provider) =\u003e {\n  const {preimage} = await provider.sendPayment('lnbc...');\n});\nunsub();\n```\n\n##### onConnecting\n\nThis event fires when a WebLN provider is initializing.\n\n- When a user connects for the first time\n- On page reload when a user has previously connected\n\n```ts\nimport {onConnecting} from '@getalby/bitcoin-connect';\n\nconst unsub = onConnecting(async () =\u003e {\n  // do something...\n});\nunsub();\n```\n\n##### onDisconnected\n\nThis event fires when the user manually disconnects from Bitcoin Connect.\n\n```ts\nimport {onDisconnected} from '@getalby/bitcoin-connect';\n\nconst unsub = onDisconnected(async () =\u003e {\n  // do something...\n});\nunsub();\n```\n\n##### onModalOpened\n\nThis event fires when the Bitcoin Connect modal opens.\n\n```ts\nimport {onModalOpened} from '@getalby/bitcoin-connect';\n\nconst unsub = onModalOpened(async () =\u003e {\n  // do something...\n});\nunsub();\n```\n\n##### onModalClosed\n\nThis event fires when the Bitcoin Connect modal closes.\n\n```ts\nimport {onModalClosed} from '@getalby/bitcoin-connect';\n\nconst unsub = onModalClosed(async () =\u003e {\n  // do something...\n});\nunsub();\n```\n\n### WebLN global object\n\n\u003e WARNING: webln is no longer injected into the window object by default. If you need this, execute the following code:\n\n```ts\nimport {onConnected} from '@getalby/bitcoin-connect';\n\nonConnected((provider) =\u003e {\n  window.webln = provider;\n});\n```\n\n_More methods coming soon. Is something missing that you'd need? let us know!_\n\n### Styling\n\nThese variables must be set at the root or on a container element wrapping any bitcoin connect components.\n\n```css\nhtml {\n  --bc-color-brand: #196ce7;\n  --bc-color-brand-dark: #3994ff; /* use a different brand color in dark mode */\n  --bc-brand-mix: 100%; /* how much to mix the brand color with default foreground color */\n  --bc-color-brand-button-text: #ffffff; /* override text color for primary button. Normally this is based on the luminance of the brand color */\n  --bc-color-brand-button-text-dark: #ffffff; /* override text color for primary button in dark mode. Normally this is based on the luminance of the brand color in dark mode */\n}\n```\n\n\u003e 💡 using near-white or black brand colors? either set a lower `bc-brand-mix` or make sure to use an off-white for `bc-color-brand` and off-black for `bc-color-brand-dark` to avoid conflicts with the modal background color.\n\n### Fonts\n\nBy default Bitcoin Connect does not use custom fonts for reduced footprint and privacy, however custom fonts can be used by providing CSS for the `Inter` (sans serif) and `Roboto Mono` (monospace) families. For example in the head section of your HTML:\n\n```html\n\u003clink rel=\"preconnect\" href=\"https://fonts.googleapis.com\" /\u003e\n\u003clink rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin /\u003e\n\u003clink\n  href=\"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700\u0026display=swap\"\n  rel=\"stylesheet\"\n/\u003e\n\u003clink\n  href=\"https://fonts.googleapis.com/css2?family=Roboto Mono:wght@400;500;600;700\u0026display=swap\"\n  rel=\"stylesheet\"\n/\u003e\n```\n\n### Dark mode\n\n#### Automatic (Recommended)\n\nBitcoin Connect uses `prefers-color-scheme` to automatically detect light/dark mode.\n\n#### Manual\n\nIn case your site uses a manual theme switcher, you can force a theme by following these steps:\n\n\u003e see an example [here](./dev/vite/index.html)\n\n1. set `globalThis.bcDarkMode = \"class\"` **before** any bitcoin connect components are rendered\n2. `\"dark\"` must be added as a classname to the document to enable dark mode (e.g. `\u003chtml class=\"dark\"\u003e` or `document.documentElement.classList.add('dark')`) otherwise light mode will be forced.\n\n## Access to underlying providers (NWC, LNC etc.)\n\n\u003e Note: [WebLN Types](https://github.com/WebBTC/webln-types) is required for type definitions.\n\n```ts\nimport { WebLNProviders, requestProvider } from \"@getalby/bitcoin-connect\";\n\nconst provider = await requestProvider();\n\nif (provider instanceof WebLNProviders.NostrWebLNProvider) {\n  provider.client.nostrWalletConnectUrl;\n}\n\nif (provider instanceof WebLNProviders.LNCWebLNProvider) {\n  provider.lnc.lnd.lightning.listInvoices(...);\n}\n\nif (provider instanceof WebLNProviders.LnbitsWebLNProvider) {\n  provider.requestLnbits('GET', '/api/v1/wallet');\n}\n```\n\n## Demos\n\n### Pure HTML Demo\n\nSee [Pure HTML](./demos/html/README.md)\n\n\u003e [Example codepen](https://codepen.io/rolznz/pen/VwgNajr)\n\nFor a more full example, see [dev/vite/index.html](./dev/vite/index.html) which can be run by following the development instructions below.\n\n### React Demo\n\nSee [React](./demos/react/README.md)\n\n#### Example Replits\n\n\u003e [Pay invoice to a Lightning Address](https://replit.com/@getalby/Bitcoin-Connect-Donation-Demo)\n\n\u003e [Pay on an E-Commerce](https://replit.com/@getalby/Bitcoin-Connect-ECommerce-Demo)\n\n#### NextJS (App Router)\n\nSee [NextJS](./demos/nextjs/README.md)\n\n#### NextJS Legacy (Pages Directory)\n\nSee [NextJS Legacy](./demos/nextjs-legacy/README.md)\n\n### More demos\n\nOpen [demos](demos/README.md)\n\n## 🛠️ Development\n\n### Install\n\nRun `yarn install \u0026\u0026 (cd dev/vite \u0026\u0026 yarn install)`\n\n### Run Vite\n\nRun `yarn dev`\n\n### Other dev options\n\nOpen [dev](dev/README.md)\n\n### Production Build\n\n`yarn build`\n\n### Testing\n\n`yarn test`\n\n## Need help?\n\nWe are happy to help, please contact us or create an issue.\n\n- [Twitter: @getAlby](https://twitter.com/getAlby)\n- [Telegram group](https://t.me/getAlby)\n- support at getalby.com\n- [bitcoin.design](https://bitcoin.design/) Discord community (find us on the #alby channel)\n- Read the [Alby developer guide](https://guides.getalby.com/overall-guide/alby-for-developers/getting-started) to better understand how Alby packages and APIs can be used to power your app.\n\n## FAQ\n\n### How does it work?\n\nBitcoin Connect provides multiple options to the user to connect to a lightning wallet, each compatible with WebLN. Any already-existing providers of WebLN (such as an installed WebLN extension like Alby) are detected and offered, as well as options to create a new WebLN provider through protocols such as NWC. No matter which option you choose, a WebLN provider will become available for the website to use to interact with your lightning wallet. Similar to the Alby extension, new options (called Connectors) can be easily added as they all follow a common, simple interface. As long as there is a way to connect to a lightning wallet through Javascript, a connector can be created for it in Bitcoin Connect. We welcome any and all contributions for new connectors!\n\n### Does this work on mobile browsers and mobile PWAs, or desktop browsers without a WebLN extension?\n\nYes! that's the main benefit.\n\n### Does it work with a desktop extension enabled?\n\nYes. It will use the desktop extension as the default connector if it exists.\n\n### Can I connect it to my mobile wallet?\n\nThat depends. The connection to your lightning node / wallet needs to be asynchronous so that you can use Bitcoin Connect natively on mobile websites or PWAs.\n\n### Can a user connect any lightning wallet?\n\nIt will only work for the connectors that are shown in the modal. Some of these connectors (e.g. the Alby Browser Extension) allow to connect multiple wallets themselves. Feel free to contribute to add a new connector.\n\n### Does it \"remember\" the user if they leave the page or close the browser?\n\nYes. Your connection is saved to localStorage\n\n### Is this safe?\n\nYou should have a certain level of trust on the website you decide to connect your wallet with, and that they ensure there is no malicious third-party scripts which would intend to read the wallet connection configuration, either from memory or storage. We heavily recommend to add [CSP rules](https://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.html) to your site and follow [best practices](https://cheatsheetseries.owasp.org/cheatsheets/Cross_Site_Scripting_Prevention_Cheat_Sheet.html) to prevent XSS.\n\nConnectors with budget controls or confirmation dialogs (Alby extension or NWC) are recommended so you have full control over your connection.\n\n### What are the high level things I need to do to add this to my site?\n\n1. add the \"Connect Wallet\" button\n2. wait for a connection event (using window.addEventListener) and then request to pay the invoice with window.webln\n\n### What connectors are supported?\n\n- [Alby Browser Extension](https://getalby.com) / [WebLN](https://webln.guide/)\n- [Alby Hub](https://albyhub.com)\n- [CoinOS](https://coinos.io)\n- [LNC](https://github.com/lightninglabs/lightning-node-connect)\n- [LNbits](https://lnbits.com/)\n- [Generic NWC URL](https://github.com/nostr-protocol/nips/blob/master/47.md)\n\n### If a user pays with another wallet why does the modal stay open?\n\nBitcoin Connect cannot detect payments made externally. It's up to your app to detect the payment and then programmatically close the modal using the exposed `closeModal` function.\n\n### Why is window.webln not set after connecting?\n\nThe global `window.webln` object can be overridden if there are multiple providers, leading to unexpected behaviour. We recommend using the `requestProvider` function to obtain a WebLN provider instead of relying on the global window object.\n\n### Why does Bitcoin Connect not work on some pages?\n\nBitcoin Connect must be imported at the root component or on every component that requires webln to ensure webln is available. If you only import the button in your settings page, you'll still need to import the library where you want to make a lightning payment. We recommend using the `requestProvider` function.\n\n## Known Issues\n\n- NWC connectors do not work on iOS in non-secure contexts because window.crypto.subtle is unavailable. If testing on your phone, please run an https server or use an https tunnel.\n\n## 🔥 Lit\n\nThis project is powered by Lit.\n\nSee [Get started](https://lit.dev/docs/getting-started/) on the Lit site for more information.\n\n## License\n\n[MIT](./LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetalby%2Fbitcoin-connect","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgetalby%2Fbitcoin-connect","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgetalby%2Fbitcoin-connect/lists"}