/docker-java-tron

Dockerfiles for building container-friendly java-tron images with event-plugin bundled

Primary LanguageShellMIT LicenseMIT

Dockerfile for java-tron

This repository hosts custom Dockerfiles for building java-tron images that are more container-friendly and works out of the box.

Docker Hub

Images are built with GitHub Actions. Available here.

Data Storage

Blockchain data are stored in /data. No volume is mounted by default. Mount a volume to /data for data persistence, or you'll lose data once the container is removed.

For example, you can use an existing output-directory on your host system at /your/output-directory with:

$ docker run -v /your/output-directory:/data sunstake/java-tron

Example: Running a Local Single-Node Testnet

Running a local, single-node test network can be helpful for developing and testing decentralized applications. With docker-java-tron you can do it with a simple command by setting NETWORK to dev and enabling witness mode:

$ docker run -e NETWORK=dev -e WITNESS_MODE=true -p 8090:8090 sunstake/java-tron

Once the node is up you can access it like:

$ curl -X POST http://localhost:8090/wallet/getnowblock

The local network contains a witness account with a lot of test TRX:

Private Key: da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0
Address: TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY

Configuration

Configuration can be done via environment variables. The entry script modifies the config file on the fly before the node is run.

NETWORK

The Tron network to connect to.

Options:

  • mainnet (default)
  • nile
  • dev (local single-node test network)

P2P_PORT

The port on which the node listens on for P2P networking. Defaults to 18888.

FULL_NODE_PORT

The port on which the node serves full node HTTP API. Defaults to 8090.

SOLIDITY_NODE_PORT

The port on which the node serves solidity node HTTP API. Defaults to 8091.

VM_MAX_TIME_RATIO

TVM time ratio to avoid timeout. See this issue. Defaults to 5.0.

WITNESS_MODE

NOTE

This option is only supported on version 4.1.1 or higher.

Whether to enable witness mode (block producer), useful for running a local test network.

Options:

  • true
  • false (default)

EVENT_PLUGIN_ENABLED

Whether to enable the Kafka event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_KAFKA_SERVER

Kafka server address for the event plugin. Mandatory if EVENT_PLUGIN_ENABLED is true.

EVENT_PLUGIN_BLOCK_TRIGGER_ENABLED

Whether to enable the block trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_TRANSACTION_TRIGGER_ENABLED

Whether to enable the transaction trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_CONTRACTEVENT_TRIGGER_ENABLED

Whether to enable the contractevent trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_CONTRACTLOG_TRIGGER_ENABLED

Whether to enable the contractlog trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_SOLIDITY_BLOCK_TRIGGER_ENABLED

Whether to enable the solidity trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_SOLIDITY_EVENT_TRIGGER_ENABLED

Whether to enable the solidityevent trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_SOLIDITY_LOG_TRIGGER_ENABLED

Whether to enable the soliditylog trigger for the event plugin.

Options:

  • true
  • false (default)

EVENT_PLUGIN_ADDRESS_FILTER

Contract address filter for the event plugin. Multiple addresses are separated by space. By default no filter is applied.

EVENT_PLUGIN_TOPIC_FILTER

Contract topic filter for the event plugin. Multiple topics are separated by space. By default no filter is applied.