Polytasker Technical Design

Last Updated: 16 Jan 2025

Create Task Flow

create task flow

Steps:

  1. Task Creation: The creator fills in task details and submits them. Our AI agent validates the details, and if legitimate, the data is stored in the database, returning a unique task ID to the frontend.
  2. Smart Contract Interaction: The creator signs and transfers the reward amount (including commission) to the smart contract. The task ID, reward details, and progress are recorded on-chain.
  3. Event Emission: Upon successful contract creation, a "Task Created" event is emitted on-chain. Our backend listens to the event, verifies that on-chain data matches the stored database details, and updates the task status.
  4. Promotion and Verification: After successful task creation, the backend uses AI to generate promotional text and posts it on X. Simultaneously, a new Discord channel is created for task finishers to submit proofs for verification.

Q&A

Why don't store task's title & description information into smart contracts as well?
  1. High Gas Costs: Storing lengthy text like titles and descriptions in smart contracts significantly increases gas fees.
  2. Slow Data Retrieval: Reading large text data from the blockchain can take up to a minute, leading to poor user experience.
  3. Costly Updates: Amending titles or descriptions on-chain requires additional transactions, incurring extra gas fees.


Finish Task Flow

finish task flow

Steps:

  1. Finishers submit proof in our Discord channel, where an AI agent verifies the proof through a conversation with each finisher. Once verified, their wallet address is flagged.
  2. The backend monitors the Discord channel and processes rewards for all verified addresses in a batch transaction via the smart contract, signed using a Ledger cold wallet. Upon completion, the smart contract emits a task update event.
  3. The backend listens to on-chain update events and updates the task status accordingly. Completed tasks are removed from the website.

Q&A

Why sign the transfer process through a cold wallet?
  1. The smart contract requires an admin address to create, which is the cold wallet.
  2. Cold wallets are inherently secure because their private keys are never exposed, ensuring 100% safety.
Why sign the transfer process through a cold wallet?
  1. While human errors (e.g. inputting the wrong address) are possible, our backend system minimizes this by automatically collecting the recipient's address and generating the transaction. The admin only needs to input the password and sign the transaction.
  2. Automating this process with a hot wallet would expose the master key to potential leaks. Cold wallets, like Ledger, keep the key securely embedded in hardware, making it impossible to export.
Why batch transactions instead of individual transfers?
  1. Each transaction incurs a base gas fee. By batching all addresses into a single transaction sent to the smart contract, we significantly reduce gas costs.