Tron API En
Chinese API
  • Basic information
  • Tron API
    • Get related configuration
    • Pre-order
    • create trx engerg order
    • create usdt engerg order
    • create bandwidth order
    • upload purchase order hash
    • create a sell order
    • Earn energy by stake
    • recovered energy
    • cancel order
    • query purchase order
    • query recent finished order
    • query purchase order records by user address
    • query sell order records by user address
  • Seller Tron API
    • Get seller configuration
    • Seller authorization
    • Update seller configuration
    • Get seller panel
  • Buyer Tron API
    • Get buyer configuration
    • Buyer charge
    • Buyer withdraw
    • Buyer leas energy
    • Buyer leas energy records
    • Buyer asset records
  • FAQ
    • Error Code
Powered by GitBook
On this page
  • Endpoint usage
  • code example
  • Postman example
  1. Tron API

Earn energy by stake

Endpoint usage

POST https://open.tronify.io/api/tronRent/createfreezeBalanceTransaction

The fields with * are required, and the fields without * are optional

Request Body

Name
Type
Description

saleAddress*

String

user address (wallet address for stake creation)

sourceFlag*

String

Source channel (Both sides need to agree on a name to represent the channel of the third parties)

payTrxNum*

String

amount of stake trx

orderType*

String

order type(ENERGY/BANDWIDTH)

{
    "resCode": 100,
    "resMsg": "Success",
    "data": {
        "visible": false,
        "txID": "05694544c56863032625dce3554e62220fd4b36d32172fd125d255123e4a0826",
        "raw_data": {
            "contract": [
                {
                    "parameter": {
                        "value": {
                            "resource": "ENERGY",
                            "frozen_balance": 400000000,
                            "owner_address": "41dcf5a07cfac1534c2410714d6ba6576f49c4a6d7"
                        },
                        "type_url": "type.googleapis.com/protocol.FreezeBalanceV2Contract"
                    },
                    "type": "FreezeBalanceV2Contract"
                }
            ],
            "ref_block_bytes": "717a",
            "ref_block_hash": "8fb56414b12b26fe",
            "expiration": 1682088777000,
            "timestamp": 1682088718991
        },
        "raw_data_hex": "0a02717a22088fb56414b12b26fe40a8aab7a2fa305a5b083612570a34747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e467265657a6542616c616e63655632436f6e7472616374121f0a1541dcf5a07cfac1534c2410714d6ba6576f49c4a6d7108088debe011801708fe5b3a2fa30"
    }
}
{
    // Response
}

code example

// example
const params = {
    saleAddress: 'TKghVbeEzvrV8GLK3YE1gRrjVHSf8rGB6k',
    orderType: 'ENERGY',
    payTrxNum: 111,
    sourceFlag: 'tronLink'
}
 const res = await axios.post('https://open.tronify.io/api/tronRent/createfreezeBalanceTransaction',params)
 console.log(res)
 if(res.resCode === '100'){
    const signedTx = await tronWeb.trx.sign(res.data)
    const broastTx = await tronWeb.trx.sendRawTransaction(signedTx)
    return broastTx.txid
 }

Postman example

Previouscreate a sell orderNextrecovered energy

Last updated 1 year ago