Security
Explains how Aggregator DEX secures transactions on-chain
Introduction
Executing trades on behalf of other users requires approval from their side to be able to move tokens from the seller's wallet to the buyer's wallet, and move eth from the buyer's account to the seller's wallet. In this section, we will explain how Aggregator DEX uses cryptographic signatures to guarantee order authenticity
How Aggregator DEX Verifies Transactions On-Chain
Order Creation: When a user wants to perform a swap, they create an order specifying details such as:
Amount In: The amount of cryptocurrency the user is offering.
Amount Out: The amount of cryptocurrency the user expects in return.
Owner: The address or identity of the user initiating the trade.
Nonce: A unique number or identifier that is used only once per order. This prevents the same order from being executed more than once
Expiration Date: A time limit after which the order is no longer valid.
User Signature: The order details are hashed (converted into a unique string of characters). The user then signs this hashed data with their private key, creating a digital signature. This signature serves as proof that the order was indeed created and authorized by the user, as only the user with access to the private key can generate a valid signature.
On-Chain Verification:
When the order is submitted to the blockchain, the Aggregator DEX’s smart contract verifies the transaction.
The smart contract uses the user’s public key (which is derived from their address) to verify the signature against the hashed order details.
If the signature matches, it confirms that the order is authentic and was created by the user.
Transaction Execution: Once verified, the smart contract executes the trade according to the order details. The user's assets are swapped as per the agreed terms, and the transaction is recorded on the blockchain.
Security and Transparency:
Since everything happens on-chain, it is transparent, and all actions are recorded on the public ledger.
The use of signatures ensures that only the legitimate owner of the crypto assets can initiate transactions, providing security against unauthorized actions.
Last updated