TRON Blockchain Client

Configuration

[blockchain_a]
  type = "tron"
  # image = "tronbox/tre" is default image

Default port is 9090

Usage

package examples

import (
	"github.com/smartcontractkit/chainlink-testing-framework/framework"
	"github.com/smartcontractkit/chainlink-testing-framework/framework/components/blockchain"
	"github.com/stretchr/testify/require"
	"testing"
)

type CfgTron struct {
	BlockchainA *blockchain.Input `toml:"blockchain_a" validate:"required"`
}

func TestTRONSmoke(t *testing.T) {
	in, err := framework.Load[CfgTron](t)
	require.NoError(t, err)

	bc, err := blockchain.NewBlockchainNetwork(in.BlockchainA)
	require.NoError(t, err)

	// all private keys are funded
	_ = blockchain.TRONAccounts.PrivateKeys[0]

	t.Run("test something", func(t *testing.T) {
		// use internal URL to connect Chainlink nodes
		_ = bc.Nodes[0].DockerInternalHTTPUrl
		// use host URL to interact
		_ = bc.Nodes[0].HostHTTPUrl

		// use bc.Nodes[0].HostHTTPUrl + "/wallet" to access full node
		// use bc.Nodes[0].HostHTTPUrl + "/walletsolidity" to access Solidity node
	})
}

More info

Follow the guide if you want to work with TRONBox environment via JS

Golang HTTP Client

TRON doesn't have any library to interact with it in Golang but we maintain our internal fork here

Check TRON HTTP API

Full node is on :9090/wallet

curl -X POST http://127.0.0.1:9090/wallet/createtransaction -d '{                                                           
    "owner_address": "TRGhNNfnmgLegT4zHNjEqDSADjgmnHvubJ",
    "to_address": "TJCnKsPa7y5okkXvQAidZBzqx3QyQ6sxMW",
    "amount": 1000000,
    "visible": true
}'

Solidity node is on :9090/walletsolidity

curl -X POST  http://127.0.0.1:9090/walletsolidity/getaccount -d '{"address": "41E552F6487585C2B58BC2C9BB4492BC1F17132CD0"}'