wallet -(changes)-> zone -forwards-to-> zone-registry -forwards-to-> search-index-registries
Action: Prepare-Database
Description: Initializes the database by creating necessary tables for zone ownership and delegation.
Parameters:
msg: The message object containing the action and data.
Action: Create-Zone
Description: Creates a new profile in the zone.
Parameters:
msg: The message object containing the action and data.
Returns:
{
"Target": "<profile_id>",
"Action": "Zone-Created-Success"
}Action: Get-Zones-For-User
Description: Retrieves Zone(s) associated with a wallet address.
Parameters:
msg: The message object containing the action and data.msg.Data:"{\"Address\": \"<some_wallet>\"}"
Returns:
{
"Target": "<profile_id>",
"Action": "Zone-Fetch-Success",
"Data": "[{\"ZoneId\": \"some_id\", \"UserId\": \"some_address\", \"Role\": \"Owner\"}]"
}Action: Zone-Metadata.Set
Description: Updates an existing profile in the zone.
Parameters:
msg: The message object containing the action and data.msg.Data: JSON object containing updated profile details.
Action: Zone-Role.Set
Description: Updates the role of a delegate for a profile.
Parameters:
msg: The message object containing the action and data.msg.Data: JSON object containingId,Op, and optionallyRole.
Action: Read-Auth
Description: Retrieves authorization data for profiles.
Parameters:
msg: The message object containing the action.
Should have profile package broken out
To set metadata entries in the Zone, send a message with the Update-Profile action and the appropriate data.
Parameters:
data: A JSON string containing an array ofentries, where each entry has akeyandvalue.
Data Schema:
{
"type": "object",
"properties": {
"entries": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": { "type": "string" },
"value": { "type": "string" }
},
"required": ["key", "value"]
}
}
},
"required": ["entries"]
}{
"process": "<your-zone-id>",
"data": "{\"entries\": [{\"key\": \"hat\", \"value\": \"blue\"}, {\"key\": \"boots\", \"value\": \"black\"}]}",
"tags": [
{
"name": "Action",
"value": "Update-Profile"
}
]
}To retrieve metadata entries from the Zone, send a message with the Get-Profile action and the appropriate data.
Parameters:
data: A JSON string containing an array ofkeysto retrieve.
Data Schema:
{
"type": "object",
"properties": {
"keys": {
"type": "array",
"items": { "type": "string" }
}
},
"required": ["keys"]
}Input:
{
"process": "<your-process>",
"data": "{\"keys\": [\"hat\", \"boots\"]}",
"tags": [
{
"name": "Action",
"value": "Get-Profile"
}
]
}Output:
{
"Data": {
"Results": {
"boots": "black",
"hat": "blue"
}
}
}To set metadata entries in the Zone, send a message with the Zone-Metadata.Set action and the appropriate data.
.load path/to/bundle.lua
.editor
<editor mode> use '.done' to submit or '.cancel' to cancel
local P = require("@permaweb/zone")
P.zoneKV:set("tree", "green")
print(P.zoneKV:get("tree"))
.done
RETURNS:
black
This concept is in very early development and experimentation phase, and as such, will be buggy and most likely evolve in ways that may not be supported without losing data or having to re-create profiles. The current version includes some base profile metadata, can store assets, and supports single wallet as an owner.
AO Profile is a protocol built on the permaweb designed to allow users to create an identity, interact with applications built on AO, operate as a smart wallet, and serve as a personal process. Instead of a wallet address owning assets or having uploads, the profile will encompass this information. This means that certain actions require first interacting with the profile, validating that a wallet has authorization to carry it out, and finally the profile will send a message onward to other processes, which can then validate its request.
A separate Profile Registry aggregation process is used to keep track of the new profile processes that are created, as well as any updates. This registry process will serve as an all encompassing database that can be queried for profile data. You can read profile metadata directly from the AO Profile process, or from the registry.
| Field | Description |
|---|---|
| DisplayName | Profile display name |
| Username | Profile username |
| Bio | Profile description |
| Avatar | Profile Avatar TXID |
| Banner | Profile Banner TXID |
Sample output from AO: "Data": "{\"Assets\":[],\"Profile\":{\"DisplayName\":\"tom-ao-profile-1\",\"Bio\":\"hello ao\",\"Avatar\":\"LzBub_drZ3xOE2mn_HW5xDNDWJ2pe3zN6NUQkMc3-C0\",\"Banner\":\"hAjf58dmqS-mkRTwPvmVLRZBPC-oZK4H-uDAceZoSPk\",\"Username\":\"tom-ao\"}}"
| Handler | Description |
|---|---|
| Info | Dry-runable, returns profile metadata and assets as JSON. |
| Update-Profile | Accepts JSON in the data field to update profile metadata. |
| Transfer | Allows a profile to transfer some quantity of an asset they own to another profile or address. |
| Debit-Notice | Supports interactions with UCM, decreases asset count if marked for sale. |
| Credit-Notice | Supports interactions with UCM, decreases asset count if marked for sale. |
| Add-Uploaded-Asset | Allows an AO Atomic Asset to be linked to a profile. |
| Handler | Description |
|---|---|
| Prepare-Database | Prepares the database schema by creating tables ao_profile_metadata and ao_profile_authorization if they don't exist. |
| Get-Metadata-By-ProfileIds | Retrieves metadata for profiles based on the provided profile IDs. Returns metadata as JSON or sends an error message if input data is invalid. |
| Get-Profiles-By-Address | Retrieves associated profiles for a given wallet address from ao_profile_authorization. Returns profiles as JSON or an error if none are found. |
| Update-Profile | Updates a profile's metadata or adds it if it doesn't exist. Links an authorized address if needed. |
| Read-Metadata | (Debug) Prints all rows from the ao_profile_metadata table. |
| Read-Authorization | (Debug) Prints all rows from the ao_profile_authorization table. |
AO Profile functions by spawning a new personal process for a user if they decide to make one. The wallet that spawns the profile is authorized to make changes to it. Prior to creating a process, you should check if the wallet address already has any profiles.
Here is an overview of actions that take place to create an AO Profile process and update the metadata:
- A new process is spawned with the base AO module. (Sample Code)
- A Gateway GraphQL query is executed for the spawned transaction ID in order to find the resulting process ID. (Sample Code)
- The profile.lua source code is then loaded from Arweave, and sent to the process as an eval message. This loads the state and handlers into the process. (Sample Code)
- Client collects Profile metadata in the data object, and uploads a banner and cover image.
- Finally, a message is sent to update the Profile metadata. (Sample Code).
If you have the Profile ID already, you can easily read the metadata directly from the Profile process via the Info handler. (Sample Code)
If you have a wallet address, you can look up the profile(s) associated with it by interacting with the Profile Registry via the Get-Profiles-By-Address handler. (Sample Code)
The Profile Registry process collects and aggregates all profile metadata in a single database and its process ID is defined in all AO Profiles. Messages are sent from the Profiles to the Registry when any creations or edits to metadata occur, and can be trusted by the msg.From address which is the Profile ID.
The overall process looks like:
- A message is sent with an action of
Update-Profileto the Profile process with the information that the creator provided. - Once the Profile metadata is updated internally in the Profile Process, a new message is then sent to the Registry process to add or update the corresponding profile accordingly via its own
Update-Profilehandler.
Atomic assets are unique digital items stored on Arweave. Unlike traditional NFTs, the asset data is uploaded together with a smart contract in a single transaction which is inseparable and does not rely on external components.
AO atomic assets follow the token spec designed for exchangeable tokens which can be found here. The creation of an atomic asset happens with these steps:
- The asset process handlers are fetched from Arweave
- Asset fields are replaced with the values submitted by the user
- A new process is spawned, with the tags and asset data included
- A message is sent to the newly created process with an action of 'Eval', which includes the process handlers
- A message is sent to the profile that created the asset in order to add the new asset to its Assets table
AO Collections are designed to allow users to group atomic assets together.
The creation of a collection happens with these steps:
- The collection process handlers are fetched from Arweave.
- Collection fields are replaced with the values submitted by the user.
- A new process is spawned, with the collection tags.
- A message is sent to the newly created process with an action of 'Eval', which includes the process handlers.
- A message is sent to a collection registry which contains information on all created collections.