Protocol specifications
Understand how TON Connect works under the hood.
Who is this section for?
- If you implement a wallet
- If you develop an SDK
- If you want to learn how TON Connect works
Sections overview
- Protocol workflows is an overview of all the protocols involved in TON Connect.
- Bridge API specifies how the data is transmitted between the app and the wallet.
- Session protocol ensures end-to-end encrypted communication over the bridge.
- Requests protocol defines requests and responses for the app and the wallet.
- Wallet guidelines defines guidelines for wallet developers.
FAQ
I am building an HTML/JS app, what should I read?
Simply use the Supported SDKs and do not worry about the underlying protocols.
I need an SDK in my favorite language
Please take the JS SDK as a reference and check out the protocol docs above.
How do you detect whether the app is embedded in the wallet?
JS SDK does that for you; just get wallets list connector.getWallets()
and check embedded
property of the corresponding list item. If you build your own SDK you should check window.[targetWalletJsBridgeKey].tonconnect.isWalletBrowser
.
How do you detect if the wallet is a browser extension?
Like with embedded apps (see above), JS SDK detects it for you via injected
property of the corresponding connector.getWallets()
list item. If you build your own SDK you should check that window.[targetWalletJsBridgeKey].tonconnect
exists.
How to implement backend authorization with tonconnect?
See an example of dapp-backend
How do I make my own bridge?
You don’t need to, unless you are building a wallet.
If you build a wallet, you will need to provide a bridge. See our reference implementation in Go.
Keep in mind that the wallet’s side of the bridge API is not mandated.
For a quick start you can use the common TON Connect bridge github.com/ton-connect/bridge2.
I make a wallet, how do I add it to the list of wallets?
Submit a pull request for the wallets-list repository and fill our all the necessary metadata.
Apps may also add wallets directly through the SDK.