
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@fizzyflow/suisql
Advanced tools
SuiSQL is a library and set of tools for working with decentralized SQL databases on the Sui blockchain and Walrus protocol.
SuiSQL is a library and set of tools for working with decentralized SQL databases on the Sui blockchain and Walrus protocol.
It brings the power and familiarity of SQL relational databases into the world of Web3 β enabling developers to store, query, and verify tamper-proof data with full SQL support, minimal setup, and no centralized backend.
SuiSQL runs a local, in-memory SQLite engine on the client. All write operations are stored locally and synced to the blockchain in batches using one of three strategies:
The library automatically selects the best method based on: memory size, sui object limits, user cost (gas/SUI/WAL). Reading is always free and public.Higher-layer encryption is possible but not built-in.
npm install @fizzyflow/suisql
import SuiSql from '@fizzyflow/suisql';
// minimum setup:
const simpleDb = new SuiSql({ name: 'UniqueDbIdString', suiClient: suiSdkClient, });
// all params:
const db = new SuiSql({
id: '0x50edd3b7a0f2c5b0093c541b9f28be1754a639f5ea8a7d45c9cd01563aae23b3', // if you already know it
name: 'UniqueDbIdString', // or let SuiSQL get db id by the unique name
network: 'testnet', // if you are ready, 'mainnet'
suiClient: suiSdkClient, // initialize it with Sui SDK or with Suidouble library
debug: true, // and watch console
// for write access:
signer: keypair, // type { Signer } from '@mysten/sui/cryptography';
signAndExecuteTransaction: sign, // or function, if you build dApp ( see below )
currentWalletAddress: '0x50..fa',// required, if no signer provided but signAndExecuteTransaction is
// for walrus write access
walrusClient: walrusSdkClient, // initialize it with Walrus SDK
publisherUrl: 'https://publisher.walrus-testnet.walrus.space',// or with URL of the publisher service
// optionally, set other aggregatorUrl
aggregatorUrl: 'https://aggregator.walrus-testnet.walrus.space',
});
name
.Sui Write operations params:
Sui's TS SDK Signer object (like keypair). Easiest for backend usage, not safe for dApps:
signAndExecuteTransaction as a function. So you can re-use walletAdapter in your dApp:
const signAndExecuteTransaction = async (tx) => {
const results = await walletAdapter.features['sui:signAndExecuteTransaction'].signAndExecuteTransaction({
transaction: tx,
});
return results.digest;
};
SuiSQL integrates with the Walrus protocol to support large and efficient database storage and syncing beyond Sui object size limits. There are two ways to connect to Walrus inside the library:
Aggregator & Publisher URLs. Easy to configure β just plug in URLs. Use public endpoints on testnet. Ideal for quick setup or lightweight apps.
Walrus SDK Client. Full control over sync logic and signing. Best for advanced usage, self-hosting, and production deployments.
Walrus methods can be mixed together, you can use aggregatorUrl for read operations and walrusClient for sync writes. Moreover, for small test databases, SuiSQL will work ok without Walrus params at all (fitting everything in the Sui object).
Additional way to sync database to Walrus implemented in SuiSQL is the delayed Walrus sync.
Most SuiSQL methods are asynchronous and return Promises β you must await them unless explicitly stated otherwise.
Performs full database initialization, including: querying metadata and data from the Sui blockchain, syncing from Walrus, reconstructing the full SQLite database in memory.
Returns the current state of the database after setup:
You can also access the current database state at any time via: db.state
property.
Executes multiple SQL commands from a single SQL text block.
const state = await db.initialize();
if (state == 'EMPTY') {
// fill the fresh database
await db.iterateStatements(`
DROP TABLE IF EXISTS employees;
CREATE TABLE employees( id integer primary key, name text,
designation text, manager integer,
hired_on date, salary integer,
commission float, dept integer);
INSERT INTO employees VALUES (NULL,'JOHNSON','ADMIN',6,'1990-12-17',18000,NULL,4);
INSERT INTO employees VALUES (NULL,'HARDING','MANAGER',9,'1998-02-02',52000,300,3);
INSERT INTO employees VALUES (NULL,'TAFT','SALES I',2,'1996-01-02',25000,500,3);
`);
}
Runs a SQL query against the local SuiSQL database.
const rows = await db.query(
'SELECT * FROM transactions WHERE category = ? AND amount > ?',
['pink boots', 100]
);
console.log(rows);
/*
[
{ id: 1, category: 'pink boots', amount: 399 },
{ id: 5, category: 'pink boots', amount: 199 }
]
*/
Creates a prepared statement object for the given SQL query. Use this method when working with large result sets that you want to iterate over efficiently.
const stmt = await db.prepare("SELECT * FROM employees;");
const count = await stmt.forEach((row) => {
console.log(row);
// row: { designation: 'CEO', nbr: 1, avg_salary: 75000 }
// row: { designation: 'MANAGER', nbr: 3, avg_salary: 54000 }
// row: { designation: 'CPA', nbr: 1, avg_salary: 35000 }
});
Syncs the current in-memory SQLite database state to the Sui blockchain and (if needed) to Walrus.
The library will automatically determine the most efficient sync method:
You can override or enhance that behavior using optional flags:
boolean
Force full Walrus sync, even if not required by size or structureboolean
Performs calculations for delayed Walrus sync during normal sync flowawait db.query(`
INSERT INTO transactions (category, amount) VALUES ('cloud rent', 999);
`);
await db.sync(); // Will choose best sync method
// await db.sync({
// forceWalrus: true,
// forceExpectWalrus: true,
// });
SuiSQL supports delayed syncing, allowing you to separate on-chain write confirmation from the heavy blob upload to Walrus. This unlocks powerful workflows for performance, batching, and decentralized collaboration.
Client session:
await db.sync({
forceExpectWalrus: true // Calculates expected blob_id without uploading it to walrus, and saves in the SuiSQL object along with patches
});
Other session (with params required for walrus write):
await db.initialize();
await db.fillExpectedWalrus();
SuiSQL on-chain package intelligently manages Walrus blobs under the hood for maximum efficiency
FAQs
SuiSQL is a library and set of tools for working with decentralized SQL databases on the Sui blockchain and Walrus protocol.
We found that @fizzyflow/suisql demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.