当前位置:首页 » 币种行情 » trx20怎样部署智能合约

trx20怎样部署智能合约

发布时间: 2024-04-15 12:13:49

『壹』 trc20网络自定义设置

1、代币名称和符号:可以自定义代币的名称和符号,例如“ABC代币”和“ABC”。
2、总供应量:可以设置代币的总供应量,例如1000个。
3、小数位数:可以设置代币的小数位数,例如设置为2,则代币可以被分成100个单位。
4、发行者地址拆碰:可以设置代币的发行者地址,即代币的创建者。
5、转账手续费:可以设置码派代币转账时需要支付的迟御贺手续费,手续费可以是代币本身或者波场的TRX代币。
6、合约代码:可以自定义代币的合约代码,包括代币的转账、发行、销毁等功能。

『贰』 trx转账需要多少能量

转账1个TRR代币大概需要315能量。

转账TRC20代币或交易等,都会消耗能量和带宽。比如以转账TRR代币为例:转账89个TRR代币需要消耗345带宽和28031能量,该地址没有足够的能量,则抵扣了3.92434TRX作为手续费。

众所周知,波场代币主要分为TRC10和TRC20代币,资源主要分为三种:能量、带宽和存储。在波场独特的网络中,存储几乎是无限的。那么能量和带宽是有限的,用完了就需要花TRX来租赁或者冻结获得能量和带宽。

RC10代币是一种是通过TRON公链内置的通证。主要消耗带宽。

TRC20代币是在TRON区块链上通过部署智能合约的方式来发行资产的一套标准,主要消耗能量和带宽。

每个波场账户每天拥有1500带宽,用完会自动慢慢恢复至1500.目前转账TRC10代币一笔大概需要消耗300-400带宽,即每个账户每天可以免费转3-4笔TRC10代币,比如TRX。如果当日转账次数过多,没有足够的带宽来消耗,就会直接抵扣账户上面的TRX估为手续费。

能量是比较“珍贵”的资源了,账户每天没有免费的能量,如果想要获得能量有2种方式可以获得:

1、冻结TRX获得能量。TRON网络中冻结1万TRX,可以获得257431能量。

2、租赁。通过波场助手tronenergy.app能量平台,用1TRX可以租赁10800能量。



『叁』 imtoken怎么添加trc20

可以直接在trc20链里面添加usdt合约,可以添加trc20钱包,然后再添加usdt智能合约。


同样的也要转到trc20的usdt地址,但需要使用trx这个币作为能量费,所以你需要往持有该usdt的trc20地址充入10个trx可能多了,但是保险。

比特币,以太坊等钱包转账都需要支付矿工费,只不过矿工费以不同形式存在而已,另外,需要注意的是波场钱包和EOS钱包波场钱包转账不需要消耗矿工费。

imToken 成立于 2016 年 5月,希望为用户打造一个去中心化的资产管理系统,将私钥加密存储于本地

但需要消耗带宽和能量EOS账号发生转账等操作就会消耗CPU和NET,消耗的CPU和NET会随着时间的推移全部退还到你的账户这里以转账ETH钱包中的USDT为例,转账ETH钱包中的USDT需要消耗ETH作为转账矿工费。

『肆』 波场发币教程TRC20发币教程TRX发币教程波场代币智能合约发币教程

波场链的币种叫TRC20代币,部署到TRX的主网上,波场发币教程也很简单,一起学习下吧,波场发币教程TRC20发币教程TRX发币教程波场代币智能合约发币教程,不会的退出阅读模式,我帮你代发

TRC-20

TRC-20是用于TRON区块链上的智能合约的技术标准,用于使用TRON虚拟机(TVM)实施代币。

实现规则

3 个可选项

通证名称

string public constant name = “TRONEuropeRewardCoin”;

通证缩写

string public constant symbol = “TERC”;

通证精度

uint8 public constant decimals = 6;

6 个必选项

contract TRC20 {

function totalSupply() constant returns (uint theTotalSupply);

function balanceOf(address _owner) constant returns (uint balance);

function transfer(address _to, uint _value) returns (bool success);

function transferFrom(address _from, address _to, uint _value) returns (bool success);

function approve(address _spender, uint _value) returns (bool success);

function allowance(address _owner, address _spender) constant returns (uint remaining);

event Transfer(address indexed _from, address indexed _to, uint _value);

event Approval(address indexed _owner, address indexed _spender, uint _value);

}

totalSupply()

这个方法返回通证总的发行量。

balanceOf()

这个方法返回查询账户的通证余额。

transfer()

这个方法用来从智能合约地址里转账通证到指定账户。

approve()

这个方法用来授权第三方(例如DAPP合约)从通证拥有者账户转账通证。

transferFrom()

这个方法可供第三方从通证拥有者账户转账通证。需要配合approve()方法使用。

allowance()

这个方法用来查询可供第三方转账的查询账户的通证余额。

2 个事件函数

当通证被成功转账后,会触发转账事件。

event Transfer(address indexed _from, address indexed _to, uint256 _value)

当approval()方法被成功调用后,会触发Approval事件。

event Approval(address indexed _owner, address indexed _spender, uint256 _value)

合约示例

pragma solidity ^0.4.16;

interface tokenRecipient { function receiveApproval(address _from, uint256 _value, address _token, bytes _extraData) external; }

contract TokenTRC20 {

// Public variables of the token

string public name;

string public symbol;

uint8 public decimals = 18;

// 18 decimals is the strongly suggested default, avoid changing it

uint256 public totalSupply;

// This creates an array with all balances

mapping (address => uint256) public balanceOf;

mapping (address => mapping (address => uint256)) public allowance;

// This generates a public event on the blockchain that will notify clients

event Transfer(address indexed from, address indexed to, uint256 value);

// This notifies clients about the amount burnt

event Burn(address indexed from, uint256 value);

/**

* Constructor function

*

* Initializes contract with initial supply tokens to the creator of the contract

*/

function TokenTRC20(

    uint256 initialSupply,

    string tokenName,

    string tokenSymbol

) public {

    totalSupply = initialSupply * 10 ** uint256(decimals);  // Update total supply with the decimal amount

    balanceOf[msg.sender] = totalSupply;                // Give the creator all initial tokens

    name = tokenName;                                  // Set the name for display purposes

    symbol = tokenSymbol;                              // Set the symbol for display purposes

}

/**

* Internal transfer, only can be called by this contract

*/

function _transfer(address _from, address _to, uint _value) internal {

    // Prevent transfer to 0x0 address. Use burn() instead

    require(_to != 0x0);

    // Check if the sender has enough

    require(balanceOf[_from] >= _value);

    // Check for overflows

    require(balanceOf[_to] + _value >= balanceOf[_to]);

    // Save this for an assertion in the future

    uint previousBalances = balanceOf[_from] + balanceOf[_to];

    // Subtract from the sender

    balanceOf[_from] -= _value;

    // Add the same to the recipient

    balanceOf[_to] += _value;

    emit Transfer(_from, _to, _value);

    // Asserts are used to use static analysis to find bugs in your code. They should never fail

    assert(balanceOf[_from] + balanceOf[_to] == previousBalances);

}

/**

* Transfer tokens

*

* Send `_value` tokens to `_to` from your account

*

* @param _to The address of the recipient

* @param _value the amount to send

*/

function transfer(address _to, uint256 _value) public {

    _transfer(msg.sender, _to, _value);

}

/**

* Transfer tokens from other address

*

* Send `_value` tokens to `_to` on behalf of `_from`

*

* @param _from The address of the sender

* @param _to The address of the recipient

* @param _value the amount to send

*/

function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) {

    require(_value <= allowance[_from][msg.sender]);    // Check allowance

    allowance[_from][msg.sender] -= _value;

    _transfer(_from, _to, _value);

    return true;

}

/**

* Set allowance for other address

*

* Allows `_spender` to spend no more than `_value` tokens on your behalf

*

* @param _spender The address authorized to spend

* @param _value the max amount they can spend

*/

function approve(address _spender, uint256 _value) public

    returns (bool success) {

    allowance[msg.sender][_spender] = _value;

    return true;

}

/**

* Set allowance for other address and notify

*

* Allows `_spender` to spend no more than `_value` tokens on your behalf, and then ping the contract about it

*

* @param _spender The address authorized to spend

* @param _value the max amount they can spend

* @param _extraData some extra information to send to the approved contract

*/

function approveAndCall(address _spender, uint256 _value, bytes _extraData)

    public

    returns (bool success) {

    tokenRecipient spender = tokenRecipient(_spender);

    if (approve(_spender, _value)) {

        spender.receiveApproval(msg.sender, _value, this, _extraData);

        return true;

    }

}

/**

* Destroy tokens

*

* Remove `_value` tokens from the system irreversibly

*

* @param _value the amount of money to burn

*/

function burn(uint256 _value) public returns (bool success) {

    require(balanceOf[msg.sender] >= _value);  // Check if the sender has enough

    balanceOf[msg.sender] -= _value;            // Subtract from the sender

    totalSupply -= _value;                      // Updates totalSupply

    emit Burn(msg.sender, _value);

    return true;

}

/**

* Destroy tokens from other account

*

* Remove `_value` tokens from the system irreversibly on behalf of `_from`.

*

* @param _from the address of the sender

* @param _value the amount of money to burn

*/

function burnFrom(address _from, uint256 _value) public returns (bool success) {

    require(balanceOf[_from] >= _value);                // Check if the targeted balance is enough

    require(_value <= allowance[_from][msg.sender]);    // Check allowance

    balanceOf[_from] -= _value;                        // Subtract from the targeted balance

    allowance[_from][msg.sender] -= _value;            // Subtract from the sender's allowance

    totalSupply -= _value;                              // Update totalSupply

    emit Burn(_from, _value);

    return true;

}

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

}

Next Previous

就是这么简单,你学会了吗?

『伍』 TRON TRC20协议如何利用它实现智能合约

热点内容
区块链错了对方收不到怎么回事 发布:2024-05-13 01:29:28 浏览:857
中国高校比特币病毒 发布:2024-05-13 01:28:54 浏览:907
比特币取款机美元 发布:2024-05-13 01:26:32 浏览:49
新浪财经区块链股票 发布:2024-05-13 01:19:12 浏览:883
btc8190键盘 发布:2024-05-13 01:15:40 浏览:890
买的苹果合约机丢了怎么办理 发布:2024-05-13 00:29:33 浏览:205
挖矿钓鱼狩猎 发布:2024-05-13 00:19:04 浏览:798
币圈被碰瓷视频 发布:2024-05-13 00:05:11 浏览:479
以太坊出块源码分析 发布:2024-05-13 00:04:12 浏览:624
游戏加加挖矿 发布:2024-05-13 00:03:51 浏览:801