### Install Manuscript GUI
Source: https://docs.chainbase.com/core-concepts/manuscript/QuickStart/prerequisites
Downloads and executes the installation script for the Manuscript GUI from a provided URL. This script handles the setup of the graphical user interface.
```bash
curl -fsSL https://github.com/chainbase-labs/manuscript-core/raw/main/install-gui.sh | bash
```
--------------------------------
### Example: Get Contract Name
Source: https://docs.chainbase.com/api-reference/web3-api/basic/contract/contract-call
Demonstrates how to retrieve the name of a smart contract using its address and ABI. This example assumes a Python environment for interacting with smart contracts.
```APIDOC
[{"inputs":[{"internalType":"uint256","name":"maxBatchSize_","type":"uint256"},{"internalType":"uint256","name":"collectionSize_","type":"uint256"},{"internalType":"uint256","name":"amountForAuctionAndDev_","type":"uint256"},{"internalType":"uint256","name":"amountForDevs_","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxBatchSize","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawMoney","outputs":[],"stateMutability":"nonpayable","type":"function"}]
```
```Python
from web3 import Web3
# Assuming you have a Web3 instance connected to an Ethereum node
# w3 = Web3(Web3.HTTPProvider('YOUR_NODE_URL'))
# Example data from the input
contract_address = '0xed5af388653567af2f388e6224dc7c4b3241c544'
chain_id = 1
function_name = 'name'
# The ABI for the 'name' function (extracted from the full ABI)
name_function_abi = [
{
"inputs": [],
"name": "name",
"outputs": [
{
"internalType": "string",
"name": "",
"type": "string"
}
],
"stateMutability": "view",
"type": "function"
}
]
# Create a contract instance
# contract = w3.eth.contract(address=contract_address, abi=name_function_abi)
# Call the 'name' function
# contract_name = contract.functions.name().call()
# print(f"Contract Name: {contract_name}")
# Note: The actual execution requires a connected Web3 instance and potentially a wallet for signing transactions if it were a non-view function.
# The provided example configuration is used here to illustrate the context.
```
--------------------------------
### Run Manuscript CLI
Source: https://docs.chainbase.com/core-concepts/manuscript/QuickStart/create_manuscript
Starts the Manuscript CLI tool to begin creating or managing manuscripts. This is the initial step after installing the GUI tool.
```shell
➜ ~ ./manuscript
```
--------------------------------
### Get NFT Owner using Axios in JavaScript
Source: https://docs.chainbase.com/platform/usecases/nft-api/get-nft-owner-by-token
Provides an example of fetching NFT owner information using the `axios` library in JavaScript. This method requires installing `axios` and demonstrates making a GET request to the Chainbase API with necessary parameters and headers.
```javascript
const axios = require('axios');
const network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
const contract_addr = '0xed5af388653567af2f388e6224dc7c4b3241c544'; // Take Azuki's contract address as an example.
const token_id = '1';
const options = {
url: `https://api.chainbase.online/v1/nft/owner?chain_id=${network_id}&contract_address=${contract_addr}&token_id=${token_id}`,
method: 'GET',
headers: {
'x-api-key': 'YOUR_CHAINBASE_API_KEY', // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### JWT Header Component Example
Source: https://docs.chainbase.com/api-reference/jtw
An example of the JSON structure for a JWT header, specifying the signing algorithm ('RS256'), token type ('JWT'), and the key ID ('kid') obtained from Chainbase.
```json
{
"alg": "RS256",
"typ": "JWT",
"kid": "e7af4467-00f1-480e-97d7-6490d7f749b9"
}
```
--------------------------------
### Get Token Price using Axios in JavaScript
Source: https://docs.chainbase.com/platform/usecases/token-api/get-token-price
This example demonstrates fetching ERC20 token prices via the Chainbase API using the axios library in JavaScript. Ensure you have installed axios (`npm install axios --save`). It requires the network ID, token contract address, and your Chainbase API key, returning price details.
```javascript
const axios = require('axios');
const network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
const token_addr = '0xdAC17F958D2ee523a2206206994597C13D831ec7'; // Take USDT as an example.
const options = {
url: `https://api.chainbase.online/v1/token/price?chain_id=${network_id}&contract_address=${token_addr}`,
method: 'GET',
headers: {
'x-api-key': 'YOUR_CHAINBASE_API_KEY', // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### Get NFT Metadata using JavaScript Axios
Source: https://docs.chainbase.com/platform/usecases/nft-api/get-nft-metadata
Provides an example of fetching NFT metadata using the `axios` library in JavaScript. This method requires installing `axios` first. It configures the request with the API endpoint, method, and headers, then logs the retrieved metadata.
```javascript
const network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
const contract_addr = '0xed5af388653567af2f388e6224dc7c4b3241c544'; // Take the contract address of Azuki as an example.
const token_id = '1'; // Token id should be in hex or num string. Here we take 1 as example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/nft/metadata?chain_id=${network_id}&contract_address=${contract_addr}&token_id=${token_id}`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### Install chainbase-sdk
Source: https://docs.chainbase.com/introduction/networks/developers
Installs the chainbase-sdk using npm, a necessary step for local development and manuscript management.
```bash
npm install chainbase-sdk
```
--------------------------------
### Get NFTs using Axios in JavaScript
Source: https://docs.chainbase.com/platform/usecases/balance-api/get-nfts-owned-by-address
Provides an example of retrieving NFTs owned by a wallet address using the Chainbase API with the `axios` library in JavaScript. This method requires installing `axios` and configuring the request with the Chainbase API key, network ID, and wallet address. The NFT data is then logged to the console.
```javascript
const axios = require('axios');
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
wallet_addr = '0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045'; // Take Vitalik's wallet address as an example.
const options = {
url: `https://api.chainbase.online/v1/account/nfts?chain_id=${network_id}&address=${wallet_addr}&page=1&limit=5`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### Install Manuscript Core Dependencies
Source: https://docs.chainbase.com/core-concepts/manuscript/zone
This snippet demonstrates how to set up the local development environment for the Chainbase Manuscript framework. It involves cloning the repository, navigating into the directory, and installing core dependencies using the `make` command, with options for GUI or CLI installation.
```bash
git clone https://github.com/chainbase-labs/manuscript-core
cd manuscript-core
make install gui # or cli
```
--------------------------------
### Check System Requirements (Docker)
Source: https://docs.chainbase.com/core-concepts/manuscript/QuickStart/prerequisites
Verifies the installation and operational status of Docker and Docker Compose. These commands are essential for confirming that the necessary containerization tools are available for the Manuscript environment.
```shell
docker --version
docker compose version
```
--------------------------------
### Example NFT Metadata Output
Source: https://docs.chainbase.com/platform/usecases/nft-api/get-nft-metadata
An example of the JSON output returned by the Chainbase API when fetching NFT metadata for Azuki #1 on Ethereum.
```json
{
"contract_address": "0xed5af388653567af2f388e6224dc7c4b3241c544",
"name": "Azuki",
"symbol": "AZUKI",
"owner": "0xC8967D1537F7B995607A1DEa2B0C06E18A9756a2",
"token_id": "0x1",
"erc_type": "ERC721",
"image_uri": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/1.png",
"mint_time": "2022-01-12T04:17:28Z",
"mint_transaction_hash": "0xc208fdb2f133bda64522fececd6518a565aaa6e8801b0a776f2f93c922fe9420",
"token_uri": "https://ikzttp.mypinata.cloud/ipfs/QmQFkLSQysj94s5GvTHPyzTxrawwtjgiiYS2TBLgrvw8CW/1",
"metadata": {
"name": "Azuki #1",
"image": "https://ikzttp.mypinata.cloud/ipfs/QmYDvPAXtiJg7s8JdRBSLWdgSphQdac8j1YuQNNxcGE1hg/1.png",
"attributes": [
{
"trait_type": "Type",
"value": "Human"
},
{
"trait_type": "Hair",
"value": "Pink Hairband"
},
{
"trait_type": "Clothing",
"value": "White Qipao with Fur"
},
{
"trait_type": "Eyes",
"value": "Daydreaming"
},
{
"trait_type": "Mouth",
"value": "Lipstick"
},
{
"trait_type": "Offhand",
"value": "Gloves"
},
{
"trait_type": "Background",
"value": "Off White D"
}
]
},
"traits": [
{
"trait_type": "Type",
"value": "Human"
},
{
"trait_type": "Hair",
"value": "Pink Hairband"
},
{
"trait_type": "Clothing",
"value": "White Qipao with Fur"
},
{
"trait_type": "Eyes",
"value": "Daydreaming"
},
{
"trait_type": "Mouth",
"value": "Lipstick"
},
{
"trait_type": "Offhand",
"value": "Gloves"
},
{
"trait_type": "Background",
"value": "Off White D"
}
]
}
```
--------------------------------
### Clone Chainbase AVS Setup Repository
Source: https://docs.chainbase.com/node/operator
Clones the official Chainbase AVS setup repository from GitHub to your local machine. This repository contains the necessary scripts and configurations for running the operator node.
```shell
git clone https://github.com/chainbase-labs/chainbase-avs-setup
```
--------------------------------
### Ethereum Blobs Table Documentation and Sample
Source: https://docs.chainbase.com/catalog/OtherEvm/Ethereum_Classic
Provides documentation for the 'blobs' column in the Ethereum dataset, detailing its structure and purpose. Includes an embedded sample of the data for the 'blobs' table, allowing users to view typical entries.
```APIDOC
EthereumBlobsTable:
Description:
- Provides schema and metadata for the 'blobs' column.
- Source: https://doc-embed-app.chainbasehq.com/columns/ethereum.blobs
SampleData:
- Displays sample records from the 'blobs' table.
- Source: https://doc-embed-app.chainbasehq.com/data/ethereum.blobs
Usage:
- Useful for understanding the structure and content of blob data on the Ethereum blockchain.
```
--------------------------------
### Get ERC20 Transfers using Axios in JavaScript
Source: https://docs.chainbase.com/platform/usecases/token-api/get-erc20-transfers-by-contract
Shows how to fetch ERC20 token transfers via the Chainbase API using the `axios` library in JavaScript. Requires `axios` installation (`npm install axios`) and a Chainbase API key. Outputs transfer data to the console.
```javascript
const axios = require('axios');
const network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
const contract_addr = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; // Take Matic Token's contract address as an example.
const CHAINBASE_API_KEY = 'YOUR_API_KEY'; // Replace with your actual API key
const options = {
url: `https://api.chainbase.online/v1/token/transfers?chain_id=${network_id}&contract_address=${contract_addr}&page=1&limit=5`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY,
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### Configure Environment Variables
Source: https://docs.chainbase.com/node/operator
Sets up the `.env` file by copying the example configuration. This file is crucial for storing sensitive information and node-specific settings required for the operator.
```shell
cp .env.example .env
```
--------------------------------
### Get NFT Owners with Chainbase API using Axios (JavaScript)
Source: https://docs.chainbase.com/platform/usecases/nft-api/get-nft-owners-by-collection
Shows how to retrieve NFT owners for a collection via the Chainbase API using the `axios` library in JavaScript. Requires `axios` installation (`npm install axios`) and a Chainbase API key. Outputs owner data.
```JavaScript
const network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
const contract_addr = '0xed5af388653567af2f388e6224dc7c4b3241c544'; // Take Azuki's contract address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/nft/owners?chain_id=${network_id}&contract_address=${contract_addr}`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### JWT Payload Component Example
Source: https://docs.chainbase.com/api-reference/jtw
An example of the JSON structure for a JWT payload, including the audience ('aud') for the token and its expiration time ('exp') in Unix timestamp format.
```json
{
"aud": "chainbase.com",
"exp": 1690523501
}
```
--------------------------------
### Ethereum Transactions Sample Data
Source: https://docs.chainbase.com/catalog/OtherEvm/re.al
Illustrates a sample dataset for Ethereum transactions, showing typical transaction records and their fields.
```HTML
```
--------------------------------
### Ethereum Blobs Schema and Sample
Source: https://docs.chainbase.com/catalog/OtherEvm/Gobbl_Testnet
Documentation for the schema and sample data of Ethereum blobs. This includes column descriptions and example data structures for blob transactions on the Ethereum network.
```APIDOC
Ethereum Blobs Column Descriptions:
URL: https://doc-embed-app.chainbasehq.com/columns/ethereum.blobs
Content: Provides detailed descriptions of the columns available for Ethereum blob data.
Ethereum Blobs Sample Data:
URL: https://doc-embed-app.chainbasehq.com/data/ethereum.blobs
Content: Displays sample data for Ethereum blobs, illustrating typical data entries.
```
--------------------------------
### Ethereum Transaction Logs Table Sample Data (APIDOC)
Source: https://docs.chainbase.com/catalog/OtherEvm/Kroma
Presents sample data from the Ethereum Transaction Logs table, showcasing typical log entries and their associated transaction data.
```APIDOC
```
--------------------------------
### Get Top Token Holders using Axios API
Source: https://docs.chainbase.com/platform/usecases/token-api/get-top-token-holders
Shows how to retrieve top token holders via the Chainbase API using the `axios` library in JavaScript. Requires installation of `axios` and a Chainbase API key.
```JavaScript
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
token_addr = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; // Take MATIC token address as an example.
const axios = require('axios');
const options = {
url: `https://api.chainbase.online/v1/token/top-holders?chain_id=${network_id}&contract_address=${token_addr}&page=1&limit=5`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
}; חיצוני axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```
--------------------------------
### Ethereum Transaction Logs Schema and Sample
Source: https://docs.chainbase.com/catalog/OtherEvm/Gobbl_Testnet
Documentation for the schema and sample data of Ethereum transaction logs. This covers column descriptions and example data for logs generated by Ethereum transactions.
```APIDOC
Ethereum Transaction Logs Column Descriptions:
URL: https://doc-embed-app.chainbasehq.com/columns/ethereum.transaction_logs
Content: Details the structure and meaning of columns within Ethereum transaction log data.
Ethereum Transaction Logs Sample Data:
URL: https://doc-embed-app.chainbasehq.com/data/ethereum.transaction_logs
Content: Presents sample records of Ethereum transaction logs for analysis.
```
--------------------------------
### Example NFT Owner Data Structure
Source: https://docs.chainbase.com/platform/usecases/nft-api/get-nft-owners-by-collection
This snippet illustrates the structure of the data returned by the 'Get NFT owners by collection' API endpoint, showing individual owner addresses and their respective NFT totals.
```jsx
[
{
"address": "0xd46c8648f2ac4ce1a1aace620460fbd24f640853",
"total": 374
},
{
"address": "0xff3879b8a363aed92a6eaba8f61f1a96a9ec3c1e",
"total": 290
},
{
"address": "0x29469395eaf6f95920e59f858042f0e28d98a20b",
"total": 224
},
{
"address": "0x8e0788650afeedfb26f26bee874aed02688b2108",
"total": 117
},
{
"address": "0x54be3a794282c030b15e43ae2bb182e14c409c5e",
"total": 113
},
{
"address": "0x2ae6b0630ebb4d155c6e04fcb16840ffa77760aa",
"total": 112
},
{
"address": "0x0377aa308c44855217a1d900f39828d5d9def153",
"total": 101
},
{
"address": "0xb9330e17d30c57b4b192ae58140a72e0bfd3b718",
"total": 91
},
{
"address": "0x5d7aaa862681920ea4f350a670816b0977c80b37",
"total": 91
},
{
"address": "0x071b1116cc023763885865cfcc2e1daccc277419",
"total": 90
},
{
"address": "0x1e1936adba1d18be91694727086e40647decf375",
"total": 71
},
{
"address": "0x5e850e5a673dc4c9ce7790a0b2790937b11c8008",
"total": 70
},
{
"address": "0xa8189c566c8b602e23b016da819c11dae50160d6",
"total": 69
},
{
"address": "0xf6fe23577bd0e7a70421706ee1a4c526cadcbaf3",
"total": 63
},
{
"address": "0x96d3b7f663ed680f316781680464045f3458440b",
"total": 59
},
{
"address": "0x72695c2af4193029e0669f2c01d84b619d8c25e7",
"total": 49
},
{
"address": "0x04d7c2ee4cdbac9a0fc46d3e35e79aba5cca471d",
"total": 47
},
{
"address": "0xb0e59b0cf8f705f94c3d523aebbf8d4703a24fad",
"total": 44
},
{
"address": "0xd4f072b18c7a31d50bbf1df729b68e9ace7bc0d9",
"total": 41
},
{
"address": "0x3d9623f9f8c682d949be2bcaf3f692ab9c40b1d4",
"total": 40
}
]
```
--------------------------------
### Ethereum Transaction Logs Sample Data
Source: https://docs.chainbase.com/catalog/OtherEvm/re.al
Provides a sample dataset for Ethereum transaction logs, demonstrating the format and content of emitted log events.
```HTML
```
--------------------------------
### Ethereum Transaction Logs Sample Data
Source: https://docs.chainbase.com/catalog/OtherEvm/Kroma_Sepolia
Provides a sample of the 'transaction_logs' table data from the Ethereum dataset. This sample is embedded via an iframe.
```APIDOC
APIDOC:
URL: https://doc-embed-app.chainbasehq.com/data/ethereum.transaction_logs
Description: Sample data for the Ethereum Transaction Logs table.
```
--------------------------------
### Axios ERC20 Token Metadata (JavaScript)
Source: https://docs.chainbase.com/platform/usecases/token-api/get-token-metadata
Fetches ERC20 token metadata using the Chainbase API with the `axios` library in JavaScript. Ensure `axios` is installed (`npm install axios --save`). Requires a Chainbase API key, network ID, and contract address.
```javascript
const axios = require('axios');
network_id = '1'; // See https://docs.chainbase.com/reference/supported-chains to get the id of different chains.
contract_addr = '0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0'; // Take Matic Token's contract address as an example.
const options = {
url: `https://api.chainbase.online/v1/token/metadata?chain_id=${network_id}&contract_address=${contract_addr}`,
method: 'GET',
headers: {
'x-api-key': CHAINBASE_API_KEY, // Replace the field with your API key.
'accept': 'application/json'
}
};
axios(options)
.then(response => console.log(response.data.data))
.catch(error => console.log(error));
```