fisco-bcos / python-sdk Goto Github PK
View Code? Open in Web Editor NEWpython sdk for FISCO BCOS
License: MIT License
python sdk for FISCO BCOS
License: MIT License
**命令行:python ./console3.py deploy HelloWorld
情况1: 已经安装solc编译器并且在remix上将sol转为了abi和bin文件:
但仍然报以下下错误:**
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start------------->
user input: ['HelloWorld']
backup [./contracts/HelloWorld.abi] to [./contracts/backup/HelloWorld.abi.20230325094945]
backup [./contracts/HelloWorld.bin] to [./contracts/backup/HelloWorld.bin.20230325094953]
INFO >> compile with nodejs compiler
/usr/bin/env: ‘node’: No such file or directory
ERROR >> execute deploy failed
ERROR >> error information: compile error for compile failed, error information: Command '['./solcjs', '--bin', '--abi', './contracts/HelloWorld.sol', '-o', 'contracts']' returned non-zero exit status 127.
**情况2: 后尝试安装nodejs
报错如下:**
INFO >> user input : ['deploy', 'HelloWorld']
BCOS3 Deploy start------------->
user input: ['HelloWorld']
backup [./contracts/HelloWorld.abi] to [./contracts/backup/HelloWorld.abi.20230325094945]
backup [./contracts/HelloWorld.bin] to [./contracts/backup/HelloWorld.bin.20230325094953]
INFO >> compile with nodejs compiler
/opt/distributed_architecture_/Blockchain+Flask/python-sdk/solcjs:93
let readCallback = (importContractName) => {
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Function.Module.runMain (module.js:442:10)
at startup (node.js:136:18)
at node.js:966:3
ERROR >> execute deploy failed
ERROR >> error information: compile error for compile failed, error information: Command '['./solcjs', '--bin', '--abi', './contracts/HelloWorld.sol', '-o', 'contracts']' returned non-zero exit status 1.
情况3:后尝试升级node:
报错如下:
BCOS3 Deploy start------------->
user input: ['HelloWorld']
backup [./contracts/HelloWorld.abi] to [./contracts/backup/HelloWorld.abi.20230325094945]
backup [./contracts/HelloWorld.bin] to [./contracts/backup/HelloWorld.bin.20230325094953]
INFO >> compile with nodejs compiler
node: /lib/x86_64-linux-gnu/libm.so.6: version GLIBC_2.27' not found (required by node) node: /lib/x86_64-linux-gnu/libc.so.6: version
GLIBC_2.25' not found (required by node)
node: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by node)
ERROR >> execute deploy failed
ERROR >> error information: compile error for compile failed, error information: Command '['./solcjs', '--bin', '--abi', './contracts/HelloWorld.sol', '-o', 'contracts']' returned non-zero exit status 1.
使用crud_service
创建table
需要设置key
,但是
entry
时并不检查key是否重复CRUDService.select()
方法时,condition
内必须含有对key
的限制CRUDService.desc()
方法时,会报错Must set condition for the primary key
cytoolz/dicttoolz.c:17:20: fatal error: Python.h: No such file or directory
#include "Python.h"
需要 yum install python3-devel.x86_64解决问题
getTotalTransactionCount, getPendingTxSize和getPbftView接口返回的信息十六进制,用户体验不友好,建议优化为十进制。
# getTotalTransactionCount原本输出:
INFO >> getTotalTransactionCount
>> {
"blockNumber": "0x10",
"failedTxSum": "0x0",
"txSum": "0x10"
}
# 建议优化为:
INFO >> getTotalTransactionCount
>> {
"blockNumber": "16",
"failedTxSum": "0",
"txSum": "16"
}
# getPendingTxSize原本输出
INFO >> getPendingTxSize
>> 0x16
# 建议优化为:
INFO >> getPendingTxSize
>> 22
# getPbftView原本输出
INFO >> getPbftView
>> 0x11
# 建议优化为:
INFO >> getPbftView
>> 17
我根据TableTest.sol写了一个合约,只是把TableTest里的int256类型也换成了string类型,然后使用python SDK去进行合约调用,表现出以下行为:
python 调用部分
script_path = "../console/demo.exp"
ContractAddr = "0xd5d0b10598272471824256b5a336d76dae29d278"
abi_file = "../console/contracts/.compiled/1/TableDemo/"+ ContractAddr+"/TableDemo.abi"
data_parser = DatatypeParser()
data_parser.load_abi_file(abi_file)
contract_abi = data_parser.contract_abi
try:
client = BcosClient()
print(client.getinfo())
# 尝试进行TableDemo合约的调用
# 表名、主key、值域
print("\n>>Call:------------------------------------------------------------------------")
res = client.call(ContractAddr, contract_abi, "insert",["TEST","TEST2"])
client.finish()
except:
pass
合约:
pragma solidity>=0.4.24 <0.6.11;
pragma experimental ABIEncoderV2;
import "./Table.sol";
contract TableDemo {
event CreateResult(int256 count);
event InsertResult(int256 count);
event UpdateResult(int256 count);
event RemoveResult(int256 count);
TableFactory tableFactory;
string constant TABLE_NAME = "test04";
constructor() public {
tableFactory = TableFactory(0x1001); //The fixed address is 0x1001 for TableFactory
// the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..."
tableFactory.createTable(TABLE_NAME, "mmsg", "mtype,mcontent");
}
//select records
function selectAll()
public
view
returns (string[] memory, string[] memory)
{
Table table = tableFactory.openTable(TABLE_NAME);
Condition condition = table.newCondition();
Entries entries = table.select("records", condition);
// string[] memory mmsg_list = new string[](
// uint256(entries.size())
// );
string[] memory mtype_list = new string[](uint256(entries.size()));
string[] memory mcontent_list = new string[](
uint256(entries.size())
);
for (int256 i = 0; i < entries.size(); ++i) {
Entry entry = entries.get(i);
// mmsg_list[uint256(i)] = entry.getString("mmsg");
mtype_list[uint256(i)] = entry.getString("mtype");
mcontent_list[uint256(i)] = entry.getString("mcontent");
}
return (mtype_list, mcontent_list);
}
function selectByType(string memory mtype)
public
view
returns (string[] memory, string[] memory)
{
Table table = tableFactory.openTable(TABLE_NAME);
Condition condition = table.newCondition();
condition.EQ("mtype", mtype);
Entries entries = table.select("records", condition);
// string[] memory mmsg_list = new string[](
// uint256(entries.size())
// );
string[] memory mtype_list = new string[](uint256(entries.size()));
string[] memory mcontent_list = new string[](
uint256(entries.size())
);
for (int256 i = 0; i < entries.size(); ++i) {
Entry entry = entries.get(i);
// mmsg_list[uint256(i)] = entry.getString("mmsg");
mtype_list[uint256(i)] = entry.getString("mtype");
mcontent_list[uint256(i)] = entry.getString("mcontent");
}
return (mtype_list, mcontent_list);
}
//insert records
function insert(string memory mtype, string memory mcontent)
public
returns (int256, string memory, string memory)
{
Table table = tableFactory.openTable(TABLE_NAME);
Entry entry = table.newEntry();
entry.set("mmsg", "records");
entry.set("mtype", mtype);
entry.set("mcontent", mcontent);
int256 count = table.insert("records", entry);
emit InsertResult(count);
return (count,mtype,mcontent);
}
//update records
function update(string memory mmsg, string memory mtype, string memory mcontent)
public
returns (int256)
{
Table table = tableFactory.openTable(TABLE_NAME);
Entry entry = table.newEntry();
entry.set("mcontent", mcontent);
Condition condition = table.newCondition();
condition.EQ("mmsg", mmsg);
condition.EQ("mtype", mtype);
int256 count = table.update(mmsg, entry, condition);
emit UpdateResult(count);
return count;
}
//remove records
function remove(string memory mmsg, string memory mtype) public returns (int256) {
Table table = tableFactory.openTable(TABLE_NAME);
Condition condition = table.newCondition();
condition.EQ("mmsg", mmsg);
condition.EQ("mtype", mtype);
int256 count = table.remove(mmsg, condition);
emit RemoveResult(count);
return count;
}
}
parsimonious库和SDK里的parsimonious有冲突。在SDK目录外调用时,结果解析会报错。
向游离状态的节点发起请求,展示返回信息包含反斜杠包含""不友好,需要优化:
例:
# 获取直连节点Node ID(搭链操作参考FISCO-BCOS文档:https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/installation.html)
$ cat ~/fisco/nodes/127.0.0.1/node0/conf/node.nodeid
2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c
# 调用removeNode进行退网操作
$ ./console.py removeNode 2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c
$ ./console.py getSealerList
# 输出信息如下:error_infomation中含有反斜杠
INFO >> user input : ['getSealerList']
ERROR >> execute getSealerList failed
ERROR >> error information: init bcosclient failed, reason: (-1, None, 'getBlockNumber failed, params: [1], response: {\'result\': {\'error\': {\'code\': -40009, \'data\': None, \'message\': "Don\'t send request to this node who doesn\'t belong to the group"}, \'id\': 0, \'jsonrpc\': \'2.0\'}}, error information: (-40009, None, "Don\'t send request to this node who doesn\'t belong to the group")')
建议处理以上json信息中的反斜杠
发现带校验的amop,官方文档中只给了web3sdk的样例,请问python是否支持?
例:
调用HelloWorld合约,返回的解析信息 ('Hello, World!',)
包含多余的括号和逗号,建议去掉:
$ ./console.py deploy HelloWorld
获取到输出的合约地址是0x84139e0d46160aa2dd2541f499049095596891c9
get
接口:$ ./console.py call HelloWorld 0x84139e0d46160aa2dd2541f499049095596891c9 get
# 输出如下:call result结果中,包含多余的括号和逗号,需要将元组转换成字符串输出
INFO >> user input : ['call', 'HelloWorld', '0x84139e0d46160aa2dd2541f499049095596891c9', 'get']
INFO >> call HelloWorld , address: 0x84139e0d46160aa2dd2541f499049095596891c9, func: get, args:[]
INFO >> call result: ('Hello, World!',)
建议将call result
后直接输出的元组转换为字符串输出。
我是bicos3版本,成功部署了contracts文件夹下的KVTableTest合约,但是调用sendRawTransaction失败。
代码如下:
receipt = client.sendRawTransaction(
to_address,
contract_abi,
"set",
['aa', 11, 'haha']
)
返回的recipt如下:
{
'blockNumber':14
'checksumContractAddress':''
'contractAddress':''
'extraData':''
'from':'0x2b21ed440abb9a6b493d75c0e5260a9e0609e2d6'
'gasUsed':'11300'
'hash':'0x'
'input':'0xed0c8b170000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000b00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000002616100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000046861686100000000000000000000000000000000000000000000000000000000'
'logEntries':[]
'message':''
'output':'0x'
'status':16
'to':'0x2b5dcbae97f9d9178e8b051b08c9fb4089bae71b'
'transactionHash':'0x1e6c6a6b4491cd987508a5eb0e2e54feca18a080eb079003ae05f6f615c0393e'
'version':0
}
请问是哪里有问题,急
下载安装之前的Python SDK(不是新推出的 Dev220209 版本),用python sdk自带控制台操作,
$ python3 ./console.py call HelloWorld 0x83592a3cf1af302612756b8687c8dc7935c0ad1d get
INFO >> user input : ['call', 'HelloWorld', '0x83592a3cf1af302612756b8687c8dc7935c0ad1d', 'get']
contract_abi_path contracts/HelloWorld.abi, contract_bin_path contracts/HelloWorld.bin
INFO>> client info: channel 127.0.0.1:20202,groupid :1,crypto type:ECDSA,ssl type:ECDSA
INFO >> call HelloWorld , address: 0x83592a3cf1af302612756b8687c8dc7935c0ad1d, func: get, args:[]
0x0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d48656c6c6f2c20576f726c642100000000000000000000000000000000000000
[Exception] (when decoding the output in response):
TypeError: isinstance() arg 2 must be a type or tuple of types
以上例外输出本人新增于 bcosclient.py 中BcosClient类的方法 call(...)中
错误发生于下面语句:
decoderesult = decode_abi(fn_output_types,decode_hex(outputdata))
即 decode_abi() 调用出错,没能正常解析出返回的结果,只是解析出了返回结果的几个 keys,而没有正确解析出 Values。
INFO >> user input : ['sendtx', 'HelloWorld', 'last', 'set', 'some string.']
contract_abi_path contracts/HelloWorld.abi, contract_bin_path contracts/HelloWorld.bin
INFO>> client info: channel 127.0.0.1:20202,groupid :1,crypto type:ECDSA,ssl type:ECDSA
INFO >> sendtx HelloWorld , address: 0x83592a3cf1af302612756b8687c8dc7935c0ad1d, func: set, args:['some string.']
ERROR >> execute sendtx failed
ERROR >> error information: TypeError: isinstance() arg 2 must be a type or tuple of types
Parse tree:
<Node matching ""> <-- *** We were here. ***
希望SDK连接节点支持基于域名的TLS访问,我们就可以通过nginx的SNI转发访问,收拢所有节点的访问ip和端口
client.bcoserror.BcosException: START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
bcos3 rpc init error START SDK error res:-1,[b'Throw location unknown (consider using BOOST_THROW_EXCEPTION)\nDynamic exception type: boost::wrapexceptboost::system::system_error\nstd::exception::what: use_private_key: no start line\n']
INFO >> compile with nodejs compiler
(node:27566) V8: /Users/zhengjingyi/python-sdk/node_modules/solc/soljson.js:3 Invalid asm.js: Invalid member of stdlib
(Use node --trace-warnings ...
to show where the warning was created)
Deploy bin file: ./contracts/HelloWorld.bin
deploy exception! [Errno 2] No such file or directory: './contracts/HelloWorld.abi'
Traceback (most recent call last):
File "/Users/zhengjingyi/python-sdk/console_utils/cmd_bcos3_transaction.py", line 93, in deploy
abiparser = DatatypeParser(contract_abi_file)
File "/Users/zhengjingyi/python-sdk/client/datatype_parser.py", line 45, in init
self.load_abi_file(abi_file)
File "/Users/zhengjingyi/python-sdk/client/datatype_parser.py", line 56, in load_abi_file
with open(abi_file, 'r') as load_f:
FileNotFoundError: [Errno 2] No such file or directory: './contracts/HelloWorld.abi'
solc和nodejs都安装了
智能合约里面有一个emit方法,作用是抛出一个事件,但是在文档和demo中,我都只看到可以从调用合约的返回值里获取log从而看到事件,找不到如何监听这个event的方法。所以这个有没有提供监听的途径呢?或者说我有没有办法通过一个for循环来轮询获得这个log呢?
Environment:
OS: Ubuntu 20.04
Python: 3.8.10
Node : 2.9 GM version
(venv3) root@SD-20210414ZMQA:~/bcos/python-sdk# python console2.py getBlockNumber
INFO >> user input : ['getBlockNumber']
INFO >> BcosClient: rpc:RPC connection http://118.195.226.179:8545
,groupid :1,crypto type:GM,ssl type:GM
1
ERROR >> execute getBlockNumber failed
ERROR >> error information: (-1, None, "getBlockNumber failed, params: [1], response: null, error information: 'Response' object has no attribute 'cb_context'")
(venv3) root@SD-20210414ZMQA:~/bcos/python-sdk#
但是跑console2.py没有问题。
感觉是solc的问题。
以下是报错信息。
python3 demo_get.py
INFO >> compile with solc compiler : ./bin/solc/v0.4.25/solc --bin --abi contracts/HelloWorld.sol -o contracts --overwrite
Traceback (most recent call last):
File "/opt/fl-bc/pysdk/client/common/compiler.py", line 99, in compile_file
Compiler.compile_with_solc(sol_file, contract_name, output_path)
File "/opt/fl-bc/pysdk/client/common/compiler.py", line 79, in compile_with_solc
common.execute_cmd(command)
File "/opt/fl-bc/pysdk/client/common/common.py", line 113, in execute_cmd
data = subprocess.check_output(cmd.split(), shell=False, universal_newlines=True)
File "/opt/anaconda3/envs/flbc_3.7.3/lib/python3.7/subprocess.py", line 395, in check_output
**kwargs).stdout
File "/opt/anaconda3/envs/flbc_3.7.3/lib/python3.7/subprocess.py", line 487, in run
output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['./bin/solc/v0.4.25/solc', '--bin', '--abi', 'contracts/HelloWorld.sol', '-o', 'contracts', '--overwrite']' died with <Signals.SIGSEGV: 11>.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "demo_get.py", line 27, in
Compiler.compile_file("contracts/HelloWorld.sol")
File "/opt/fl-bc/pysdk/client/common/compiler.py", line 112, in compile_file
raise CompileError("compile error for compile failed, error information: {}".format(e))
client.bcoserror.CompileError: compile error for compile failed, error information: Command '['./bin/solc/v0.4.25/solc', '--bin', '--abi', 'contracts/HelloWorld.sol', '-o', 'contracts', '--overwrite']' died with <Signals.SIGSEGV: 11>.
Python SDK工具,调用HelloWorld合约,返回的信息中包含一个逗号,建议优化
请问call函数返回值是不是有长度要求,我在预编译合约中返回了很长的字符串,用call调用合约时报预编译错误(precomiled error),但是我将我返回的字符串减半后正常运行,不报错;请问这个限制怎么改
部署Python SDK过程中执行./console.py getNodeVersion报错,怎么解决啊?安装Python SDK依赖过程中没有报错,到这里不行了
(python-sdk) wpg@ubuntu:~/python-sdk$ python3 ./console.py getNodeVersion
Traceback (most recent call last):
File "./console.py", line 19, in
from console_utils.cmd_account import CmdAccount
File "/home/wpg/python-sdk/console_utils/cmd_account.py", line 21, in
from client.common import common
File "/home/wpg/python-sdk/client/common/common.py", line 20, in
from client.datatype_parser import DatatypeParser
File "/home/wpg/python-sdk/client/datatype_parser.py", line 17, in
from eth_abi import decode_single, decode_abi
File "/home/wpg/python-sdk/eth_abi/init.py", line 3, in
from eth_abi.abi import ( # NOQA
File "/home/wpg/python-sdk/eth_abi/abi.py", line 1, in
from eth_abi.codec import (
File "/home/wpg/python-sdk/eth_abi/codec.py", line 11, in
from eth_utils import (
File "/home/wpg/python-sdk/eth_utils/init.py", line 24, in
from .applicators import ( # noqa: F401
File "/home/wpg/python-sdk/eth_utils/applicators.py", line 29, in
def combine_argument_formatters(*formatters: List[Callable[..., Any]]) -> Formatters:
File "/usr/lib/python3.5/typing.py", line 1025, in getitem
tvars = _type_vars(params)
File "/usr/lib/python3.5/typing.py", line 284, in _type_vars
_get_type_vars(types, tvars)
File "/usr/lib/python3.5/typing.py", line 279, in _get_type_vars
t._get_type_vars(tvars)
File "/usr/lib/python3.5/typing.py", line 786, in _get_type_vars
_get_type_vars(self.args, tvars)
File "/usr/lib/python3.5/typing.py", line 277, in _get_type_vars
for t in types:
TypeError: 'ellipsis' object is not iterable
在使用过程会出现如下错误,可以怎么解决
non-resource variables are not supported in the long term
INFO >> compile with nodejs compiler
internal/modules/cjs/loader.js:965
throw err;
^
Error: Cannot find module 'fs-extra'
Require stack:
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "main.py", line 73, in
Compiler.compile_file("contracts/CommitteePrecompiled.sol")
File "/home/dyson/Dyson/FISCO_BFLC/python-sdk/client/common/compiler.py", line 112, in compile_file
raise CompileError("compile error for compile failed, error information: {}".format(e))
client.bcoserror.CompileError: compile error for compile failed, error information: Command '['./solcjs', '--bin', '--abi', 'contracts/CommitteePrecompiled.sol', '-o', 'contracts']' returned non-zero exit status 1.
到现在新推出的 python sdk (2022年9月),还只是支持 solc-0.4.25 (当然我不清楚这个版本是如何对应的),下面一些常用的函数或表达式都不能支持。
string.concat(...)
type(uint).min, type(uint).max
Hello,
When restart fisco bcos nodes, the tranaction will appear timeout by sending the python sdk. What's problem?
Thank you!
不支持True和False写法,只能在abi文件手动改成ture 和false才可以生成模版。
demo_transaction里有这样一个示例:
receipt = client.sendRawTransactionGetReceipt(to_address, contract_abi, "set", args)
receipt里可以看到from地址的信息,但之前并没有指定过from地址,如果要显式指定from地址该如何操作?
如题.
谢谢.
还想请问.
python sdk之后会继续开发吗, 我们在做技术选型. 希望能找一个稳定的框架.
谢谢~
The smart contract has a function
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
I expect the SDK to return an error "caller is not the owner" if user != owner, but If there was an error in the smart contract, it is not returned.
abi_parser.parse_output(fn_name, output) function returns empty result.
status in transaction = 16 - RevertInstruction.
How can I read an error from a smart contract?
搭链操作参考:
https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/installation.html
节点入网、退网相关操作参考:
https://fisco-bcos-documentation.readthedocs.io/zh_CN/latest/docs/manual/node_management.html
例:
# 以将node0加入观察者节点为例:
# 获取node0的NodeID
$ cat ~/fisco/nodes/127.0.0.1/node0/conf/node.nodeid
2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c
# 将node0加入为观察者节点
$ ./console.py addObserver 2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c
# 输出信息如下:
INFO >> user input : ['addObserver', '2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c']
INFO >> compile with solc compiler
INFO >> addObserver
>> status: 0x0
>> transactionHash: 0x3d416bdabdb2e9032c019b73c1eefc71f2edf75c7c5eaca7cd1134de688901e2
>> gasUsed: 0x7658
>> addObserver succ, output: 1
# 将node0加入为观察者节点
$ ./console.py addObserver 2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c
# 输出信息如下:
INFO >> user input : ['addObserver', '2f0a2cfb4b2e5f63fda88c2bdb9edd8f8dd2a408c04c1d4fda8a75ad1047baf87c2b18f4dbf20d67db84019b221bf50b683eeebade7e5eaffefef876e5db9a8c']
INFO >> compile with solc compiler
INFO >> addObserver
>> status: 0x0
>> transactionHash: 0x39fdc047e31ebc1c6d1b33a0a6bc2c825810fa12e2354b8655287cbd2d2afb28
>> gasUsed: 0x7658
>> addObserver succ, output: 1
需要在Python SDK中,对addObserver
操作做防重:
getObserverList
接口获取当前观察节点列表the node is already in the observer list
执行RPC Query Cmds相关命令正常,但执行CONSENSUS cmd就会报错,示例命令: python3 console3.py addSealer 27582c8*** ,报错文件如下:
cpp_sdk_log_2023031416.09.log
ubuntu20.04 Python 3.8.3 fisco 2.9
File "./console2.py", line 10
SyntaxError: Non-ASCII character '\xef' in file ./console2.py on line 11, but no encoding declared; see http://python.org/dev/peps/pep-0263/ for details
但是我看文件头已经加了# -- coding: utf-8 --
不知道为什么报错?
TransactionCommon.format_args_by_abi 这个方法参数序列化不支持数组和动态类型
(-1, None, 'sendRawTransaction failed, params: [1, '0xf90235842f0627438401c9c3808401c9c380821983949181e725a6c78f47722ed26b1bb76b5acf66e26980b901c45d28560a000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000c0000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000294144535f53545544454e545f55475f4558414d524553554c54535f31375f7465737458585858626363000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000164f5f53545544454e545f45525f53545544454e5449440000000000000000000000000000000000000000000000000000000000000000000000000000000000a04f5f53545544454e545f45525f434f5552534549442c4f5f53545544454e545f45525f5343484f4f4c594541522c4f5f53545544454e545f45525f5343484f4f4c5445524d2c4f5f53545544454e545f45525f434f555253454e414d452c4f5f53545544454e545f45525f434f5552534554595045434f44452c4f5f53545544454e545f45525f4352454449542c4f5f53545544454e545f45525f53434f52450101801ba04c621a0d5eedcc2f43694925ad165e64d6a5efa7a044d9bcdcebe428335ac37fa06d0e21e9c4385bcd72099f575cbe3beac83273af4745d180d0548dae1957dd93'], response: {"result": {"error": {"code": -32603, "data": null, "message": "INTERNAL_ERROR: : INTERNAL_ERROR: : /FISCO-BCOS/libtxpool/TxPool.cpp(191): Throw in function virtual std::pair<h256, Address> dev::txpool::TxPool::submitTransactions(dev::eth::Transaction::Ptr)\nDynamic exception type: boost::exception_detail::clone_impldev::eth::TransactionRefused\nstd::exception::what: std::exception\n[dev::tag_comment*] = BlockLimitCheckFailed, txBlockLimit=6531, txHash=c499052a...\n"}, "id": 3529, "jsonrpc": "2.0"}}, error information: (-32603, None, 'INTERNAL_ERROR: : INTERNAL_ERROR: : /FISCO-BCOS/libtxpool/TxPool.cpp(191): Throw in function virtual std::pair<h256, Address> dev::txpool::TxPool::submitTransactions(dev::eth::Transaction::Ptr)\nDynamic exception type: boost::exception_detail::clone_impldev::eth::TransactionRefused\nstd::exception::what: std::exception\n[dev::tag_comment*] = BlockLimitCheckFailed, txBlockLimit=6531, txHash=c499052a...\n')')
client/local_lib_helper.py第38行
应该是aarch64,没有arch这个版本
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.