Once an application has detected the provider, it can then request to connect to Phantom by invoking the requestAccounts method. This connection request will prompt the user for permission to share their Bitcoin addresses, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as signing a message or sending a transaction.The requestAccounts method returns a Promise that resolves if the user approves the connection request. Once resolved, it contains an array of the user’s BtcAccount objects. If the user declines the request or closes the pop-up, it will reject (throw when awaited).The array of BtcAccount objects represent the possible addresses that can be used when a user connects with Phantom. This is defined as:
publicKey: A hex string representing the bytes of the public key of the account.
purpose: The general purpose of the address. If ordinals, the user prefers to store Ordinals on this address. If payment, the user prefers to store bitcoin on this address.
The purpose fields represent user preferences and do not represent a guarantee that there will only be Bitcoin on payment addresses or only Ordinals on ordinals addresses. When submitting a transaction, make sure to carefully select UTXOs such that you do not cause the user to accidentally spend a rare or inscribed satoshi.
The following is an example of how to connect to Phantom:
There is no way for dapps to programmatically disconnect a user. Once a user has established a connection, Phantom will add the website they opened a connection with to a list of Connected Apps. When a user returns to one of these whitelisted sites, Phantom will attempt to reconnect the application automatically. At any time, the user can revoke access to the dapp through their UI by navigating to Settings > Connected Apps. If a user disconnects from a dapp, they will need to reconnect on the subsequent visit before signing a message or sending a transaction.
Phantom allows users to manage multiple accounts from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an accountsChanged event.
If Phantom passes an empty array on accountsChanged, it implies that the user has switched to an account that has not connected to the dapp before (that is, not already in Connected Apps) or does not support Bitcoin (for example, a Solana private key account). In this case, the application can either do nothing or attempt to reconnect:
phantomProvider.on('accountsChanged', (accounts: BtcAccount[]) => { if (accounts.length > 0) { // Set new address and continue as usual } else { // Attempt to reconnect to Phantom phantomProvider.requestAccounts().catch((error) => { // handle connection failure }); }});
Was this page helpful?
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Phantom developer documentation","description":"Phantom is a crypto wallet that can be used to manage digital assets and access decentralized apps on multiple blockchains.","colors":{"primary":"#AB9FF2","light":"#AB9FF2","dark":"#AB9FF2"},"logo":{"light":"https://mintcdn.com/phantom-e50e2e68/tU9g5MXFXgx4l6Em/logo/phantom-light.svg?fit=max\u0026auto=format\u0026n=tU9g5MXFXgx4l6Em\u0026q=85\u0026s=e900bab5ae2cffa45148551c3678ce46","dark":"https://mintcdn.com/phantom-e50e2e68/tU9g5MXFXgx4l6Em/logo/phantom-dark.svg?fit=max\u0026auto=format\u0026n=tU9g5MXFXgx4l6Em\u0026q=85\u0026s=eff6d20e74e8315e9c4a8deb0cf9da15"},"favicon":"https://mintcdn.com/phantom-e50e2e68/tU9g5MXFXgx4l6Em/favicon.svg?fit=max\u0026auto=format\u0026n=tU9g5MXFXgx4l6Em\u0026q=85\u0026s=c951a8095deaeea8c05a37884471cede","background":{"color":{"dark":"#202020"}},"navbar":{"links":[{"href":"https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform","label":"Support"}],"primary":{"type":"button","label":"Download Phantom","href":"https://phantom.app/download"}},"footer":{"socials":{"website":"https://phantom.com","github":"https://github.com/phantom"}},"errors":{"404":{"redirect":false,"title":"Page Not Found","description":"The page you're looking for may have been moved, renamed, or doesn't exist. Here are some helpful resources:\n\n\u003cCardGroup cols={2}>\n \u003cCard title=\"Introduction\" icon=\"book-open\" href=\"/introduction\">\n Start here to learn about Phantom wallet integration\n \u003c/Card>\n \u003cCard title=\"Phantom Connect\" icon=\"link\" href=\"/phantom-connect\">\n Enable users to connect using Social Login or browser extension\n \u003c/Card>\n \u003cCard title=\"SDK Overview\" icon=\"code\" href=\"/wallet-sdks-overview\">\n Choose the right SDK for your application\n \u003c/Card>\n \u003cCard title=\"FAQ\" icon=\"circle-question\" href=\"/resources/faq\">\n Find answers to common questions\n \u003c/Card>\n \u003cCard title=\"Support\" icon=\"life-ring\" href=\"https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform\">\n Get help from our developer support team\n \u003c/Card>\n\u003c/CardGroup>"}},"contextual":{"options":["claude","copy","view","mcp","cursor","vscode"],"display":"header"},"styling":{"latex":true},"navigation":{"global":{"anchors":[{"anchor":"Announcements","icon":"telegram","href":"https://t.me/+R0vUw_QWSO9lNjlh"},{"anchor":"Support","icon":"life-ring","href":"https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform"},{"anchor":"GitHub","icon":"github","href":"https://github.com/phantom"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"phantom-e50e2e68","hasAudioNarration":false,"actualSubdomain":"phantom-e50e2e68","customDomains":["docs.phantom.com"],"gitSource":{"type":"github","owner":"phantom","repo":"docs-v2","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6ae25b47d4516c241b00d91c","collectionId":"fae98940-fdf4-4dbc-9cab-417e0d517bf0","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6ae25b47d4516c241b00d91c"},"feedback":{"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"REMOVE_BRANDING":{"status":"ENABLED"},"CONTEXTUAL_FEEDBACK":{"status":"ENABLED"},"CODE_SNIPPET_FEEDBACK":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6ae25b47d4516c241b00d91c","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"Developer tools and resources","count":79},{"language":"default","tag":"Traditional Provider","count":37},{"language":"default","tag":"Phantom Connect SDKs","count":23},{"language":"default","tag":"Recipes","count":23},{"language":"default","tag":"EVM networks","count":19},{"language":"default","tag":"Mobile Deep Links","count":16},{"language":"default","tag":"Provider API Reference","count":14},{"language":"default","tag":"Guides","count":10},{"language":"default","tag":"Overview","count":9},{"language":"default","tag":"Phantom Portal","count":8}]},"assistantConfig":{"enableStarterQuestions":false},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[],"page":{"pagePath":"bitcoin/establishing-a-connection","slug":"/bitcoin/establishing-a-connection","pageMetadata":{"title":"Establish a connection","description":"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.","href":"/bitcoin/establishing-a-connection"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,OptimizedImage,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!OptimizedImage)_missingMdxReference(`OptimizedImage`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(Warning,{children:_jsx(_components.p,{children:_jsxs(_components.strong,{children:[`The `,_jsx(_components.code,{children:`window.phantom.bitcoin`}),` provider has been deprecated.`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`connect`,children:`Connect`}),`\n`,_jsxs(_components.p,{children:[`Once an application has `,_jsx(_components.a,{href:`/bitcoin/detecting-the-provider`,children:`detected the provider`}),`, it can then request to connect to Phantom by invoking the `,_jsx(_components.code,{children:`requestAccounts`}),` method. This connection request will prompt the user for permission to share their Bitcoin addresses, indicating that they are willing to interact further. Users must approve a connection request before the app can make additional requests such as `,_jsx(_components.a,{href:`/bitcoin/signing-a-message`,children:`signing a message`}),` or `,_jsx(_components.a,{href:`/bitcoin/sending-a-transaction`,children:`sending a transaction`}),`.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=6ff8c7c5334f943fb9d60e618a16d289`,alt:`Phantom popup triggered when user connects to an app for the first time`,\"data-og-width\":`2000`,width:`2000`,\"data-og-height\":`3369`,height:`3369`,\"data-path\":`bitcoin/images/establishing-a-connection.webp`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=280\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=7d8aa1ec5b06a7bed8a3acda4a851796 280w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=560\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=ffb3a27aba436f43b9dfdb3ff4512bbf 560w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=840\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=f265db176efd9369b3e781e8641727ce 840w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=1100\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=6d71b550b10bc1fe0b1aa9d7d71a5741 1100w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=1650\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=87f995153f26f82b9817253763f5f79a 1650w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/establishing-a-connection.webp?w=2500\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=a9ec7d8cd43f13d734203634013adf17 2500w`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`requestAccounts`}),` method returns a `,_jsx(_components.a,{href:`https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise`,children:`Promise`}),` that resolves if the user approves the connection request. Once resolved, it contains an array of the user’s `,_jsx(_components.code,{children:`BtcAccount`}),` objects. If the user declines the request or closes the pop-up, it will reject (throw when awaited).`]}),`\n`,_jsxs(_components.p,{children:[`The array of `,_jsx(_components.code,{children:`BtcAccount`}),` objects represent the possible addresses that can be used when a user connects with Phantom. This is defined as:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`type`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` BtcAccount`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` address`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` addressType`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"p2tr\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"p2wpkh\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"p2sh\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"p2pkh\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` publicKey`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:` string`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:` purpose`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"payment\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` |`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"ordinals\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`;`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`};`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Where:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`address`}),`: The Bitcoin address owned by the user.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`addressType`}),`: The address’s format. For details, see `,_jsx(_components.a,{href:`https://bitcoin.design/guide/glossary/address/`,children:`Bitcoin Design Glossary`}),`.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`publicKey`}),`: A hex string representing the bytes of the public key of the account.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.code,{children:`purpose`}),`: The general purpose of the address. If `,_jsx(_components.code,{children:`ordinals`}),`, the user prefers to store Ordinals on this address. If `,_jsx(_components.code,{children:`payment`}),`, the user prefers to store bitcoin on this address.`]}),`\n`]}),`\n`,_jsx(Warning,{children:_jsxs(_components.p,{children:[`The purpose fields represent user preferences and do not represent a guarantee that there will only be Bitcoin on `,_jsx(_components.code,{children:`payment`}),` addresses or only Ordinals on `,_jsx(_components.code,{children:`ordinals`}),` addresses. When submitting a transaction, make sure to carefully select UTXOs such that you do not cause the user to accidentally spend a rare or inscribed satoshi.`]})}),`\n`,_jsx(_components.p,{children:`The following is an example of how to connect to Phantom:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`20`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`20`,children:[_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` phantomProvider`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` getProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(); `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// see \"Detecting the Provider\"`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`const`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4FC1FF`},children:` accounts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` =`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` await`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` phantomProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`requestAccounts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`();`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`accounts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/**`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`[`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"address\": \"bc1phajtersv55fwud5xr0t70p5234swy396a6avqhuny0qf83zssvrsm7tl4q\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"publicKey\": \"02435c68c1f20522946e46bcc39f8a19088095939db840e874e1ad2c18f0f2361c\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"addressType\": \"p2tr\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"purpose\": \"ordinals\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` },`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` {`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"address\": \"bc1qqy4emmf7q623vlf2z4j3pvgfyjkaffx2u3fkpk\",`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"publicKey\": \"0279f5b4123030accae6c4ca9a17263753a21df2142bbf0ced940d28ca613e87f9\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"addressType\": \"p2wpkh\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` \"purpose\": \"payment\"`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`]`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`**/`})}),`\n`]})})}),`\n`,_jsx(Heading,{level:`2`,id:`disconnect`,children:`Disconnect`}),`\n`,_jsxs(_components.p,{children:[`There is no way for dapps to programmatically disconnect a user. Once a user has established a connection, Phantom will add the website they opened a connection with to a list of `,_jsx(_components.strong,{children:`Connected Apps`}),`. When a user returns to one of these whitelisted sites, Phantom will attempt to reconnect the application automatically. At any time, the user can revoke access to the dapp through their UI by navigating to `,_jsx(_components.strong,{children:`Settings`}),` > `,_jsx(_components.strong,{children:`Connected Apps`}),`. If a user disconnects from a dapp, they will need to reconnect on the subsequent visit before signing a message or sending a transaction.`]}),`\n`,_jsx(OptimizedImage,{src:`https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=79c8fb1d273f35ff54ff73e3c1c7da43`,alt:`Disconnecting a dApp in Connected Apps settings in Phantom extension`,\"data-og-width\":`2000`,width:`2000`,\"data-og-height\":`3319`,height:`3319`,\"data-path\":`bitcoin/images/disconnect.png`,\"data-optimize\":`true`,\"data-opv\":`3`,srcset:`https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=280\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=ac64cd86bb7f6f1de30fbf72abd390c8 280w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=560\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=5813fb224c54c5ddf20762a92ec5e9f3 560w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=840\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=2154610df347c53801ca4656b18060dd 840w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=1100\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=fb86b95e8fd53d13d7c2af01597ce020 1100w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=1650\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=50cb44f07f1470de7b0978005babe2b2 1650w, https://mintcdn.com/phantom-e50e2e68/fkWrmnMWhjoXSGZ9/bitcoin/images/disconnect.png?w=2500\u0026fit=max\u0026auto=format\u0026n=fkWrmnMWhjoXSGZ9\u0026q=85\u0026s=806a2ab1137c59180e48e8518d3838b5 2500w`}),`\n`,_jsx(Heading,{level:`2`,id:`change-accounts`,children:`Change accounts`}),`\n`,_jsxs(_components.p,{children:[`Phantom allows users to manage multiple accounts from within a single extension or mobile app. Whenever a user switches accounts, Phantom will emit an `,_jsx(_components.code,{children:`accountsChanged`}),` event.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`phantomProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'accountsChanged'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`accounts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` BtcAccount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[]) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` console`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`log`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'Accounts changed:'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`accounts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`);`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If Phantom passes an empty array on `,_jsx(_components.code,{children:`accountsChanged`}),`, it implies that the user has switched to an account that has not connected to the dapp before (that is, not already in `,_jsx(_components.strong,{children:`Connected Apps`}),`) or does not support Bitcoin (for example, a Solana private key account). In this case, the application can either do nothing or attempt to reconnect:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`10`,language:`typescript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`typescript`,children:_jsxs(_components.code,{language:`typescript`,numberOfLines:`10`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`phantomProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`on`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`'accountsChanged'`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, (`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`accounts`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`:`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` BtcAccount`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`[]) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:` if`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` (`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`accounts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#9CDCFE`},children:`length`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:` >`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#B5CEA8`},children:` 0`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Set new address and continue as usual`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` } `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`else`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // Attempt to reconnect to Phantom`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` phantomProvider`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`requestAccounts`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`().`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`catch`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`((`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#9CDCFE`},children:`error`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`=>`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // handle connection failure`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` });`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`});`})}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Establish a connection","description":"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.","href":"/bitcoin/establishing-a-connection"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Connect","slug":"connect","depth":2,"children":[]},{"title":"Disconnect","slug":"disconnect","depth":2,"children":[]},{"title":"Change accounts","slug":"change-accounts","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/phantom-e50e2e68/f7f937fb83d93950/analytics.js"],"subdomain":"phantom-e50e2e68","siteName":"Phantom developer documentation","title":"Establish a connection - Phantom developer documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-06-17T19:10:14.040Z","originalFileLocation":"bitcoin/establishing-a-connection.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Phantom developer documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Establish a connection - Phantom developer documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Phantom developer documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.phantom.com/bitcoin/establishing-a-connection\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://phantom-e50e2e68.mintlify.app/_mintlify/api/og/v2?division=Bitcoin\u0026amp;title=Establish+a+connection\u0026amp;description=Connect+your+Bitcoin+or+Ordinals+app+to+Phantom+by+requesting+user+permission+to+share+their+Bitcoin+addresses.\u0026amp;theme=21774f1aff2cf2b99aaf4a99\u0026amp;signature=bb0cd3e0742ed2a91a0ff4e0ac7d7ea9c19264a0862717b4e25addd7e981abf3\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Establish a connection - Phantom developer documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://phantom-e50e2e68.mintlify.app/_mintlify/api/og/v2?division=Bitcoin\u0026amp;title=Establish+a+connection\u0026amp;description=Connect+your+Bitcoin+or+Ordinals+app+to+Phantom+by+requesting+user+permission+to+share+their+Bitcoin+addresses.\u0026amp;theme=21774f1aff2cf2b99aaf4a99\u0026amp;signature=bb0cd3e0742ed2a91a0ff4e0ac7d7ea9c19264a0862717b4e25addd7e981abf3\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/phantom-e50e2e68/AbWha2SN5Sn1jyjl/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Phantom developer documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#AB9FF2\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.phantom.com/bitcoin/establishing-a-connection\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/bitcoin/establishing-a-connection.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.phantom.com/#organization\",\"name\":\"Phantom developer documentation\",\"url\":\"https://docs.phantom.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/phantom-e50e2e68/tU9g5MXFXgx4l6Em/logo/phantom-light.svg?fit=max\u0026auto=format\u0026n=tU9g5MXFXgx4l6Em\u0026q=85\u0026s=e900bab5ae2cffa45148551c3678ce46\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.phantom.com#website\",\"name\":\"Phantom developer documentation\",\"url\":\"https://docs.phantom.com\",\"publisher\":{\"@id\":\"https://docs.phantom.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.phantom.com/bitcoin/establishing-a-connection#webpage\",\"url\":\"https://docs.phantom.com/bitcoin/establishing-a-connection\",\"name\":\"Establish a connection\",\"description\":\"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\",\"dateModified\":\"2026-06-17T19:10:14.040Z\",\"isPartOf\":{\"@id\":\"https://docs.phantom.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.phantom.com/bitcoin/establishing-a-connection#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.phantom.com/bitcoin/establishing-a-connection#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Traditional Provider\",\"item\":\"https://docs.phantom.com/solana/integrating-phantom\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Bitcoin\",\"item\":\"https://docs.phantom.com/bitcoin/integrating-phantom\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Establish a connection\",\"item\":\"https://docs.phantom.com/bitcoin/establishing-a-connection\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.phantom.com/bitcoin/establishing-a-connection#article\",\"headline\":\"Establish a connection\",\"name\":\"Establish a connection\",\"description\":\"Connect your Bitcoin or Ordinals app to Phantom by requesting user permission to share their Bitcoin addresses.\",\"url\":\"https://docs.phantom.com/bitcoin/establishing-a-connection\",\"mainEntityOfPage\":{\"@id\":\"https://docs.phantom.com/bitcoin/establishing-a-connection#webpage\"},\"dateModified\":\"2026-06-17T19:10:14.040Z\",\"publisher\":{\"@id\":\"https://docs.phantom.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.phantom.com#website\"}}]}\u003c/script>","siteName":"Phantom developer documentation","nav":{"global":{"anchors":[{"anchor":"Announcements","icon":"telegram","href":"https://t.me/+R0vUw_QWSO9lNjlh"},{"anchor":"Support","icon":"life-ring","href":"https://docs.google.com/forms/d/e/1FAIpQLSeHWETFkEJbHQCF-lnl1AHmVQPuyfC0HbnxjDjIp6VYV1sBZQ/viewform"},{"anchor":"GitHub","icon":"github","href":"https://github.com/phantom"}]},"tabs":[{"tab":"Get started","pages":[{"title":"Get started","href":"/introduction"}]},{"tab":"Phantom MCP server","pages":[{"title":"Phantom MCP server","href":"/phantom-mcp-server"}]},{"tab":"Phantom CLI","pages":[{"title":"Phantom CLI","href":"/phantom-cli"}]},{"tab":"Phantom Connect SDKs","pages":[{"title":"Phantom Connect SDKs","href":"/wallet-sdks-overview"}]},{"tab":"Recipes","pages":[{"title":"Recipes","href":"/recipes"}]},{"tab":"Developer tools and resources","groups":[{"group":"Overview","pages":[{"title":"Developer tools and resources","href":"/developer-powertools/overview"}]},{"group":"Developer tools","icon":"wrench","pages":[{"title":"AI-assisted development","href":"/developer-powertools/ai-tools"},{"title":"Phantom Cursor plugin","href":"/resources/cursor-plugin"},{"title":"Cursor AI prompts","href":"/resources/cursor-prompts"},{"title":"Phantom Connect SDK MCP server","href":"/resources/mcp-server"}]},{"group":"Security and validation","icon":"shield","pages":[{"title":"Domain and transaction warnings","href":"/developer-powertools/domain-and-transaction-warnings"},{"title":"Transaction Validation","href":"/developer-powertools/lighthouse"},{"title":"Token pages","href":"/developer-powertools/token-pages"},{"title":"Sign-In-With (SIW) standards","href":"/developer-powertools/signing-a-message"},{"title":"Shortcuts","href":"/developer-powertools/shortcuts"}]},{"group":"Solana features","icon":"bolt","pages":[{"title":"Solana priority fees","href":"/developer-powertools/solana-priority-fees"},{"title":"Solana Versioned Transactions","href":"/developer-powertools/solana-versioned-transactions"},{"title":"Wallet Standard","href":"/developer-powertools/wallet-standard"},{"title":"Solana Token Extensions (Token22)","href":"/developer-powertools/solana-token-extensions-token22"}]},{"group":"Testing and debugging","icon":"bug","pages":[{"title":"Testnet mode","href":"/developer-powertools/testnet-mode"},{"title":"Mobile web debugging","href":"/developer-powertools/mobile-web-debugging"}]},{"group":"Best practices","icon":"star","pages":[{"title":"Go-live checklist","href":"/best-practices/launching-a-dapp"},{"title":"Display apps within dialogs","href":"/best-practices/displaying-your-app"},{"group":"Token display and verification","pages":[{"title":"Display tokens on Solana","href":"/best-practices/tokens/token-display"},{"title":"Fungibles","href":"/best-practices/tokens/home-tab-fungibles"},{"title":"NFTs and semi-fungibles","href":"/best-practices/tokens/collectibles-nfts-and-semi-fungibles"},{"title":"Supported media types","href":"/best-practices/tokens/supported-media-types"},{"title":"Make your token appear as verified","href":"/best-practices/tokens/token-verification"}]}]},{"group":"Resources","icon":"book-open","pages":[{"title":"FAQ","href":"/resources/faq"},{"title":"Demo apps","href":"/resources/sandbox"},{"title":"Logos and assets","href":"/resources/assets"}]},{"group":"Traditional Provider","icon":"puzzle-piece","pages":[{"group":"Solana","pages":[{"title":"Get started with Solana","href":"/solana/integrating-phantom"},{"title":"Detect the provider","href":"/solana/detecting-the-provider"},{"title":"Establish a connection","href":"/solana/establishing-a-connection"},{"title":"Sign a message","href":"/solana/signing-a-message"},{"title":"Send a legacy transaction","href":"/solana/sending-a-transaction"},{"title":"Send a versioned transaction","href":"/solana/sending-a-transaction-1"},{"title":"Error messages and codes","href":"/solana/errors"}]},{"group":"EVM networks","pages":[{"title":"Get started with EVM networks","href":"/ethereum-monad-testnet-base-and-polygon/getting-started"},{"title":"Detect the provider","href":"/ethereum-monad-testnet-base-and-polygon/detecting-the-provider"},{"title":"Establish a connection","href":"/ethereum-monad-testnet-base-and-polygon/establishing-a-connection"},{"title":"Sign a message","href":"/ethereum-monad-testnet-base-and-polygon/signing-a-message"},{"title":"Send a transaction","href":"/ethereum-monad-testnet-base-and-polygon/sending-a-transaction"},{"group":"Provider API Reference","pages":[{"title":"Provider API reference","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/README"},{"group":"Methods","pages":[{"title":"Methods","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/README"},{"title":"request","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/request"},{"title":"isConnected","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/methods/isconnected"}]},{"group":"Events","pages":[{"title":"Events","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/README"},{"title":"Connect","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/connect"},{"title":"Disconnect","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/disconnect"},{"title":"Accounts changed","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/accounts-changed"},{"title":"Chain changed","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/events/chain-changed"}]},{"group":"Properties","pages":[{"title":"Properties","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/README"},{"title":"isPhantom","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/isphantom"},{"title":"chainId","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/chainid"},{"title":"selectedAddress","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/selectedaddress"},{"title":"networkVersion","href":"/ethereum-monad-testnet-base-and-polygon/provider-api-reference/properties/networkversion"}]}]}]},{"group":"Bitcoin","tag":"Deprecated","pages":[{"title":"Get started with Bitcoin","href":"/bitcoin/integrating-phantom"},{"description":"To detect if a user has already installed Phantom, a web application should check for the existence of a phantom object.","title":"Detect the provider","href":"/bitcoin/detecting-the-provider"},{"title":"Establish a connection","href":"/bitcoin/establishing-a-connection"},{"title":"Sign a message","description":"Request message signatures from Bitcoin users through Phantom to verify address ownership without fees.","href":"/bitcoin/signing-a-message"},{"title":"Send a transaction","href":"/bitcoin/sending-a-transaction"},{"title":"Provider API reference","href":"/bitcoin/provider-api-reference"}]},{"group":"Sui","tag":"Deprecated","pages":[{"title":"Get started with Sui","href":"/sui/getting-started-with-sui"},{"title":"Detect the provider","href":"/sui/detecting-the-provider"},{"title":"Establish a connection","href":"/sui/establishing-a-connection"},{"title":"Sign a message","href":"/sui/signing-a-message"},{"title":"Send a transaction","href":"/sui/sending-a-transaction"}]}]},{"group":"Mobile Deep Links","icon":"mobile","pages":[{"title":"Phantom deep links","href":"/phantom-deeplinks/deeplinks-ios-and-android"},{"title":"Handle sessions","href":"/phantom-deeplinks/handling-sessions"},{"title":"Specifying redirects","href":"/phantom-deeplinks/specifying-redirects"},{"title":"Encryption","href":"/phantom-deeplinks/encryption"},{"title":"Limitations","href":"/phantom-deeplinks/limitations"},{"group":"Provider Methods","pages":[{"title":"Provider methods","href":"/phantom-deeplinks/provider-methods/README"},{"title":"Connect","href":"/phantom-deeplinks/provider-methods/connect"},{"title":"Disconnect","href":"/phantom-deeplinks/provider-methods/disconnect"},{"title":"SignAndSendTransaction (deprecated)","href":"/phantom-deeplinks/provider-methods/signandsendtransaction"},{"title":"SignTransaction","href":"/phantom-deeplinks/provider-methods/signtransaction"},{"title":"SignAllTransactions","href":"/phantom-deeplinks/provider-methods/signalltransactions"},{"title":"SignMessage","href":"/phantom-deeplinks/provider-methods/signmessage"}]},{"group":"Other Methods","pages":[{"title":"Other methods","href":"/phantom-deeplinks/other-methods/README"},{"title":"Browse","href":"/phantom-deeplinks/other-methods/browse"},{"title":"Fungible","href":"/phantom-deeplinks/other-methods/fungible"},{"title":"Swap","href":"/phantom-deeplinks/other-methods/swap"}]}]}]}]},"basePath":"","title":"Establish a connection - Phantom developer documentation","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":["a74be98ba7"],"chunks":["zoom-image-lightbox-B4-wUcHm.js","lightbox-handle-r17bVUz3.js"]}