Create database
SDK Init
Python
db_name = "library"
dataset_desc = DatasetDesc(
description="The eBookLibrary database is designed to store and manage a collection of electronic books, facilitating easy access, organization, and retrieval of eBook information for users.",
cover_img="https://ipfs.glitterprotocol.dev/ipfs/QmZHD8P65mghh818W4hb4ReEZ1G5XxFzqGgV5hkQmHMtWJ",
cid="",
website=Website(),
app=[App(
img="https://ipfs.glitterprotocol.dev/ipfs/QmZHD8P65mghh818W4hb4ReEZ1G5XxFzqGgV5hkQmHMtWJ",
name="lib3",
website="https://liber3.eth.limo/"
)],
storage="98G",
row_cnt=1430000,
)
r = glitter_cli.create_dataset(db_name, "https://library.glitterprotocol.xyz", dataset_desc)
JavaScript
import { MnemonicKey, LCDClient, Coins, Numeric } from 'glitter';
const HOST = "https://orlando-api.glitterprotocol.tech"
const CHAIN_ID = "glitter_12001-4"
const mnemonicKey = new MnemonicKey({
mnemonic: "lesson police usual earth embrace someone opera season urban produce jealous canyon shrug usage subject cigar imitate hollow route inhale vocal special sun fuel"
});
const client = new LCDClient({
URL: HOST,
chainID: CHAIN_ID,
gasPrices: Coins.fromString('0.15agli'),
gasAdjustment: Numeric.parse(1.5),
})
const key = new MnemonicKey({
mnemonic: mnemonicKey,
account: 0,
index: 0,
});
const glitterCli = client.db(key);
Golang
cli := New()
ctx := context.Background()
datasetName := "library_test"
workStatus := chaindepindextype.ServiceStatus(2)
hosts := "https://anybt.glitterprotocol.xyz"
managageAddr := "glitter178uwquz93vwkc292s5n56kwq4cc2hnxfvlujmt"
description := "{}"
duration := int64(10000)
resp, err := cli.CreateDataset(ctx, datasetName, workStatus, hosts, managageAddr, description, duration)
t.Log(utils.ConvToJSON(resp))
t.Log(err)