?首先根目录gradle中添加依赖:
? First, add dependency to the root directory & #xff1a;
?然后项目文件中添加plugin,添加依赖包:
? then add plugin, in the project document; add a dependency package & #xff1a;
?最后main下添加proto路径,添加proto文件;
? Last main add proto path & #xff0c; add proto file & #xff1b;
?
? ? ? ?关于tron的基础类,我整理了个lib,使用时直接导入lib即可。
♪ ♪ about the tron base class ♪ #xff0c; I sorted out a lib, directly import lib when used. ♪
? ? ? ?主要包括wallet钱包类,管理类等内容。
♪ ♪ Mainly includes the Wallet Wallet class ♪ #xff0c; management class. ♪
? ? ? ?
?这里我主要贴出wallet的代码
♪ Here I post the wallet code ♪
? ? ?
? ? ?其实就一步操作,就是根据私钥 创建wallet对象。
♪ It's actually a step-by-step operation ♪ ♪ xff0c; it's the creation of a walklet object based on a private key. ♪
? ? ? ?创建钱包需要两个参数,一个是钱包名称,一个是设置的密码,钱包名称还好,重要的是密码,因为转账,导出私钥助记词等信息时,都是需要密码验证的。
♪ ♪ ♪ The wallet needs two parameters to be created xff0c; one is the wallet name xff0c; one is the set password xff0c; the wallet name is still good xff0c; the important thing is the password xff0c; because the transfer xff0c; the export of private key helpwords and other information xff0c; all require password validation.
store方法是使用SharedPreferences存储当前钱包的信息,其中我们可以通过密码来获取wallet的eckey从而得到钱包的公钥和私钥。
The store method is to store the information on the current wallet using SharadPreferences & #xff0c; in this, we can access Wallet's eckey by password and get the public and private keys to the wallet.
? ? ? 这里主要用到项目中grpcClient类和walletmanager类。
♪ This is used mainly in the grpcClient and walletmanager categories of the project.
? ? ? 这个类主要封装了对应的网络请求以及钱包管理
♪ This class mainly covers the corresponding network requests and wallet management
? ? ? ?grpcClient类的initGrpc需要传入对应的fullnode和soliditynode,这个可以去下面的地址去选择,
♪ ♪ grpcClit type initGrpc needs to be passed on to the corresponding fullnode and soliditynode, this can go to the address below to select xff0c;
? ?documentation/Official_Public_Node.md at master · tronprotocol/documentation · GitHub
?查询账户需要用到账户的地址:
? search accounts need to use the account address xff1a;
? account可以查询balance和FrozenList;
? account can query balance and FrozenList;
accountNetMessage 可以查询账户的带宽信息。
AccountNetMessage can query the bandwidth information of the account.
具体代码如下:
The codes are as follows: xff1a;
?
? ? ?
根据上面的代码,获取到mTransactionUnsigned ,然后输入密码校验密码并获取到wallet的eckey。
Based on the code above & #xff0c; obtained from mTransactionUnsigned & #xff0c; then entered the password to verify the password and obtained the wallet eckey.
设置时间戳,交易签名。
Sets the time stamp xff0c; transaction signature.
最后一步是广播交易。
The last step is the broadcast trade.
具体的代码可查看git。
The specific code can be viewed as git.
注册有任何问题请添加 微信:MVIP619 拉你进入群
打开微信扫一扫
添加客服
进入交流群
发表评论