用于基于komodo的资产链的rpc api库,用于python dapp开发人员
komodorpc的Python项目详细描述
komodo rpc api库
面向基于komodo的资产链的rpc api库,面向python开发人员。
一、二、二、三、三、三、四、四、四、四、四、四、四、四、四、四、四、四、四、四、四、四、六、六、六、六、六
描述:
komodo rpc库帮助您将python应用程序与komodo资产链集成,而无需设置/实现所需的rpc功能。安装这个python库并调用komodo api rpcs,这和调用本地函数一样简单。komodo rpc库充当python应用程序和服务器上运行的komodo守护进程之间的包装器。
安装:
安装“komodorpc”python模块:
pip install komodorpc
用法:
>>> from komodo_rpc import KomodoRPC >>> import komodo.wallet as wallet >>> komodo_rpc = KomodoRPC(node_addr='127.0.0.1', rpc_port=98102, req_method='POST', rpc_username='user71631186', ... rpc_password='pass725b1d10ae0c2217a8ffbgh30e5ca13367afvdl937bf1cbq11bd16f8a1e36d30') >>> result = wallet.getwalletinfo() >>> result '{"result":{"walletversion":60000,"balance":2000000.16063408,"unconfirmed_balance":0.00000000,"immature_balance":0.00000000,"txcount":15,"keypoololdest":1561025064,"keypoolsize":101,"paytxfee":0.00000000,"seedfp":"7bd4d97c90d68f5921fee04e63168bd956d63346bf011c80d46e75b134385c"},"error":null,"id":"curltest"}\n' >>>
使用以下参数创建一个komodorpc类的对象,以填充rpc选项和身份验证参数。
Argument | Description |
---|---|
node_addr | IP address of the node where the Komodo-daemon is running; Default: '127.0.0.1' |
rpc_port | Port number where the Komodo-daemon is listening for RPCs |
rpc_username | Username for RPC authentication |
rpc_password | Password for RPC authentication |
req_method | Request Method for RPCs; Default: 'POST' |
jsonrpc_ver | Default:'1.0' |
rpc_req_id | ID for RPC requests Default:'curltest' |
>>> from komodo_rpc import KomodoRPC >>> komodo_rpc = KomodoRPC( node_addr='127.0.0.1', rpc_port='4524', req_method='POST', rpc_username='user32703390897', rpc_password='pass885b1d876131e0c2217a848ffbf5fe5ca34367af529a6d519abf8cbb5bd16f8a1e36d30' )
API命令被分成不同的模块:
Module | Description |
---|---|
komodo.address | Includes all address-related commands. Example: ^{ ^{ |
komodo.blockchain | Includes all blockchain-related commands. Example: ^{ ^{ |
komodo.control | Includes all Control commands. Example: ^{ ^{ |
komodo.disclosure | Includes all disclosure-related commands. Example: ^{ ^{ |
komodo.generate | Includes all Generation commands. Example: ^{ ^{ |
komodo.jumblr | Includes all Jumblr commands. Example: ^{ ^{ |
komodo.mining | Includes all mining-related commands. Example: ^{ ^{ |
komodo.network | Includes all network-related commands. Example: ^{ ^{ |
komodo.raw_transactions | Includes all raw_transactions commands. Example: ^{ ^{ |
komodo.util | Includes all utility-related commands. Example: ^{ ^{ |
komodo.wallet | Includes all wallet-related commands. Example: ^{ ^{ |