Hackathon Project Name: HolaChain, TRON L1 Secured W2W dChat Communication Framework
Track: TRON Hackathon Season 3, Web3
Team Name: 4thTech
Team Member(s): 6
Season 3 DevPost URL: https://devpost.com/software/holachain-tron-l1-secured-w2w-dchat-communication-framework
Project Goal: To not be only an end-user dMail & dChat UI dApp but a permissionless communication standard that enables 1000s of dMail & dChat dApps Blum on Web3, via SDKs & White-labels, while its core Web3 primitive; one message = one L1 transaction, utilises L1s security to enable immutable W2W on-chain communication.
Project Deck: TRON-secured-W2W-dMail-dChat-communication_public-v2.pdf (5.4 MB)
Project Websites: https://4thtech.io/, https://wiki.4thtech.io/, https://tron.4thtech.io/
Project Test Instructions:
Step 1: DL & setup FOURwaL by following the link below (TronLink wallet will be enabled in Q4);
Step 2: Log in to the tron.4thtech.io;
Step 3: Airdrop TRON Shasta TestNet tokens to the FOURwaL account (address available in the accounts tab);
Step 4: Click the “dMail” or “dChat” TAB;
Step 5: Add new contact by pasting the FOURwaL (later TronLink) TRON TestNet recipient address.
Step 6: Start sending on-chain messages.
Step 7: Check your transactions by clicking on the Explorer links available in the UI.
Note: Both, the wallet of the sender and the wallet of the receiver must have a positive TRX balance
Tron dChat Onboarding Video Tutorial
Tron dChat TestNet Video
FOURwaL Chromium DL (testnet wallet)
FOURwaL Mozilla DL (testnet wallet)
TRON dChat TestNet UI (tron.4thtech.io)
TestNet token mint
Tron dMail & dChat are already available for testing. Feel free to test Tron dMail & dChat using the FOURwaL TestNet wallet and tron.4thtech.io UI.
Shasta TestNet dChat Smart Contract - Season 3
Shasta TestNet dMail Smart Contract- Season 2
Whenever we speak about online security we consider it a topic important to us. Securing your digital communications should be your highest priority when going online. Blockchain has always offered the promise of enabling secure, immutable W2W communication while retaining data and identity ownership, it is by design the perfect security tool. However, it could never really take off due to early-generation blockchains’ scalability and cost constraints. Enters TRON with its network stability, low transaction cost, fast transaction finality and vast user base fulfilling all needed parameters to support Web3’s first secure on-chain communication. At the same time, its thriving ecosystem would benefit from the social messaging communication layers.
Season 2 vs Season 3 Clarifications:
4thTech is building Tron & Bittorrent Chain Secured W2W dMail & dChat communication framework. The Hackathon Season 2 submission was focusing on the dMail solution while illustrating the big picture of the future on-chain communication infrastructure that we are building. The Hackathon Season 3 submission is solving the other piece of the puzzle, the dChat. To clarify further:
- 4thTech = Web3 Secured W2W dMail & dChat communication framework stack.
- HolaChain = dMail & dChat application-specific TRON sidechain (future development).
- TRON hackathon season-2 Winner = TRON & BTTC L1 Secured W2W dMail communication infrastructure.
- TRON hackathon season-3 Submission = TRON L1 & BTTC Secured W2W dChat communication infrastructure.
The dChat EVM framework was developed specifically for the TRON hackathon season 3. Both the dMail and dChat are already live on Tron Shasta TestNet (tron.4thtech.io). We are waiting for TronLink to enable the ComputeSharedSecret Method planned to be enabled in the next TronLink update. After the update, we can deploy the Tron Beta dMail & dChat on MainNet.
Background key points:
- The right to online safety should be above all and provided for all online communications.
- Blockchain protocols offered great promise but scalability, throughput and cost were always an issue.
- Web3 projects & DAOs all use Web2 communication tools, which goes against the decentralization ethos.
- Immutable on-chain W2W messaging is prime to become the future of secure Web3 communication - Not Your Keys, Not Your Message!
Solution key points:
- Establishing a TRON L1 on-chain communication framework that is web, desktop & mobile interoperable - One Message = One TRON L1 Transaction.
- Bringing social communication to the Web3 Ecosystem.
- E2EE secure, immutable, censorship-resistant, scalable & accessible »on-chain« messaging.
- Web3 wallet login, no signup or personal information.
- Resistant to identity theft.
- W2W private, group & community on-chain messaging with an option of NFT curated chat groups.
- Data file & media sharing via BTFS decentralized storage.
- Stand-alone app or White labelled (SDK).
- Interoperable with all significant TRON wallets.
- Due to heavy on-chain activity (i.e. 1 message = 1 TX), 4thTech dApps can bring significant growth in daily TRON transactions volume.
What it does
Web3’s dChat framework enables security & data ownership within W2W communication:
- W2W E2EE dChat, Group dChat & NFT curated Group Chat.
- dChat SDKs & White-Labels.
When you think about 4thTech and what value it delivers, it really is quite straightforward. There are four major value propositions.
- 4thTech utilises blockchain to enable security in online communication, which is now virtually non-existing in traditional Web2 applications.
- Behind the scenes, 4thTech enables any project to integrate the dMail & dChat layers into their platform UIs or wallets using the SDK framework.
- To ensure true on-chain security 4thTech protocols have to be transaction heavy as every message represents its own transaction. Due to this heavy on-chain activity (i.e. one message = one transaction), 4thTech dApps bring significant growth in daily L1 transactions.
10 messages per day MainNet transaction projection.
|No. of dChat users on TRON||Daily TX||Monthly TX||Yearly TX|
If we take a look at the third row for example 25.000 TRON users sending 10 messages per day produce 7.5 Mio transactions a month, those users also create 75k of monthly L1 transaction fees but they also created 7.5k of dChat service fees considering the fee is based at only 10% of the L1 transaction cost.
4thTech Core Primitives:
One Message = One L1 Transaction
The dChat W2W message exchange happens on-chain, as one short message represents one L1 transaction. Blockchain is used to store encrypted messages, timestamps & sender addresses.
Not Your Keys = Not Your Message
Every wallet becomes an on-chain identity & message data vault, accessible/decrypted only with users’ private keys!
L1 security + Encryption + Decentralized storage = Secure W2W dChat Communication
True dChat privacy is achieved by utilising L1s security, encryption cocktail (AES, RSA, SHA-256, ECDH) and BTFS decentralized storage.
How we built it
Security by design was our guiding approach, that simply means that we put into consideration how we could preserve privacy, guarantee protection, and obfuscate metadata to the largest possible degree at the forefront of all our architectural decisions. At the same time, no personal data whatsoever is collected by the protocol. Code is Law, principles apply!
The full project framework consists of six main parts;
- (1) FOURim Protocol (i.e. dChat framework - TRON hackathon season-3 submission);
- (2) FOURdx Protocol (i.e. dMail Framework - TRON hackathon season-2 Web3 track Winner);
- (3) FOURid Protocol;
- (4) UI platform (i.e. tron.4thtech.io);
- (5) SDK framework, and;
- (6) Encryption framework.
The dChat EVM framework was developed specifically for the TRON hackathon season-3. The dChat is deployed on TRON Shasta TestNet and ready for TRON MainNet. Other solutions are in development and a part of the grand project roadmap. To ensure true on-chain privacy and utilise the security of an underlining L1, 4thTech protocols have to be transaction heavy as every dChat message or email represents its own transaction which comes with the cost of writing data on the blockchain. 4thTech protocols can strongly contribute to TRON L1 transaction volume, while its solid fee model can support the project in the future. Let’s not forget one message = one transaction, which = one service fee.
FOURim Protocol (EVM SC): Solidity-based W2W messaging protocol that enables on-chain E2EE private messaging, group chat & curated community chats. FOURim docs.
Tron dChat TestNet Smart Contract link:
FOURim SC (shasta testnet)
The Messaging process itself is pretty straightforward. Let’s take an example of Alice and Bob:
- Step 1 - A public and private key pair are created for Alice & Bob. Alice creates a message along with a picture or data file attachment she wants to send to Bob.
- Step 2 - The send message is encrypted with Advanced Encryption Standard (AES), while Elliptic-Curve Diffie-Hellman (ECDH) key agreement protocol is used for generating the secret key (used in AES encryption). At the final stage of step 2, the message hash is written on the TRON blockchain. Just to clarify, this message is temporarily stored on-chain, while attachments are stored on decentralized storage.
- Step 3 - Bob receives and decrypts the message and attachment sent by Alice with his private key.
- Step 4 - The message and its attachments are stored in Bob’s local storage.
- To enable the use of the TronLink wallet, we have to upgrade the encryption standard to Elliptic-Curve Diffie-Hellman, while the TronLink wallet needs to add/permit; (1) ComputeSharedSecret(otherPublicKey) method (shared secret key computation) and; (2) permission for executing the calling method. Both issues are being solved.
FOURdx Protocol (EVM SC): Solidity-based E2EE email protocol resilient to data mining & spoofing, that enables users to share content, files and media from wallet to wallet. TRON dMail is currently available in BETA. FOURdx docs.
As dMail is data heavier, lite encrypted JSON files are created to hold the dMail metadata (i.e. subject, content & attachment location) while the link to this JSON metadata file & checksum (i.e. dMail content structure SHA-256 hash) are recorded on-chain in the form of an L1 transaction. So again the core primitive “one message = one L1 transaction” applies.
Tron dMail TestNet Smart Contract link:
FOURid Protocol (Typescript, Vue.js): Serves as a public key exchange point between users and connects wallets during the dMail & dChat data exchange process. FOURid docs.
SDK framework (Typescript): EVM compatible dMail & dChat SDK framework enables back-end partner integration into their UIs or Wallets.
Encryption (AES, ECDH): While the message is encrypted with Advanced Encryption Standard (i.e. AES), the Elliptic-Curve Diffie-Hellman (i.e. ECDH) key agreement protocol is used for generating a secret key (i.e. used in AES encryption). The implementation of the Elliptic-Curve Diffie-Hellman protocol will enable the interoperability of 4thTech communication protocols with TRON wallets. Encryption docs.
We were thinking about a two-step approach to TRON deployment:
Due to TRONs EVM interoperability, tested network resilience, security, low TX cost and fast transaction finality we see viable commercialization on TRON MainChain:
- Social dChat layers with private & secure W2W on-chain communication.
- dChat SDK framework for direct back-end integration into ecosystem partners UIs or Wallets.
- W2W exchange of data & media via BTFS decentralized storage (i.e. already in dev as a part of the Tron dMail).
In step 2, we believe that an application-specific TRON sidechain (e.g. HolaChain) is needed to enable stable, scalable, and even lower-cost blockchain infrastructure to power the future on-chain W2W communication. Due to TRON dAppChain EVM interoperability, TRON MainChain shared security and battle-tested design framework, we see real integration possibilities for;
- Web, mobile & desktop dChat framework at scale.
- SDK dChat framework for web, mobile & desktop.
- Low-cost W2W exchange of data & media via BTFS decentralized storage also suitable for Enterprise.
4thTech Databases & Storage
- Blockchain is used to store; (1) dChat encrypted message, timestamp & sender address. The overall security of the blockchain network depends on its decentralization, while access security depends on the user’s private key safety measures;
- Decentralized storage BTFS is used for the temporary or permanent storage of encrypted data files, media and JSON files (i.e. dMail, subject & content attachment location) that are exchanged between wallets in the dMail or dChat process. The decryption and access to the data files are possible only with a private key of the user;
- To comply with GDPR, the data file cloud repository is also an option that is used for the temporary 7-day storage of encrypted data, media and JSON files (i.e. dMail subject, content attachment location) that are exchanged between wallets in the dMail or dChat process. The decryption of the data files is possible only with a private key of the user. The data file cloud repository is protected by a firewall. In the case of a user request, it is possible to delete any user-related data to comply with GDPR regulations;
- User local storage is used to store; (1) wallet private keys; (2) dMail & dChat content, and; (3) user-initiated backup of conversations, data files and reports. The security of local storage is in the user’s domain.
Speed & Pricing
The average TRON transaction confirmation is <3s, with a transaction (i.e., TX) estimated price of 0.01$. As one message represents one TRON L1 transaction, we can determine that one message cost is 0.01$. After significant testing on Shasta TestNet, we have come to the conclusion that the send or receive message speed depends on the message length, encryption/decryption process and transaction finality as it varies between 3 to 5 seconds. As every message represents its own on-chain confirmed transaction and needs to be encrypted and decrypted this is still a good result and it is as “instant” as it can get with a current framework. Further TRON MainNet testing will be done to produce more accurate results. Currently, only TRX TX cost is being charged, while a small protocol service fee will be added in the production version.
There are two approaches to project tokenomics;
- In the case of TRON MainChain deployment fees are charged in TRX (i.e. one message = one transaction), while the protocol charges an additional service fee. The service fee is charged on-chain and represents a small % of the transaction cost.
- In the case of application-specific HolaChain DAppChain the native token utility is quite straightforward. The token would be used as gas while also having governance functions.
If needed a dChat brand spin-offs can be deployed with their own tokenomics layers, while the 4thTech genesis asset will enable SDK partner incentive staking with fee discounts. 4thTech can also enable additional revenues for dMails & dChat SDK partners or L1s in the form of smart contract fee sharing (i.e. to ensure true on-chain security, 4thTech protocols are transaction heavy as every message or email represents its own transaction). Blockchain transactions are accompanied by dMail & dChat service fees that can be shared with onboarding partners.
Challenges we ran into
We spent over four years developing the 4thTech multi-chain communication building blocks, built around privacy and ecosystem integrations deployed on various Layer 1s. As time passed, some of the chosen L1s did not pan out due to interoperability or scalability issues. So the main challenge is to find the most suitable underlying L1 that would fit all the main requirements and make on-chain private communication usable at scale.
E2EE group messaging was always challenging to achieve, this goes for Web2 and especially for Web3. Developing the tech to support on-chain E2EE group messaging was a challenge in itself. We solve it by random generation of the secret key, that is used to encrypt/decrypt messages. The secret key is distributed to all group members and separately encrypted with Advanced Encryption Standard (i.e. AES) over the Elliptic-Curve Diffie-Hellman (i.e. ECDH) key agreement protocol. This opens a new chapter in Web3 on-chain communication and could disrupt traditional Web2 messaging communication platforms.
Accomplishments that we’re proud of:
- 2018: Ethereum dID, dMail, dNotary deployment (EVM, Solidity) - Beyond 4.0 award.
- 2020: SI-Chain dID, dMail, dNotary deployment (EVM, Solidity) - UNCEFACT use case.
- 2020: Tolar HashNet, dID, dMail, dNotary (EVM, Solidity) - EU Consortium Grants.
- 2021: Edgeware, dID, dMail, dNotary (Substrate, Rust) - Endorsement.
- 2021: Solana, dID, dChat, dMail, dNotary (Rust) - Endorsement.
- 2022: Moonbeam, dID, dMail, dNotary (EVM, Solidity) - TestNet.
- 2022: Tron, dID, dMail, dNotary (EVM, Solidity) - Tron Grand Hackathon Winner Web3 track.
- 2022: EVMOS, dID, dChat, dMail, dNotary (EVM, Solidity).
- 2022: Tron dChat (EVM, Solidity).
What we learned
- Blockchain has always offered the promise of enabling private, immutable W2W communication while retaining data and identity ownership, it is by design the perfect security tool.
- Due to stability and scalability issues, early generation blockchains can not sustain the on-chain communication infrastructure.
- User migration from “free” but not private Web2 communication platforms to payable but private Web3 infrastructure will be challenging, so new incentive onboarding models will have to be introduced.
- With the rise of security awareness and Web3 adoption in general, the on-chain W2W email & messaging could become the dominant communication and as such can become the future of private online communication. The privacy and security of Web3 native features are just too good to be overlooked “Not Your Keys, Not Your Message!”
Hackathon-related Project Milestones:
Q4 2022 TRON dMail BETA (done).
Q4 2022 TRON dChat TestNet.
Q1 2023 TRON dMail & dChat MainNet, E2EE chat groups, BTFS, white-label & SDK.
Q4 2023 Application-specific TRON sidechain (e.g. HolaChain).