发行TRC-10代币

HTTP接口:

wallet/createassetissue
作用:创建未签名的发行TRC10 Token交易
示例:curl -X POST  https://api.shasta.trongrid.io/wallet/createassetissue -d '{
"owner_address":"417946F66D0FC67924DA0AC9936183AB3B07C81126",
"name":"0x6173736574497373756531353330383934333132313538",
"abbr": "0x6162627231353330383934333132313538",
"total_supply" :100000000,
"trx_num":1,
"num":1,
"precision":1,
"start_time" : 1581928489000,
"end_time":1581938187000,
"description":"007570646174654e616d6531353330363038383733343633",
"url":"007570646174654e616d6531353330363038383733343633",
"free_asset_net_limit":10000,
"public_free_asset_net_limit":10000,
"frozen_supply":{"frozen_amount":1, "frozen_days":2}
}'
参数说明:
owner_address发行人地址    
name是token名称    
abbr是token简称  
total_supply是发行总量  
trx_num和num是token和trx的兑换价值  
precision是精度,也就是小数点个数  
start_time和end_time是token发行起止时间  
description是token说明,需要是hexString格式 
url是token发行方的官网,需要是hexString格式 
free_asset_net_limit是每个token拥护者能使用本token的免费带宽
public_free_asset_net_limit是Token的总的免费带宽
frozen_supply是token发行者可以在发行的时候指定质押的token  

返回值:发行Token的Transaction

Tronweb示例:

const privateKey = "...";
var createAssetAddress = "TM2TmqauSEiRf16CyFgzHV2BVxBejY9iyR";
const trc_options = {
      name : "test", 
      abbreviation : "tt",  
      description : "fortest", 
      url : "www.baidu.com",
      totalSupply : 10000000,
      trxRatio : 1,
      tokenRatio : 1,
      saleStart : 1581929489000,
      saleEnd : 1581938187000,
      freeBandwidth : 0,
      freeBandwidthLimit : 0,
      frozenAmount : 0,
      frozenDuration : 0,
      precision : 6
}
//创建一个未签名的交易,用于发行trc10代币,相当于 createToken
tradeobj = await tronWeb.transactionBuilder.createAsset(
      trc_options,
      createAssetAddress
).then(output => {
  console.log('- Output:', output, '\n');
  return output;
});
//签名
const signedtxn = await tronWeb.trx.sign(
      tradeobj,
      privateKey
);
//广播
const receipt = await tronWeb.trx.sendRawTransaction(
      signedtxn
).then(output => {
  console.log('- Output:', output, '\n');
  return output;
});

Wallet-cli示例 :

#用法: AssetIssue [OwnerAddress] AssetName AbbrName TotalSupply TrxNum AssetNum Precision StartDate EndDate Description Url FreeNetLimitPerAccount PublicFreeNetLimit FrozenAmount0 FrozenDays0 ... FrozenAmountN FrozenDaysN
AssetIssue TestToken TT 100000 1 1 6 "2020-02-19 22:25:00" "2020-03-20" "This is a TRC10 Token" "https://shasta.tronscan.org/" 0 0

请按照以下说明步骤完成本次交易:
1.提示:“Please confirm and input your permission id, if input y or Y means default 0, other non-numeric characters will cancel transaction.”,输入“y” 或是“Y”, 确认本次交易;
2.提示:“lease choose your key for sign. …… Please choose between 1 and 2”,选择签名账户的序号;
3.提示:“Please input your password.”,输入本地密码;
4.提示:“AssetIssue TestToken successful !!” 表示成功发行TRC10 代币。