studio-db
FreeNo executable scriptsNot checkedQuery Studio deployment PostgreSQL databases for transaction debugging and analytics
About this skill
Studio Database Debugging
Query and debug the genlayer_state database for transaction issues.
Connection
For cluster access setup and connection workflow, see:
devexp-apps-workload/.claude/skills/studio-db/SKILL.md
Quick connect (after setup):
export PATH="/opt/homebrew/share/google-cloud-sdk/bin:/opt/homebrew/bin:$PATH"
DBHOST=$(kubectl get secret database-config -n <namespace> -o jsonpath='{.data.DBHOST}' | base64 -d)
DBPASSWORD=$(kubectl get secret database-password -n <namespace> -o jsonpath='{.data.DBPASSWORD}' | base64 -d)
echo "<SQL>" | kubectl run pg-query --rm -i --image=postgres:16 --restart=Never \
--namespace=<namespace> --env="PGPASSWORD=$DBPASSWORD" -- \
psql -h "$DBHOST" -p 5432 -U postgres -d genlayer_state -t
Transaction Table Schema
Primary table for debugging (transactions):
| Column | Type | Description |
|---|---|---|
| hash | VARCHAR(66) | Primary key, tx identifier |
| status | ENUM | Transaction lifecycle status |
| from_address | VARCHAR | Sender address |
| to_address | VARCHAR | Recipient/contract address |
| nonce | INTEGER | Tx sequence number |
| value | INTEGER | Transaction value |
| type | INTEGER | Tx type (0-3) |
| created_at | TIMESTAMP | When tx was created |
| input_data | JSONB | Contract call input |
| data | JSONB | Transaction data payload |
| consensus_data | JSONB | Final consensus results |
| consensus_history | JSONB | Full voting history |
| contract_snapshot | JSONB | Contract state at execution |
| appealed | BOOLEAN | Was tx appealed |
| appeal_failed | INTEGER | Appeal failure count |
| appeal_undetermined | BOOLEAN | Appeal resulted in undetermined |
| appeal_leader_timeout | BOOLEAN | Leader timeout during appeal |
| appeal_validators_timeout | BOOLEAN | Validators timeout during appeal |
| leader_timeout_validators | JSONB | Validators that timed out |
| worker_id | VARCHAR | Which worker processed tx |
| triggered_by_hash | VARCHAR(66) | Parent tx hash (for tx chains) |
| blocked_at | TIMESTAMP | When/if tx got blocked |
Transaction Statuses
PENDING → ACTIVATED → PROPOSING → COMMITTING → REVEALING → ACCEPTED → FINALIZED
↘ UNDETERMINED
↘ LEADER_TIMEOUT
↘ VALIDATORS_TIMEOUT
↘ CANCELED
Other Tables
- current_state: Global chain state (
id,dataJSONB,balance) - validators: Validator configs (
id,address,stake,provider,model,plugin) - llm_providers: LLM provider configurations
- snapshot: Compressed state snapshots (
snapshot_id,state_data,transaction_data)
Common Debugging Queries
Find transaction by hash
SELECT hash, status, from_address, to_address, created_at,
consensus_data, worker_id
FROM transactions WHERE hash = '0x...';
List stuck/problematic transactions
SELECT hash, status, created_at, worker_id
FROM transactions
WHERE status IN ('UNDETERMINED', 'LEADER_TIMEOUT', 'VALIDATORS_TIMEOUT')
ORDER BY created_at DESC LIMIT 20;
Transaction status distribution
SELECT status, COUNT(*) as count
FROM transactions
GROUP BY status ORDER BY count DESC;
Recent transactions
SELECT hash, status, from_address, created_at
FROM transactions ORDER BY created_at DESC LIMIT 10;
Transactions with appeals
SELECT hash, status, appealed, appeal_undetermined, appeal_failed,
appeal_leader_timeout, appeal_validators_timeout
FROM transactions WHERE appealed = true
ORDER BY created_at DESC LIMIT 20;
Find triggered transactions (tx chains)
SELECT t1.hash as parent, t2.hash as child, t2.status
FROM transactions t1
JOIN transactions t2 ON t2.triggered_by_hash = t1.hash
WHERE t1.hash = '0x...';
Transactions by worker
SELECT worker_id, status, COUNT(*)
FROM transactions
WHERE created_at > NOW() - INTERVAL '24 hours'
GROUP BY worker_id, status
ORDER BY worker_id, count DESC;
Check consensus history for a tx
SELECT hash, status,
jsonb_pretty(consensus_history) as history
FROM transactions WHERE hash = '0x...';
Write Operations
CAUTION: Before any UPDATE/DELETE:
- First SELECT to verify affected rows
- Ask user for explicit confirmation
- Prefer dev/stg for testing
Reset stuck transaction
-- Verify first
SELECT hash, status FROM transactions
WHERE hash = '0x...' AND status = 'UNDETERMINED';
-- Then update (after confirmation)
UPDATE transactions SET status = 'PENDING' WHERE hash = '0x...';
Full Schema
Models: backend/database_handler/models.py
Migrations: backend/database_handler/migration/versions/
Tx processor: backend/database_handler/transactions_processor.py
Install studio-db in Claude Code & Claude Desktop
Sign up to install this skill
Create a free account to reveal the install command and save the skill to your library.
- Reveal the one-line install command
- Save skills to your synced library
- Get notified when skills update
Allowed tools
Tools this skill is permitted to call.
No restriction — this skill can use any tool.
FAQ
What does the studio-db skill do?
Query Studio deployment PostgreSQL databases for transaction debugging and analytics
How do I install the studio-db skill?
Copy the skill folder into ~/.claude/skills (the Claude Code tab above does this in one command), or install it as a plugin.
Does the studio-db skill run scripts?
No, this skill is instructions only (SKILL.md) with no executable scripts.
Related skills
skill-creator
Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
by Anthropicdiscernment-nudge
After you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
by Anthropicdata-consolidate
Joins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
by Anthropicinspection-to-capa
Runs the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…
by Anthropic