CreateTransaction using Trongrid API

Publish date: 2024-05-21

I am trying to create a tron transaction using trongrid APi. But when I do so, I get the following error:

{ "Error": "class org.tron.core.exception.ContractValidateException : Validate TransferContract error, no OwnerAccount." }

There is the api: https://developers.tron.network/reference/createtransaction

There is the curl command:

curl --request POST \ --url https://api.shasta.trongrid.io/wallet/createtransaction \ --header 'accept: application/json' \ --header 'content-type: application/json' \ --data ' { "to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "415c543dca23f94f3e3db585368cb070204efeca0f", "amount": 100000 } ' 
1

1 Answer

You are missing the TRON-PRO-API-KEY header. Here is a an example:

curl -X POST \ https://api.trongrid.io/wallet/createtransaction \ -H 'Content-Type: application/json' \ -H 'TRON-PRO-API-KEY: 25f66928-0b70-48cd-9ac6-da6f8247c663' \ -d '{ "to_address": "41e9d79cc47518930bc322d9bf7cddd260a0260a8d", "owner_address": "41D1E7A6BC354106CB410E65FF8B181C600FF14292", "amount": 1000 }' 

You can create your api key here.

Notice that this will only create the transaction string, you still need to sign it and broadcast to the network:

Create -> Sign -> Broadcast -> (wait) -> Lookup and get receipt

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobm5xaG2FdHyOnKmemaSawbOtzayYnKyZpLtuwdKipaBlpKe8r7PRoptmmaCe