Understanding the Risks
This recharge method carries inherent transaction risks. Users must carefully evaluate before proceeding.
Step-by-Step Recharge Process
- Bind External Exchange Address: Users must link their wallet address from another exchange.
Initiate Recharge:
- Enter the recharge amount
- Generate a recharge order
- Transfer funds to the platform's designated receiving wallet address
Verification:
- Provide the transaction hash
- Confirm successful transfer via hash verification
Database Structure
CREATE TABLE `yy_recharge` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT 'User ID',
`order_num` varchar(255) DEFAULT NULL COMMENT 'Recharge order number',
`usdt_order_num` varchar(255) DEFAULT NULL COMMENT 'USDT transaction number',
`money` decimal(18,8) NOT NULL DEFAULT '0.00000000' COMMENT 'Recharge amount',
`sender` varchar(255) DEFAULT NULL COMMENT 'Sender address',
`recipient` varchar(255) DEFAULT NULL COMMENT 'Recipient address',
`status` tinyint(4) DEFAULT '1' COMMENT 'Status: 1=Pending, 2=Confirmed, 3=Failed',
`create_time` datetime DEFAULT NULL COMMENT 'Creation time',
`qr_time` datetime DEFAULT NULL COMMENT 'Confirmation time',
`block_time` datetime DEFAULT NULL COMMENT 'Block transaction time',
`block_t_time` varchar(255) DEFAULT '' COMMENT 'Block transaction timestamp',
`remarks` varchar(255) DEFAULT NULL COMMENT 'Description',
PRIMARY KEY (`id`),
UNIQUE KEY `ordernum` (`order_num`)
) ENGINE=InnoDB AUTO_INCREMENT=145 DEFAULT CHARSET=utf8;Transaction Verification with omni_gettransaction
The omni_gettransaction API retrieves detailed information about specific Omni transactions.
Key Parameters
txid: Transaction hash (required string)
Sample Response
{
"txid": "c41525d0de0b5d5668f44995570184e6a4c52931a0ebb7e10205676f6bb9a40f",
"fee": "0.00015975",
"sendingaddress": "3KeC2JqGHqW6kuUBJKjAHmmfUThj2RiR1F",
"referenceaddress": "18An5WWLHR59NpHdKzPoDjKLKULsMpP1ci",
"ismine": true,
"version": 0,
"type_int": 0,
"type": "Simple Send",
"propertyid": 31,
"divisible": true,
"amount": "0.10000000",
"valid": true,
"blockhash": "0000000000000000000158c6c5f5f58f912a03c9b4d6af383e9f727203ab4e1e",
"blocktime": 1560766900,
"positioninblock": 931,
"block": 581098,
"confirmations": 36
}Automated Wallet Monitoring
Implement a scheduled task to scan wallet addresses for new transactions and update the database accordingly.
๐ Learn how to implement scheduled tasks with TP5 and Swoole
Sample Monitoring Code
setName('recharge')
->setDescription('USDT recharge');
}
protected function execute(Input $input, Output $output)
{
// Trigger every 5000ms
$id = \swoole_timer_tick(5000, function ($timer_id) {
try {
$recharge = Db::name('recharge')
->where(['status' => 1, 'usdt_order_num' => ['<>', '']])
->select();
foreach ($recharge as $v) {
$usdt = (new Coins())->getCoins();
$rc = $usdt->omni_gettransaction($v['usdt_order_num']);
if (!is_array($rc)) {
$message = 'Invalid transaction hash';
goto STOP;
}
// Additional validation checks...
if ($rc['valid']) {
// Update successful transaction
Db::name('recharge')
->where(['id' => $v['id']])
->update([
'status' => 2,
'qr_time' => date('YmdHis'),
'block_t_time' => $rc['blocktime'],
'block_time' => date('Y-m-d H:i:s', $rc['blocktime'])
]);
Db::name('users_asset')
->where(['user_id' => $v['user_id']])
->setInc('usdt', $v['money']);
} else {
STOP:
Db::name('recharge')
->where(['id' => $v['id']])
->update(['status' => 3, 'remarks' => $message]);
}
}
} catch (Exception $exception) {
// Error handling
}
});
}
}Key Considerations for USDT Recharge
- Always verify transaction details
- Ensure address compatibility
- Monitor confirmation status
- Implement proper error handling
๐ Best practices for cryptocurrency transactions
FAQ
What is the minimum confirmation time for USDT transactions?
Typically 6 confirmations are required, but this may vary by exchange.
Why is my transaction showing as invalid?
Common reasons include incorrect recipient address, insufficient network fees, or blockchain congestion.
How can I verify my transaction hash?
Use blockchain explorers like Omni Explorer or your wallet's transaction history.
What should I do if my recharge fails?
Double-check all details and contact support if the issue persists after 30 minutes.
Are there any limits for USDT recharge?
Limits vary by platform. Check your exchange's policy for specific thresholds.