Category Archives: Uncategorized

Shasta 测试网

Shasta has been updated. Since we wipe out the database,
You might want to re deploy the contracts.

The access for event server, full node and solidity node via https is:
Https://api.shasta.trongrid.io

GRPC access for full node is
grpc.shasta.trongrid.io:50051

GRPC access for solidity node is
grpc.shasta.trongrid.io:50052

If you want to connect, the conga file can be found at
https://github.com/tronprotocol/tron-deployment/blob/master/test_net_config.conf for full node
and
https://github.com/tronprotocol/tron-deployment/blob/master/shasta_sol.conf for solidity node

Correction:
for full node confg its https://github.com/tronprotocol/tron-deployment/blob/master/shasta.conf

Tron 资源消耗

带宽

普通的转账是不收手续费的,但是会消耗bd ,如果bd 不足的情况下会消耗trx

bd是跟字节有关,一般一笔交易是200字节左右

每天会有5000免费带宽

1bd= 10Sun

https://developers.tron.network/docs/bandwith

每笔交易消耗的trx根据交易大小计算而来,10sun/byte

一般一笔交易是200字节左右,即一笔交易0.002TRX

如果是激活新的账户的话,也是需要0.1trx的,所以如果你是向一个新的账户转账,也是需要消耗0.1trx 的手续费的

能量

1energy = 20sun

1trx 也就是 50000energy

TRON 能量和带宽计算器:https://tronstation.io/energycalc

triggersmartcontract 的使用说明

triggersmartcontract:api 接口参数以及返回数据的注释文档

https://github.com/tronprotocol/Documentation/blob/master/TRX_CN/Tron-http.md

https://developers.tron.network/v3.0/reference#trigger-smart-contract

Shell

调用合约指令

triggercontract

参数说明

contract_address:即之前部署过合约的地址,格式 base58,如:TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6
method:调用的函数签名,如set(uint256,uint256)或者 fool(),参数使用','分割且不能有空格
args:如果非十六进制,则自然输入使用','分割且不能有空格,如果是十六进制,直接填入即可
is_hex:输入参数是否为十六进制,false 或者 true
fee_limit:和deploycontract的时候类似,表示本次部署合约消耗的TRX的上限,单位是SUN(1 SUN = 10-6 TRX),包括CPU资源、STORAGE资源和可用余额的消耗。
value:在部署合约时,给该合约转账金额,使用十六进制32位表示

调用的例子

设置 mapping 1->1
triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 set(uint256,uint256) 1,1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000

取出 mapping key = 1的 value
triggercontract TTWq4vMEYB2yibAbPV7gQ4mrqTyX92fha6 get(uint256) 1 false 1000000 0000000000000000000000000000000000000000000000000000000000000000

RPC 调用

wallet/triggersmartcontract
作用:调用合约
demo: curl -X POST http://127.0.0.1:8090/wallet/triggercontract -d '{"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"set(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","fee_limit":10,"call_value":100,"owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}'
参数说明:
contract_address,hexString格式
function_selector,函数签名,不能有空格
parameter:调用参数[1,2]的虚拟机格式,使用remix提供的js工具,将合约调用者调用的参数数组[1,2]转化为虚拟机所需要的参数格式
fee_limit:最大消耗的SUN(1TRX = 1,000,000SUN)
call_value:本次调用往合约转账的SUN(1TRX = 1,000,000SUN)
owner_address:发起triggercontract的账户地址
返回值:TransactionExtention, TransactionExtention中包含未签名的交易Transaction

TRON 开发参考文档

官方主网fullnode
api.trongrid.io

建立本地测试环境可以参考:
https://developers.tron.network/v1.0/docs/getting-started-1

RPC请求测试参考
https://developers.tron.network/docs/api-sign-flow

获取当前区块
https://api.trongrid.io/wallet/getnowblock
https://api.trongrid.io/walletsolidity/getnowblock

部署工具,类似于以太坊的remix
https://developers.tron.network/docs/tron-studio-intro

web3
https://github.com/TronWatch/TronWeb

开发 best-practices
https://developers.tron.network/docs/best-practices

Tron-http
https://github.com/tronprotocol/Documentation/blob/master/TRX/Tron-http.md

TRON_Wallet_RPC-API
https://github.com/tronprotocol/Documentation/blob/master/English_Documentation/TRON_Protocol/TRON_Wallet_RPC-API.md

Demo Project
https://github.com/kookiekrak/TronLink-Demo-Messages

测试网工具
https://explorer.shasta.trongrid.io/
https://explorer.shasta.trongrid.io/tokens/view