🤖 Telegram bots & clients: 🛡️ Self-custody wallets & 👨👩👧👦 Multi-signature transactions
How to use Telegram as your ❤️🔥 hot wallet for signing Harmony transactions? Keep your private keys strictly 🛡️ on device – rather than on any bot server or even Telegram itself. How to extend the custody and the approval of Web3 & AI assets and governance to a 👨👩👧👦 social group as simply a multi-people chats?
Try our Telegram bot @HarmonyOneAIBot with ONE tokens: artistic QR codes, Stable Diffusion XL photorealism, voice meeting summarization. Come build with us!
Users WANT to access Web1 ∪ Web2 ∪ Web3… products via their choice of mobile chats, cloud spreadsheets, or domain profiles. With BUNDLING of 100+ AI and crypto services, I can make Midjourney images, chat with Forever Voices celebrities, and multi-sign Gnosis Safe cross-border payrolls on Telegram – via unified digital assets and social graphs on ONE chain.
Imagine this: Direct message with Telegram handle of our 🤖 @OneBot at t.me/OneBot to create wallets, sign transactions, or check portfolio – replacing 🦊 browser extension MetaMask, 📒 hardware ledgers, 🙈 on-device authentications, and 🔑 server-side passwords + passkeys. You can use phone short SMS messages, email addresses, browser clients, Google one-time-password OTP authenticators.
See demos of self-custodial wallets and single-channel chat clients on our Q3 roadmap (in progress)! Our collaborators at Common Prefix has published a prototype and a research paper on keyless wallets.
But how? Are fully on-device key generation, storage and signing via pure Javascript possible on Telegram? So non-custodial or self-custodial of everything while protected by Telegram’s phone-number login and second-factor passwords.
🌼 Features & limits
We are creating bots for image creation, news summarization, voice memos, fan chats. Why? Metering usage in ONE tokens and sharing accounts across 10+ AI products. Friends pay $1 to join small social groups. They tip each other’s AI actions with emoji reactions.
✅ Buy / trade 1.country domain NFTs, sign onchain records of Notion / Substack hostings
✅ Wallet Connect’s authentication and approval flows – via QR code or hex strings
✅ Uniswap’s exchanges of wallet assets, Radical pricing of domain auctions.
✅ Gnosis multisig, social recovery (Argent or 1Wallet-web) via chat groups
Also, we are building a Telegram web client for a single chat channel with Harmony AI bot. Now, extend or fork Telegram’s Web-K client in pure Javascript, similar to its Discussion Widget with minimal controls – so you can chat to generate images with Stable Diffusion / DreamStudio XL API. Possible?
❓End-to-end encryption (client-side only, non-custody storage) of private keys and messages against Telegram servers and bots?
❓ Limits of Javascript evaluation and client storage within Telegram client in a chat window? within a Telegram bot?
❓ How to store private keys / seed phrases locally – Javascript client storage, persistent state variables, message passing, application logic, custom callback data, Telegram Passport? Truly non-custodial, self-custodial, client-side only.
🛡️ Social Wallets & Security
Our wallets are designed with these following goals in mind on security.
1. Social (People)
Resilient. Funds are recoverable through time locks and multiple safety nets. No single point of failure such as thefts, cracks, loss, censorship or coercions is catastrophic.
Sufficient. All steps are well defined without delegating to hardware devices or seed phrases in safety boxes. Users do not need any passwords or rely on biometrics.
Anonymous. An account is a fresh cryptographic hash, not tied to existing systems or real-world identity. Derived paths support multiple public keys to protect privacy.
2. Smart (Code)
Composable. One-time or low-entropy passwords are useful for small funds. Multiple authentications can independently boost protection thresholds against brute-force.
On-chain. A decentralized network with high stakes and fast finality validates all transactions. Its platform has sustainable incentives and open governance to evolve.
Programmable. Operations can call third-party contracts, store history of states, or upgrade its code. Complex applications may use oracles of time, locations and events.
3. Hard (Math)
Self-Sovereign. No third parties, government documents, designated guardians, backup servers or hardware enclaves are necessary. Users have full custody and self control.
Air-Gapped. Key-loggers and man-in-the-middle attacks are minimized. The full parameters of transactions are easy to verify and approve without cables or cameras.
Verified. Trusted are only open source and hardened cryptography. Formal verification, through logical frameworks, assures end-to-end security beyond tests and audits.
🔐 From Dionysis Zindros's research paper "Keyless Cryptocurrency Wallets” and “Cassiopeia: Practical On-Chain Witness Encryption”: We put forth a keyless wallet, a cryptocurrency wallet in which money can be spent using a password alone, and no private keys are required. It requires a smart contract blockchain. We propose two schemes. In the first, the user sets a short wallet password and can spend their money at a prespecified maturity date using the password alone. Using this as a stepping stone, we propose a second scheme, in which the user uses an OTP authenticator seed to generate a long series of time-based OTP passwords for the foreseeable future. These are encrypted and organized in a Merkle tree whose root is stored in a smart contract. The user can spend funds at any time by simply visually providing the current OTP password from an air gapped device. These OTPs can be relatively short: Just 6 alphanumeric characters suffice.
Our OTP scheme can work in proof-of-stake as well as static and variable difficulty proof-of-work blockchains. The low-entropy in the passwords and OTPs in our scheme is protected from brute force attempts by requiring that an adversary accompany any brute force attempt by a transaction on the chain. This quickly incurs enormous economic costs for the adversary. Thus, we develop the first decentralized rate limiting scheme. We use Witness Encryption (WE) to construct a timelock encryption scheme in which passwords are encrypted from past into future blocks by leveraging the NP-language expressing proof-of-work or proof-of-stake performed as the witness. Witness Encryption is a currently impractical cryptographic primitive, but our scheme may become practical as these primitives are further developed.
Applications. Witness Encryption can be used to build powerful cryptographic primitives such as succinct Functional Encryption for Turing machines. When combined with a blockchain, Witness Encryption can also be leveraged to achieve fairness against dishonest majority in a secure multi-party computation protocol. More practically, it can also be used to instantiate Timelock Encryption, which can be applied towards building new forms of wallets among other applications.
🧠 From Ivan Homoliak’s research paper “SmartOTPs: An Air-Gapped 2-Factor Authentication for Smart-Contract Wallets”: With the recent rise of cryptocurrencies' popularity, the security and management of crypto-tokens have become critical. We have witnessed many attacks on users and providers, which have resulted in significant financial losses. To remedy these issues, several wallet solutions have been proposed. However, these solutions often lack either essential security features, usability, or do not allow users to customize their spending rules.
In this paper, we propose SmartOTPs, a smart-contract wallet framework that gives a flexible, usable, and secure way of managing crypto-tokens in a self-sovereign fashion. The proposed framework consists of four components (i.e., an authenticator, a client, a hardware wallet, and a smart contract), and it provides 2-factor authentication (2FA) performed in two stages of interaction with the blockchain. To the best of our knowledge, our framework is the first one that utilizes one-time passwords (OTPs) in the setting of the public blockchain. In SmartOTPs, the OTPs are aggregated by a Merkle tree and hash chains whereby for each authentication only a short OTP (e.g., 16B-long) is transferred from the authenticator to the client. Such a novel setting enables us to make a fully air-gapped authenticator by utilizing small QR codes or a few mnemonic words, while additionally offering resilience against quantum cryptanalysis. We have made a proof-of-concept based on the Ethereum platform. Our cost analysis shows that the average cost of a transfer operation is comparable to existing 2FA solutions using smart contracts with multi-signatures.
💎 Telegram & TON tokens
Telegram clients & bots for image creation, news summarization, voice memos, fan chats – metering usage in ONE tokens and sharing accounts across 10+ AI products. Friends pay $1 to join small social groups; they tip each other’s AI actions with emoji reactions. Compare to the official Telegram’s @Wallet.
✅ Embed a Telegram group as a website widget per 1.country domains and per its subpage; e.g. x.country for all AI news, /midjourney for tools, or /lora for models, or /animie for topics.
✅ Extend Telegram announcement groups (100K+ users, fully public, read-only) with emoji reactions that tip with ONE tokens; much like Substack’s Notes, Reddit’s karama points and Civit AI’s content promotion.
✅ Log in with MetaMask / Wallet Connect / Timeless – without Telegram accounts which require phone numbers.
As Telegram’s NFT on its TON blockchain, there are 63K user names, at 7 TON = $10 floor price, with 54M TON = $75M volume. Also, 137K phone numbers, 136 TON = $190 floor, 8.1M TON = $11M volume. And, 27K domains, 3.6 TON = $5.0 fllor, 4.3M TON = $6.1M volume.
🎮 Web Apps & Games
Simulate Javascript evaluation and client-only chat states for Telegram bots? By visiting a website in an external browser with URL parameters and Telegram callback.
❓ Does Instant View support Javascript evaluation with URL parameters? Support callback to the same Telegram chat window without double-redirection (click to close the in-window browser view, and set the in-window chat with a new command with extra state as callback payload data)?
❓ Can Telegram Games with HTML5 actions support full Javascript? Can tracking “High Scores” be used for tracking other states? See <button onclick="TelegramGameProxy.shareScore()">Share score</button> in the doc.
❓ Do Web Apps support unrestricted / sanboxed Javascript evaluation? Support storage? Dynamic state parameters in menu actions? ”To transmit data from the user back to the bot, the Web App can call the Telegram.WebApp.sendData method. Data will be transmitted to the bot as a String in a service message. The bot can continue communicating with the user after receiving it.”
❓ Re: client-only key management and transaction signing: Does Telegram offer proper sandbox like browser extensions? Can custom Telegram clients support extension? Can full Telegram APIs simulate that?
🛡️ Light clients & Security protocol
WebZ is written in React, WebK does not have any popular libraries (React, Vue, Angular, Svelte...) in the dependencies and in the source code is written in native js (ts).
Telegram is a popular messenger with more than 550 million monthly active users and a large ecosystem of different clients. Telegram has its own bespoke transport layer security protocol, MTProto 2.0. This protocol was recently subjected to a detailed study by Albrecht et al. (IEEE S&P 2022). They gave attacks on the protocol and its implementations, along with a security proof for a modified version of the protocol. We complement that study by analysing a range of third-party client implementations of MTProto 2.0.
We report practical replay attacks for the Pyrogram, Telethon and GramJS clients, and a more theoretical timing attack against the MadelineProto client. We show how vulnerable third-party clients can affect the security of the entire ecosystem, including official clients. Our analysis reveals that many third-party clients fail to securely implement MTProto 2.0. We discuss the reasons for these failures, focussing on complications in the design of MTProto 2.0 that lead developers to omit security-critical features or to implement the protocol in an insecure manner. We also discuss changes that could be made to MTProto 2.0 to remedy this situation. Overall, our work highlights the cryptographic fragility of the Telegram ecosystem. (Theo von Arx and Kenneth G. Paterson, 2022)
🏃♀️ Bot’s Javascript runs & states
Replace Entire Websites. Telegram bots can host full Web Apps built with JavaScript. This allows for infinitely flexible interfaces that can power everything from online stores to arcade games.
Web Apps. Bots can easily process complex inputs of any kind and dynamic interaction flows via Web Apps. With this unique feature, you can develop any number of flexible, streamlined interfaces in JavaScript.
A method used to send data to the bot. When this method is called, a service message is sent to the bot containing the data data of the length up to 4096 bytes, and the Web App is closed. See the field web_app_data in the class Message. A method that opens a link in an external browser. The Web App will not be closed.
Bot API 6.4+ If the optional options parameter is passed with the field try_instant_view=true, the link will be opened in Instant View mode if possible. Note that this method can be called only in response to user interaction with the Web App interface (e.g. a click inside the Web App or on the main button)
Bot API 6.4+ A method that shows a native popup for scanning a QR code described by the params argument of the type ScanQrPopupParams. The Web App will receive the event qrTextReceived every time the scanner catches a code with text data. If an optional callback parameter was passed, the callback function will be called and the text from the QR code will be passed as the first argument. Returning true inside this callback function causes the popup to be closed.
postMessage API. Finally, web MTProto clients that need to open a game, open a bot web app or process a payment in an iframe can use the postMessage API to receive events from iframes.
The GamingCommunication and bot web apps libraries by default will use '*' as targetOrigin, sending messages to parent pages regardless of the origin of the embedder. window.parent.postMessage(JSON.stringify({eventType: eventType, eventData: eventData}), targetOrigin)