feknall / Hyperledger-FL

4 stars 0 forks source link

403: Ledger not found error #2

Closed feknall closed 2 years ago

feknall commented 2 years ago

By executing some specific API that needs communication between the ledger and the agent, 403: ledger not found will be thrown. This is the command that will be used for running an agent:

PORTS="5000:5000 10000:10000" ./scripts/run_docker start --inbound-transport http 0.0.0.0 10000 --outbound-transport http --log-level DEBUG --admin 0.0.0.0 5000 --admin-insecure-mode --endpoint http://127.0.0.1:10000 --genesis-url http://172.17.0.3:8000/genesis
feknall commented 2 years ago

This cannot be a networking problem since the agent's container can connect to the ledger's pool nodes.

nc 172.17.0.6 9701
feknall commented 2 years ago

The problem was the command I was using to run the agent. Each agent needs some kind of a wallet in order to communicate with to ledger. However, I was not specifying any options to use a wallet. By adding these new options to the previous command, the problem is almost solved:

--wallet-key key --wallet-name my-wallet --wallet-type indy

However, my-wallet doesn't exist by default and must be created when we run the container. I added the below command to Dockerfile.run to create this wallet with a specific key.

RUN echo "wallet create my-wallet key" > /tmp/t.txt; echo "key" | indy-cli /tmp/t.txt

The final command that works perfectly:

PORTS="5000:5000 10000:10000" ./scripts/run_docker start --inbound-transport http 0.0.0.0 10000 --outbound-transport http --log-level INFO --admin 0.0.0.0 5000 --admin-insecure-mode --endpoint http://127.0.0.1:10000 --genesis-url http://172.17.0.3:8000/genesis --wallet-key key --wallet-name my-wallet --wallet-type indy