Socket
Book a DemoInstallSign in
Socket

tronweb

Package Overview
Dependencies
Maintainers
2
Versions
140
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tronweb

JavaScript SDK that encapsulates the TRON HTTP API

6.0.4
latest
Source
npmnpm
Version published
Weekly downloads
251K
36.77%
Maintainers
2
Weekly downloads
 
Created

What is tronweb?

TronWeb is a JavaScript library that provides a comprehensive set of tools for interacting with the TRON blockchain. It allows developers to create, deploy, and interact with smart contracts, manage accounts, and perform transactions on the TRON network.

What are tronweb's main functionalities?

Account Management

This feature allows you to manage TRON accounts, including retrieving account information such as balance and transaction history. The code sample demonstrates how to initialize TronWeb and fetch account details using an address.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function getAccountInfo(address) {
  const accountInfo = await tronWeb.trx.getAccount(address);
  console.log(accountInfo);
}

getAccountInfo('your_tron_address');

Smart Contract Interaction

TronWeb allows you to interact with smart contracts on the TRON network. This code sample shows how to call a method on a deployed smart contract by specifying the contract address, method name, and parameters.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function callContractMethod(contractAddress, methodName, parameters) {
  const contract = await tronWeb.contract().at(contractAddress);
  const result = await contract[methodName](...parameters).call();
  console.log(result);
}

callContractMethod('contract_address', 'methodName', ['param1', 'param2']);

Transaction Management

This feature enables you to manage transactions on the TRON network, including sending TRX tokens. The code sample demonstrates how to send a transaction to a specified address with a given amount.

const TronWeb = require('tronweb');
const tronWeb = new TronWeb({
  fullHost: 'https://api.trongrid.io',
  privateKey: 'your_private_key'
});

async function sendTransaction(to, amount) {
  const transaction = await tronWeb.trx.sendTransaction(to, amount);
  console.log(transaction);
}

sendTransaction('recipient_address', 1000);

Other packages similar to tronweb

Keywords

TRON

FAQs

Package last updated on 31 Jul 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.