TRC10 issuance is a transaction flow rather than a Solidity contract deployment. The original TronWeb example selected a provider, built an asset-creation transaction, signed it, and submitted the signed result.
The original install command was:
npm i tronweb --save
The historical client
import TronWeb from 'tronweb'
export default class TRONTokenClient {
async start(): Promise<any> {
const mainNetProvider = 'https://api.trongrid.io';
const testNetProvider = 'https://api.shasta.trongrid.io';
const netProvider = testNetProvider;
const HttpProvider = TronWeb.providers.HttpProvider; // Optional provider, can just use a url for the nodes instead
const fullNode = new HttpProvider(`${netProvider}`); // Full node http endpoint
const solidityNode = new HttpProvider(`${netProvider}`); // Solidity node http endpoint
const eventServer = `${netProvider}`; // Contract events http endpoint
const privateKey = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx';
const tronWeb = new TronWeb(
fullNode,
solidityNode,
eventServer,
privateKey
);
const defaultTestAddress = tronWeb.address.fromPrivateKey(privateKey);
await this.createTestTRC10Token(tronWeb, defaultTestAddress, privateKey);
// Verify at: https://shasta.tronscan.org/#/
}
async signAndSubmitTx(tronWeb, rawTxObject, privateKey) {
console.log(rawTxObject);
const sign = await tronWeb.trx.sign(rawTxObject, privateKey);
console.log({sign});
const tx = await tronWeb.trx.sendRawTransaction(sign);
// console.log(tx);
return tx;
}
async createTestTRC10Token(tronWeb, issuerAddress, privateKey) {
try {
let options = {
name: 'ExampleToken',
abbreviation: 'nhancv',
description: 'Example token for a historical test',
url: 'nhancv.com',
totalSupply: 1000000000,
trxRatio: 1, // How much TRX will tokenRatio cost?
tokenRatio: 1, // How many tokens will trxRatio afford?
saleStart: Date.now() + 10000, // sale start mus > now
saleEnd: Date.now() + 31536000000, // 365 days
freeBandwidth: 0, // The creator's "donated" bandwidth for use by token holders
freeBandwidthLimit: 0, // Out of totalFreeBandwidth, the amount each token holder get
frozenAmount: 0,
frozenDuration: 0
};
const issuerHex = tronWeb.address.toHex(issuerAddress);
const rawTxObj = await tronWeb.transactionBuilder.createToken(options, issuerHex);
// https://shasta.tronscan.org/#/
console.log({rawTxObj});
const res = await this.signAndSubmitTx(tronWeb, rawTxObj, privateKey);
console.log({res});
} catch (e) {
console.error(e);
}
}
}
The private-key field is symbolic, and token names have been generalized. The source used Shasta and an older multi-provider TronWeb constructor; the package version was not pinned by its install command.
The earlier note also recorded a one-asset-per-account restriction. Its applicability belongs to the intended chain and protocol configuration, not a newly verified network check here.
Broadcast acceptance and logging a result do not establish confirmation or the issued asset’s final state. No key, wallet, token, or transaction was created for this revision. The TRC10 documentation is the protocol reference.