Skip to content

/wallet/createwitness

Apply to become a Super Representative (SR) candidate. The fee is the current chain parameter getAccountUpgradeCost, expressed in sun; its default is 9,999,000,000 sun (9999 TRX). Governance proposals can change this fee.

  • Source: framework/src/main/java/org/tron/core/services/http/CreateWitnessServlet.java
  • Method: POST
  • Contract: protocol.WitnessCreateContract

Request parameters

Field Type Required Description
owner_address string Yes Applicant address
url string Yes Candidate URL (hex UTF-8)
Permission_id int32 No Multi-sig permission ID
visible bool No Format of address / text fields

Example:

curl --request POST \
     --url https://nile.trongrid.io/wallet/createwitness \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "owner_address": "41dd791d6b49e190062d650e6a23c575510d35f2f9",
  "url":           "68747470733a2f2f747261782e696f"
}
'

Response

Before construction, the validator checks that the account balance is at least the current getAccountUpgradeCost (default 9999 TRX) and that the account is not already an SR candidate. The example account has insufficient balance; the actual Nile response is:

{"Error": "class org.tron.core.exception.ContractValidateException : balance < AccountUpgradeCost"}

When validation passes, returns an unsigned protocol.Transaction. Structure outline (txID / ref_block_* / expiration / timestamp / raw_data_hex semantics are the same as /wallet/createtransaction):

{
  "visible": false,
  "txID": "<computed from raw_data>",
  "raw_data": {
    "contract": [
      {
        "parameter": {
          "value": {
            "owner_address": "41dd791d6b49e190062d650e6a23c575510d35f2f9",
            "url":           "68747470733a2f2f747261782e696f"
          },
          "type_url": "type.googleapis.com/protocol.WitnessCreateContract"
        },
        "type": "WitnessCreateContract"
      }
    ],
    "ref_block_bytes": "<reference block selected by trx.reference.block; default: solid>",
    "ref_block_hash":  "<reference block selected by trx.reference.block; default: solid>",
    "expiration":      "<head block timestamp + trx.expiration.timeInMilliseconds (default interval: 60_000 ms)>",
    "timestamp":       "<construction wall-clock time>"
  },
  "raw_data_hex": "<protobuf encoding of raw_data>"
}

Error responses

Trigger Response
Request body exceeds node.http.maxMessageSize Usually HTTP 413 Payload Too Large when rejected by SizeLimitHandler
Request body is not valid JSON / field type mismatch {"Error": "class org.tron.json.JSONException : <parser info>"} or {"Error": "class org.tron.core.services.http.JsonFormat$ParseException : <decoder info>"}
Invalid owner_address {"Error": "class org.tron.core.exception.ContractValidateException : Invalid address"}
Invalid url (empty or too long) {"Error": "... : Invalid url"}
owner account does not exist {"Error": "... : account[<address>] not exists"}
Address is already an SR candidate {"Error": "... : Witness[<address>] has existed"}
Balance < AccountUpgradeCost (default 9999 TRX) {"Error": "... : balance < AccountUpgradeCost"}
Other exceptions {"Error": "<exceptionClass> : <message>"}