此文已由作者苏州授权网易云社区发布。
欢迎访问网易云社区,了解更多网易技术产品运营经验
peer.discovery = {
# 是否开启节点发现,如果开启会去发现其他节点并建立连接,如果关闭则只连接peer.active中配置的节点
enabled = true
# 预配置的种子节点,便于搜索其他连接节点,配置格式values: [ip:port, enode://nodeid@ip:port, ip:port ...](主要用于太访公链)
ip.list = [
]
# 外部IP,如果不设置系统将使用http://checkip.amazonaws.com,为主机发现报告
external.ip = 127.0.0.1
# 本地网络的IP,如果为空则自动通过已知网站进行检索,配置为localhost地址外部节点将无法访问
bind.ip = 127.0.0.1
# 是否会把发现的节点加入相连接节点列表
public.home.node = true
# 是否持久化发现的节点,便于VM重启后不丢失
persist = true
# 尝试重新连接成功节点的时间,如果为0表示不重试连接
touchPeriod = 600
# 尝试连接的最大节点数,-1表示无限制。(主要用于太访公链)
touchMaxNodes = 100
# 测试在线节点的工人(线程)数
workers = 8
}
peer {
# 外部节点建立通信连接的端口
listen.port = 30304
# 网络ID
networkId = 4900
# Private key of the peer
# The key is generated by default on the first run and stored in the database folder
# If you have your own peer ID, specify its private key here
# derived nodeId = dead745c1dbcde518b48e52aca1e8d5ba666005a2c8804e39826c6080fb11c1e8abe41d1e41896e871f204f790a90fa9781744cccecf492212192a7c56e7673b
# privateKey = f67c4032a7ff79bbfa7a780331b235c4eb681d51a0704cb1562064fb6c4bced4
# 启动建立链接节点列表
active = [
# Sample entries:
# { url = "enode://<hex nodeID>@hostname.com:30303" }
# {
# ip = hostname.com
# port = 30303
# nodeId = e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c
# }
]
# 配置可信节点,可信节点发起连接都接收
trusted = [
# Sample entries:
# {nodeId = "e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c"},
# {ip = "11.22.33.44"},
# {ip = "11.22.33.*"},
# {
# nodeId = "e437a4836b77ad9d9ffe73ee782ef2614e6d8370fcf62191a6e488276e23717147073a7ce0b444d485fff5a0c34c4577251a7a990cf80d8542e21b95aa8c5e6c"
# ip = "11.22.33.44"
# }
]
# 最大活跃节点连接数,如果超出将会提示TOO_MANY_PEERS信息,可信节点发起连接都接收
maxActivePeers = 30
# 节点支持协议协议,可以是[eth, shh, bzz]
capabilities = [eth]
# 尝试连接节点的超时时间,单位秒
connection.timeout = 2
# 信道等待信息的时间,超时将关闭信道
channel.read.timeout = 90
p2p {
# the default version outbound connections are made with
# inbound connections are made with the version declared by the remote peer (if supported)
# version = 4
# 网络frame(帧)最大的bytes
framing.maxSize = 32768
# 强制节点发送握手协议在EIP-8中定义的,详见https://github.com/ethereum/EIPs/blob/master/EIPS/eip-8.md
eip8 = true
}
}
# 创世文件的文件名,在resources/genesis下
genesis = consortium.json
# path to genesis file
# has priority over `genesis` option
# genesisFile = /some/path/to/frontier.json
# 链配置,main为以太访主网,ropsten、olympic略,testnet测试链,参考blockchain.config.class
blockchain.config.name = "testnet"
# This is a more advanced replacement for 'blockchain.config.name'
# Here the exact org.ethereum.config.BlockchainForkConfig implementation
# class name can be specified.
# Only one of two options (this and above) can be defined.
#blockchain.config.class = "org.ethereum.config.fork.MainForkConfig"
# 区块数据设置
database {
# 以太访数据文件存放文件夹路径
dir = consortium
# 每次启动将数据清楚,从其他节点下载最新数据
reset = false
# reset=true的情况,将从resetBlock重新异步更新,0表示全部更新
resetBlock = 0
# 处理不兼容的数据库的版本,Exit:显示错误,并退出;Reset:清空数据目录;IGNORE:继续并忽略可能的问题
incompatibleDatabaseBehavior = EXIT
# controls state database pruning
# pruned state consumes much less disk space (e.g. 50G full and 1G pruned)
# but the state can be restored only within last [maxDepth] blocks, all older
# states are lost
# 当磁盘不够时,启动数据库瘦身,只能恢复maxDepth区块,其他信息将丢失
prune {
#启用标志
enabled = true
# 最后多少块不被修剪,不建议设置低于192,可以防止再建分支从长分叉
maxDepth = 192
}
}
# 缓存设置
cache {
flush {
# 写入LevelDB数据的缓存大小,小于0表示禁用该选项
writeCacheSize = 64
# 每N个blocks强制刷新数据,等于0表示禁用该选项
blocks = 0
# 刷新每一个块,在一个长同步完成
shortSyncFlush = true
}
# stateDB读数据缓存单位Mbytes
stateCacheSize = 256
# 块队列缓存大小,单位MBytes
blockQueueSize = 32
# 块头部队列缓存大小,单位MBytes
headerQueueSize = 8
# Bloom过滤器最大值,单位MBytes,128M可以管理50M的数据实体
maxStateBloomSize = 128
}
# 同步进程设置
sync {
# 同步开启开关
enabled = true
# 快速同步选项
fast {
# 开关
enabled = false
# when specified the fastsync retrieves the state for this block
# this is the fast and secure option to do fastsync
# if not specified the block is selected like [peerBestBlockNumber - 1000]
// pivotBlockHash = 6149ddfd7f52b2aa34a65b15ae117c269b5ff2dc58aa839dd015790553269411
}
# 最小用于同步进程的节点数,会发现至少n个节点
peer.count = 30
# Uncomment this param
# to use a strict Eth version.
# Useful for testing
# version = 62
# 当块冲突是否退出
exitOnBlockConflict = false
}
# 挖矿选项
mine {
# 启动自动挖矿,当'sync.enabled'=true,会先将块同步完成,否则基于最新快立即开启挖矿
start = true
# 挖矿的CPU线程数
cpuMineThreads = 1
# 挖矿模式,full模式:需要更多的内存,但后续挖矿块;light:需要少内存但是挖矿慢
fullDataSet = true
# 矿工账户
coinbase = "b8c059e31bcfa20b961d3f5a021b5c44d7da57ae"
# 额外的数据被打包至Block中
extraData = "EthereumJ powered"
#extraDataHex = "0102abcd"
# 被打包交易的最低gasPrice,单位为Wei
# minGasPrice = 15000000000 # 15 Gwei
minGasPrice = 0
# 挖矿最小超时
minBlockTimeoutMsec = 0
# 开启挖矿的特别的nonce,为空的话将随机
startNonce = null
}
# Solidity选项
solc {
# solc的编译全路径,不提供将使用绑定的编译器
path = null
}
# rpc选项(自定义)
rpc {
http.enabled = true
http.ip=127.0.0.1
http.port = 8549
}
# ========================================================
# Debug and advanced options
# ========================================================
# 交易被确认的时间,超过该时间进行重试,单位秒
transaction.approve.timeout = 15
# 交易过期时间,超过多少块未被确认,交易将被删除,单位为块数
transaction.outdated.threshold = 10
dump {
# 是否dump所有信息,以及dump至的目录,信息格式为JSON
full = false
dir = dmp
# dump虚拟机的追踪信息,-1表示不追踪区块,其他[pretty/standard+] (default: standard+)
block = -1
style = pretty
# 每次启动清除dump目录
clean.on.restart = true
}
# 结构化的形式收集到的跟踪跟踪是在json对象和暴露给用户或任何其他方便的形式。
# 虚拟机结构
vm.structured {
trace = false
dir = vmtrace
# 压缩
compressed = true
# 初始内存限制
initStorageLimit = 10000
}
# 跟踪变更从选取的某个块,-1不做任何跟踪
trace.startblock = -1
# 是否开启内部交易数据记录,开启将导致数据量变大
record.internal.transactions.data = true
# invoke vm program on message received, if the vm is not invoked the balance transfer occurs anyway [true/false]
# 当消息接收并由vm执行,如果vm是否执行交易都将发送
play.vm = true
# 交互短语被设置
hello.phrase = Dev
# this property used mostly for debug purposes
# so if you don't know exactly how to apply it, leave it as [-1]
#
# ADVANCED: if we want to load a root hash for db not from the saved block chain (last block)
# but any manual hash this property will help.values [-1] - load from db
# [hex hash 32 bytes] root hash
root.hash.start = null
# 数据库信息: [leveldb/inmem]
keyvalue.datasource = leveldb
record.blocks=false
blockchain.only=false
# 从rlp文件中加载块信息,而不是从网络中加载,配置文件路径
blocks.loader=""
#加密设置
crypto {
#JCA cryptoprovider name.
providerName="SC"
#Used for create JCA MessageDigest
hash.alg256="ETH-KECCAK-256"
hash.alg512="ETH-KECCAK-512"
}
免费领取验证码、内容安全、短信发送、直播点播体验包及云服务器等套餐
更多网易技术、产品、运营经验分享请点击。