Car park skills
The AEA car-park skills demonstrate an interaction between two AEAs.
- The
carpark_detection
AEA provides information on the number of car parking spaces available in a given vicinity. - The
carpark_client
AEA is interested in purchasing information on available car parking spaces in the same vicinity.
Discussion
The full Fetch.ai car park AEA demo is documented in its own repo here. This demo allows you to test the AEA functionality of the car park AEA demo without the detection logic.
It demonstrates how the AEAs trade car park information.
Communication
This diagram shows the communication between the various entities as data is successfully sold by the car park AEA to the client.
Option 1: AEA Manager approach
Follow this approach when using the AEA Manager Desktop app. Otherwise, skip and follow the CLI approach below.
Preparation instructions
Install the AEA Manager.
Demo instructions
The following steps assume you have launched the AEA Manager Desktop app.
-
Add a new AEA called
car_detector
with public idfetchai/car_detector:0.32.0
. -
Add another new AEA called
car_data_buyer
with public idfetchai/car_data_buyer:0.33.0
. -
Copy the address from the
car_data_buyer
into your clip board. Then go to the Dorado block explorer and request some test tokens viaGet Funds
. -
Run the
car_detector
AEA. Navigate to its logs and copy the multiaddress displayed. -
Navigate to the settings of the
car_data_buyer
and undercomponents > connection >
fetchai/p2p_libp2p:0.22.0
update as follows (make sure to replace the placeholder with the multiaddress): -
Run the
car_data_buyer
.
In the AEA's logs, you should see the agent trading successfully.
Option 2: CLI approach
Follow this approach when using the aea
CLI.
Preparation instructions
Dependencies
Follow the Preliminaries and Installation sections from the AEA quick start.
Demo instructions
Create car detector AEA
First, fetch the car detector AEA:
Alternatively, create from scratch.
The following steps create the car detector from scratch:
aea create car_detector
cd car_detector
aea add connection fetchai/p2p_libp2p:0.26.0
aea add connection fetchai/soef:0.27.0
aea add connection fetchai/ledger:0.20.0
aea add skill fetchai/carpark_detection:0.27.0
aea config set --type dict agent.dependencies \
'{
"aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"}
}'
aea config set agent.default_connection fetchai/p2p_libp2p:0.26.0
aea config set --type dict agent.default_routing \
'{
"fetchai/ledger_api:1.1.0": "fetchai/ledger:0.20.0",
"fetchai/oef_search:1.1.0": "fetchai/soef:0.27.0"
}'
aea install
aea build
Create car data buyer AEA
Then, fetch the car data client AEA:
Alternatively, create from scratch.
The following steps create the car data client from scratch:
aea create car_data_buyer
cd car_data_buyer
aea add connection fetchai/p2p_libp2p:0.26.0
aea add connection fetchai/soef:0.27.0
aea add connection fetchai/ledger:0.20.0
aea add skill fetchai/carpark_client:0.27.0
aea config set --type dict agent.dependencies \
'{
"aea-ledger-fetchai": {"version": "<2.0.0,>=1.0.0"}
}'
aea config set agent.default_connection fetchai/p2p_libp2p:0.26.0
aea config set --type dict agent.default_routing \
'{
"fetchai/ledger_api:1.1.0": "fetchai/ledger:0.20.0",
"fetchai/oef_search:1.1.0": "fetchai/soef:0.27.0"
}'
aea install
aea build
Add keys for the car data seller AEA
First, create the private key for the car data seller AEA based on the network you want to transact. To generate and add a private-public key pair for Fetch.ai Dorado
use:
Next, create a private key used to secure the AEA's communications:
aea generate-key fetchai fetchai_connection_private_key.txt
aea add-key fetchai fetchai_connection_private_key.txt --connection
Finally, certify the key for use by the connections that request that:
Add keys and generate wealth for the car data buyer AEA
The buyer needs to have some wealth to purchase the service from the seller.
First, create the private key for the car data buyer AEA based on the network you want to transact. To generate and add a private-public key pair for Fetch.ai Dorado
use:
Then, create some wealth for your car data buyer based on the network you want to transact with. On the Fetch.ai Dorado
network:
Next, create a private key used to secure the AEA's communications:
aea generate-key fetchai fetchai_connection_private_key.txt
aea add-key fetchai fetchai_connection_private_key.txt --connection
Finally, certify the key for use by the connections that request that:
Run the AEAs
Run both AEAs from their respective terminals.
First, run the car data seller AEA:
Once you see a message of the form To join its network use multiaddr 'SOME_ADDRESS'
take note of the address. (Alternatively, use aea get-multiaddress fetchai -c -i fetchai/p2p_libp2p:0.26.0 -u public_uri
to retrieve the address.)
This is the entry peer address for the local agent communication network created by the car data seller.
Then, in the car data buyer, run this command (replace SOME_ADDRESS
with the correct value as described above):
aea config set --type dict vendor.fetchai.connections.p2p_libp2p.config \
'{
"delegate_uri": "127.0.0.1:11001",
"entry_peers": ["SOME_ADDRESS"],
"local_uri": "127.0.0.1:9001",
"log_file": "libp2p_node.log",
"public_uri": "127.0.0.1:9001"
}'
Then run the buyer AEA:
You will see that the AEAs negotiate and then transact using the Fetch.ai testnet.
Cleaning up
When you're finished, delete your AEAs: