https://github.com/bugout-dev/entity
https://github.com/bugout-dev/entity
Last synced: 26 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/bugout-dev/entity
- Owner: bugout-dev
- Created: 2022-10-12T11:54:02.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-07-13T17:38:04.000Z (over 2 years ago)
- Last Synced: 2025-12-15T06:31:56.282Z (4 months ago)
- Language: Python
- Size: 74.2 KB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Entity
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
## Different use cases and schemes
### Smartcontract
Required keys: `name`, `address`, `blockchain`, `contract_deployer`, `support_erc`, `proxy`. Other fields could be added as additional.
name: `Terminus`
required fields:
```json
{
"blockchain": "polygon",
"address": "0x062BEc5e84289Da2CD6147E0e4DA402B33B8f796",
"contract_deployer": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F",
"support_erc": [1155, 721],
"proxy": true
}
```
additional fields:
```json
{
"description": "Terminus Moonstream.to smartcontract.",
"discord": "https://discord.com/invite/K56VNUQGvA"
}
```
## Smartcontract deployer
Required keys: `address`, `name`, `blockchain`, `deployed_contract`. Other fields could be added as additional.
title: `Moonstream dropper contract deployer`
required fields:
```json
{
"blockchain": "polygon",
"address": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F",
"deployed_contract": "0x7bbf900Ded826D5A16a27dF028018673E521B35d",
"deployed_contract": "0xEba757cEac281D9de85b768Ef4B9E1992C41EA7F"
}
```
additional fields:
```json
{
"description": "Moonstream.to deployer.",
"discord": "https://discord.com/invite/K56VNUQGvA"
}
```
## Entity API
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:
```bash
export MOONSTREAM_ACCESS_TOKEN=""
```
### Creating collections via API
Create collection `curl` request
```bash
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
```bash
curl --request GET "https://api.moonstream.to/entity/collections" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"
```
### Creating entities
Set collection you are working with:
```bash
export MOONSTREAM_ENTITY_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.
```bash
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:
```bash
curl --request GET "https://api.moonstream.to/entity/collections/$MOONSTREAM_ENTITY_COLLECTION_ID/entities" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"
```
### Entity modifications
Set entity you are working with:
```bash
export MOONSTREAM_ENTITY_ID=""
```
Delete entity:
```bash
curl --request DELETE "https://api.moonstream.to/entity/collections/$MOONSTREAM_ENTITY_COLLECTION_ID/entities/$MOONSTREAM_ENTITY_ID" \
--header "Authorization: Bearer $MOONSTREAM_ACCESS_TOKEN"
```