部署TRON

前提

  1. 具备至少两个钱包账户的私钥与地址;
  2. 至少部署一个SuperNode用于出块;
  3. 部署任意数量的FullNode节点用于同步区块、广播交易;
  4. SuperNode与FullNode组成网络,可以进行网络发现、区块同步、广播交易;

部署配置文件参数

  1. 设置genesis.block.witnesses为超级节点地址列表
  2. 设置p2p.version为除了11111之外的任意正整数
  3. 第1个SR设置block.needSyncCheck为false,其他可以设置为true
  4. 设置block.maintenanceTimeInterval 为维护时间间隔
  5. 设置block.proposalExpireTime为提案过期时间
  6. 设置node.discovery.enable为true
  7. 设置 listen.port 为节点绑定端口 同时开启 listen.port 的tcp和udp udp 用于节点发现,tcp是用于数据同步的
  8. 设置 http.fullNodePort 为节点钱包http端口
  9. 设置 http.solidityPort 为钱包节点 solidity http端口
  10. 设置 rpc.port 为钱包节点rpc端口
  11. 用您的IP列表替换seed.node ip.list中的现有条目
  12. 设置node.discovery.enable 为true

部署脚本

部署SuperNode节点脚本

nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -p your private key --witness -c your config.conf(Example:/data/java-tron/config.conf) &
Example:
nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -p 650950B193DDDDB35B6E48912DD28F7AB0E7140C1BFDEFD493348F02295BD812 --witness -c /data/java-tron/config.conf &
命令行参数说明:
--witness: 启动witness功能,i.e.: --witness
-c: 指定配置文件路径,i.e.: -c config.conf
-p 地址私钥

部署FullNode节点脚本

  1. 设置seed.node ip.list 为SR的ip地址和端口
  2. 设置p2p.version与超级节点的p2p.version一致
  3. 设置genesis.block 与SR中的genesis.block配置一致
  4. 设置needSyncCheck为true
  5. 设置node.discovery.enable 为true
  6. 如果FullNode和SR部署在同一台机器上,则需要修改listen.port、http端口、rpc 端口
nohup java -Xmx6g -XX:+HeapDumpOnOutOfMemoryError -jar FullNode.jar -c private_net_config.conf &
命令行参数说明:
-c: 指定配置文件路径,i.e.: -c config.conf。

SuperNode 配置文件

net {
  type = mainnet
  # type = testnet
}

storage {
  # Directory for storing persistent data

  db.version = 2,
  db.engine = "LEVELDB",
  db.directory = "database",
  index.directory = "index",

  # You can custom these 14 databases' configs:

  # account, account-index, asset-issue, block, block-index,
  # block_KDB, peers, properties, recent-block, trans,
  # utxo, votes, witness, witness_schedule.

  # Otherwise, db configs will remain defualt and data will be stored in
  # the path of "output-directory" or which is set by "-d" ("--output-directory").

  # Attention: name is a required field that must be set !!!
  properties = [
    //    {
    //      name = "account",
    //      path = "storage_directory_test",
    //      createIfMissing = true,
    //      paranoidChecks = true,
    //      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
    //    {
    //      name = "account-index",
    //      path = "storage_directory_test",
    //      createIfMissing = true,
    //      paranoidChecks = true,
    //      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
  ]

}

# this part of config is used to node discovery.
node.discovery = {
  enable = true  # you should set this entry value with ture if you want your node can be discovered by other node.
  persist = true  # this entry is used to determined to whether storing the peers in the database or not.
  bind.ip = ""
  external.ip = null
}

# this part of config is used to set backup node for witness service.
node.backup {
  port = 10001
  priority = 8
  members = [
  ]
}

node {
  # trust node for solidity node
  # trustNode = "ip:port"
  trustNode = "127.0.0.1:50051"

  # expose extension api to public or not
  walletExtensionApi = true
  # 同时开启listen.port 的tcp和udp就可以了,udp 用于节点发现,tcp是用于数据同步的
  listen.port = 16666

  connection.timeout = 2

  tcpNettyWorkThreadNum = 0

  udpNettyWorkThreadNum = 1

  # Number of validate sign thread, default availableProcessors / 2
  # validateSignThreadNum = 16

  maxActiveNodes = 30

  maxActiveNodesWithSameIp = 2

  minParticipationRate = 0

  # check the peer data transfer ,disconnect factor
  disconnectNumberFactor = 0.4
  maxConnectNumberFactor = 0.8
  receiveTcpMinDataLength = 2048
  isOpenFullTcpDisconnect = true

  p2p {
    version = 98766789 # 11111: mainnet; 20180622: testnet; you can set other number when you deploy one private net, but the node must have the same number in some private net. 
  }

  active = [
    # Active establish connection in any case
    # Sample entries:
    # "ip:port",
    # "ip:port"
  ]

  passive = [
    # Passive accept connection in any case
    # Sample entries:
    # "ip:port",
    # "ip:port"
  ]

  http {
    fullNodePort = 26667
    solidityPort = 26668
  }

  rpc {
    port = 16669

    # Number of gRPC thread, default availableProcessors / 2
    # thread = 16

    # The maximum number of concurrent calls permitted for each incoming connection
    # maxConcurrentCallsPerConnection =

    # The HTTP/2 flow control window, default 1MB
    # flowControlWindow =

    # Connection being idle for longer than which will be gracefully terminated
    maxConnectionIdleInMillis = 60000

    # Connection lasting longer than which will be gracefully terminated
    # maxConnectionAgeInMillis =

    # The maximum message size allowed to be received on the server, default 4MB
    # maxMessageSize =

    # The maximum size of header list allowed to be received, default 8192
    # maxHeaderListSize =

    # Transactions can only be broadcast if the number of effective connections is reached.
    minEffectiveConnection = 0
  }

}



seed.node = {
  # List of the seed nodes. This is used to enable the node can connect when join one net at first.
  # If you deploy one private net, you must add some "ip:port" here for other node connecting.
  # Seed nodes are stable full nodes, and the first SuperNode must be inclued in.
  # example:
  # ip.list = [
  #   "ip:port",
  #   "ip:port"
  # ]
  ip.list = [
  ]
}

genesis.block = {
  # Reserve balance
  assets = [
    {
      accountName = "Zion"
      accountType = "AssetIssue"
      address = "TWVQLxQHLDrtSnuggVNNrJbvGzPVoNde5j"
      balance = "95000000000000000"
    },
    {
      accountName = "Sun"
      accountType = "AssetIssue"
      address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb"
      balance = "5000000000000000"
    },
    {
      accountName = "Blackhole"
      accountType = "AssetIssue"
      address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip"
      balance = "-9223372036854775808"
    }
  ]

  witnesses = [
    {
      address: TKFgZSa5Qc3aegpGN6uAN8Yhs328yFSq5X,
      url = "http://tronstudio.com",
      voteCount = 10000
    }
  ]

  timestamp = "0" #2017-8-26 12:00:00

  parentHash = "957dc2d350daecc7bb6a38f3938ebde0a0c1cedafe15f0edae4256a2907449f6"
}

localwitness = [
  1e588f360499a2f09219e93ae65f0d2ef4aaa8d343f481d3e7eee13a6b47a0b2  # you must enable this value and the witness address are match.
]

#localwitnesskeystore = [
#  "src/main/resources/localwitnesskeystore.json"  # if you do not set the localwitness above, you must set this value.Otherwise,your SuperNode can not produce the block. 
#]

block = {
  needSyncCheck = false # first node : false, other : true
  maintenanceTimeInterval = 3600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms)
  proposalExpireTime = 7200000
}


vm = {
  supportConstant = true
  minTimeRatio = 0.0
  maxTimeRatio = 5.0
}

committee = {
  allowCreationOfContracts = 1  //mainnet:0 (reset by committee),test:1
  allowAdaptiveEnergy = 1  //mainnet:0 (reset by committee),test:1
  allowUpdateAccountName = 1
  allowSameTokenName = 1
  allowDelegateResource = 1
  allowTvmTransferTrc10 = 1
  allowTvmConstantinople = 1
  multiSignFee = 1
  allowMultiSign = 1
  updateAccountPermissionFee = 1
  allowProtoFilterNum = 0
  changedDelegation = 1
  allowTvmSolidity059 = 1
  forbidTransferToContract = 1
}

event.subscribe = {
  native = {
    useNativeQueue = true // if true, use native message queue, else use event plugin.
    bindport = 5555 // bind port
    sendqueuelength = 1000 //max length of send queue
  }

  path = "" // absolute path of plugin
  server = "" // target server address to receive event triggers
  dbconfig = "" // dbname|username|password
  contractParse = true,
  topics = [
    {
      triggerName = "block" // block trigger, the value can't be modified
      enable = false
      topic = "block" // plugin topic, the value could be modified
    },
    {
      triggerName = "transaction"
      enable = false
      topic = "transaction"
    },
    {
      triggerName = "contractevent"
      enable = false
      topic = "contractevent"
    },
    {
      triggerName = "contractlog"
      enable = false
      topic = "contractlog"
    },
    {
      triggerName = "solidity" // solidity block event trigger, the value can't be modified
      enable = true            // the default value is true
      topic = "solidity"
    }
  ]

  filter = {
    fromblock = "" // the value could be "", "earliest" or a specified block number as the beginning of the queried range
    toblock = "" // the value could be "", "latest" or a specified block number as end of the queried range
    contractAddress = [
      "" // contract address you want to subscribe, if it's set to "", you will receive contract logs/events with any contract address.
    ]

    contractTopic = [
      "" // contract topic you want to subscribe, if it's set to "", you will receive contract logs/events with any contract topic.
    ]
  }
}

FullNode 配置文件

net {
  type = mainnet
  # type = testnet
}

storage {
  # Directory for storing persistent data

  db.version = 2,
  db.engine = "LEVELDB",
  db.directory = "database",
  index.directory = "index",

  # You can custom these 14 databases' configs:

  # account, account-index, asset-issue, block, block-index,
  # block_KDB, peers, properties, recent-block, trans,
  # utxo, votes, witness, witness_schedule.

  # Otherwise, db configs will remain defualt and data will be stored in
  # the path of "output-directory" or which is set by "-d" ("--output-directory").

  # Attention: name is a required field that must be set !!!
  properties = [
    //    {
    //      name = "account",
    //      path = "storage_directory_test",
    //      createIfMissing = true,
    //      paranoidChecks = true,
    //      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
    //    {
    //      name = "account-index",
    //      path = "storage_directory_test",
    //      createIfMissing = true,
    //      paranoidChecks = true,
    //      verifyChecksums = true,
    //      compressionType = 1,        // compressed with snappy
    //      blockSize = 4096,           // 4  KB =         4 * 1024 B
    //      writeBufferSize = 10485760, // 10 MB = 10 * 1024 * 1024 B
    //      cacheSize = 10485760,       // 10 MB = 10 * 1024 * 1024 B
    //      maxOpenFiles = 100
    //    },
  ]

}

# this part of config is used to node discovery.
node.discovery = {
  enable = true  # you should set this entry value with ture if you want your node can be discovered by other node.
  persist = true  # this entry is used to determined to whether storing the peers in the database or not.
  bind.ip = ""
  external.ip = null
}

# this part of config is used to set backup node for witness service.
node.backup {
  port = 10001
  priority = 8
  members = [
  ]
}

node {
  # trust node for solidity node
  # trustNode = "ip:port"
  trustNode = "127.0.0.1:50051"

  # expose extension api to public or not
  walletExtensionApi = true
  #同时开启listen.port 的tcp和udp就可以了,udp 用于节点发现,tcp是用于数据同步的
  listen.port = 26666

  connection.timeout = 2

  tcpNettyWorkThreadNum = 0

  udpNettyWorkThreadNum = 1

  # Number of validate sign thread, default availableProcessors / 2
  # validateSignThreadNum = 16

  maxActiveNodes = 30

  maxActiveNodesWithSameIp = 2

  minParticipationRate = 0

  # check the peer data transfer ,disconnect factor
  disconnectNumberFactor = 0.4
  maxConnectNumberFactor = 0.8
  receiveTcpMinDataLength = 2048
  isOpenFullTcpDisconnect = true

  p2p {
    version = 98766789 # 11111: mainnet; 20180622: testnet; you can set other number when you deploy one private net, but the node must have the same number in some private net. 
  }

  active = [
    # Active establish connection in any case
    # Sample entries:
    # "ip:port",
    # "ip:port"
  ]

  passive = [
    # Passive accept connection in any case
    # Sample entries:
    # "ip:port",
    # "ip:port"
  ]

  http {
    fullNodePort = 8090
    solidityPort = 26668
  }

  rpc {
    port = 26669

    # Number of gRPC thread, default availableProcessors / 2
    # thread = 16

    # The maximum number of concurrent calls permitted for each incoming connection
    # maxConcurrentCallsPerConnection =

    # The HTTP/2 flow control window, default 1MB
    # flowControlWindow =

    # Connection being idle for longer than which will be gracefully terminated
    maxConnectionIdleInMillis = 60000

    # Connection lasting longer than which will be gracefully terminated
    # maxConnectionAgeInMillis =

    # The maximum message size allowed to be received on the server, default 4MB
    # maxMessageSize =

    # The maximum size of header list allowed to be received, default 8192
    # maxHeaderListSize =

    # Transactions can only be broadcast if the number of effective connections is reached.
    minEffectiveConnection = 0
  }

}



seed.node = {
  # List of the seed nodes. This is used to enable the node can connect when join one net at first.
  # If you deploy one private net, you must add some "ip:port" here for other node connecting.
  # Seed nodes are stable full nodes, and the first SuperNode must be inclued in.
  # example:
  # ip.list = [
  #   "ip:port",
  #   "ip:port"
  # ]
  ip.list = [
    "xxxxx:16666"
  ]
}

genesis.block = {
  # Reserve balance
  assets = [
    {
      accountName = "Zion"
      accountType = "AssetIssue"
      address = "TWVQLxQHLDrtSnuggVNNrJbvGzPVoNde5j"
      balance = "95000000000000000"
    },
    {
      accountName = "Sun"
      accountType = "AssetIssue"
      address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb"
      balance = "5000000000000000"
    },
    {
      accountName = "Blackhole"
      accountType = "AssetIssue"
      address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip"
      balance = "-9223372036854775808"
    }
  ]

  witnesses = [
    {
      address: TKFgZSa5Qc3aegpGN6uAN8Yhs328yFSq5X,
      url = "http://tronstudio.com",
      voteCount = 10000
    }
  ]

  timestamp = "0" #2017-8-26 12:00:00

  parentHash = "957dc2d350daecc7bb6a38f3938ebde0a0c1cedafe15f0edae4256a2907449f6"
}

localwitness = [
  9b9b8bd8ee343d43c5889ec06b3c4e7fe723211a73be18119c7729107b4fcdc8  # you must enable this value and the witness address are match.
]

#localwitnesskeystore = [
#  "src/main/resources/localwitnesskeystore.json"  # if you do not set the localwitness above, you must set this value.Otherwise,your SuperNode can not produce the block. 
#]

block = {
  needSyncCheck = true # first node : false, other : true
  maintenanceTimeInterval = 3600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms)
  proposalExpireTime = 7200000
}


vm = {
  supportConstant = true
  minTimeRatio = 0.0
  maxTimeRatio = 5.0
}

committee = {
  allowCreationOfContracts = 1  //mainnet:0 (reset by committee),test:1
  allowAdaptiveEnergy = 1  //mainnet:0 (reset by committee),test:1
  allowUpdateAccountName = 1
  allowSameTokenName = 1
  allowDelegateResource = 1
  allowTvmTransferTrc10 = 1
  allowTvmConstantinople = 1
  multiSignFee = 1
  allowMultiSign = 1
  updateAccountPermissionFee = 1
  allowProtoFilterNum = 0
  changedDelegation = 1
  allowTvmSolidity059 = 1
  forbidTransferToContract = 1
}

event.subscribe = {
  native = {
    useNativeQueue = true // if true, use native message queue, else use event plugin.
    bindport = 6555 // bind port
    sendqueuelength = 1000 //max length of send queue
  }

  path = "" // absolute path of plugin
  server = "" // target server address to receive event triggers
  dbconfig = "" // dbname|username|password
  contractParse = true,
  topics = [
    {
      triggerName = "block" // block trigger, the value can't be modified
      enable = false
      topic = "block" // plugin topic, the value could be modified
    },
    {
      triggerName = "transaction"
      enable = false
      topic = "transaction"
    },
    {
      triggerName = "contractevent"
      enable = false
      topic = "contractevent"
    },
    {
      triggerName = "contractlog"
      enable = false
      topic = "contractlog"
    },
    {
      triggerName = "solidity" // solidity block event trigger, the value can't be modified
      enable = true            // the default value is true
      topic = "solidity"
    }
  ]

  filter = {
    fromblock = "" // the value could be "", "earliest" or a specified block number as the beginning of the queried range
    toblock = "" // the value could be "", "latest" or a specified block number as end of the queried range
    contractAddress = [
      "" // contract address you want to subscribe, if it's set to "", you will receive contract logs/events with any contract address.
    ]

    contractTopic = [
      "" // contract topic you want to subscribe, if it's set to "", you will receive contract logs/events with any contract topic.
    ]
  }
}

提案参数

只有超级代表(SR)、合伙人(Partner)和候选人(Candidates)对应账户具有提议权。
允许修改的网络动态参数以及编号如下( [min, max] ): {0,1}:1代表‘通过’或者‘激活’,0代表否
{http://xxxxx}/wallet/getchainparameters

# Command Value
0 getMaintenanceTimeInterval
(修改超级代表调整时间间隔)
6 Hours
[3 27, 24 3600] s
1 getAccountUpgradeCost
(修改账户升级为超级代表的费用)
9999 TRX
[0, 100000000000] TRX
2 getCreateAccountFee
(修改创建账户费用)
0.1 TRX
[0, 100000000000] TRX
3 getTransactionFee
(修改TRX抵扣带宽的费用)
10 Sun/Byte
[0, 100000000000] TRX
4 getAssetIssueFee
(修改资产发行费用)
1024 TRX
[0, 100000000000] TRX
5 getWitnessPayPerBlock
(修改超级代表出块奖励)
16 TRX
[0, 100000000000] TRX
6 getWitnessStandbyAllowance
(修改分给前127名超级代表候选人的奖励)
115200 TRX
[0, 100000000000] TRX
7 getCreateNewAccountFeeInSystemContract
(修改系统创建账户的费用)
0 TRX
8 getCreateNewAccountBandwidthRate
(提议7、8,组合使用,用于修改创建账户时对资源或TRX的消耗)
1 Bandwith/Byte
9 getAllowCreationOfContracts
(控制虚拟机功能的开启 )
1
{0, 1}
10 getRemoveThePowerOfTheGr
(用于清除GR的创世票数)
1
{0, 1}
11 getEnergyFee
(修改能量费用)
10 Sun
[0, 100000000000] TRX
12 getExchangeCreateFee
(修改创建交易对的费用)
1024 TRX
[0, 100000000000] TRX
13 getMaxCpuTimeOfOneTx
(修改交易最长执行时间)
50 ms
[0, 1000] ms
14 getAllowUpdateAccountName
(允许用户更改昵称以及昵称同名)
0
{0, 1}
15 getAllowSameTokenName
(允许创建相同名称的token)
1
{0, 1}
16 getAllowDelegateResource
(控制资源代理功能的开启)
1
{0, 1}
18 getAllowTvmTransferTrc10
(允许智能合约调用TRC10 token的接口)
1
{0, 1}
19 getTotalEnergyCurrentLimit
(修改ENERGY总量)
50000000000
20 getAllowMultiSign
(允许开启多重签名)
1
{0, 1}
21 getAllowAdaptiveEnergy
(允许ENERGY总量自适应调整)
0
{0, 1}
22 getUpdateAccountPermissionFee
(修改账户权限费用)
100 TRX
23 getMultiSignFee
(修改账户权限费用)
1 TRX
24 getAllowProtoFilterNum
(允许更新protobuf的数字)
0
{0, 1}
26 getAllowTvmConstantinople
(允许TVM支持君士坦丁堡更新)
1
{0, 1}
27 getAllowShieldedTransaction
(允许匿名交易开启)
0
{0, 1}
28 getShieldedTransactionFee
(修改匿名交易手续费)
10 TRX
[0, 10000] TRX
29 getAdaptiveResourceLimitMultiplier
(用于修改动态能量最大值)
1000
[1, 10000]
30 getChangeDelegation
(修改更换委托机制)
1
{0, 1}
31 getWitness127PayPerBlock
(修改票数排名奖励)
160TRX
[0, 100000000000] TRX
32 getAllowTvmSolidity059
(允许虚拟机支持0.5.9版本的Solidity编译器)
0
{0, 1}
33 getAdaptiveResourceLimitTargetRatio
(修改能量目标值)
10
[1, 1000]

你可能感兴趣的:(tron,区块链,java,网络,tron,波场)