POST /apiv2/time/stop
暂时停止TRON地址的能量委托,同时保持主机模式。
概述
时间停止端点会暂停特定TRON地址的能量委托,而不会将其从主机模式中移除。这在您想要暂时停止能量分配同时保留您的循环和配置时非常有用。该地址将保留在主机模式下,所有循环都保持不变,并且可以随时重新激活,而不会丢失任何设置或剩余循环。
端点 URL
POST https://netts.io/apiv2/time/stop
身份验证
此端点使用JSON主体身份验证(而非标头)。您的API密钥和目标地址在请求主体中提供。
身份验证流程
- API Key Validation: System verifies the API key exists and is active
- IP Whitelist Check: Request IP must match configured whitelist
- Ownership Verification: API key must own the specified address
- Status Check: Verifies address is in Host Mode and currently active
- Delegation Check: Ensures no critical delegations are in progress
请求头
Header | Required | Description |
---|---|---|
Content-Type | Yes | application/json |
请求体
json
{
"api_key": "your_api_key",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
}
参数
Parameter | Type | Required | Validation | Description |
---|---|---|---|---|
api_key | string | Yes | Must exist in system | Your API key for authentication and account management |
address | string | Yes | TRC-20 format | TRON address to stop delegations for (must start with 'T' and be 34 characters) |
参数验证
api_key:
- Must be a valid 32-character hexadecimal string
- Must be associated with an active account
- Must have ownership of the specified address
- Account must not be suspended or restricted
- Must have stop/pause permissions
address:
- Must match TRC-20 format
^T[1-9A-HJ-NP-Za-km-z]{33}$
- Must be currently in Host Mode under your account
- Must be in active or running state
- Cannot be already stopped or paused
- Must not have pending critical operations
- Must match TRC-20 format
IP Address:
- Your request IP must be in the whitelist associated with your API key
- Maximum 5 IP addresses per API key
- IPv4 and IPv6 supported
示例请求
cURL
bash
curl -X POST https://netts.io/apiv2/time/stop \
-H "Content-Type: application/json" \
-d '{
"api_key": "YOUR_API_KEY_HERE",
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
}'
Python
python
import requests
import json
from typing import Dict, Optional
def stop_energy_delegation(api_key: str, address: str) -> Dict:
"""
Temporarily stop energy delegation for a TRON address in Host Mode.
Args:
api_key: Your API authentication key
address: TRON address to stop delegations for
Returns:
API response dictionary
"""
url = "https://netts.io/apiv2/time/stop"
# Validate address format
if not address.startswith('T') or len(address) != 34:
raise ValueError(f"Invalid TRON address format: {address}")
data = {
"api_key": api_key,
"address": address
}
try:
response = requests.post(url, json=data, verify=True, timeout=30)
response.raise_for_status()
result = response.json()
if result['code'] == 0:
print(f"✅ Successfully stopped delegations for: {result['data']['address']}")
print(f"Status: {result['data']['status']}")
print(f"Cycles preserved: {result['data']['cycles_remaining']}")
print(f"Energy reclaimed: {result['data'].get('energy_reclaimed', 0)}")
if result['data'].get('can_resume'):
print("ℹ️ Address can be resumed anytime using /time/infinitystart")
else:
print(f"❌ Error: {result['msg']}")
return result
except requests.exceptions.RequestException as e:
print(f"❌ Request failed: {str(e)}")
raise
except json.JSONDecodeError as e:
print(f"❌ Invalid JSON response: {str(e)}")
raise
# Example with status check
def stop_and_verify(api_key: str, address: str):
"""Stop delegation and verify the status."""
# Stop delegation
stop_result = stop_energy_delegation(api_key, address)
if stop_result['code'] == 0:
# Check status after stopping
import time
time.sleep(2) # Wait for status update
status_url = "https://netts.io/apiv2/time/status"
status_response = requests.post(status_url, json={"api_key": api_key})
if status_response.status_code == 200:
status_data = status_response.json()
for addr in status_data['data']['addresses']:
if addr['address'] == address:
print(f"\n📊 Current Status:")
print(f" Status: {addr['status']}")
print(f" Delegation Active: {addr['delegation_active']}")
print(f" Cycles Remaining: {addr['cycles_remaining']}")
break
if __name__ == "__main__":
API_KEY = "YOUR_API_KEY_HERE"
ADDRESS = "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
stop_and_verify(API_KEY, ADDRESS)
Node.js
javascript
const axios = require('axios');
/**
* Temporarily stop energy delegation for a TRON address in Host Mode
* @param {string} apiKey - Your API authentication key
* @param {string} address - TRON address to stop delegations for
* @returns {Promise<Object>} API response
*/
async function stopEnergyDelegation(apiKey, address) {
const url = 'https://netts.io/apiv2/time/stop';
// Validate address format
if (!address.startsWith('T') || address.length !== 34) {
throw new Error(`Invalid TRON address format: ${address}`);
}
const data = {
api_key: apiKey,
address: address
};
try {
const response = await axios.post(url, data, {
headers: {
'Content-Type': 'application/json'
},
timeout: 30000
});
const result = response.data;
if (result.code === 0) {
console.log(`✅ Successfully stopped delegations for: ${result.data.address}`);
console.log(`Status: ${result.data.status}`);
console.log(`Cycles preserved: ${result.data.cycles_remaining}`);
console.log(`Energy reclaimed: ${result.data.energy_reclaimed || 0}`);
if (result.data.can_resume) {
console.log('ℹ️ Address can be resumed anytime');
}
} else {
console.error(`❌ Error: ${result.msg}`);
}
return result;
} catch (error) {
if (error.response) {
console.error(`❌ API Error: ${error.response.status} - ${error.response.data?.msg || error.message}`);
} else if (error.request) {
console.error('❌ No response from server');
} else {
console.error(`❌ Request failed: ${error.message}`);
}
throw error;
}
}
/**
* Stop multiple addresses in batch
* @param {string} apiKey - Your API authentication key
* @param {Array<string>} addresses - Array of TRON addresses
* @returns {Promise<Array>} Results for each address
*/
async function batchStopDelegations(apiKey, addresses) {
const results = [];
for (const address of addresses) {
try {
console.log(`\nStopping ${address}...`);
const result = await stopEnergyDelegation(apiKey, address);
results.push({ address, success: result.code === 0, result });
// Add delay to avoid rate limits
await new Promise(resolve => setTimeout(resolve, 1000));
} catch (error) {
results.push({ address, success: false, error: error.message });
}
}
// Summary
const successful = results.filter(r => r.success).length;
console.log(`\n📊 Batch Stop Summary:`);
console.log(` Successful: ${successful}/${addresses.length}`);
console.log(` Failed: ${addresses.length - successful}/${addresses.length}`);
return results;
}
// Example usage
(async () => {
const API_KEY = 'YOUR_API_KEY_HERE';
const ADDRESS = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE';
try {
// Stop single address
const result = await stopEnergyDelegation(API_KEY, ADDRESS);
console.log('Result:', result);
// Example: Stop multiple addresses
// const addresses = [
// 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE',
// 'TYn8Y3khEsLJW2ChVWFMSMeRDow6KcbMTF'
// ];
// await batchStopDelegations(API_KEY, addresses);
} catch (error) {
console.error('Failed to stop delegation:', error.message);
}
})();
PHP
php
<?php
/**
* Temporarily stop energy delegation for a TRON address in Host Mode
*
* @param string $apiKey Your API authentication key
* @param string $address TRON address to stop delegations for
* @return array API response
*/
function stopEnergyDelegation($apiKey, $address) {
$url = 'https://netts.io/apiv2/time/stop';
// Validate address format
if (!preg_match('/^T[1-9A-HJ-NP-Za-km-z]{33}$/', $address)) {
throw new InvalidArgumentException("Invalid TRON address format: $address");
}
$data = [
'api_key' => $apiKey,
'address' => $address
];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($data),
'timeout' => 30
]
];
$context = stream_context_create($options);
$response = @file_get_contents($url, false, $context);
if ($response === false) {
$error = error_get_last();
throw new RuntimeException('Request failed: ' . $error['message']);
}
$result = json_decode($response, true);
if ($result['code'] == 0) {
echo "✅ Successfully stopped delegations for: {$result['data']['address']}\n";
echo "Status: {$result['data']['status']}\n";
echo "Cycles preserved: {$result['data']['cycles_remaining']}\n";
echo "Energy reclaimed: " . ($result['data']['energy_reclaimed'] ?? 0) . "\n";
if ($result['data']['can_resume'] ?? false) {
echo "ℹ️ Address can be resumed anytime\n";
}
} else {
echo "❌ Error: {$result['msg']}\n";
}
return $result;
}
/**
* Stop and monitor address status
*
* @param string $apiKey Your API authentication key
* @param string $address TRON address to monitor
* @param int $checkInterval Seconds between status checks
* @param int $maxChecks Maximum number of status checks
*/
function stopAndMonitor($apiKey, $address, $checkInterval = 5, $maxChecks = 10) {
// Stop delegation
$stopResult = stopEnergyDelegation($apiKey, $address);
if ($stopResult['code'] != 0) {
return false;
}
echo "\n🔍 Monitoring status changes...\n";
// Monitor status
for ($i = 0; $i < $maxChecks; $i++) {
sleep($checkInterval);
$statusUrl = 'https://netts.io/apiv2/time/status';
$statusData = ['api_key' => $apiKey];
$options = [
'http' => [
'header' => "Content-Type: application/json\r\n",
'method' => 'POST',
'content' => json_encode($statusData),
'timeout' => 30
]
];
$context = stream_context_create($options);
$response = @file_get_contents($statusUrl, false, $context);
if ($response !== false) {
$statusResult = json_decode($response, true);
foreach ($statusResult['data']['addresses'] as $addr) {
if ($addr['address'] == $address) {
echo "Check #" . ($i + 1) . ": Status = {$addr['status']}, ";
echo "Energy = {$addr['current_energy']}\n";
if ($addr['status'] == 'paused' && $addr['current_energy'] == 0) {
echo "✅ Address successfully paused and energy reclaimed\n";
return true;
}
break;
}
}
}
}
echo "⚠️ Max checks reached, final status may not be confirmed\n";
return true;
}
// Example usage
$API_KEY = 'YOUR_API_KEY_HERE';
$ADDRESS = 'TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE';
try {
// Simple stop
$result = stopEnergyDelegation($API_KEY, $ADDRESS);
print_r($result);
// Stop with monitoring
// stopAndMonitor($API_KEY, $ADDRESS);
} catch (Exception $e) {
echo "Failed to stop delegation: " . $e->getMessage() . "\n";
}
?>
Go
go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
"time"
)
// StopRequest represents the API request structure
type StopRequest struct {
APIKey string `json:"api_key"`
Address string `json:"address"`
}
// StopResponse represents the API response structure
type StopResponse struct {
Code int `json:"code"`
Msg string `json:"msg"`
Data struct {
Address string `json:"address"`
Status string `json:"status"`
CyclesRemaining int `json:"cycles_remaining"`
EnergyReclaimed int `json:"energy_reclaimed"`
StoppedAt int64 `json:"stopped_at"`
CanResume bool `json:"can_resume"`
TransactionHash string `json:"transaction_hash"`
} `json:"data"`
}
// StopEnergyDelegation stops energy delegation for a TRON address
func StopEnergyDelegation(apiKey, address string) (*StopResponse, error) {
url := "https://netts.io/apiv2/time/stop"
// Validate address format
if len(address) != 34 || address[0] != 'T' {
return nil, fmt.Errorf("invalid TRON address format: %s", address)
}
// Create request
reqData := StopRequest{
APIKey: apiKey,
Address: address,
}
jsonData, err := json.Marshal(reqData)
if err != nil {
return nil, err
}
// Make HTTP request
client := &http.Client{Timeout: 30 * time.Second}
req, err := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
if err != nil {
return nil, err
}
req.Header.Set("Content-Type", "application/json")
resp, err := client.Do(req)
if err != nil {
return nil, err
}
defer resp.Body.Close()
// Read response
body, err := ioutil.ReadAll(resp.Body)
if err != nil {
return nil, err
}
// Parse response
var result StopResponse
if err := json.Unmarshal(body, &result); err != nil {
return nil, err
}
if result.Code == 0 {
fmt.Printf("✅ Successfully stopped delegations for: %s\n", result.Data.Address)
fmt.Printf("Status: %s\n", result.Data.Status)
fmt.Printf("Cycles preserved: %d\n", result.Data.CyclesRemaining)
fmt.Printf("Energy reclaimed: %d\n", result.Data.EnergyReclaimed)
if result.Data.CanResume {
fmt.Println("ℹ️ Address can be resumed anytime")
}
} else {
fmt.Printf("❌ Error: %s\n", result.Msg)
}
return &result, nil
}
// BatchStop stops multiple addresses with rate limiting
func BatchStop(apiKey string, addresses []string) map[string]bool {
results := make(map[string]bool)
for i, address := range addresses {
fmt.Printf("\n[%d/%d] Stopping %s...\n", i+1, len(addresses), address)
result, err := StopEnergyDelegation(apiKey, address)
if err != nil {
fmt.Printf("Error: %v\n", err)
results[address] = false
} else {
results[address] = result.Code == 0
}
// Rate limiting delay (except for last address)
if i < len(addresses)-1 {
time.Sleep(1 * time.Second)
}
}
// Print summary
successful := 0
for _, success := range results {
if success {
successful++
}
}
fmt.Printf("\n📊 Batch Stop Summary:\n")
fmt.Printf(" Successful: %d/%d\n", successful, len(addresses))
fmt.Printf(" Failed: %d/%d\n", len(addresses)-successful, len(addresses))
return results
}
func main() {
apiKey := "YOUR_API_KEY_HERE"
address := "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE"
// Stop single address
result, err := StopEnergyDelegation(apiKey, address)
if err != nil {
fmt.Printf("Failed to stop delegation: %v\n", err)
return
}
if result.Code == 0 {
fmt.Printf("\nTransaction Hash: %s\n", result.Data.TransactionHash)
stoppedTime := time.Unix(result.Data.StoppedAt, 0)
fmt.Printf("Stopped at: %s\n", stoppedTime.Format("2006-01-02 15:04:05"))
}
// Example: Batch stop multiple addresses
// addresses := []string{
// "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
// "TYn8Y3khEsLJW2ChVWFMSMeRDow6KcbMTF",
// }
// BatchStop(apiKey, addresses)
}
响应
成功响应 (200 OK)
json
{
"code": 0,
"msg": "Energy delegation stopped successfully",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"status": "paused",
"previous_status": "active",
"cycles_remaining": 25,
"mode": "standard",
"energy_reclaimed": 131000,
"stopped_at": 1699528800,
"can_resume": true,
"resume_method": "/time/infinitystart or wait for manual resume",
"delegation_active": false,
"next_delegation_time": null,
"transaction_hash": "d9f5c3a2e8b1d7f4a9c6e3b8d5f2a7c4e9b6d3f8a5c2e9b6d3f8a5c2e9b6d3f8",
"estimated_resume_cost": 0,
"savings": {
"energy_saved": 131000,
"cycles_preserved": 25,
"cost_saved": 75.0
}
}
}
响应字段
Field | Type | Description |
---|---|---|
code | integer | Status code (0 for success, -1 for error) |
msg | string | Human-readable status message |
data | object | Response data object |
data.address | string | The TRON address that was stopped |
data.status | string | Current status ("paused", "stopped") |
data.previous_status | string | Status before stopping ("active") |
data.cycles_remaining | integer | Number of cycles preserved |
data.mode | string | Current mode ("standard", "infinity") |
data.energy_reclaimed | integer | Amount of energy reclaimed |
data.stopped_at | integer | Unix timestamp when stopped |
data.can_resume | boolean | Whether address can be resumed |
data.resume_method | string | How to resume delegations |
data.delegation_active | boolean | Whether delegation is active (always false after stop) |
data.next_delegation_time | null | Next delegation time (null when stopped) |
data.transaction_hash | string | TRON blockchain transaction hash for the reclaim |
data.estimated_resume_cost | number | Cost to resume (usually 0) |
data.savings | object | Resources saved by stopping |
错误响应
身份验证错误 (401)
json
{
"code": -1,
"msg": "Invalid API key",
"data": null
}
Causes:
- Invalid or expired API key
- API key not found in system
- Account suspended or terminated
Resolution:
- Verify API key is correct
- Check account status in dashboard
- Contact support if key should be valid
地址未找到 (404)
json
{
"code": -1,
"msg": "Address not found in Host Mode",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"suggestion": "Use /time/add to add this address to Host Mode first"
}
}
Causes:
- Address not in Host Mode
- Address was deleted from Host Mode
- Address belongs to different API key
Resolution:
- Verify address is in Host Mode using
/time/status
- Check if address was deleted
- Ensure using correct API key
已停止 (409)
json
{
"code": -1,
"msg": "Address delegation already stopped",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"status": "paused",
"stopped_at": 1699442400,
"suggestion": "Address is already paused. Use /time/infinitystart to resume"
}
}
Causes:
- Address already in paused state
- Previous stop command already executed
- Delegation already inactive
Resolution:
- No action needed if already stopped
- Use
/time/infinitystart
to resume if needed - Check current status with
/time/status
无效地址格式 (400)
json
{
"code": -1,
"msg": "Invalid TRON address format",
"data": {
"address": "invalid_address",
"format": "Address must start with 'T' and be 34 characters long"
}
}
Causes:
- Address doesn't match TRC-20 format
- Address contains invalid characters
- Address wrong length
Resolution:
- Verify address starts with 'T'
- Ensure address is exactly 34 characters
- Check for typos or copy/paste errors
正在进行中的主动委托 (409)
json
{
"code": -1,
"msg": "Cannot stop address with active delegation in progress",
"data": {
"address": "TQn9Y2khEsLJW1ChVWFMSMeRDow5KcbLSE",
"delegation_ends": 1699529100,
"retry_after": 300,
"suggestion": "Wait for current delegation to complete"
}
}
Causes:
- Energy delegation transaction in progress
- Critical operation not yet completed
- Blockchain confirmation pending
Resolution:
- Wait for current delegation to complete
- Retry after specified time
- Check transaction status on blockchain
权限不足 (403)
json
{
"code": -1,
"msg": "Insufficient permissions to stop address",
"data": {
"required_permission": "manage_addresses",
"your_permissions": ["read_only"]
}
}
Causes:
- API key has read-only permissions
- Stop operations disabled for account
- Sub-account with limited permissions
Resolution:
- Request permission upgrade from account owner
- Use master API key instead of sub-account key
- Contact support to enable stop permissions
速率限制
Period | Limit | Description |
---|---|---|
1 minute | 6 requests | Maximum 6 requests per minute per API key |
1 hour | 100 requests | Maximum 100 requests per hour per API key |
1 day | 1000 requests | Maximum 1000 requests per day per API key |
速率限制报头
http
X-RateLimit-Limit-Minute: 6
X-RateLimit-Remaining-Minute: 5
X-RateLimit-Reset-Minute: 1699528860
X-RateLimit-Limit-Hour: 100
X-RateLimit-Remaining-Hour: 98
X-RateLimit-Reset-Hour: 1699532400
X-RateLimit-Limit-Day: 1000
X-RateLimit-Remaining-Day: 995
X-RateLimit-Reset-Day: 1699574400
速率限制超出响应 (429)
json
{
"code": -1,
"msg": "API rate limit exceeded",
"data": {
"retry_after": 45,
"limit": "6 per minute",
"reset_at": 1699528860
}
}
理解停止功能
停止后会发生什么
立即采取的措施
- Energy delegation halted immediately
- Any active energy reclaimed from address
- Address status changed to "paused"
- Cycles remain intact and preserved
能量回收
- Currently delegated energy returned to pool
- Takes 1-2 TRON blocks (3-6 seconds)
- Energy available for other addresses
- Transaction recorded on blockchain
周期保留
- All remaining cycles kept in queue
- No cycles lost or expired
- Cycle counter frozen
- Ready for resumption anytime
状态更新
- Database updated to paused state
- Monitoring alerts may trigger
- Webhooks sent if configured
- Dashboard reflects new status
停止与删除对比
Feature | Stop | Delete |
---|---|---|
Reversibility | Fully reversible | Permanent for billing cycle |
Cycles | Preserved | Lost |
Energy | Reclaimed | Reclaimed |
Host Mode | Remains active | Removed |
Resume Cost | Free | Must re-add and repurchase |
Use Case | Temporary pause | Permanent removal |
何时使用Stop
维护窗口
- Scheduled blockchain maintenance
- Smart contract upgrades
- Wallet maintenance
- Security audits
成本优化
- Low activity periods
- Weekend/holiday breaks
- Testing phases complete
- Budget constraints
安全问题
- Suspicious activity detected
- Key compromise suspected
- Pending security review
- Emergency response
运行原因
- Project paused
- Development halted
- Migration in progress
- Resource reallocation
简历流程
如何恢复
停止地址后,您可以使用以下方法恢复能量委托:
Automatic Resume (Not available - must use manual)
Manual Resume via API
- Use
/time/infinitystart
endpoint to resume - Same API key required
- Instant reactivation
- Use
仪表盘摘要
- Login to dashboard
- Navigate to Host Mode section
- Click "Resume" button
- Confirm action
简历要求
- Address must be in paused state
- API key must own the address
- Account must be active
- No pending operations
简历时间线
- Instant: Status change immediate
- Energy Delegation: Next cycle within 1-5 minutes
- Full Activation: Complete within one cycle period
主机模式影响
停止之前
- Address receives automatic energy every 24 hours
- Cycles consumed sequentially
- Energy available for transactions
- Automatic management active
停止期间
- No energy delegations occur
- Cycles remain frozen
- Address uses own resources only
- Management suspended
恢复后
- Energy delegations restart
- Cycles continue from where stopped
- Automatic management resumes
- No configuration lost
##计费影响
成本节约
- Standard Mode: No charges during stop period
- Infinity Mode: Daily charges may pause (check terms)
- Cycles: Preserved cycles retain value
- Refunds: No refunds for partial cycles
###计费行为
Mode | During Stop | Billing Impact |
---|---|---|
Standard | Paused | No new charges |
Infinity | Varies | May continue daily billing |
Cycles | Frozen | No consumption, no charges |
成本恢复
- Standard Mode: No cost to resume
- Infinity Mode: Regular billing resumes
- Additional Cycles: Can purchase when resuming
安全注意事项
身份验证安全
- API Key Storage: Never expose API keys in client-side code
- HTTPS Only: All requests must use HTTPS
- IP Whitelist: Configure IP whitelist for production use
- Key Rotation: Rotate API keys regularly
停止操作安全
所有权验证
- Only owner can stop address
- API key must match records
- IP must be whitelisted
状态验证
- Address must be active
- No pending operations
- Valid Host Mode status
审计追踪
- All stop operations logged
- Timestamp recorded
- IP address captured
- Reason tracking available
安全最佳实践
- Stop addresses immediately if compromise suspected
- Monitor stop/resume patterns for anomalies
- Set up alerts for unexpected stops
- Review audit logs regularly
技术架构
服务组件
API 网关
- Request validation and routing
- Rate limiting enforcement
- IP whitelist checking
状态管理器
- Address state transitions
- Status validation
- Conflict resolution
能量管理器
- Delegation control
- Energy reclamation
- Resource reallocation
区块链服务
- Undelegate transactions
- Confirmation monitoring
- Transaction verification
数据库层
- State persistence
- Audit logging
- Status tracking
请求流程
- Client sends POST request with API key and address
- API Gateway validates request format and rate limits
- Authentication Service verifies API key and permissions
- State Manager checks current address status
- Energy Manager initiates reclamation if energy delegated
- Blockchain Service submits undelegate transaction
- Database updated with paused state
- Response sent to client with transaction details
状态转换
Active → Stopping → Paused → Resuming → Active
↓ ↓
[Error] [Error]
↓ ↓
Active Paused
相关端点
- POST /apiv2/time/add - Add address to Host Mode
- POST /apiv2/time/infinitystart - Resume stopped address
- POST /apiv2/time/status - Check current status
- POST /apiv2/time/delete - Permanently remove address
- POST /apiv2/time/order - Purchase cycles before resuming
最佳实践
何时停止
计划维护
- Stop before maintenance windows
- Resume after confirmation
- Test on non-critical addresses first
成本管理
- Stop during low activity periods
- Monitor usage patterns
- Optimize based on actual needs
安全响应
- Stop immediately on suspicion
- Investigate thoroughly
- Resume only when cleared
停止模式
定期计划
python# Stop addresses on weekends import datetime if datetime.datetime.now().weekday() >= 5: # Saturday or Sunday stop_energy_delegation(API_KEY, ADDRESS)
基于活动的
javascript// Stop if no activity for 24 hours if (address.transaction_count_24h === 0) { await stopEnergyDelegation(API_KEY, address.address); }
基于阈值的
python# Stop if energy usage below threshold if address['energy_usage_24h'] < 10000: stop_energy_delegation(API_KEY, address['address'])
自动化示例
计划停止/恢复
pythonimport schedule import time def stop_for_maintenance(): stop_energy_delegation(API_KEY, ADDRESS) def resume_after_maintenance(): # Use infinitystart endpoint to resume resume_energy_delegation(API_KEY, ADDRESS) # Schedule stop at 2 AM schedule.every().day.at("02:00").do(stop_for_maintenance) # Schedule resume at 4 AM schedule.every().day.at("04:00").do(resume_after_maintenance) while True: schedule.run_pending() time.sleep(60)
条件停止
javascript// Stop based on market conditions async function conditionalStop() { const marketPrice = await getTRXPrice(); if (marketPrice > THRESHOLD_PRICE) { // Stop to save costs when price high await stopEnergyDelegation(API_KEY, ADDRESS); } }
故障排除
常见问题
“主机模式下找不到地址”
问题: 尝试停止非主机模式下的地址
解决方案:
- Verify address with
/time/status
endpoint - Check if address was deleted
- Ensure using correct API key
- Verify address format is correct
“地址委托已停止”
问题: 地址已暂停
解决方案:
- Check current status with
/time/status
- No action needed if already stopped
- Use
/time/infinitystart
to resume if needed
“无法停止具有活动委托的地址”
问题: 委托交易正在进行中
解决方案:
- Wait 1-2 minutes for transaction to complete
- Check blockchain for transaction status
- Retry after confirmation
- Contact support if persists
“无效的API密钥”
问题: API 密钥无法识别或已过期
解决方案:
- Verify API key is correct
- Check account status in dashboard
- Ensure API key has proper permissions
- Generate new API key if needed
停止无效
症状: 地址在停止后仍显示为活动状态
解决方案:
- Wait 1-2 minutes for propagation
- Check transaction hash on blockchain
- Verify no errors in response
- Force refresh status endpoint
- Contact support with transaction details
未回收的能量
症状: 能量在停止后仍被委托
解决方案:
- Check blockchain transaction status
- Wait for network confirmation
- Verify sufficient bandwidth for transaction
- Check for network congestion
- Contact support if energy stuck
无法在停止后恢复
症状: 恢复尝试失败
解决方案:
- Verify address is in paused state
- Check account has sufficient balance
- Ensure no pending operations
- Try resume after 5 minutes
- Contact support with error details
监控和告警
建议监控
停止事件
- Track all stop operations
- Monitor stop frequency
- Alert on unexpected stops
恢复模式
- Track time between stop and resume
- Identify addresses frequently stopped
- Alert on failed resumes
成本影响
- Calculate savings from stops
- Track efficiency improvements
- Monitor billing changes
警报配置
json
{
"alerts": [
{
"type": "address_stopped",
"threshold": "immediate",
"notification": "email"
},
{
"type": "multiple_stops",
"threshold": "3 in 1 hour",
"notification": "sms"
},
{
"type": "stop_failed",
"threshold": "immediate",
"notification": "webhook"
}
]
}
备注
- Instant Effect: Stop takes effect immediately upon success
- Cycle Preservation: All cycles remain intact during stop period
- Free Resume: No cost to resume stopped addresses
- Energy Reclaim: Reclaimed energy available for other addresses immediately
- No Time Limit: Addresses can remain stopped indefinitely
- Batch Operations: Stop multiple addresses with client-side iteration
- Webhook Support: Configure webhooks for stop/resume notifications
- Audit Trail: All stop operations logged for compliance
- Emergency Stop: Can be used for immediate security response
- Graceful Handling: System handles stop during active delegations
- Status Persistence: Stop status survives system restarts
- API Versioning: This is v2 API; v1 has different behavior
- Maintenance Mode: Addresses remain stopped during platform maintenance
- Recovery: Automatic recovery procedures if stop fails
- Monitoring: Real-time monitoring of stopped addresses in dashboard