Skip to main content

Metadatos

La función de reclamos y metadatos del protocolo Celo hace posible la conexión dentro de la cadena con identidades fuera de la cadena.

Los casos de uso incluyen:

  • Las herramientas quieren presentar metadatos públicos proporcionados por un validador o un grupo de validadores como parte de una lista de grupos de candidatos, o una lista de validadores elegidos actualmente.
  • Las UIs del Explorador de Gobernanza pueden querer presentar metadatos públicos sobre los creadores de propuestas de gobernanza
  • La Fundación Celo recibe notificación de una vulnerabilidad de seguridad y quiere ponerse en contacto con los validadores electos para facilitarles la toma de decisiones sobre la aplicación de un parche.
  • Un DApp hace una solicitud a la cartera de Celo para obtener información de la cuenta o para firmar una transacción. La billetera Celo debe proporcionar información sobre la DApp para permitir al usuario tomar una decisión sobre la firma o no de la transacción.

Además, estas herramientas pueden querer incluir información elegida por el usuario como nombres o fotos de perfil que resulten costosas de almacenar en cadena. Para este propósito, el protocolo Celo soporta metadatos que permite a las cuentas hacer reclamos verificables y no verificables. El diseño se describe en el CIP3.

En el contrato inteligente Accounts, cualquier cuenta puede registrar una URL bajo la cual su archivo de metadatos está disponible. El archivo de metadatos contiene una lista no ordenada de reclamos, firmada por la cuenta.

Tipos de Reclamo#

ContractKit soporta actualmente los siguientes tipos de reclamo:

  • Reclamo de nombres - Una cuenta puede reclamar un nombre legible. Este reclamo no es verificable.

  • Attestation Service URL Claim - For the lightweight identity layer, validators can make a claim under which their Attestation Service is reachable to provide attestations. This claim is not verifiable.

  • Keybase User Claim - Accounts can make claims on Keybase usernames. This claim is verifiable by signing a message with the account and hosting it on the publicly accessible path of the Keybase file system.

  • Domain Claim - Accounts can make claims on domain names. This claim is verifiable by signing a message with the account and embedding it in a TXT record.

In the future ContractKit may support other types of claim, including:

  • Twitter User Claim - Accounts can make claims on Twitter usernames. This claim is verifiable by signing a message with the account and posting it as a tweet. Any client can verify the claim with a reference to the tweet in the claim.

Handling Metadata#

You can interact with metadata files easily through the CLI, or in your own scripts, tools or DApps via ContractKit. Most commands require a node being available under http://localhost:8545 to make view calls, and to modify metadata files, you'll need the relevant account to be unlocked to sign the files.

You can create an empty metadata file with:

celocli account:create-metadata ./metadata.json --from $ACCOUNT_ADDRESS

You can add claims with various commands:

celocli account:claim-attestation-service-url ./metadata.json --from $ACCOUNT_ADDRESS --url $ATTESTATION_SERVICE_URL

You can display the claims in your file and their status with:

celocli account:show-metadata ./metadata.json

Once you are satisfied with your claims, you can upload your file to your own web site or a site that will host the file (for example, https://gist.github.com) and then register it with the Accounts smart contract by running:

celocli account:register-metadata --url $METADATA_URL --from $ACCOUNT_ADDRESS

Then, anyone can lookup your claims and verify them by running:

celocli account:get-metadata $ACCOUNT_ADDRESS