> For the complete documentation index, see [llms.txt](https://docs.likn.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.likn.ai/likn-core/likn-core-api/graphql.md).

# GraphQL

## Schema

#### `Block` Table

Stores block data:

* `baseFeePerGas`: The base gas fee of the block, stored as a `bigint`.
* `difficulty`: The mining difficulty of the block.
* `extraData`: Additional data field of the block, stored as a hexadecimal string.
* `gasLimit`: The maximum amount of gas allowed for the block.
* `gasUsed`: The total gas used by all transactions in the block.
* `id`: The block hash.
* `hash`: The block hash (same as `id`).
* `logsBloom`: Bloom filter for quick log event lookups.
* `miner`: Address receiving the block mining reward.
* `mixHash`: Random number for proof-of-work validation.
* `nonce`: Unique identifier for the block.
* `number`: Block number.
* `parentHash`: Hash of the parent block.
* `receiptsRoot`: Root of the receipts trie.
* `sha3Uncles`: SHA3 hash of the uncle block list.
* `size`: Size of the block in bytes.
* `stateRoot`: Root hash of the state trie.
* `timestamp`: Unix timestamp of block creation.
* `totalDifficulty`: Total difficulty of the chain.
* `transactionsRoot`: Root hash of the transactions trie.

#### `Collection` Table

Stores contract information:

* `id`: Contract address.
* `chainId`: Blockchain ID.
* `decimals`: Number of decimal places for the token.
* `name`: Token name.
* `symbol`: Token symbol.
* `totalSupply`: Total supply of the token.
* `type`: Contract type (e.g., ERC20, ERC721).

#### `Account` Table

Stores user account information:

* `chainId`: Blockchain ID.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract.
* `id`: User address.
* `tokenCount`: Number of tokens held by the user.
* `isOwner`: Whether the user is an owner of a contract.
* `tokens`: List of NFTs owned by the user.
* `erc20tokens`: List of ERC20 tokens owned by the user.
* `transferFromEvents`: List of transaction events where the user is the sender.
* `transferToEvents`: List of transaction events where the user is the recipient.
* `createTime`: Creation timestamp.
* `updateTime`: Update timestamp.

#### `ApprovalEvent` Table

Logs approval events for ERC20 tokens:

* `id`: Event ID.
* `amount`: Number of tokens approved.
* `timestamp`: Timestamp of the event.
* `ownerId`: Address of the token owner.
* `spenderId`: Address of the spender.
* `owner`: Associated token owner.
* `spender`: Associated spender.

#### `Allowance` Table

Stores authorization information:

* `id`: Authorization ID.
* `amount`: Amount of tokens authorized.
* `ownerId`: Address of the token owner.
* `spenderId`: Address of the spender.
* `owner`: Associated token owner.
* `spender`: Associated spender.

#### `TransferEvent` Table

Logs ERC20 token transfer events:

* `id`: Event ID.
* `chainId`: Blockchain ID.
* `amount`: Amount of tokens transferred.
* `timestamp`: Event timestamp.
* `fromId`: Sender's address.
* `toId`: Recipient's address.
* `from`: Sender information.
* `to`: Recipient information.
* `type`: Transfer type.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract information.
* `createTime`: Creation time.
* `updateTime`: Update time.

#### `Erc20Token` Table

Stores ERC20 token holder information:

* `chainId`: Blockchain ID.
* `id`: Token holder's address.
* `balance`: Amount of tokens held.
* `ownerId`: Address of the token holder.
* `owner`: Associated holder.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract information.
* `createTime`: Creation time.
* `updateTime`: Update time.

#### `NftOffer` Table

Logs NFT offer information:

* `id`: Offer ID.
* `chainId`: Blockchain ID.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract.
* `from`: Offer creator.
* `price`: Offer price.
* `startTime`: Offer start time.
* `endTime`: Offer end time.
* `isCancel`: Whether the offer is canceled.
* `tokenPk`: Associated NFT ID.
* `token`: Associated NFT.
* `createTime`: Creation time.
* `updateTime`: Update time.

#### `Nft` Table

Stores NFT information:

* `id`: NFT ID (contract address + tokenID).
* `tokenId`: NFT's tokenID.
* `chainId`: Blockchain ID.
* `level`: NFT level.
* `tokenURI`: Metadata URI for the NFT.
* `price`: Current price of the NFT.
* `priceStartTime`: Price start time.
* `priceEndTime`: Price end time.
* `isBurn`: Whether the NFT is burned.
* `transactionCount`: Number of transactions.
* `createTime`: Creation time.
* `updateTime`: Update time.
* `mintTime`: Mint time.
* `minterAddress`: Minter's address.
* `minter`: Associated minter.
* `ownerId`: Owner's address.
* `owner`: Associated owner.
* `contractAddress`: Contract address.
* `contract`: Associated contract.

#### `NftEvent` Table

Logs events related to NFTs:

* `blockHash`: Associated block hash.
* `block`: Associated block information.
* `chainId`: Blockchain ID.
* `price`: Event price.
* `startTime`: Event start time.
* `endTime`: Event end time.
* `tokenPk`: Associated NFT ID.
* `token`: Associated NFT.
* `eventType`: Event type (e.g., transfer, mint).
* `createTime`: Creation time.
* `updateTime`: Update time.
* `fromId`: Sender's address.
* `toId`: Recipient's address.
* `from`: Sender information.
* `to`: Recipient information.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract.

#### `NftStat` Table

Stores statistics for NFTs:

* `id`: Statistic ID (contract address + timestamp).
* `hourId`: Hourly statistic time.
* `chainId`: Blockchain ID.
* `last`: Last price.
* `low`: Lowest price.
* `high`: Highest price.
* `average`: Average price.
* `count`: Number of transactions.
* `sumPurchase`: Total purchase amount.
* `createTime`: Creation time.
* `updateTime`: Update time.
* `contractAddress`: Associated contract address.
* `contract`: Associated contract.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.likn.ai/likn-core/likn-core-api/graphql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
