Skip to main content

Ironfish API

Public Iron Fish API

GitHub Repo

Schema

generator client {
provider = "prisma-client-js"
previewFeatures = ["interactiveTransactions"]
}

datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}

model Event {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
type EventType
occurred_at DateTime @db.Timestamp(6)
points Int
user_id Int
deleted_at DateTime? @db.Timestamp(6)
deposit_id Int? @unique(map: "uq_events_on_deposit_id")
block_id Int? @unique(map: "uq_events_on_block_id")
deposit Deposit? @relation(fields: [deposit_id], references: [id])
block Block? @relation(fields: [block_id], references: [id])
user User @relation(fields: [user_id], references: [id])
url String? @db.VarChar

@@index([deposit_id], name: "index_events_on_deposit_id")
@@index([block_id], name: "index_events_on_block_id")
@@index([user_id], name: "index_events_on_user_id")
@@map("events")
}

model User {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
email String @unique(map: "uq_users_on_email") @db.VarChar
graffiti String @unique(map: "uq_users_on_graffiti") @db.VarChar
country_code String @db.VarChar
email_notifications Boolean @default(false)
last_login_at DateTime? @db.Timestamp(6)
discord String? @db.VarChar
telegram String? @db.VarChar
github String? @db.VarChar
events Event[]
points UserPoints?
node_uptime NodeUptime?

@@index([email], name: "index_users_on_email")
@@index([graffiti], name: "index_users_on_graffiti")
@@map("users")
}

model NodeUptime {
id Int @id @default(autoincrement())
user User @relation(fields: [user_id], references: [id])
user_id Int @unique
total_hours Int @default(0)
last_checked_in DateTime @default(now()) @db.Timestamp(6)

@@index([user_id], name: "index_node_uptime_on_user_id")
@@map("node_uptimes")
}

model Block {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
hash String @db.VarChar
sequence Int
previous_block_hash String? @db.VarChar
main Boolean
network_version Int
transactions_count Int
timestamp DateTime @db.Timestamp(6)
time_since_last_block_ms Int?
graffiti String @db.VarChar
size Int?
difficulty BigInt
blocks_transactions BlockTransaction[]
event Event?

@@unique([hash, network_version], name: "uq_blocks_on_hash_and_network_version", map: "uq_blocks_on_hash_and_network_version")
@@index([hash], name: "index_blocks_on_hash")
@@index([hash, network_version], name: "index_blocks_on_hash_and_network_version")
@@index([sequence, network_version], name: "index_blocks_on_sequence_and_network_version")
@@map("blocks")
}

model Transaction {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
hash String @db.VarChar
network_version Int
fee Int
size Int
notes Json
spends Json
blocks_transactions BlockTransaction[]

@@unique([hash, network_version], name: "uq_transactions_on_hash_and_network_version", map: "uq_transactions_on_hash_and_network_version")
@@index([hash], name: "index_transactions_on_hash")
@@index([hash, network_version], name: "index_transactions_on_hash_and_network_version")
@@map("transactions")
}

model BlockTransaction {
block Block @relation(fields: [block_id], references: [id])
block_id Int
transaction Transaction @relation(fields: [transaction_id], references: [id])
transaction_id Int
index Int?

@@id([block_id, transaction_id])
@@index([block_id], name: "index_blocks_transactions_on_block_id")
@@index([transaction_id], name: "index_blocks_transactions_on_transaction_id")
@@map("blocks_transactions")
}

model FaucetTransaction {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
email String? @db.VarChar
public_key String @db.VarChar
started_at DateTime? @db.Timestamp(6)
completed_at DateTime? @db.Timestamp(6)
tries Int @default(0)
hash String? @db.VarChar

@@index([email], map: "index_faucet_transactions_on_email")
@@index([public_key], map: "index_faucet_transactions_on_public_key")
@@index([hash], map: "index_faucet_transactions_on_hash")
@@map("faucet_transactions")
}

model BlockDaily {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
date DateTime @db.Timestamp(6) @unique(map: "uq_blocks_daily_on_date")
unique_graffiti_count Int
average_block_time_ms Int
blocks_count Int
blocks_with_graffiti_count Int
cumulative_unique_graffiti Int
transactions_count Int
average_difficulty_millis BigInt
chain_sequence Int

@@index([date], map: "index_blocks_daily_on_date")
@@map("blocks_daily")
}

model Version {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
version String @db.VarChar

@@map("versions")
}

enum EventType {
BLOCK_MINED
BUG_CAUGHT
COMMUNITY_CONTRIBUTION
PULL_REQUEST_MERGED
SOCIAL_MEDIA_PROMOTION
NODE_UPTIME
SEND_TRANSACTION

@@map("event_type")
}

model UserPoints {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
user_id Int @unique
total_points Int @default(0)
block_mined_points Int @default(0)
block_mined_last_occurred_at DateTime? @db.Timestamp(6)
bug_caught_points Int @default(0)
bug_caught_last_occurred_at DateTime? @db.Timestamp(6)
community_contribution_points Int @default(0)
community_contribution_last_occurred_at DateTime? @db.Timestamp(6)
pull_request_merged_points Int @default(0)
pull_request_merged_last_occurred_at DateTime? @db.Timestamp(6)
social_media_promotion_points Int @default(0)
social_media_promotion_last_occurred_at DateTime? @db.Timestamp(6)
node_uptime_points Int @default(0)
node_uptime_last_occurred_at DateTime? @db.Timestamp(6)
send_transaction_points Int @default(0)
send_transaction_last_occurred_at DateTime? @db.Timestamp(6)
user User @relation(fields: [user_id], references: [id])

@@index([user_id], map: "index_user_points_on_user_id")
@@index([block_mined_points], map: "index_user_points_on_block_mined")
@@index([bug_caught_points], map: "index_user_points_on_bug_caught")
@@index([community_contribution_points], map: "index_user_points_on_community_contribution")
@@index([pull_request_merged_points], map: "index_user_points_on_pull_request_merged")
@@index([social_media_promotion_points], map: "index_user_points_on_social_media_promotion")
@@index([node_uptime_points], map: "index_user_points_on_node_uptime")
@@index([send_transaction_points], map: "index_user_points_on_send_transaction")
@@map("user_points")
}

model Deposit {
id Int @id @default(autoincrement())
created_at DateTime @default(now()) @db.Timestamp(6)
updated_at DateTime @default(now()) @updatedAt @db.Timestamp(6)
transaction_hash String @db.VarChar
block_hash String @db.VarChar
graffiti String @db.VarChar
block_sequence Int
network_version Int
main Boolean
amount Int
event Event?

@@map("deposits")
@@unique([transaction_hash, graffiti], name: "uq_deposits_on_transaction_hash_and_graffiti", map: "uq_deposits_on_transaction_hash_and_graffiti")
}

model DepositHead {
id Int @id
block_hash String @db.VarChar

@@map("deposit_head")
}