API for Tronscan.org
Requirements • Installation • tronscan.org • api.tronscan.org
Tronscan API provides data for the Tronscan Frontend. Tronscan API is built with Scala using Play Framework and Akka Streams.
The non-blocking architecture of Play combined with the reactive streams of Akka provides a high performance synchronisation system.
- Import of the blockchain from Full/Solidity Node
- Swagger UI for API documentation
- EHCache / Redis Caching
- Socket.io API provides a stream of events from the blockchain
- Network Scanner scans the network using GRPC and hops between nodes to find all the nodes in the network
- GRPC Load Balancer uses data provided from the network scanner to find the fastest nodes to communicate with
- Vote Scraper makes periodic snapshots of the votes to provide historical vote data
- (Beta) Remote Device signing provides a websocket API to sign transactions from an external device
- PostgreSQL 9.6
- Java 8
- Redis
- SBT
- Create a new database in PostgreSQL, for example
tron-explorer
- Create the schema by running the schema script
- Change the
slick.dbs.default
anddb.default
connection details in application.conf
- Run
sbt run
The GRPC api is intended to be a JSON proxy for the GRPC api
Transactions can be created, signed and broadcasted to the network. This feature should only be used for test purposes or on a self-hosted instance. Never send your private keys to api.tronscan.org
All contract endpoints support:
Broadcast
Broadcast the transaction to the network.
The private key is required when broadcasting a transaction
"broadcast": true
Signing
Sign the transaction with a private key.
only use this for testing or self-hosted instances.
"key": "FFA5EA61073FB13E1559F182F91E25C3E51C03906428C7BC8C865A335AED7617"
Example
Broadcast a signed transfer contract to the network
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
"toAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E",
"amount": 100000
},
"key": "FFA5EA61073FB13E1559F182F91E25C3E51C03906428C7BC8C865A335AED7617",
"broadcast": true
}
All contract endpoints return the same result
{
"success": true,
"result": {
"code": "SUCCESS",
"message": ""
}
}
ownerAddress
From Account
toAddress
To Account
amount
Amount of coins to send in sun
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
"toAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E",
"amount": 100000
},
...
}
ownerAddress
From Account
toAddress
To Account
assetName
Token Name
amount
Amount of coins to send in sun
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
"toAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E",
"assetName": "ExampleToken",
"amount": 100000
},
...
}
ownerAddress
Owner Account
accountAddress
Account Address to create
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
"accountAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E"
},
...
}
ownerAddress
Owner Account
accountName
Account Address
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
"accountName": "NewName"
},
...
}
ownerAddress
Owner Account for with to claim rewards
{
"contract": {
"ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu"
},
...
}