Tron SEA by USTX Team - Safe and Efficient Airdrop/reward framework

Project Name: Tron SEA
Project Track: DeFi
Team Name: USTX Team
Team Member(s): 3, Sirluke, Benna, Aska
DevPost Project Link: Tron SEA on Devpost
Project Goal: Tron SEA is a framework for developers trying to simplify and make more affordable handling large airdrop or rewarding campaign. The TRX price increase over the last months and the high energy demand driving the rental prices high had the consequence of rendering very expensive sending tokens to many users. Tron SEA provides the building blocks to integrate Merkle tree distribution strategy into any Tron based project, greatly reducing the complexity and the cost on the builder by requiring user involvement in the claim action.
Project Value: Merkle tree algorithms are widely used in the blockchain industry, especially in the blockchain with higher TX fees. Sending tokens to hundreds or thousands of addresses is very expensive, also on Tron because of the fees increase over the last months. New projects, with little financial backing cannot currently afford such a campaign. but Tron SEA will be an enabling technology, made available for all builders, as open source and free code. Currently there is not an easy to use implementation of Merkle trees in Tron blockchain.
Project Info: Pitchdeck
Project Website: Github,Tron SEA website
Project Test Instructions: Tron SEA project is divided into 2 sections, the on-chain contract handling the verification of the proof and distribution of tokens and a php part to be integrated in the backend of the target application. The php generates the Merkle tree and creates the proof for each user to claim the airdrop.

Merkle trees need a predefined list of “leaves”, in this case a list of user/amount pairs has been created:

[ {"user":"TJHYbk7q2EuMJJZeEF6cxPBEDg9kG1sR1j","amount":"100000000"}, {"user":"TRc7JCUtMopM3sADYDj5KUBhzD1K3q1JsR","amount":"200000000"}, {"user":"TGpSjS9wg4tJRVv69bnCJCq9mGAmkMaSFC","amount":"300000000"}, {"user":"TLx5zMUwqcTu9iUmqpZsFMCRnNA2c1cAxt","amount":"400000000"}, {"user":"TJriuKLDcDjHrKUZvaoQvX84zLT2vy5GJv","amount":"500000000"}, {"user":"TAPobz7nvpNBJcqwv6zenuSGwscd47ToaN","amount":"500000000"}, {"user":"TKWmf2LbTjS4esYd1XfbZi5FWsZfrAphPX","amount":"600000000"} ]

To get the hashed tree for the list everyone can call the mTree.php like:

sea.ustx.io/php/mTree.php

To get the proof for a specific pair call the mProof.php service, passing the user and amount parameters, like:

sea.ustx.io/php/mProof.php?user=TGpSjS9wg4tJRVv69bnCJCq9mGAmkMaSFC&amount=300000000

The script returns a json with proof and root, to be used to claim the reward from the contract using the claim or verify function on Tronscan

Project Details:

Inspiration
The TRX price increase over the last months and the high energy demand had the consequence of rendering very expensive sending tokens to many users. Small community projects without large resource backing do not have the capability to make large token distribution campaigns.
What it does
Tron SEA is a framework for developers trying to simplify and make more affordable handling large airdrop or rewarding campaign. Tron SEA provides the building blocks to integrate Merkle tree distribution strategy into any Tron based project, greatly reducing the complexity and the cost on the builder by requiring user involvement in the claim action.

Merkle trees were invented in 1979 by Ralph Merkle. The tree is a mathematical way to link all the leaves, to the tree top, the root. This allows to efficiently determine if a particular leaf belongs to a specific tree, using only a subset of all the information contained in the tree, the so called “proof”. Once a leaf has been validated to be belonging to the tree, a specific action can be executed safely.


In the blockchain field, the most common use of Merkle trees is to distribute rewards or airdrops (e.g. in Tron it’s used to distribute JustLend rewards) to a large number of users, without actually doing the transfer. The users have to take action directly (paying the TX fees) to claim the tokens, interacting with a smart contract that, together with the Merkle proof, ensures that only allowed users are claiming the correct amount of tokens.

How we built it
Tron SEA is build on Tron using Solidity using TronIDE as deployment platform. The backend is written in php and uses the IEXBase TronAPI library.
Challenges we ran into
There are several Merkle tree code bases available on the web, but none specifically targeted to Tron blockchain and using php as the backend language. We made the effort of handling Tron specific address coding and creating from scratch the Merkle tree creation and proof generation algorithms in php.
Accomplishments that we’re proud of
Merkle tree generation and proof creation work as expected, likewise the smart contracts deployed on chain.
What we learned
Even if some code technique is known and somewhat explained in literature, putting together a working product still requires time and effort to solve all the integration issues that always arise.
What’s next for Tron SEA - Safe and Efficient Airdrops framework
After mainnet deployment we’ll create a real rewarding campaign airdropping a selcted Tron OG community token to users willing to participate in a real world demo of the Tron SEA framework.
Smart Contract links: Tron SEA Nile contract
Project Milestones:

  • October 8th - Deployment of MVP, consisting in php code to generate tree and Nile contract to verify Merkle proof [DONE!]
  • December 3rd - Mainnet deployment and public airdrop campaign of a selected Tron OG community token
13 Likes

Welcome to hackaTron S7. This project is about shifting airdrop transaction cost from project developers to the community right?
How will you ensure easy understanding of the claiming process especially to less tech savvy users?

2 Likes

Thanks for the question. The use of Merkle tree is exactly like you described, it changes the actor of the transfer from the builder to the end user. This also ensures a higher involvement of the user receiving the reward.
The claiming process is very simple and straightforward, just pressing a CLAIM button.
I’d like to state that the claiming function does NOT create any risk to the user pushing the button since there is no “approve” for user funds to be transferred or any “change of permissions”.

Scams are behind every corner in crypto space, we all need to be very careful and spread the knowledge that “approve” and “change account permissions” are dangerous transactions.

1 Like

Hackathon entry has been completed, just in time :grinning:

1 Like

Here are three questions about the Tron SEA project:

  1. How does the Merkle tree distribution strategy implemented by Tron SEA specifically reduce costs and complexity for developers conducting large airdrop campaigns?
  2. In what ways does Tron SEA’s open-source framework support new projects with limited financial resources in launching effective token distribution strategies?
  3. What steps do developers need to take to integrate Tron SEA’s Merkle tree implementation into their Tron-based projects?
1 Like
  1. Normally doing a large airdrop requires the project owner sending directly (from wallet or distribution smart contract) tokens to every recipient. This has a gas fee cost proportional to the number of recipients. Somewhere from 0.5$ to 1$ for every wallet is typical for Tron. If you rent energy is much less, but sending tokens to 1000s of users will be expensive. Using Merkle tree the cost on the builder is the deployment of a smart contract and simple frontend/backend dApp with a claim button, the transfer costs are on the end user that will trigger the contract to get the tokens. This is a huge saving on the project owner.
  2. Projects with limited resources can operate big rewarding or airdrop campaigns using Tron SEA Merkle tree implementation, at the cost of deploying a simple smart contract and little development effort.
  3. Go to the Github repository and access all source code:
  • Gather a list of recipients and amount to be rewarded/airdropped
  • Deploy the php files and create the Merkle tree for the list
  • Build the simple html/js/css UI to implement the CLAIM button
  • Deploy the smart contract (as is provided by Tron SEA), set the Merkle root and send tokens to the contract
1 Like

Welcome to the Hackathon of season 7, please tell me what are the particular integration challenges that you have identified, thank you

1 Like

Nice submission :heart_eyes:

At first I thought what the PHP does and how it keeps the two Merkle tree in sync then I understood that you have the Merkle Tree before deploying the smart contract so you need first to get all the users and set their amount and addresses and then you deploy the smart contract with the Merkle tree!

Nice!

It will be interesting to try and make the system able to add also another node/user/airdrop address after deployment of the contract!

I guess you are working on website interface to be able based on a CVS to create a new airdrop of a TRC20 contract?

Good luck!

2 Likes

It’s always possible to add items to the tree, even after having deployed the contract. The admin can update the root and the new tree will be operational. Usually the token distribution happens after all the recipients have been defined, though.

1 Like

Integration should be fairly easily for an average experience developer, since the PHP backend is easily tailored to the specific needs and the contract can be used as is. What is currently missing from the framework is an example of a frontend interface with a CLAIM button, but that will come shortly and it’s not rocket science.

3 Likes

Welcome to Hackathon Season 7, after a careful read I see this aims to simplify and reduce the costs associated with large-scale token airdrops and reward campaigns on the Tron blockchain by utilizing Merkle tree algorithms.
How do you plan to educate potential users about using the Tron SEA framework, especially those unfamiliar with Merkle trees and blockchain technology?

1 Like

Tron SEA is a framework mean to be used by builders and devs. The average skill of a feont end dev should allow for quick integration into any project. The end user will just see a CLAIM button on a web interface, like any other dApp. No dedicated training is required and the signed transaction is harmless, since “approval” and “change account permissions” are not needed. The use of Merkel tree will happen behind the scenes, transparently to the end users.

Thank you for your reply to me, please tell me how are you going to do to ensure that you’re end users can easily claim their rewards without them having any kind of technical issue, thank you

What measures will the framework take if a user attempts to claim tokens and the transaction fails due to incorrect proof, gas issues, or expired campaigns?

The user experience is mostly dependent on the frontend design, that is out of the scope of Tron SEA. We’ll keep testing and improving the docs to make sure that the backend is working correctly in all conditions.

The project owner/devs need to make sure that the framework integration and adaption to the project specific requirements is done correctly and that all possible error conditions are handled.

1 Like

I wish you zero hassles during testing, goodluck

1 Like

Given that error handling is crucial, do you have recommended testing environments or practices for developers?

Every developer has it’s own means for doing testing before going live. Tron SEA does not have any impact on the frontend development, so error handling on the user interface is independent of Tron SEA. This is a positive aspect of the implementation, meaning that to use Tron SEA you do not need to change your coding style or workflow.

2 Likes

Congratulations. Am glad you made it on time.

2 Likes