python - SyntaxError:在区块链上扫描字符串文字错误时 EOL
问题描述
我对准备好的区块链网络进行了更改。我正在使用以下代码启动系统
python3 full_node.py --port=8001 --node=127.0.0.1:8000 --mine=1
,但是每当我输入此代码时,每次打开和关闭终端时钱包地址都会更改。除了代码之外,我还添加了一个名为 wall 的地方。代码是这样的。
import argparse
parser = argparse.ArgumentParser(description='Blockchain full node.')
parser.add_argument('--node', type=str, help='Address of node to connect. If not will init fist node.')
parser.add_argument('--port', required=True, type=int, help='Port on which run the node.')
parser.add_argument('--mine', required=False, type=bool, help='Port on which run the node.')
parser.add_argument('--diff', required=False, type=int, help='Difficulty')
parser.add_argument('--wall', required=False, type=str, help='wallet address')
args = parser.parse_args()
_DB = DB()
_DB.config['difficulty']
_W = Wallet.create()
_BC = Blockchain(_DB, _W)
_API = API(_BC)
logger.info(' ####### Server Address: %s ########' %_W.address)
app.config['db'] = _DB
app.config['wallet'] = args.wall
app.config['bc'] = _BC
app.config['api'] = _API
app.config['port'] = args.port
app.config['host'] = '127.0.0.1'
app.config['nodes'] = set([args.node]) if args.node else set(['127.0.0.1:%s' % args.port])
app.config['sync_running'] = False
app.config['mine'] = args.mine
在我更改代码之前是这样的
import argparse
parser = argparse.ArgumentParser(description='Blockchain full node.')
parser.add_argument('--node', type=str, help='Address of node to connect. If not will init fist node.')
parser.add_argument('--port', required=True, type=int, help='Port on which run the node.')
parser.add_argument('--mine', required=False, type=bool, help='Port on which run the node.')
parser.add_argument('--diff', required=False, type=int, help='Difficulty')
args = parser.parse_args()
_DB = DB()
_DB.config['difficulty']
_W = Wallet.create()
_BC = Blockchain(_DB, _W)
_API = API(_BC)
logger.info(' ####### Sunucu Adresi: %s ########' %_W.address)
app.config['db'] = _DB
app.config['wallet'] = _W
app.config['bc'] = _BC
app.config['api'] = _API
app.config['port'] = args.port
app.config['host'] = '127.0.0.1'
app.config['nodes'] = set([args.node]) if args.node else set(['127.0.0.1:%s' % args.port])
app.config['sync_running'] = False
app.config['mine'] = args.mine
我希望能够在我想要的代码中放置一个钱包地址。每次启动终端时都只使用 1 个钱包。错误出现在上面的代码中或此处。
@classmethod
def create(cls):
inst = cls(b'',b'')
_pub, _priv = rsa.newkeys(512)
inst._pub = Address(_pub)
inst._priv = _priv
return inst
感谢所有提前帮助的人。
解决方案
推荐阅读
- java - 如何在不使用@JsonCreator的情况下将请求参数中的整数转换为枚举类型字段的枚举?
- http - 本地网站 Flutter Dart 的身份验证错误
- node.js - 如何使用nodejs将xdevapi中的默认端口33060更改为mysql的3306?
- python - 使用 SWIG 和 Visual Studio 2017 在 python 中导入 C++ DLL
- python-3.x - 即使在 element_to_be_clickable 之后单击也不起作用
- c# - 删除操作不适用于实体框架中没有依赖关系的实体
- unity3d - 着色器在编辑器中工作,但在构建中是白色的
- java - 基于Java中的嵌套值对对象列表进行排序
- websocket - @nestjs/websockets with Guards 因 host.setType 而失败
- c# - 将变量传递给 Microsoft BotBuilder C# .NET Core 中的对话框