问题描述
我是 Hyperledger Aries 的新手,我不知道我做错了什么。
环境:
- Ubuntu16LTS
- Docker 18.09.7 构建 2d0083d
- hyperledger-aries-python 版本:0.6.0(源代码)
来自 aca-py 存储库(https://github.com/hyperledger/aries-cloudagent-python 我运行:
./scripts/run_docker start -e http://host.docker.internal:8000 -it http 0.0.0.0 8000 -ot http --admin 0.0.0.0 11000 --admin-insecure-mode --log-level DEBUG --genesis-网址 https://raw.githubusercontent.com/CHempel-esatus/SSI4DE_Genesis/master/pool_transactions_genesis --trace
注意:我尝试了不同的 pool_genesis_transaction 文件并尝试以各种方式传递它们(通过 URL,通过位于 docker conainer 中的文件)。它总是丢弃相同或相似的信息:
2021-03-12 09:48:32,311 aries_cloudagent.config.ledger INFO Ledger instance not provided
2021-03-12 09:48:32,312 aries_cloudagent.core.conductor WARNING No ledger configured
这里是完整的输出:
2021-03-12 09:48:31,035 asyncio DEBUG Using selector: EpollSelector
2021-03-12 09:48:31,036 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.out_of_band
2021-03-12 09:48:31,037 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.actionmenu
2021-03-12 09:48:31,038 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.routing
2021-03-12 09:48:31,039 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.discovery
2021-03-12 09:48:31,041 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.introduction
2021-03-12 09:48:31,041 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.problem_report
2021-03-12 09:48:31,042 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.coordinate_mediation
2021-03-12 09:48:31,043 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.present_proof
2021-03-12 09:48:31,044 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.trustping
2021-03-12 09:48:31,045 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.didexchange
2021-03-12 09:48:31,047 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.issue_credential
2021-03-12 09:48:31,048 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.basicmessage
2021-03-12 09:48:31,050 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.protocols.connections
2021-03-12 09:48:31,051 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.holder
2021-03-12 09:48:31,057 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.ledger
2021-03-12 09:48:31,072 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.messaging.credential_deFinitions
2021-03-12 09:48:31,085 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.messaging.schemas
2021-03-12 09:48:31,091 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.revocation
2021-03-12 09:48:31,105 aries_cloudagent.core.plugin_registry DEBUG Loaded module: aries_cloudagent.wallet
2021-03-12 09:48:31,119 aries_cloudagent.config.ledger INFO Fetching genesis transactions from: https://raw.githubusercontent.com/CHempel-esatus/SSI4DE_Genesis/master/pool_transactions_genesis
2021-03-12 09:48:32,302 aries_cloudagent.core.profile INFO Create profile manager: in_memory
2021-03-12 09:48:32,312 aries_cloudagent.core.conductor WARNING No ledger configured
::::::::::::::::::::::::::::::::::::::::::::::
:: Aries Cloud Agent ::
:: ::
:: ::
:: Inbound Transports: ::
:: ::
:: - http://0.0.0.0:8000 ::
:: ::
:: Outbound Transports: ::
:: ::
:: - http ::
:: - https ::
:: ::
:: Administration API: ::
:: ::
:: - http://0.0.0.0:11000 ::
:: ::
:: ver: 0.6.0 ::
::::::::::::::::::::::::::::::::::::::::::::::
Listening...
在演示中我只是不知道为什么我的 aries 无法连接到任何 indy-ledger。 使用具有相同创世文件的 indy-cli 工作正常。 CLI 能够连接,所以我假设所有 pool_genesis_files 都正确。
我做错了什么还是遗漏了什么?
解决方法
我终于找到了解决方案。我是如何找到它的故事:
短篇故事:
先决条件:在您的机器上安装 indy-sdk、aries-cloudagent、python3_indy 和 python 3.6.9+。如果您不知道该怎么做,请参阅长篇故事。 Python 3.6.9 随 Ubuntu18LTS 开箱即用
- 在本地安装 aries-cloudagent-python (aca-py)。
- 首先使用配置命令运行 aca-py 来配置您的 aca-py 实例。为此使用参数 wallet-type indy
- 使用 start 命令和您的配置参数正常运行 aca-py。请务必使用 --wallet-type indy 标志才能连接到 indy 分类帐
长篇故事:
在 aries-cloudagent-python (aca-py) 代码中,使用哪个分类帐(例如 indy 分类帐)的配置似乎来自指定的钱包类型。
第一:提供参数:--wallet-type indy -> 这返回了错误,需要 --wallet-name 和 --wallet-key 参数。所以我提供了它们:
./scripts/run_docker start
-e http://127.0.0.1:8000
-it http 127.0.0.1 8000
-ot http
--admin 127.0.0.1 11000
--admin-insecure-mode
--log-level DEBUG
--genesis-url https://raw.githubusercontent.com/CHempel-esatus/SSI4DE_Genesis/master/pool_transactions_genesis
--trace
--recreate-wallet
--wallet-type indy
--wallet-name test
--wallet-key 12345
2nd。:这会导致以下错误,表明没有提供钱包数据库。
2021-03-16 09:19:45,447 indy.libindy DEBUG _indy_loop_callback: >>> command_handle: 0,err,args: (0,)
2021-03-16 09:19:45,447 indy.libindy WARNING _indy_loop_callback: Function returned error
2021-03-16 09:19:45,449 indy.libindy DEBUG _indy_loop_callback <<<
2021-03-16 09:19:45,449 aries_cloudagent.commands.start ERROR Exception during startup:
Traceback (most recent call last):
File "/home/indy/aries_cloudagent/indy/sdk/wallet_setup.py",line 169,in open_wallet
credentials=json.dumps(self.wallet_access),File "/home/indy/.pyenv/versions/3.6.13/lib/python3.6/site-packages/indy/wallet.py",line 127,in open_wallet
open_wallet.cb)
indy.error.WalletNotFoundError
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/indy/aries_cloudagent/commands/start.py",line 72,in init
await startup
File "/home/indy/aries_cloudagent/commands/start.py",line 28,in start_app
await conductor.setup()
File "/home/indy/aries_cloudagent/core/conductor.py",line 91,in setup
self.root_profile,self.setup_public_did = await wallet_config(context)
File "/home/indy/aries_cloudagent/config/wallet.py",line 40,in wallet_config
profile = await mgr.open(context,profile_cfg)
File "/home/indy/aries_cloudagent/indy/sdk/profile.py",line 161,in open
opened = await indy_config.open_wallet()
File "/home/indy/aries_cloudagent/indy/sdk/wallet_setup.py",line 182,in open_wallet
) from x_indy
File "/home/indy/aries_cloudagent/indy/sdk/wallet_setup.py",in open_wallet
open_wallet.cb)
aries_cloudagent.core.error.ProfileNotFoundError: Wallet 'test' not found: Error: Wallet not found
Caused by: No wallet database exists
3rd.:https://github.com/hyperledger/aries-cloudagent-python/blob/main/DevReadMe.md 处的 aca-py 文档明确指出:
在本地运行:对于本地开发,我们建议使用提供的 Docker 脚本来运行 ACA-Py 软件
第四点:aca-py 可以使用安装在 docker 容器中的 sqlite。要查看 aca-py 是否与 sqlite 兼容,请运行
./scripts/run_docker start --help
返回可用参数列表。一种是:
--wallet-storage-type <storage-type>
Specifies the type of Indy wallet backend to use.
Supported internal storage types are 'basic' (memory),'default' (sqlite),and 'postgres_storage'. The
default,if not specified,is 'default'. [env var:
ACAPY_WALLET_STORAGE_TYPE]
第五:跑步
./scripts/run_docker provision
-e http
--genesis-url
https://raw.githubusercontent.com/CHempel-esatus/SSI4DE_Genesis/master/pool_transactions_genesis
--recreate-wallet
--wallet-type indy
--wallet-name test
--wallet-key 12345
返回
Successfully tagged aries-cloudagent-run:latest
Created new profile
Profile backend: indy
Profile name: test
No public DID
Ledger configured
这很奇怪,因为现在他可以找到sqlite了。这似乎正确配置了数据库,因此可以使用它。但是因为它是在一个 docker 容器内,并且容器会丢弃每一次更改,所以这个内部配置将永远无法使用。
第六。为了解决这个问题,我在 Ubuntu18LTS 上安装了来自 https://pypi.org/project/aries-cloudagent/
的本地云代理包pip3 install aries-cloudagent
pip3 install python3_indy
并按照 indy-sdk https://github.com/hyperledger/indy-sdk
的安装说明进行操作我还在本地机器上安装了 sqlite:
sudo apt install sqlite
7th。:在我重新启动系统后,我执行:
aca-py provision -e http://127.0.0.1:8000 --genesis-url https://raw.githubusercontent.com/CHempel-esatus/SSI4DE_Genesis/master/pool_transactions_genesis --recreate-wallet --wallet-type indy --wallet-name test --wallet-key test
回来
Created new profile
Profile backend: indy
Profile name: test
No public DID
Ledger configured
8th.: 之后,我在云端运行 aca-py 并使用 admin-REST-api 连接到我的分类帐