Cryptocurrency Deposit Feature Requirements Document (PRD)
Project Overview
The goal of this feature is to provide administrators with a system to manage multiple cryptocurrency deposit addresses and ensure users are dynamically assigned unused addresses during the deposit process. Administrators can upload and manage multiple deposit addresses through the backend. When a user selects the corresponding cryptocurrency, the system will assign a valid address from the database. The validity period of the deposit address can be set by the administrator.
System functionality requirements:
Administrators manually upload deposit addresses and manage multiple wallet addresses.
When a user selects a cryptocurrency, the system will randomly assign an unused address from the valid address pool.
The deposit address will be assigned to the user, and its validity period will be set by the administrator. After a successful deposit or when the time expires, the address will be automatically released for other users to use.
After the deposit is completed, the user's balance will be automatically updated.
Functional Requirements
2.1 Wallet Address Upload and Management
Requirement Description:
Administrators can manually upload multiple cryptocurrency deposit addresses through the backend, supporting mainstream cryptocurrencies and networks.
The addresses include cryptocurrency type, network, deposit address, and validity period.
Administrators can select predefined cryptocurrencies and networks from a dropdown, manually upload addresses, and set their validity periods.
The validity period for each address is set by the administrator (e.g., 10 minutes, 30 minutes) to prevent unused addresses from lingering for too long.
All address information will be stored in the database, and administrators can view the status and usage of each address.
2.2 Address Assignment and User Deposit
Requirement Description:
Once a user selects a cryptocurrency, the system will randomly assign a valid address from the database for the deposit.
The validity period of the address is set by the administrator (e.g., 10 minutes). Within this period, the address can only be used by one user.
The system will detect whether the address has received a deposit, and once the funds are confirmed, the user's USD balance will be updated.
2.3 Address Occupancy Rules
Requirement Description:
Each address can only be used by one user. If an address is assigned to a user, it cannot be used by another user during the validity period.
The system will mark the address as "occupied" and prevent other users from selecting it.
If the address’s validity period expires and it has not been used, the system will automatically release the address and mark it as "available."
2.4 Address Expiry and Release
Requirement Description:
The system will automatically release the address after its validity period expires. If the address has not been used, it will revert to "available" status.
Released addresses will re-enter the address pool and await assignment to the next user.
2.5 Deposit Monitoring and Balance Update
Requirement Description:
Once a user initiates the deposit, the system will monitor the blockchain status to detect if the funds have been received at the address.
Upon confirming the deposit, the platform will convert the deposit amount to USD using the current exchange rate and update the user's balance.
The system must ensure the deposit amount is accurate and prevent fund loss or erroneous deposits.
2.6 Address Record and Management
Requirement Description:
The system will record the usage of each deposit address, including address, cryptocurrency type, network, status, assigned user, validity period, deposit time, etc.
Administrators can view each address’s status (e.g., occupied/available) and review historical deposit records.
Administrators can manually manage addresses, such as deleting or modifying their validity period.
2.7 Administrator Functions
Requirement Description:
Administrators can perform the following operations on the backend dashboard:
Create Wallet Addresses: Manually upload new cryptocurrency deposit addresses and associate them with a cryptocurrency and network.
Set Validity Period: Set the validity period for each deposit address and adjust it dynamically if necessary.
View Address Usage Status: View each address’s status, including whether it is occupied, its validity period, and deposit status.
View Historical Deposit Records: View historical deposit records for each address to facilitate management and tracking.
2.8 Two-Factor Authentication (2FA) for Address Additions, Modifications, and Deletions
Requirement Description:
To enhance security, any address addition, modification, or deletion must go through Two-Factor Authentication (2FA) confirmation.
When administrators add, modify, or delete a deposit address, the system will require 2FA confirmation.
2FA confirmation can be done through methods such as SMS, email, or an app (e.g., Google Authenticator).
The operation will only be executed after successful 2FA confirmation. If verification fails, no address operations (addition, modification, or deletion) will be allowed.
System Design
3.1 Redis Cache Design
Cache Design:
Cache Key:
Use wallet:<address> as the cache key to store each address's status information (e.g., available, occupied, expired).
Cache Expiration:
3.2 Deposit Monitoring and System Workflow
Deposit Monitoring Workflow:
When a user selects a cryptocurrency and initiates the deposit, the system will randomly assign a valid address.
The system will set the address’s validity period, and it can only be used by one user during this period.
The system will monitor the deposit via a blockchain listening mechanism.
Once funds are received, the system will confirm that the address belongs to the user, convert the deposit amount to USD using the current exchange rate, and update the user's balance.
Address Release Workflow:
If an address’s validity period expires without being used, the system will automatically release it and mark it as "available."
The released address will re-enter the address pool for reassignment to the next user.
Non-Functional Requirements
4.1 Performance Requirements
The system should have high concurrency handling capabilities, especially during peak user deposit times, enabling quick address assignment, monitoring, and release operations.
The system should ensure a smooth user experience during the deposit process and avoid delays that might negatively impact the user experience.
4.2 Security Requirements
All operations related to deposit addresses must undergo authorization checks to prevent unauthorized users from viewing or modifying wallet addresses.
Sensitive operations, such as using deposit addresses and monitoring deposits, must be encrypted to ensure the safety of user funds.
The deposit process, including fund movement and exchange rate conversion, must be strictly verified and encrypted to prevent fund loss or erroneous operations.
Address addition, modification, and deletion must be confirmed via 2FA to ensure the security of address management.
4.3 Scalability
Note:
This PRD is intended to help understand the requirements. The content mentioned here is for reference purposes only.