Entity is used to store any web3 address (including smart contract addresses and even addresses that may not have been used) and identifying information/notes.
Entities are useful during game air drops, it's providing additional information in leaderboards, for internal usage of crypto projects who want their users to pass KYC and legal things there was a problem to bridge the blockchain and physical world.
Current document describes how to store user identity data with Moonstream infrastructure for different use cases:
It supports different use cases:
- User web3 addresses
- Maintaining a list of deployed smart contracts (by address)
- Maintaining a list of smart contract deployers
- Blacklisting or whitelisting accounts by Discord id, Twitter id, email, etc.
- Other..
This is not just a mapping between users (human-owned addresses) and identifying information, but any web3 address (including smart contract addresses and even addresses that may not have been used) and identifying information/notes. For smart contracts, it would also store things like bytecode, ABI, etc.
For each entity there are 3 permanently required fields:
- name
- address
- blockchain
Depending on the use case, you can specify additional fields that will be required for your entities in certain collection. Then, you will be able to search across these fields with high precision compared to other fields.
Detailed documentation you can find at https://docs.moonstream.to/engine/entity
Required keys: name
, address
, blockchain
, contract_deployer
, support_erc
, proxy
. Other fields could be added as additional.
name: Terminus
required fields:
{
"blockchain": "polygon",
"address": "0x062BEc5e84289Da2CD6147E0e4DA402B33B8f796",
"contract_deployer": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F",
"support_erc": [1155, 721],
"proxy": true
}
additional fields:
{
"description": "Terminus Moonstream.to smartcontract.",
"discord": "https://discord.com/invite/K56VNUQGvA"
}
Required keys: address
, name
, blockchain
, deployed_contract
. Other fields could be added as additional.
title: Moonstream dropper contract deployer
required fields:
{
"blockchain": "polygon",
"address": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F",
"deployed_contract": "0x7bbf900Ded826D5A16a27dF028018673E521B35d",
"deployed_contract": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F"
}
additional fields:
{
"description": "Moonstream.to deployer.",
"discord": "https://discord.com/invite/K56VNUQGvA"
}
All your entities stored in collections and each new collection belongs only to you until you will provide access to you friends or team read/update/delete access.
To work with entity you need to Create an account at https://moonstream.to, and generate Bearer access token or attach your web3 address for web3_token. And store it as environment variable:
export MOONSTREAM_ACCESS_TOKEN="<your_access_token>"
Create collection curl
request
curl --request POST "https://api.moonstream.to/entity/collections" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"name": "Whitelist of November"
}'
Get list of your collections
curl --request GET "https://api.moonstream.to/entity/collections" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"
Set collection you are working with:
export MOONSTREAM_ENTITY_COLLECTION_ID="<your_collection_id>"
For each entity there are 3 permanently required fields:
- name
- address
- blockchain
Depending on the use case, you can specify additional fields that will be required for your entities in certain collection. Then, you will be able to search across these fields with high precision compared to other fields.
curl --location --request POST "https://api.moonstream.to/entity/collections/$MOONSTREAM_ENTITY_COLLECTION_ID/entities" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN" \
--header "Content-Type: application/json" \
--data-raw '{
"name": "Dark Forest burner",
"address": "0xe7f5cce56814f2155f05ef6311a6de55e4189ea5",
"blockchain": "xdai",
"required_fields": [
{"discord": "https://discord.com/invite/K56VNUQGvA"},
{"organization": true}
},
"description": "Moonstream organization burner address for Dark Forest game."
}'
Also you can pass a list of entities to create them in bulk mode to url https://api.moonstream.to/entity/collections/{{collection_id}}/bulk
Get list of entities with request:
curl --request GET "https://api.moonstream.to/entity/collections/$MOONSTREAM_ENTITY_COLLECTION_ID/entities" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"
Set entity you are working with:
export MOONSTREAM_ENTITY_ID="<your_entity_id>"
Delete entity:
curl --request DELETE "https://api.moonstream.to/entity/collections/$MOONSTREAM_ENTITY_COLLECTION_ID/entities/$MOONSTREAM_ENTITY_ID" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"