Win10+IDEA ChainMaker V2.2.0 SOLO节点启动报错空指针异常
【问题分类】
- bug
- P2P网络相关(包含libp2p,liquid)
- 链账户身份与权限相关(证书问题、public、多签投票问题)
- 核心交易引擎相关(交易池、DAG)
- 共识相关
- 智能合约相关
- 存储相关
- SDK相关
- 长安链CMC工具
- 长安链管理台
- 长安链浏览器
- 长安链合约IDE
- 长安链web签名插件
- 跨链相关
- 轻节点相关
- 隐私计算相关
- 密码学相关
- 其他补充:运行错误
【问题描述】
Win10+IDEA2022.1 ChainMaker V2.2.0 SOLO节点启动报错空指针异常,因初次学习该项目,估计应该是我某项配置错误,故在其他补充项反馈该问题。
下载ChainMaker代码,按照官方文档使用IDEA启动,选择配置文件 ./config/wx-org1-solo 启动调试
/chainmaker-go-master/module/blockchain/blockchain_init.go:582 空指针异常
配置文件如下:
chainmaker.yml
#
# Copyright (C) BABEC. All rights reserved.
# Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
auth_type: "permissionedWithCert" # permissionedWithCert / permissionedWithKey / public
log:
config_file: ../config/wx-org1-solo/log.yml # config file of logger configuration.
crypto_engine: tjfoc #crypto engine config setting, support gmssl, tencentsm and tjfoc
blockchain:
- chainId: chain1
genesis: ../config/wx-org1-solo/chainconfig/bc1.yml
node:
type: full
org_id: wx-org1.chainmaker.org
priv_key_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.sign.key
cert_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.sign.crt
cert_cache_size: 1000
net:
provider: LibP2P
listen_addr: /ip4/0.0.0.0/tcp/11351
seeds:
- "/ip4/127.0.0.1/tcp/11301/p2p/QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC4"
tls:
enabled: true
priv_key_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.tls.key
cert_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.tls.crt
txpool:
max_txpool_size: 51200 # 普通交易池上限
max_config_txpool_size: 10 # config交易池的上限
full_notify_again_time: 30 # 交易池溢出后,再次通知的时间间隔(秒)
rpc:
provider: grpc
port: 12301
tls:
# TLS模式:
# disable - 不启用TLS
# oneway - 单向认证
# twoway - 双向认证
#mode: disable
#mode: oneway
mode: twoway
priv_key_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.tls.key
cert_file: ../config/wx-org1-solo/certs/node/consensus1/consensus1.tls.crt
monitor:
enabled: false
port: 14321
pprof:
enabled: false
port: 24321
storage:
# rebuild_block_height: 5
store_path: ../data/org1/ledgerData1
encryptor: sm4 # sm4/aes
encrypt_key: "1234567890123456" #16 bytes key
disable_block_file_db: false
blockdb_config:
provider: leveldb
leveldb_config:
store_path: ../data/org1/blocks
statedb_config:
provider: leveldb
leveldb_config:
store_path: ../data/org1/statedb
historydb_config:
provider: leveldb
leveldb_config:
store_path: ../data/org1/history
resultdb_config:
provider: leveldb
leveldb_config:
store_path: ../data/org1/result
disable_contract_eventdb: true #是否禁止合约事件存储功能,默认为true,如果设置为false,需要配置mysql
contract_eventdb_config:
provider: sql #如果开启contract event db 功能,需要指定provider为sql
sqldb_config:
sqldb_type: mysql #contract event db 只支持mysql
dsn: root:password@tcp(127.0.0.1:3306)/ #mysql的连接信息,包括用户名、密码、ip、port等,示例:root:admin@tcp(127.0.0.1:3306)/
debug:
# 是否开启CLI功能,过度期间使用
is_cli_open: true
is_http_open: false
vm:
enable_dockervm: false
dockervm_container_name: chainmaker-vm-docker-go-container
dockervm_mount_path: ../data/org1/docker-go # mount point in chain maker
dockervm_log_path: ../log/org1/dockervm
log_in_console: true
log_level: INFO
uds_open: true # default is unix domain socket connection
user_num: 100
time_limit: 2
max_concurrency: 50
max_send_msg_size: 10
max_recv_msg_size: 10
bc1.yml配置文件如下
#
# Copyright (C) BABEC. All rights reserved.
# Copyright (C) THL A29 Limited, a Tencent company. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0
#
chain_id: chain1 # 链标识
version: v2.2.0 # 链版本
sequence: 0 # 配置版本
auth_type: "permissionedWithCert" # 认证类型
crypto:
hash: SHA256
# 合约支持类型的配置
contract:
enable_sql_support: false
# 虚拟机配置
vm:
addr_type: 0 #0:chainmaker, 1:zxl, 2:ethereum(预留值,当前尚未支持)
# 虚拟机支持列表
support_list:
- "wasmer"
- "gasm"
- "evm"
- "dockergo"
# 交易、区块相关配置
block:
tx_timestamp_verify: true # 是否需要开启交易时间戳校验
tx_timeout: 600 # 交易时间戳的过期时间(秒)
block_tx_capacity: 100 # 区块中最大交易数
block_size: 10 # 区块最大限制,单位MB
block_interval: 200 # 出块间隔,单位:ms
# core模块
core:
tx_scheduler_timeout: 10 # [0, 60] 交易调度器从交易池拿到交易后, 进行调度的时间
tx_scheduler_validate_timeout: 10 # [0, 60] 交易调度器从区块中拿到交易后, 进行验证的超时时间
enable_sender_group: false # 用于高效处理交易发送者冲突的情况(如发送者扣除gas)
enable_conflicts_bit_window: true # 用于在运行时根据冲突率动态调整协程池大小
consensus_turbo_config:
consensus_message_turbo: true # 是否开启共识报文压缩
retry_time: 500 # 根据交易ID列表从交易池获取交易的重试次数
retry_interval: 20 # 重试间隔,单位:ms
# gas account config
account_config:
enable_gas: false
gas_count: 0
gas_admin_address: ""
default_gas: 1234567
#共识配置
consensus:
# 共识类型(0-SOLO,1-TBFT,2-MBFT,3-MAXBFT,4-RAFT,10-POW)
type: 0
# 共识节点列表,组织必须出现在trust_roots的org_id中,每个组织可配置多个共识节点,节点地址采用libp2p格式
nodes:
- org_id: "wx-org1.chainmaker.org"
node_id:
- "QmcQHCuAXaFkbcsPUj7e37hXXfZ9DdN7bozseo5oX4qiC4"
ext_config: # 扩展字段,记录难度、奖励等其他类共识算法配置
- key: aa
value: chain01_ext11
# 信任组织和根证书
trust_roots:
- org_id: "wx-org1.chainmaker.org"
root:
- "../config/wx-org1-solo/certs/ca/wx-org1.chainmaker.org/ca.crt"
# 权限配置(只能整体添加、修改、删除)
resource_policies:
- resource_name: CHAIN_CONFIG-NODE_ID_UPDATE
policy:
rule: SELF # 规则(ANY,MAJORITY...,全部大写,自动转大写)
org_list: # 组织名称(组织名称,区分大小写)
role_list: # 角色名称(role,自动转大写)
- admin
- resource_name: CHAIN_CONFIG-TRUST_ROOT_ADD
policy:
rule: MAJORITY
org_list:
role_list:
- admin
- resource_name: CHAIN_CONFIG-CERTS_FREEZE
policy:
rule: ANY
org_list:
role_list:
- admin
disabled_native_contract:
# - CONTRACT_NAME # 通过指定系统合约名字来禁用系统合约
【相关日志文件】
【系统信息】(请填写系统信息,方便定位问题)
- chainmaker-go version * : [v2.2.0]
- OS & version Windows 10专业版 * : 21H1
- IDE IDEA:2022.1
- SDK GO:1.15
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information