tronscan / tronscan-api

Tronscan API
https://api.tronscan.org
59 stars 37 forks source link
tron-protocol

NOTE: This repo is DEPRECATED. tronscan-api now is a private project!!!



Tronscan API

API for Tronscan.org

RequirementsInstallationtronscan.orgapi.tronscan.org

Intro

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.

Features

Requirements

Installation

Running

GRPC API

The GRPC api is intended to be a JSON proxy for the GRPC api

Creating Transactions

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

API

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
}

Response

All contract endpoints return the same result

{
  "success": true,
  "result": {
    "code": "SUCCESS",
    "message": ""
  } 
}

Endpoints

POST /api/transaction-builder/contract/transfer

ownerAddress From Account
toAddress To Account
amount Amount of coins to send in sun

{
  "contract": {
    "ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
    "toAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E",
    "amount": 100000
  },
  ...
}

POST /api/transaction-builder/contract/transferasset

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
  },
  ...
}

POST /api/transaction-builder/contract/accountcreate

ownerAddress Owner Account
accountAddress Account Address to create

{
  "contract": {
    "ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
    "accountAddress": "TWxKPGEyGWEP87Z4GrBccQiWQCf5iUHx9E"
  },
  ...
}

POST /api/transaction-builder/contract/accountupdate

ownerAddress Owner Account
accountName Account Address

{
  "contract": {
    "ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu",
    "accountName": "NewName"
  },
  ...
}

POST /api/transaction-builder/contract/withdrawbalance

ownerAddress Owner Account for with to claim rewards

{
  "contract": {
    "ownerAddress": "TPwJS5eC5BPGyMGtYTHNhPTB89sUWjDSSu"
  },
  ...
}