diff --git a/Benchmark.jar b/Benchmark.jar new file mode 100644 index 00000000..e1691a14 Binary files /dev/null and b/Benchmark.jar differ diff --git a/README.md b/README.md index 6ca169f1..6ffd0351 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,7 @@ +## Scope of use +This script could be used on Linux/MacOS, but not on Windows. +Just Support FullNode and SolidityNode. + ## Download and run script ```shell @@ -7,15 +11,17 @@ wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy ## Parameter Illustration ```shell -bash deploy_tron.sh --app [FullNode|SolidityNode] --net [mainnet|testnet|privatenet] --db [keep|remove|backup] +bash deploy_tron.sh --app [FullNode|SolidityNode] --net [mainnet|testnet|privatenet] --db [keep|remove|backup] --heap-size ---app Running application. The default node is Fullnode and it could be FullNode or SolidityNode. ---net Connecting network. The default network is mainnet and it could be mainnet, testnet, privatenet . ---db The way of data processing could be keep, remove and backup. If you launch two different networks, like from mainnet to testnet or from testnet to mainnet, you need to delete database. ---trust-node It only works when deploying SolidityNode. The specified gRPC service of Fullnode, like 127.0.0.1:50051 or 13.125.249.129:50051. ---rpc-port Port of grp. If you deploy SolidityNode and FullNode on the same host,you need to configure different ports. ---commit Optional, commitid of project. ---branch Optional,branch of project. +--app Optional, Running application. The default node is Fullnode and it could be FullNode or SolidityNode. +--net Optional, Connecting network. The default network is mainnet and it could be mainnet, testnet. +--db Optional, The way of data processing could be keep, remove and backup. Default is keep. If you launch two different networks, like from mainnet to testnet or from testnet to mainnet, you need to delete database. +--trust-node Optional, It only works when deploying SolidityNode. Default is 127.0.0.1:50051. The specified gRPC service of Fullnode, like 127.0.0.1:50051 or 13.125.249.129:50051. +--rpc-port Optional, Port of grpc. Default is 50051. If you deploy SolidityNode and FullNode on the same host,you need to configure different ports. +--commit Optional, commitid of project. +--branch Optional, branch of project. Mainnet default is latest release and Testnet default is master. +--heap-size Optional, jvm option: Xmx. The default heap-size is 0.8 * memory size. +--work_space Optional, default is current directory. ``` ## Examples @@ -24,30 +30,24 @@ bash deploy_tron.sh --app [FullNode|SolidityNode] --net [mainnet|testnet|private ```shell wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy_tron.sh -O deploy_tron.sh -bash deploy_tron.sh --app FullNode --net mainnet +bash deploy_tron.sh ``` ### Deployment of SolidityNode on the one host. ```shell wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy_tron.sh -O deploy_tron.sh -# User can self-configure the IP and Port of GRPC service in the turst-node field of SolidityNode. -bash deploy_tron.sh --app SolidityNode --net mainnet --trust-node +# User can self-configure the IP and Port of GRPC service in the turst-node field of SolidityNode. trust-node is the fullnode you just deploy. +bash deploy_tron.sh --app SolidityNode --trust-node ``` -### Deployment of FullNode(PrivateNet: Just one witness node) on the one host. - -```shell -wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy_tron.sh -O deploy_tron.sh -bash deploy_tron.sh --app FullNode --branch develop --net privatenet -``` ### Deployment of FullNode and SolidityNode on the same host. ```shell +# You need to configure different gRPC ports on the same host because gRPC port is available on SolidityNode and FullNodeConfigure and it cannot be set as default value 50051. In this case the default value of rpc port is set as 50041. wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy_tron.sh -O deploy_tron.sh -bash deploy_tron.sh --app FullNode --net mainnet -# You need to configure different gRPC ports on the same host because gRPC port is available on SolidityNode and FullNodeConfigure and it cannot be set as default value 50051. In this case the default value of rpc port is set as 50041. -bash deploy_tron.sh --app SolidityNode --net mainnet --trust-node 127.0.0.1:50051 --rpc-port 50041 +bash deploy_tron.sh --app FullNode +bash deploy_tron.sh --app SolidityNode --rpc-port 50041 ``` ## Deployment of grpc gateway diff --git a/README_CN.md b/README_CN.md index 23a42e2a..c2333d6f 100644 --- a/README_CN.md +++ b/README_CN.md @@ -38,12 +38,6 @@ wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy # 这里自己指定SolidityNode的trust-node的gRPC服务的ip和端口号 bash deploy_tron.sh --app SolidityNode --net mainnet --trust-node ``` -### 单独启动私有链FullNode(仅仅运行一个产块节点) - -```shell -wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/deploy_tron.sh -O deploy_tron.sh -bash deploy_tron.sh --app FullNode --branch develop --net privatenet -``` ### 启动主网FullNode和SolidityNode在同一台机器 diff --git a/check-machine-config.sh b/check-machine-config.sh new file mode 100755 index 00000000..506ca6f5 --- /dev/null +++ b/check-machine-config.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/Benchmark.jar -O Benchmark.jar +java -jar Benchmark.jar + +if [ $? == 1 ]; then + echo "-----------------------------------------------------" + echo "--------------------FAIL RESULT----------------------" + echo "Start fail! Please upgrade server configuration." + echo "CPU needs at least 16 cores" + echo "Memory needs at least 30GB" + echo "Java MUST be oracle jdk, and version >= 1.8" + echo "-----------------------------------------------------" + exit 1 +fi diff --git a/deploy_tron.sh b/deploy_tron.sh index 30a26ba6..728a4ae9 100644 --- a/deploy_tron.sh +++ b/deploy_tron.sh @@ -1,4 +1,6 @@ #!/bin/bash + +# default config APP="FullNode" PROJECT="java-tron" WORK_SPACE=$PWD @@ -8,6 +10,9 @@ DB="keep" RPC_PORT=50051 TRUST_NODE="127.0.0.1:50051" +# compute default heap size +# total=`cat /proc/meminfo |grep MemTotal |awk -F ' ' '{print $2}'` +# HEAP_SIZE=`echo "$total/1024/1024*0.8" | bc |awk -F. '{print $1"g"}'` while [ -n "$1" ] ;do @@ -18,11 +23,11 @@ while [ -n "$1" ] ;do ;; --app) APP=$2 - shift 2 + shift 2 ;; --db) DB=$2 - shift 2 + shift 2 ;; --work_space) WORK_SPACE=$2 @@ -44,23 +49,34 @@ while [ -n "$1" ] ;do RPC_PORT=$2 shift 2 ;; + --heap-size) + HEAP_SIZE=$2 + shift 2 + ;; *) ;; esac done -if [ $APP == "Witness" ]; then - JAR_NAME="FullNode" -else - JAR_NAME=$APP + +if [ -z $HEAP_SIZE ]; then + if [ "$(uname)" == "Darwin" ]; then + total=`top -l 1 | head -n 10 | grep PhysMem | awk -F " " '{a=substr($2,0,length($2)-1);b=substr($6,0,length($6)-1);if(match($2,/[0-9]+G/)) a=a*1024;if(match($6,/[0-9]+G/)) b=b*1024;print a+b}'` + HEAP_SIZE=`echo "$total/1024*0.8" | bc |awk -F. '{print $1"g"}'` + elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then + total=`cat /proc/meminfo |grep MemTotal |awk -F ' ' '{print $2}'` + HEAP_SIZE=`echo "$total/1024/1024*0.8" | bc |awk -F. '{print $1"g"}'` + fi fi +JAR_NAME=$APP + BIN_PATH="$WORK_SPACE/$APP" CONF_PATH="" -echo 'download code from git repositorie' +echo 'download code from git repository' if [ ! -e $BIN_PATH ]; then mkdir -p $BIN_PATH cd $BIN_PATH @@ -70,20 +86,17 @@ fi cd $BIN_PATH if [ $NET == "mainnet" ]; then wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/main_net_config.conf -O main_net_config.conf + RELEASE=`curl --silent "https://api.github.com/repos/tronprotocol/java-tron/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/'` CONF_PATH=$BIN_PATH/main_net_config.conf elif [ $NET == "testnet" ]; then wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/test_net_config.conf -O test_net_config.conf - BRANCH="develop" CONF_PATH=$BIN_PATH/test_net_config.conf -elif [ $NET == "privatenet" ]; then - wget https://raw.githubusercontent.com/tronprotocol/TronDeployment/master/private_net_config.conf -O private_net_config.conf - CONF_PATH=$BIN_PATH/private_net_config.conf fi if [ -n $RPC_PORT ]; then sed "s/port = 50051/port = $RPC_PORT/g" $CONF_PATH > tmp cat tmp > $CONF_PATH -fi +fi # checkout branch or commitid if [ -n "$BRANCH" ]; then cd $BIN_PATH/$PROJECT && git fetch && git checkout $BRANCH; git reset --hard origin/$BRANCH @@ -93,6 +106,11 @@ if [ -n "$COMMITID" ]; then cd $BIN_PATH/$PROJECT && git fetch && git checkout $COMMITID fi +if [ -n "$RELEASE" ]; then + cd $BIN_PATH/$PROJECT && git fetch && git checkout tags/$RELEASE -b release + BRANCH='release' +fi + if [ $DB == "remove" ]; then rm -rf $BIN_PATH/output-directory echo "remove db success" @@ -112,50 +130,50 @@ elif [ $APP == "FullNode" ]; then START_OPT="" fi +JVM_OPT="-Xmx$HEAP_SIZE -XX:+HeapDumpOnOutOfMemoryError" + count=1 -while [ $count -le 60 ]; do +while [ $count -le 360 ]; do pid=`ps -ef |grep $JAR_NAME.jar | grep java | grep -v grep |awk '{print $2}'` if [ -n "$pid" ]; then kill -15 $pid echo "kill -15 java-tron, counter $count" - sleep 1 + sleep 5 else echo "$APP killed" break fi count=$[$count+1] - if [ $count -ge 60 ]; then - kill -9 $pid + if [ $count -ge 360 ]; then + echo "deploy failure because of kill process fails!" + exit 1 fi done echo "starting $APP" cd $BIN_PATH -if [ $NET == "mainnet" ]; then - nohup java -jar "$JAR_NAME.jar" $START_OPT -c $CONF_PATH >> start.log 2>&1 & - echo "process : nohup java -jar $JAR_NAME.jar $START_OPT -c $CONF_PATH >> start.log 2>&1 &" -elif [ $NET == "testnet" ]; then - nohup java -jar "$JAR_NAME.jar" $START_OPT -c $CONF_PATH >> start.log 2>&1 & - echo "process : nohup java -jar $JAR_NAME.jar $START_OPT -c $CONF_PATH >> start.log 2>&1 &" -elif [ $NET == "privatenet" ]; then - nohup java -jar "$JAR_NAME.jar" $START_OPT -c $CONF_PATH --witness>> start.log 2>&1 & - echo "process : nohup java -jar $JAR_NAME.jar $START_OPT -c $CONF_PATH --witness >> start.log 2>&1 &" -fi +nohup java $JVM_OPT -jar $JAR_NAME.jar -c $CONF_PATH $START_OPT >> start.log 2>&1 & pid=`ps ax |grep $JAR_NAME.jar |grep -v grep | awk '{print $1}'` echo $pid -echo "application : $APP" -echo "pid : $pid" -echo "tron net : $NET" +if [ -z $pid ]; then + echo "run $JAR_NAME failed, please check your parameters" + exit 2 +fi -echo "deploy path : $BIN_PATH" +echo "process : nohup java $JVM_OPT -jar $JAR_NAME.jar $START_OPT -c $CONF_PATH >> start.log 2>&1 &" +echo "pid : $pid" +echo "application: $APP" +echo "tron net : $NET" +echo "deploy path: $BIN_PATH" echo "git commit : "`cd $BIN_PATH/$PROJECT; git rev-parse HEAD` echo "git branch : $BRANCH" -echo "db path : $BIN_PATH/output-directory" -echo "log path : $BIN_PATH/logs" -echo "grpc port : $RPC_PORT" +echo "db path : $BIN_PATH/output-directory" +echo "log path : $BIN_PATH/logs" +echo "heap-size : $HEAP_SIZE" +echo "grpc port : $RPC_PORT" if [ $APP == "SolidityNode" ]; then - echo "trust-node : $TRUST_NODE" + echo "trust-node : $TRUST_NODE" fi diff --git a/how_to_config.txt b/how_to_config.txt new file mode 100644 index 00000000..35e6b8c8 --- /dev/null +++ b/how_to_config.txt @@ -0,0 +1 @@ +### This document is used to explain the features of configuration items in the *.conf file and help you understand how to use them. diff --git a/main_net_config.conf b/main_net_config.conf index 5fd601ad..f6045cd9 100644 --- a/main_net_config.conf +++ b/main_net_config.conf @@ -5,39 +5,55 @@ net { storage { # Directory for storing persistent data - + db.engine = "LEVELDB", + db.sync = false, db.directory = "database", - index.directory = "index", + transHistory.switch = "on", # 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 + # Otherwise, db configs will remain default and data will be stored in # the path of "output-directory" or which is set by "-d" ("--output-directory"). + # setting can impove leveldb performance .... start + # node: if this will increase process fds,you may be check your ulimit if 'too many open files' error occurs + # see https://github.com/tronprotocol/tips/blob/master/tip-343.md for detail + # if you find block sync has lower performance,you can try this settings + #default = { + # maxOpenFiles = 100 + #} + #defaultM = { + # maxOpenFiles = 500 + #} + #defaultL = { + # maxOpenFiles = 1000 + #} + # setting can impove leveldb performance .... end + # Attention: name is a required field that must be set !!! properties = [ -// { -// name = "account", -// path = "storage_directory_test", -// createIfMissing = true, -// paranoidChecks = true, -// verifyChecksums = true, + // { + // 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, + // }, + // { + // 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 @@ -46,22 +62,82 @@ storage { // }, ] + needToUpdateAsset = true + + //dbsettings is needed when using rocksdb as the storage implement (db.engine="ROCKSDB"). + //we'd strongly recommend that do not modify it unless you know every item's meaning clearly. + dbSettings = { + levelNumber = 7 + //compactThreads = 32 + blocksize = 64 // n * KB + maxBytesForLevelBase = 256 // n * MB + maxBytesForLevelMultiplier = 10 + level0FileNumCompactionTrigger = 4 + targetFileSizeBase = 256 // n * MB + targetFileSizeMultiplier = 1 + } + + balance.history.lookup = false + + # checkpoint.version = 2 + # checkpoint.sync = true + + # the estimated number of block transactions (default 1000, min 100, max 10000). + # so the total number of cached transactions is 65536 * txCache.estimatedTransactions + # txCache.estimatedTransactions = 1000 + # if true, transaction cache initialization will be faster. default false + # txCache.initOptimization = true + + # data root setting, for check data, currently, only reward-vi is used. + + # merkleRoot = { + # reward-vi = 9debcb9924055500aaae98cdee10501c5c39d4daa75800a996f4bdda73dbccd8 // main-net, Sha256Hash, hexString + # } + } node.discovery = { enable = true persist = true - bind.ip = "" - external.ip = null } +# custom stop condition +#node.shutdown = { +# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. +# BlockHeight = 33350800 # if block header height in persistent db matched. +# BlockCount = 12 # block sync count after node start. +#} + node.backup { + # udp listen port, each member should have the same configuration port = 10001 + + # my priority, each member should use different priority priority = 8 + + # time interval to send keepAlive message, each member should have the same configuration + keepAliveInterval = 3000 + + # peer's ip list, can't contain mine members = [ + # "ip", + # "ip" ] } +crypto { + engine = "eckey" +} +# prometheus metrics start +# node.metrics = { +# prometheus{ +# enable=true +# port="9527" +# } +# } + +# prometheus metrics end + node { # trust node for solidity node # trustNode = "ip:port" @@ -74,19 +150,28 @@ node { connection.timeout = 2 - tcpNettyWorkThreadNum = 0 + fetchBlock.timeout = 200 udpNettyWorkThreadNum = 1 - # Number of validate sign thread, default availableProcessors / 2 + # Number of validate sign thread, default availableProcessors # validateSignThreadNum = 16 - maxActiveNodes = 30 + maxConnections = 30 + + minConnections = 8 - maxActiveNodesWithSameIp = 2 + minActiveConnections = 3 + + maxConnectionsWithSameIp = 2 + + maxHttpConnectNumber = 50 minParticipationRate = 15 + isOpenFullTcpDisconnect = false + inactiveThreshold = 600 //seconds + p2p { version = 11111 # 11111: mainnet; 20180622: testnet } @@ -105,13 +190,27 @@ node { # "ip:port" ] + fastForward = [ + "100.27.171.62:18888", + "15.188.6.125:18888" + ] + http { + fullNodeEnable = true fullNodePort = 8090 + solidityEnable = true solidityPort = 8091 + PBFTEnable = true + PBFTPort = 8092 } rpc { + enable = true port = 50051 + solidityEnable = true + solidityPort = 50061 + PBFTEnable = true + PBFTPort = 50071 # Number of gRPC thread, default availableProcessors / 2 # thread = 16 @@ -133,8 +232,187 @@ node { # 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 = 1 + + # The switch of the reflection service, effective for all gRPC services + # reflectionService = true } + # number of solidity thread in the FullNode. + # If accessing solidity rpc and http interface timeout, could increase the number of threads, + # The default value is the number of cpu cores of the machine. + #solidity.threads = 8 + + # Limits the maximum percentage (default 75%) of producing block interval + # to provide sufficient time to perform other operations e.g. broadcast block + # blockProducedTimeOut = 75 + + # Limits the maximum number (default 700) of transaction from network layer + # netMaxTrxPerSecond = 700 + + # Whether to enable the node detection function, default false + # nodeDetectEnable = false + + # use your ipv6 address for node discovery and tcp connection, default false + # enableIpv6 = false + + # if your node's highest block num is below than all your pees', try to acquire new connection. default false + # effectiveCheckEnable = false + + # Dynamic loading configuration function, disabled by default + # dynamicConfig = { + # enable = false + # Configuration file change check interval, default is 600 seconds + # checkInterval = 600 + # } + + dns { + # dns urls to get nodes, url format tree://{pubkey}@{domain}, default empty + treeUrls = [ + #"tree://AKMQMNAJJBL73LXWPXDI4I5ZWWIZ4AWO34DWQ636QOBBXNFXH3LQS@main.trondisco.net", + ] + + # enable or disable dns publish, default false + # publish = false + + # dns domain to publish nodes, required if publish is true + # dnsDomain = "nodes1.example.org" + + # dns private key used to publish, required if publish is true, hex string of length 64 + # dnsPrivate = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" + + # known dns urls to publish if publish is true, url format tree://{pubkey}@{domain}, default empty + # knownUrls = [ + #"tree://APFGGTFOBVE2ZNAB3CSMNNX6RRK3ODIRLP2AA5U4YFAA6MSYZUYTQ@nodes2.example.org", + # ] + + # staticNodes = [ + # static nodes to published on dns + # Sample entries: + # "ip:port", + # "ip:port" + # ] + + # merge several nodes into a leaf of tree, should be 1~5 + # maxMergeSize = 5 + + # only nodes change percent is bigger then the threshold, we update data on dns + # changeThreshold = 0.1 + + # dns server to publish, required if publish is true, only aws or aliyun is support + # serverType = "aws" + + # access key id of aws or aliyun api, required if publish is true, string + # accessKeyId = "your-key-id" + + # access key secret of aws or aliyun api, required if publish is true, string + # accessKeySecret = "your-key-secret" + + # if publish is true and serverType is aliyun, it's endpoint of aws dns server, string + # aliyunDnsEndpoint = "alidns.aliyuncs.com" + + # if publish is true and serverType is aws, it's region of aws api, such as "eu-south-1", string + # awsRegion = "us-east-1" + + # if publish is true and server-type is aws, it's host zone id of aws's domain, string + # awsHostZoneId = "your-host-zone-id" + } + + # open the history query APIs(http&GRPC) when node is a lite fullNode, + # like {getBlockByNum, getBlockByID, getTransactionByID...}. + # default: false. + # note: above APIs may return null even if blocks and transactions actually are on the blockchain + # when opening on a lite fullnode. only open it if the consequences being clearly known + # openHistoryQueryWhenLiteFN = false + + jsonrpc { + # Note: If you turn on jsonrpc and run it for a while and then turn it off, you will not + # be able to get the data from eth_getLogs for that period of time. + + # httpFullNodeEnable = true + # httpFullNodePort = 8545 + # httpSolidityEnable = true + # httpSolidityPort = 8555 + # httpPBFTEnable = true + # httpPBFTPort = 8565 + + # The maximum blocks range to retrieve logs for eth_getLogs, default value is 5000, + # should be > 0, otherwise means no limit. + maxBlockRange = 5000 + + # The maximum number of allowed topics within a topic criteria, default value is 1000, + # should be > 0, otherwise means no limit. + maxSubTopics = 1000 + } + + # Disabled api list, it will work for http, rpc and pbft, both fullnode and soliditynode, + # but not jsonrpc. + # Sample: The setting is case insensitive, GetNowBlock2 is equal to getnowblock2 + # + # disabledApi = [ + # "getaccount", + # "getnowblock2" + # ] + +} + +## rate limiter config +rate.limiter = { + # Every api could be set a specific rate limit strategy. Three strategy are supported:GlobalPreemptibleAdapter、IPQPSRateLimiterAdapte、QpsRateLimiterAdapter + # GlobalPreemptibleAdapter: permit is the number of preemptible resource, every client must apply one resourse + # before do the request and release the resource after got the reponse automaticlly. permit should be a Integer. + # QpsRateLimiterAdapter: qps is the average request count in one second supported by the server, it could be a Double or a Integer. + # IPQPSRateLimiterAdapter: similar to the QpsRateLimiterAdapter, qps could be a Double or a Integer. + # If do not set, the "default strategy" is set.The "default startegy" is based on QpsRateLimiterAdapter, the qps is set as 1000. + # + # Sample entries: + # + http = [ + # { + # component = "GetNowBlockServlet", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "GetAccountServlet", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "ListWitnessesServlet", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # } + ], + + rpc = [ + # { + # component = "protocol.Wallet/GetBlockByLatestNum2", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "protocol.Wallet/GetAccount", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "protocol.Wallet/ListWitnesses", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # }, + ] + + # global qps, default 50000 + # global.qps = 50000 + # IP-based global qps, default 10000 + # global.ip.qps = 10000 } @@ -148,35 +426,38 @@ seed.node = { # "ip:port" # ] ip.list = [ - "54.236.37.243:18888", - "52.53.189.99:18888", - "18.196.99.16:18888", - "34.253.187.192:18888", - "52.56.56.149:18888", - "35.180.51.163:18888", - "54.252.224.209:18888", - "18.228.15.36:18888", - "52.15.93.92:18888", - "34.220.77.106:18888", - "13.127.47.162:18888", - "13.124.62.58:18888", - "13.229.128.108:18888", - "35.182.37.246:18888", - "34.200.228.125:18888", - "18.220.232.201:18888", - "13.57.30.186:18888", - "35.165.103.105:18888", - "18.184.238.21:18888", - "34.250.140.143:18888", - "35.176.192.130:18888", - "52.47.197.188:18888", - "52.62.210.100:18888", - "13.231.4.243:18888", - "18.231.76.29:18888", - "35.154.90.144:18888", - "13.125.210.234:18888", - "13.250.40.82:18888", - "35.183.101.48:18888" + "3.225.171.164:18888", + "52.8.46.215:18888", + "3.79.71.167:18888", + "108.128.110.16:18888", + "18.133.82.227:18888", + "35.180.81.133:18888", + "13.210.151.5:18888", + "18.231.27.82:18888", + "3.12.212.122:18888", + "52.24.128.7:18888", + "15.207.144.3:18888", + "3.39.38.55:18888", + "54.151.226.240:18888", + "35.174.93.198:18888", + "18.210.241.149:18888", + "54.177.115.127:18888", + "54.254.131.82:18888", + "18.167.171.167:18888", + "54.167.11.177:18888", + "35.74.7.196:18888", + "52.196.244.176:18888", + "54.248.129.19:18888", + "43.198.142.160:18888", + "3.0.214.7:18888", + "54.153.59.116:18888", + "54.153.94.160:18888", + "54.82.161.39:18888", + "54.179.207.68:18888", + "18.142.82.44:18888", + "18.163.230.203:18888", + # "[2a05:d014:1f2f:2600:1b15:921:d60b:4c60]:18888", // use this if support ipv6 + # "[2600:1f18:7260:f400:8947:ebf3:78a0:282b]:18888", // use this if support ipv6 ] } @@ -346,16 +627,134 @@ genesis.block = { parentHash = "0xe58f33f9baf9305dc6f82b9f1934ea8f0ade2defb951258d50167028c780351f" } -#localwitness = [ -#] +// Optional.The default is empty. +// It is used when the witness account has set the witnessPermission. +// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, +// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. +// When it is empty,the localwitness is configured with the private key of the witness account. -localwitnesskeystore = [ - "localwitnesskeystore.json" +//localWitnessAccountAddress = + +localwitness = [ ] +#localwitnesskeystore = [ +# "localwitnesskeystore.json" +#] + block = { needSyncCheck = true maintenanceTimeInterval = 21600000 + proposalExpireTime = 259200000 // 3 day: 259200000(ms) +} + +# Transaction reference block, default is "solid", configure to "head" may cause TaPos error +# trx.reference.block = "solid" // head;solid; + +# This property sets the number of milliseconds after the creation of the transaction that is expired, default value is 60000. +# trx.expiration.timeInMilliseconds = 60000 + +vm = { + supportConstant = false + maxEnergyLimitForConstant = 100000000 + minTimeRatio = 0.0 + maxTimeRatio = 5.0 + saveInternalTx = false + + # Indicates whether the node stores featured internal transactions, such as freeze, vote and so on + # saveFeaturedInternalTx = false + + # Indicates whether the node stores the details of the internal transactions generated by the + # CANCELALLUNFREEZEV2 opcode, such as bandwidth/energy/tronpower cancel amount. + # saveCancelAllUnfreezeV2Details = false + + # In rare cases, transactions that will be within the specified maximum execution time (default 10(ms)) are re-executed and packaged + # longRunningTime = 10 + + # Indicates whether the node support estimate energy API. + # estimateEnergy = false + + # Indicates the max retry time for executing transaction in estimating energy. + # estimateEnergyMaxRetry = 3 +} + +committee = { + allowCreationOfContracts = 0 //mainnet:0 (reset by committee),test:1 + allowAdaptiveEnergy = 0 //mainnet:0 (reset by committee),test: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 + } + version = 0 + # Specify the starting block number to sync historical events. This is only applicable when version = 1. + # After performing a full event sync, set this value to 0 or a negative number. + # startSyncBlockNum = 1 + + path = "" // absolute path of plugin + server = "" // target server address to receive event triggers + // dbname|username|password, if you want to create indexes for collections when the collections + // are not exist, you can add version and set it to 2, as dbname|username|password|version + // if you use version 2 and one collection not exists, it will create index automaticaly; + // if you use version 2 and one collection exists, it will not create index, you must create index manually; + dbconfig = "" + contractParse = true + topics = [ + { + triggerName = "block" // block trigger, the value can't be modified + enable = false + topic = "block" // plugin topic, the value could be modified + solidified = false // if set true, just need solidified block, default is false + }, + { + triggerName = "transaction" + enable = false + topic = "transaction" + solidified = false + ethCompatible = false // if set true, add transactionIndex, cumulativeEnergyUsed, preCumulativeLogCount, logList, energyUnitPrice, default is false + }, + { + triggerName = "contractevent" + enable = false + topic = "contractevent" + }, + { + triggerName = "contractlog" + enable = false + topic = "contractlog" + redundancy = false // if set true, contractevent will also be regarded as contractlog + }, + { + triggerName = "solidity" // solidity block trigger(just include solidity block number and timestamp), the value can't be modified + enable = true // the default value is true + topic = "solidity" + }, + { + triggerName = "solidityevent" + enable = false + topic = "solidityevent" + }, + { + triggerName = "soliditylog" + enable = false + topic = "soliditylog" + redundancy = false // if set true, solidityevent will also be regarded as soliditylog + } + ] + + 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. + ] + } +} diff --git a/private_net_config.conf b/private_net_config.conf index a8cfe48a..4f05e0ff 100644 --- a/private_net_config.conf +++ b/private_net_config.conf @@ -5,19 +5,35 @@ net { storage { # Directory for storing persistent data - + db.engine = "LEVELDB", + db.sync = false, db.directory = "database", index.directory = "index", - + transHistory.switch = "on", # 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 + # Otherwise, db configs will remain default and data will be stored in # the path of "output-directory" or which is set by "-d" ("--output-directory"). + # setting can impove leveldb performance .... start + # node: if this will increase process fds,you may be check your ulimit if 'too many open files' error occurs + # see https://github.com/tronprotocol/tips/blob/master/tip-343.md for detail + # if you find block sync has lower performance,you can try this settings + #default = { + # maxOpenFiles = 100 + #} + #defaultM = { + # maxOpenFiles = 500 + #} + #defaultL = { + # maxOpenFiles = 1000 + #} + # setting can impove leveldb performance .... end + # Attention: name is a required field that must be set !!! properties = [ // { @@ -46,22 +62,93 @@ storage { // }, ] + needToUpdateAsset = true + + //dbsettings is needed when using rocksdb as the storage implement (db.engine="ROCKSDB"). + //we'd strongly recommend that do not modify it unless you know every item's meaning clearly. + dbSettings = { + levelNumber = 7 + //compactThreads = 32 + blocksize = 64 // n * KB + maxBytesForLevelBase = 256 // n * MB + maxBytesForLevelMultiplier = 10 + level0FileNumCompactionTrigger = 4 + targetFileSizeBase = 256 // n * MB + targetFileSizeMultiplier = 1 + } + + //backup settings when using rocks db as the storage implement (db.engine="ROCKSDB"). + //if you want to use the backup plugin, please confirm set the db.engine="ROCKSDB" above. + backup = { + enable = false // indicate whether enable the backup plugin + propPath = "prop.properties" // record which bak directory is valid + bak1path = "bak1/database" // you must set two backup directories to prevent application halt unexpected(e.g. kill -9). + bak2path = "bak2/database" + frequency = 10000 // indicate backup db once every 10000 blocks processed. + } + + balance.history.lookup = false + + # checkpoint.version = 2 + # checkpoint.sync = true + + # the estimated number of block transactions (default 1000, min 100, max 10000). + # so the total number of cached transactions is 65536 * txCache.estimatedTransactions + # txCache.estimatedTransactions = 1000 + # if true, transaction cache initialization will be faster. default false + # txCache.initOptimization = true + + # data root setting, for check data, currently, only reward-vi is used. + + # merkleRoot = { + # reward-vi = 9debcb9924055500aaae98cdee10501c5c39d4daa75800a996f4bdda73dbccd8 // main-net, Sha256Hash, hexString + # } + } node.discovery = { - enable = false - persist = true - bind.ip = "" - external.ip = null + enable = false # you should set this entry value with true 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. + external.ip = 127.0.0.1 } +# custom stop condition +#node.shutdown = { +# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. +# BlockHeight = 33350800 # if block header height in persistent db matched. +# BlockCount = 12 # block sync count after node start. +#} + node.backup { + # udp listen port, each member should have the same configuration port = 10001 + + # my priority, each member should use different priority priority = 8 + + # time interval to send keepAlive message, each member should have the same configuration + keepAliveInterval = 3000 + + # peer's ip list, can't contain mine members = [ + # "ip", + # "ip" ] } +crypto { + engine = "eckey" +} +# prometheus metrics start +# node.metrics = { +# prometheus{ +# enable=true +# port="9527" +# } +# } + +# prometheus metrics end + node { # trust node for solidity node # trustNode = "ip:port" @@ -70,25 +157,36 @@ node { # expose extension api to public or not walletExtensionApi = true - listen.port = 18888 + listen.port = 16666 connection.timeout = 2 + fetchBlock.timeout = 200 + tcpNettyWorkThreadNum = 0 udpNettyWorkThreadNum = 1 - # Number of validate sign thread, default availableProcessors / 2 + # Number of validate sign thread, default availableProcessors # validateSignThreadNum = 16 - maxActiveNodes = 30 + maxConnections = 30 + + minConnections = 8 - maxActiveNodesWithSameIp = 2 + minActiveConnections = 3 - minParticipationRate = 0 + maxConnectionsWithSameIp = 2 + + maxHttpConnectNumber = 50 + + minParticipationRate = 15 + + isOpenFullTcpDisconnect = false + inactiveThreshold = 600 //seconds p2p { - version = 1 # 11111: mainnet; 20180622: testnet + version = 1 # 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 = [ @@ -105,13 +203,22 @@ node { # "ip:port" ] + fastForward = [ + + ] + http { - fullNodePort = 8090 - solidityPort = 8091 + fullNodeEnable = true + fullNodePort = 16667 + solidityEnable = true + solidityPort = 16668 } rpc { + enable = true port = 50051 + solidityEnable = true + solidityPort = 50061 # Number of gRPC thread, default availableProcessors / 2 # thread = 16 @@ -133,15 +240,193 @@ node { # 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 = 1 + + # The switch of the reflection service, effective for all gRPC services + # reflectionService = true + } + + # number of solidity thread in the FullNode. + # If accessing solidity rpc and http interface timeout, could increase the number of threads, + # The default value is the number of cpu cores of the machine. + #solidity.threads = 8 + + # Limits the maximum percentage (default 75%) of producing block interval + # to provide sufficient time to perform other operations e.g. broadcast block + # blockProducedTimeOut = 75 + + # Limits the maximum number (default 700) of transaction from network layer + # netMaxTrxPerSecond = 700 + + # Whether to enable the node detection function, default false + # nodeDetectEnable = false + + # use your ipv6 address for node discovery and tcp connection, default false + # enableIpv6 = false + + # if your node's highest block num is below than all your pees', try to acquire new connection. default false + # effectiveCheckEnable = false + + # Dynamic loading configuration function, disabled by default + # dynamicConfig = { + # enable = false + # Configuration file change check interval, default is 600 seconds + # checkInterval = 600 + # } + + dns { + # dns urls to get nodes, url format tree://{pubkey}@{domain}, default empty + treeUrls = [ + #"tree://APFGGTFOBVE2ZNAB3CSMNNX6RRK3ODIRLP2AA5U4YFAA6MSYZUYTQ@nodes1.example.org", + ] + + # enable or disable dns publish, default false + # publish = false + + # dns domain to publish nodes, required if publish is true + # dnsDomain = "nodes1.example.org" + + # dns private key used to publish, required if publish is true, hex string of length 64 + # dnsPrivate = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" + + # known dns urls to publish if publish is true, url format tree://{pubkey}@{domain}, default empty + # knownUrls = [ + #"tree://APFGGTFOBVE2ZNAB3CSMNNX6RRK3ODIRLP2AA5U4YFAA6MSYZUYTQ@nodes2.example.org", + # ] + + # staticNodes = [ + # static nodes to published on dns + # Sample entries: + # "ip:port", + # "ip:port" + # ] + + # merge several nodes into a leaf of tree, should be 1~5 + # maxMergeSize = 5 + + # only nodes change percent is bigger then the threshold, we update data on dns + # changeThreshold = 0.1 + + # dns server to publish, required if publish is true, only aws or aliyun is support + # serverType = "aws" + + # access key id of aws or aliyun api, required if publish is true, string + # accessKeyId = "your-key-id" + + # access key secret of aws or aliyun api, required if publish is true, string + # accessKeySecret = "your-key-secret" + + # if publish is true and serverType is aliyun, it's endpoint of aws dns server, string + # aliyunDnsEndpoint = "alidns.aliyuncs.com" + + # if publish is true and serverType is aws, it's region of aws api, such as "eu-south-1", string + # awsRegion = "us-east-1" + + # if publish is true and server-type is aws, it's host zone id of aws's domain, string + # awsHostZoneId = "your-host-zone-id" + } + + # open the history query APIs(http&GRPC) when node is a lite fullNode, + # like {getBlockByNum, getBlockByID, getTransactionByID...}. + # default: false. + # note: above APIs may return null even if blocks and transactions actually are on the blockchain + # when opening on a lite fullnode. only open it if the consequences being clearly known + # openHistoryQueryWhenLiteFN = false + + jsonrpc { + # Note: If you turn on jsonrpc and run it for a while and then turn it off, you will not + # be able to get the data from eth_getLogs for that period of time. + + httpFullNodeEnable = true + httpFullNodePort = 8545 + httpSolidityEnable = true + httpSolidityPort = 8555 + + # The maximum blocks range to retrieve logs for eth_getLogs, default value is 5000, + # should be > 0, otherwise means no limit. + maxBlockRange = 5000 + + # The maximum number of allowed topics within a topic criteria, default value is 1000, + # should be > 0, otherwise means no limit. + maxSubTopics = 1000 } + # Disabled api list, it will work for http and rpc, both fullnode and soliditynode, + # but not jsonrpc. + # Sample: The setting is case insensitive, GetNowBlock2 is equal to getnowblock2 + # + # disabledApi = [ + # "getaccount", + # "getnowblock2" + # ] + +} + +## rate limiter config +rate.limiter = { + # Every api could be set a specific rate limit strategy. Three strategy are supported:GlobalPreemptibleAdapter、IPQPSRateLimiterAdapte、QpsRateLimiterAdapter + # GlobalPreemptibleAdapter: permit is the number of preemptible resource, every client must apply one resourse + # before do the request and release the resource after got the reponse automaticlly. permit should be a Integer. + # QpsRateLimiterAdapter: qps is the average request count in one second supported by the server, it could be a Double or a Integer. + # IPQPSRateLimiterAdapter: similar to the QpsRateLimiterAdapter, qps could be a Double or a Integer. + # If do not set, the "default strategy" is set.The "default startegy" is based on QpsRateLimiterAdapter, the qps is set as 10000. + # + # Sample entries: + # + http = [ + # { + # component = "GetNowBlockServlet", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "GetAccountServlet", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "ListWitnessesServlet", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # } + ], + + rpc = [ + # { + # component = "protocol.Wallet/GetBlockByLatestNum2", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "protocol.Wallet/GetAccount", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "protocol.Wallet/ListWitnesses", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # }, + ] + + # global qps, default 50000 + # global.qps = 50000 + # IP-based global qps, default 10000 + # global.ip.qps = 10000 } seed.node = { - # List of the seed nodes - # Seed nodes are stable full nodes + # 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", @@ -171,14 +456,44 @@ genesis.block = { accountType = "AssetIssue" address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip" balance = "-9223372036854775808" + }, + { + accountName = "TestA" + accountType = "AssetIssue" + address = "TVdyt1s88BdiCjKt6K2YuoSmpWScZYK1QF" + balance = "1000000000000000" + }, + { + accountName = "TestB" + accountType = "AssetIssue" + address = "TCNVmGtkfknHpKSZXepZDXRowHF7kosxcv" + balance = "1000000000000000" + }, + { + accountName = "TestC" + accountType = "AssetIssue" + address = "TAbzgkG8p3yF5aywKVgq9AaAu6hvF2JrVC" + balance = "1000000000000000" + }, + { + accountName = "TestD" + accountType = "AssetIssue" + address = "TMmmvwvkBPBv3Gkw9cGKbZ8PLznYkTu3ep" + balance = "1000000000000000" + }, + { + accountName = "TestE" + accountType = "AssetIssue" + address = "TBJHZu4Sm86aWHtt6VF6KQSzot8vKTuTKx" + balance = "1000000000000000" } ] witnesses = [ { address: TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY, - url = "http://Alioth.com", - voteCount = 100027 + url = "http://tronstudio.com", + voteCount = 10000 } ] @@ -187,15 +502,134 @@ genesis.block = { parentHash = "957dc2d350daecc7bb6a38f3938ebde0a0c1cedafe15f0edae4256a2907449f6" } +// Optional.The default is empty. +// It is used when the witness account has set the witnessPermission. +// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, +// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. +// When it is empty,the localwitness is configured with the private key of the witness account. + +//localWitnessAccountAddress = + localwitness = [ - da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 + da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0 # you must enable this value and the witness address TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY are matched. ] #localwitnesskeystore = [ -# "src/main/resources/localwitnesskeystore.json" +# "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 = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms) + proposalExpireTime = 259200000 // 3 day: 259200000(ms) +} + +# Transaction reference block, default is "solid", configure to "head" may cause TaPos error +# trx.reference.block = "solid" // head;solid; + +# This property sets the number of milliseconds after the creation of the transaction that is expired, default value is 60000. +# trx.expiration.timeInMilliseconds = 60000 + +vm = { + supportConstant = false + maxEnergyLimitForConstant = 100000000 + minTimeRatio = 0.0 + maxTimeRatio = 5.0 + saveInternalTx = false + + # Indicates whether the node stores featured internal transactions, such as freeze, vote and so on + # saveFeaturedInternalTx = false + + # Indicates whether the node stores the details of the internal transactions generated by the + # CANCELALLUNFREEZEV2 opcode, such as bandwidth/energy/tronpower cancel amount. + # saveCancelAllUnfreezeV2Details = false + + # In rare cases, transactions that will be within the specified maximum execution time (default 10(ms)) are re-executed and packaged + # longRunningTime = 10 + + # Indicates whether the node support estimate energy API. + # estimateEnergy = false + + # Indicates the max retry time for executing transaction in estimating energy. + # estimateEnergyMaxRetry = 3 +} + +committee = { + allowCreationOfContracts = 1 //mainnet:0 (reset by committee),test: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 + } + # version = 0 + # Specify the starting block number to sync historical events. This is only applicable when version = 1. + # After performing a full event sync, set this value to 0 or a negative number. + # startSyncBlockNum = 1 + + path = "" // absolute path of plugin + server = "" // target server address to receive event triggers + // dbname|username|password, if you want to create indexes for collections when the collections + // are not exist, you can add version and set it to 2, as dbname|username|password|version + // if you use version 2 and one collection not exists, it will create index automaticaly; + // if you use version 2 and one collection exists, it will not create index, you must create index manually; + dbconfig = "" + contractParse = true + topics = [ + { + triggerName = "block" // block trigger, the value can't be modified + enable = false + topic = "block" // plugin topic, the value could be modified + solidified = false // if set true, just need solidified block, default is false + }, + { + triggerName = "transaction" + enable = false + topic = "transaction" + solidified = false + ethCompatible = false // if set true, add transactionIndex, cumulativeEnergyUsed, preCumulativeLogCount, logList, energyUnitPrice, default is false + }, + { + triggerName = "contractevent" + enable = false + topic = "contractevent" + }, + { + triggerName = "contractlog" + enable = false + topic = "contractlog" + redundancy = false // if set true, contractevent will also be regarded as contractlog + }, + { + triggerName = "solidity" // solidity block trigger(just include solidity block number and timestamp), the value can't be modified + enable = true // the default value is true + topic = "solidity" + }, + { + triggerName = "solidityevent" + enable = false + topic = "solidityevent" + }, + { + triggerName = "soliditylog" + enable = false + topic = "soliditylog" + redundancy = false // if set true, solidityevent will also be regarded as soliditylog + } + ] + + 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. + ] + } } + diff --git a/test_net_config.conf b/test_net_config.conf index 888ea683..3642882b 100644 --- a/test_net_config.conf +++ b/test_net_config.conf @@ -5,19 +5,33 @@ net { storage { # Directory for storing persistent data - + db.engine = "LEVELDB", + db.sync = false, db.directory = "database", - index.directory = "index", + transHistory.switch = "on", # 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 + # Otherwise, db configs will remain default and data will be stored in # the path of "output-directory" or which is set by "-d" ("--output-directory"). - + # setting can impove leveldb performance .... start + # node: if this will increase process fds,you may be check your ulimit if 'too many open files' error occurs + # see https://github.com/tronprotocol/tips/blob/master/tip-343.md for detail + # if you find block sync has lower performance,you can try this settings + #default = { + # maxOpenFiles = 100 + #} + #defaultM = { + # maxOpenFiles = 500 + #} + #defaultL = { + # maxOpenFiles = 1000 + #} + # setting can impove leveldb performance .... end # Attention: name is a required field that must be set !!! properties = [ // { @@ -46,22 +60,79 @@ storage { // }, ] + needToUpdateAsset = true + + //dbsettings is needed when using rocksdb as the storage implement (db.engine="ROCKSDB"). + //we'd strongly recommend that do not modify it unless you know every item's meaning clearly. + dbSettings = { + levelNumber = 7 + //compactThreads = 32 + blocksize = 64 // n * KB + maxBytesForLevelBase = 256 // n * MB + maxBytesForLevelMultiplier = 10 + level0FileNumCompactionTrigger = 4 + targetFileSizeBase = 256 // n * MB + targetFileSizeMultiplier = 1 + } + + + balance.history.lookup = false + + # checkpoint.version = 2 + # checkpoint.sync = true + + # the estimated number of block transactions (default 1000, min 100, max 10000). + # so the total number of cached transactions is 65536 * txCache.estimatedTransactions + # txCache.estimatedTransactions = 1000 + # data root setting, for check data, currently, only reward-vi is used. + + merkleRoot = { + reward-vi = b474b61f93824cd70106f8f5283fa740d61b83a7d57a3c12401d627f1fae0a77 // nile-net, Sha256Hash, hexString + } } node.discovery = { enable = true persist = true - bind.ip = "" - external.ip = null } +# custom stop condition +#node.shutdown = { +# BlockTime = "54 59 08 * * ?" # if block header time in persistent db matched. +# BlockHeight = 33350800 # if block header height in persistent db matched. +# BlockCount = 12 # block sync count after node start. +#} + node.backup { + # udp listen port, each member should have the same configuration port = 10001 + + # my priority, each member should use different priority priority = 8 + + # time interval to send keepAlive message, each member should have the same configuration + keepAliveInterval = 3000 + + # peer's ip list, can't contain mine members = [ + # "ip", + # "ip" ] } +crypto { + engine = "eckey" +} +# prometheus metrics start +# node.metrics = { +# prometheus{ +# enable=true +# port="9527" +# } +# } + +# prometheus metrics end + node { # trust node for solidity node # trustNode = "ip:port" @@ -74,6 +145,8 @@ node { connection.timeout = 2 + fetchBlock.timeout = 200 + tcpNettyWorkThreadNum = 0 udpNettyWorkThreadNum = 1 @@ -81,14 +154,22 @@ node { # Number of validate sign thread, default availableProcessors / 2 # validateSignThreadNum = 16 - maxActiveNodes = 30 + maxConnections = 30 + + minConnections = 8 - maxActiveNodesWithSameIp = 2 + minActiveConnections = 3 - minParticipationRate = 33 + maxConnectionsWithSameIp = 2 + + maxHttpConnectNumber = 50 + + minParticipationRate = 15 + + isOpenFullTcpDisconnect = false p2p { - version = 20180815 + version = 201910292 } active = [ @@ -105,13 +186,25 @@ node { # "ip:port" ] + fastForward = [ + ] + http { + fullNodeEnable = true fullNodePort = 8090 + solidityEnable = true solidityPort = 8091 + PBFTEnable = true + PBFTPort = 8092 } rpc { + enable = true port = 50051 + solidityEnable = true + solidityPort = 50061 + PBFTEnable = true + PBFTPort = 50071 # Number of gRPC thread, default availableProcessors / 2 # thread = 16 @@ -133,8 +226,186 @@ node { # 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 = 1 + + # The switch of the reflection service, effective for all gRPC services + # reflectionService = true } + # number of solidity thread in the FullNode. + # If accessing solidity rpc and http interface timeout, could increase the number of threads, + # The default value is the number of cpu cores of the machine. + #solidity.threads = 8 + + # Limits the maximum percentage (default 75%) of producing block interval + # to provide sufficient time to perform other operations e.g. broadcast block + # blockProducedTimeOut = 75 + + # Limits the maximum number (default 700) of transaction from network layer + # netMaxTrxPerSecond = 700 + + # Whether to enable the node detection function, default false + # nodeDetectEnable = false + + # use your ipv6 address for node discovery and tcp connection, default false + # enableIpv6 = false + + # if your node's highest block num is below than all your pees', try to acquire new connection. default false + # effectiveCheckEnable = false + + # Dynamic loading configuration function, disabled by default + # dynamicConfig = { + # enable = false + # Configuration file change check interval, default is 600 seconds + # checkInterval = 600 + # } + + dns { + # dns urls to get nodes, url format tree://{pubkey}@{domain}, default empty + treeUrls = [ + #"tree://APFGGTFOBVE2ZNAB3CSMNNX6RRK3ODIRLP2AA5U4YFAA6MSYZUYTQ@nodes1.example.org", + ] + + # enable or disable dns publish, default false + # publish = false + + # dns domain to publish nodes, required if publish is true + # dnsDomain = "nodes1.example.org" + + # dns private key used to publish, required if publish is true, hex string of length 64 + # dnsPrivate = "b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291" + + # known dns urls to publish if publish is true, url format tree://{pubkey}@{domain}, default empty + # knownUrls = [ + #"tree://APFGGTFOBVE2ZNAB3CSMNNX6RRK3ODIRLP2AA5U4YFAA6MSYZUYTQ@nodes2.example.org", + # ] + + # staticNodes = [ + # static nodes to published on dns + # Sample entries: + # "ip:port", + # "ip:port" + # ] + + # merge several nodes into a leaf of tree, should be 1~5 + # maxMergeSize = 5 + + # only nodes change percent is bigger then the threshold, we update data on dns + # changeThreshold = 0.1 + + # dns server to publish, required if publish is true, only aws or aliyun is support + # serverType = "aws" + + # access key id of aws or aliyun api, required if publish is true, string + # accessKeyId = "your-key-id" + + # access key secret of aws or aliyun api, required if publish is true, string + # accessKeySecret = "your-key-secret" + + # if publish is true and serverType is aliyun, it's endpoint of aws dns server, string + # aliyunDnsEndpoint = "alidns.aliyuncs.com" + + # if publish is true and serverType is aws, it's region of aws api, such as "eu-south-1", string + # awsRegion = "us-east-1" + + # if publish is true and server-type is aws, it's host zone id of aws's domain, string + # awsHostZoneId = "your-host-zone-id" + } + + # open the history query APIs(http&GRPC) when node is a lite fullNode, + # like {getBlockByNum, getBlockByID, getTransactionByID...}. + # default: false. + # note: above APIs may return null even if blocks and transactions actually are on the blockchain + # when opening on a lite fullnode. only open it if the consequences being clearly known + # openHistoryQueryWhenLiteFN = false + + jsonrpc { + # Note: If you turn on jsonrpc and run it for a while and then turn it off, you will not + # be able to get the data from eth_getLogs for that period of time. + + # httpFullNodeEnable = true + # httpFullNodePort = 8545 + # httpSolidityEnable = true + # httpSolidityPort = 8555 + # httpPBFTEnable = true + # httpPBFTPort = 8565 + + # The maximum blocks range to retrieve logs for eth_getLogs, default value is 5000, + # should be > 0, otherwise means no limit. + maxBlockRange = 5000 + + # The maximum number of allowed topics within a topic criteria, default value is 1000, + # should be > 0, otherwise means no limit. + maxSubTopics = 1000 + } + + # Disabled api list, it will work for http, rpc and pbft, both fullnode and soliditynode, + # but not jsonrpc. + # Sample: The setting is case insensitive, GetNowBlock2 is equal to getnowblock2 + # + # disabledApi = [ + # "getaccount", + # "getnowblock2" + # ] +} + +## rate limiter config +rate.limiter = { + # Every api could be set a specific rate limit strategy. Three strategy are supported:GlobalPreemptibleAdapter、IPQPSRateLimiterAdapte、QpsRateLimiterAdapter + # GlobalPreemptibleAdapter: permit is the number of preemptible resource, every client must apply one resourse + # before do the request and release the resource after got the reponse automaticlly. permit should be a Integer. + # QpsRateLimiterAdapter: qps is the average request count in one second supported by the server, it could be a Double or a Integer. + # IPQPSRateLimiterAdapter: similar to the QpsRateLimiterAdapter, qps could be a Double or a Integer. + # If do not set, the "default strategy" is set.The "default startegy" is based on QpsRateLimiterAdapter, the qps is set as 10000. + # + # Sample entries: + # + http = [ + # { + # component = "GetNowBlockServlet", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "GetAccountServlet", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "ListWitnessesServlet", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # } + ], + + rpc = [ + # { + # component = "protocol.Wallet/GetBlockByLatestNum2", + # strategy = "GlobalPreemptibleAdapter", + # paramString = "permit=1" + # }, + + # { + # component = "protocol.Wallet/GetAccount", + # strategy = "IPQPSRateLimiterAdapter", + # paramString = "qps=1" + # }, + + # { + # component = "protocol.Wallet/ListWitnesses", + # strategy = "QpsRateLimiterAdapter", + # paramString = "qps=1" + # }, + ] + + # global qps, default 50000 + # global.qps = 50000 + # IP-based global qps, default 10000 + # global.ip.qps = 10000 } @@ -148,11 +419,11 @@ seed.node = { # "ip:port" # ] ip.list = [ - "47.254.144.25:18888", - "47.254.146.147:18888", - "47.254.16.55:18888", - "47.254.18.49:18888", - "52.14.86.232:18888" + "44.236.192.97:18888", + "44.236.125.107:18888", + "44.232.119.174:18888", + "52.39.105.180:18888", + "54.70.52.47:18888" ] } @@ -162,174 +433,289 @@ genesis.block = { { accountName = "Zion" accountType = "AssetIssue" - address = "TNNqZuYhMfQvooC4kJwTsMJEQVU3vWGa5u" - balance = "95000000000000000" + address = "TMWXhuxiT1KczhBxCseCDDsrhmpYGUcoA9" + balance = "99000000000000000" }, { accountName = "Sun" accountType = "AssetIssue" - address = "TWsm8HtU2A5eEzoT8ev8yaoFjHsXLLrckb" - balance = "5000000000000000" + address = "TN21Wx2yoNYiZ7znuQonmZMJnH5Vdfxu78" + balance = "99000000000000000" }, { accountName = "Blackhole" accountType = "AssetIssue" - address = "TSJD5rdu6wZXP7F2m3a3tn8Co3JcMjtBip" + address = "TDPJULRzVtzVjnBmZvfaTcTNQ2tsVi6XxQ" balance = "-9223372036854775808" } ] witnesses = [ { - address: TVdyt1s88BdiCjKt6K2YuoSmpWScZYK1QF, - url = "http://Alioth.com", - voteCount = 100027 + address: TD23EqH3ixYMYh8CMXKdHyQWjePi3KQvxV, + url = "http://GR1.com", + voteCount = 100000026 }, { - address: TCNVmGtkfknHpKSZXepZDXRowHF7kosxcv, - url = "http://Aries.com", - voteCount = 100026 + address: TCm4Lz1uP3tQm3jzpwFTG6o5UvSTA2XEHc, + url = "http://GR2.com", + voteCount = 100000025 }, { - address: TAbzgkG8p3yF5aywKVgq9AaAu6hvF2JrVC, - url = "http://Cancer.com", - voteCount = 100025 + address: TTgDUgREiPBeY3iudD5e2eEibE4v4CE8C9, + url = "http://GR3.com", + voteCount = 100000024 }, { - address: TMmmvwvkBPBv3Gkw9cGKbZ8PLznYkTu3ep, - url = "http://Capricorn.com", - voteCount = 100024 + address: TFVDe7kMEmb8EuUxxp42kocQY1fFY727WS, + url = "http://GR4.com", + voteCount = 100000023 }, { - address: TBJHZu4Sm86aWHtt6VF6KQSzot8vKTuTKx, - url = "http://Cassiopeia.com", - voteCount = 100023 + address: TY4NSjctzTchHkhaCskVc5zQtnX9s1uxAX, + url = "http://GR5.com", + voteCount = 100000022 }, { - address: TLvCstA93piBhpdvMggJ9r5b793b6rqdGd, - url = "http://Crux.com", - voteCount = 100022 + address: TWSMPrm6aizvsJmPnjMB7x3UExJfRhyQhd, + url = "http://GR6.com", + voteCount = 100000021 }, { - address: TEf2ADumcubtg9NeNi7bNP14KfvYxKzTDu, - url = "http://Delphinus.com", - voteCount = 100021 + address: TKwLkSaCvqqpAB44qaHGTohCTCFoYw7ecy, + url = "http://GR7.com", + voteCount = 100000020 }, { - address: TTqqbNxnqniyeCFi4aYwQQFHtuMwiBLARo, - url = "http://Dorado.com", - voteCount = 100020 + address: TDsYmm1St9r4UZebDGWBcTMtfYTw9YX5h4, + url = "http://GR8.com", + voteCount = 100000019 }, { - address: TWwJwoqAYvUVjmp5odhwZYgKekBqL3Mbcf, - url = "http://Dubhe.com", - voteCount = 100019 + address: TFEQbWAPxhbUr1P14y9UJBUZo3LgtdqTS7, + url = "http://GR9.com", + voteCount = 100000018 }, { - address: TCPKsDZCJDzC83KWcAnHo9b46DN9o4s48y, - url = "http://Eridanus.com", - voteCount = 100018 + address: TCynAi8tb7UWP7uhLv6fe971KLm2KT8tcs, + url = "http://GR10.com", + voteCount = 100000017 }, { - address: TJnd8wF5ScEvuYq4WnJUyGbg6iS7ibnWrY, - url = "http://Gemini.com", - voteCount = 100017 + address: TC2YsLp4rzrt3AbeN3EryoSywrBjEUVCq3, + url = "http://GR11.com", + voteCount = 100000016 }, { - address: TTZDB64rNpdw8rpEKko5FhB7BMUf5y4JMT, - url = "http://Hercules.com", - voteCount = 100016 + address: THxMKH1uaL5FpURujkQR7u2sNZ2n5PSsiH, + url = "http://GR12.com", + voteCount = 100000015 }, { - address: TVWapNccbdFDqdHjFGnJ8ePancR6HjSned, - url = "http://Leo.com", - voteCount = 100015 + address: TWbzgoHimDcXWy19ts1An8bxA4JKjcYHeG, + url = "http://GR13.com", + voteCount = 100000014 }, { - address: TUVdiR6bYsuDNB5HWPLyK3ueY6225n5AdJ, - url = "http://Libra.com", - voteCount = 100014 + address: TW2LmXnVCEaxuVtQN8gZR1ixT5PNm4QLft, + url = "http://GR14.com", + voteCount = 100000013 }, { - address: TRBQFNJrJJzzgqfnbP9WvAjWd2oCNyqanC, - url = "http://Lupus.com", - voteCount = 100013 + address: TVuqk4rYYVHVA6j6sSEnaLexhhoQhN8nyZ, + url = "http://GR15.com", + voteCount = 100000012 }, { - address: TBSq7zAhyEyVf96tbQmh6SwBGRiQXJf9sx, - url = "http://Lyra.com", - voteCount = 100012 + address: TVMZu5ptZPhhkZ3Kaagkq35FmyuKNvUKJV, + url = "http://GR16.com", + voteCount = 100000011 }, { - address: TFZhwKPxqadgLGSwkiD1JeFJgfSMn2BD75, - url = "http://Monoceros.com", - voteCount = 100011 + address: TFDHT8PqUrL2Bd8DeysSiHHBAEMidZgkhx, + url = "http://GR17.com", + voteCount = 100000010 }, { - address: TZ6PqKSodEW7yQNYSDS8WoDo8t3SfACV3V, - url = "http://Norma.com", - voteCount = 100010 + address: TVqz5Bj3M1uEenaSsw2NnXvTWChPj6K3hb, + url = "http://GR18.com", + voteCount = 100000009 }, { - address: TSiyqwmcqsDBXQmWPZhC4Y5zncECMN61Li, - url = "http://Orion.com", - voteCount = 100009 + address: TSt8YNpARJkhdMdEV4C7ajH1tFHpZWzF1T, + url = "http://GR19.com", + voteCount = 100000008 }, { - address: TVnWr8bm3b2gDrJDBTfWXuPXiT1cvZUGan, - url = "http://Pavo.com", - voteCount = 100008 + address: TTxWDjEb3Be1Ax8BCvK48cnaorZofLq2C9, + url = "http://GR20.com", + voteCount = 100000007 }, { - address: TNR2BDkX53rFCvkSg89nK7nfeC6hLN7B5o, - url = "http://Perseus.com", - voteCount = 100007 + address: TU5T838YtyZtEQKpnXEdRz3d8hJn6WHhjw, + url = "http://GR21.com", + voteCount = 100000006 }, { - address: TVw2k1pD3n4ErWnr4uWmjVwsdai8vT5wyn, - url = "http://Phecda.com", - voteCount = 100006 + address: TRuSs1MpL3o2hzhU8r6HLC7WtDyVE9hsF6, + url = "http://GR22.com", + voteCount = 100000005 }, { - address: THtcGdFXoGWNd9PDrhCradfvcdsQAoNVAC, - url = "http://Phoenix.com", - voteCount = 100005 + address: TYMCoCZyAjWkWdUfEHg1oZQYbLKev282ou, + url = "http://GR23.com", + voteCount = 100000004 }, { - address: TEZ31xxrECtLmsGvQFnh2quQVxKFoHxqqu, - url = "http://Pyxis.com", - voteCount = 100004 + address: TQvAyGATpLZymHbpeaRozJCKqSeRWVNhCJ, + url = "http://GR24.com", + voteCount = 100000003 }, { - address: TA6ztifHZSkQ5F6KMe73rYRgQ5fBKLPomV, - url = "http://Scutum.com", - voteCount = 100003 + address: TYDd9nskbhJmLLNoe4yV2Z1SYtGjNa8wyg, + url = "http://GR25.com", + voteCount = 100000002 }, { - address: TXuLKjf8J8aCKgDgA5uczwn1yQNYVPLocY, - url = "http://Taurus.com", - voteCount = 100002 + address: TS5991Geh2qeHtw46rskpJyn6hFNbuZGGc, + url = "http://GR26.com", + voteCount = 100000001 }, { - address: TAihbgDWBK1QTS5gsk7evWDy2nhpkmkGZJ, - url = "http://Volans.com", - voteCount = 100001 + address: TKnn5MBnmXXeKdu9dxKVfKk4n1YdCeSRGr, + url = "http://GR27.com", + voteCount = 100000000 } ] timestamp = "0" #2017-8-26 12:00:00 - parentHash = "0x11524e0d6bfbbd25a9bd9cf5c5389f122e2bc2e66a29569d532739a1aa4376ae" + parentHash = "0xe58f33f9baf9305dc6f82b9f1934ea8f0ade2defb951258d50167028c780351f" } -#localwitness = [ -#] +// Optional.The default is empty. +// It is used when the witness account has set the witnessPermission. +// When it is not empty, the localWitnessAccountAddress represents the address of the witness account, +// and the localwitness is configured with the private key of the witnessPermissionAddress in the witness account. +// When it is empty,the localwitness is configured with the private key of the witness account. + +//localWitnessAccountAddress = + +localwitness = [ +] #localwitnesskeystore = [ -# "src/main/resources/localwitnesskeystore.json" +# "localwitnesskeystore.json" #] block = { - needSyncCheck = true # first node : false, other : true - maintenanceTimeInterval = 21600000 // 1 day: 86400000(ms), 6 hours: 21600000(ms) + needSyncCheck = false + maintenanceTimeInterval = 600000 + proposalExpireTime = 600000 // +} + +# Transaction reference block, default is "solid", configure to "head" may incur TaPos error +# trx.reference.block = "solid" // head;solid; + +# This property sets the number of milliseconds after the creation of the transaction that is expired, default value is 60000. +# trx.expiration.timeInMilliseconds = 60000 + +vm = { + supportConstant =true + maxEnergyLimitForConstant = 100000000 + minTimeRatio = 0.0 + maxTimeRatio = 5.0 + saveInternalTx = true + + # Indicates whether the node stores featured internal transactions, such as freeze, vote and so on + saveFeaturedInternalTx = true + + # Indicates whether the node stores the details of the internal transactions generated by the + # CANCELALLUNFREEZEV2 opcode, such as bandwidth/energy/tronpower cancel amount. + saveCancelAllUnfreezeV2Details = true + + # In rare cases, transactions that will be within the specified maximum execution time (default 10(ms)) are re-executed and packaged + # longRunningTime = 10 + + # Indicates whether the node support estimate energy API. + # estimateEnergy = false + + # Indicates the max retry time for executing transaction in estimating energy. + # estimateEnergyMaxRetry = 3 +} + +committee = { + allowCreationOfContracts = 0 //mainnet:0 (reset by committee),test:1 + allowAdaptiveEnergy = 0 //mainnet:0 (reset by committee),test: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 + } + version = 0 + # Specify the starting block number to sync historical events. This is only applicable when version = 1. + # After performing a full event sync, set this value to 0 or a negative number. + # startSyncBlockNum = 1 + + path = "" // absolute path of plugin + server = "" // target server address to receive event triggers + // dbname|username|password, if you want to create indexes for collections when the collections + // are not exist, you can add version and set it to 2, as dbname|username|password|version + // if you use version 2 and one collection not exists, it will create index automaticaly; + // if you use version 2 and one collection exists, it will not create index, you must create index manually; + dbconfig = "" + + 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" + }, + { + triggerName = "solidityevent" + enable = false + topic = "solidityevent" + }, + { + triggerName = "soliditylog" + enable = false + topic = "soliditylog" + } + ] + + 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. + ] + } }