KUB Developers (@kubdevs) header
KUB Developers (@kubdevs) profile picture

Blockchain infrastructure for business · Built for KUB devs · News, updates, content, and code

Joined May 2026
Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)Photo by KUB Developers (@kubdevs)
KUB Docs MCP is now available! Connect the KUB Docs directly to your AI coding assistant: Claude, Cursor, Gemini, Codex, whatever you build in. Ask about RPC configuration, KAP-20, deployment, and get answers grounded in the actual docs, no tab-switching.
7
9
3
17
2,187
Zuch Upgrade is now on KUB Testnet. Calling all developers to check it out!
ZURICH HARDFORK IS DEPLOYED ON KUB CHAIN TESTNET 5 KEY UPGRADES. ONE MAJOR EVOLUTION. The next chapter of KUB Chain is taking shape! The Zurich Hardfork has been deployed on KUB Chain Testnet, introducing five major upgrades designed to enhance network performance, expand smart contract capabilities, and empower the next generation of Web3 builders. Here’s what’s new: 🔥 KIP-100 Introducing automated transaction base-fee burning directly at the protocol level. 🔐 EIP-7702 Unlocking smart contract capabilities for existing wallets, enabling more flexible Web3 experiences. ⚡ 1-Second Block Time Reducing block time from 3 seconds to 1 second for a more responsive network. 💻 Solidity Upgrade Supporting newer Solidity features for modern smart contract development. ⚙️ Go-Ethereum Upgrade Upgrading the underlying execution client to support modern Ethereum capabilities. TESTNET IS LIVE. MAINNET IS NEXT. Explore the network, monitor transactions, and discover what’s coming to KUB Chain. 🔎 KUB Chain Testnet Explorer: testnet.kubscan.com/ Stay tuned for the upcoming Mainnet upgrade! 💚 #KUBChain #ZurichHardfork #KIP100 #EIP7702 #Web3 #BlockchainDevelopment
1
33
KUB Developers retweeted
Ever wanted to build your own game? Join AI ARCADE ON KUB CHAIN, a one-day Workshop & Hackathon! 🔥 LEARN from experts 🔥 BUILD games with AI 🔥 PITCH & compete for rewards No team or blockchain experience needed! 📅 15 December 2026 📍FYI Center, Bangkok FREE TO JOIN — LIMITED SPOTS!
1
2
10
600
What if your next KUB app started with one sentence? KUB Studio is coming. It’s an AI app creator built for KUB: you describe the app you want in plain language, and KUB Studio builds and runs it live. When your idea needs on-chain logic, it can include smart contracts on KUB as part of the build. Early sign-ups will receive 100 free credits when KUB Studio launches. To get on the waitlist, follow @kubdevs on X and KUB Developers on Facebook, then enter your email on the waitlist page. If you’ve got an idea you’ve been meaning to ship on KUB, now’s a good time to start writing it down. Join the waitlist: studio.kubdeveloper.com/
5
4
10
949
KUB Developers retweeted
🕹️ ARE YOU READY TO BUILD? 🎮 Every legendary game starts with an idea. Now, it's your turn to bring yours to life! 🚀 Get ready for AI Arcade on KUB Chain, where AI, creativity, and blockchain come together to build the next generation of onchain games. 💚 REGISTRATION OPENS SOON! The countdown has begun. Are you ready, Player One? 👾
4
2
10
746
KUB Developers retweeted
🔥 EVERY TRANSACTION. A STEP TOWARD THE BURN. A new chapter of KUB Coin tokenomics is coming! Introducing KIP-100, an automated on-chain burning mechanism that makes transaction fee burning part of the KUB Chain protocol. With every transaction, the base fee is automatically burned on-chain, creating a more transparent and systematic approach to KUB Coin tokenomics. KIP-100 is coming with the Zurich Hardfork. Stay tuned for what's next! 💚 #KUBChain #ZurichHardfork #KIP100
1
4
2
11
1,480
KUB Developers retweeted
SOMETHING BIG IS COMING TO KUB CHAIN. The Zurich Hardfork is on the horizon, bringing 5 major upgrades across network performance, smart wallet capabilities, developer experience, core infrastructure, and on-chain tokenomics. Faster blocks. Smarter wallets. More possibilities for builders. Five upgrades. One stronger KUB Chain. Stay tuned as we unveil what's next! #KUBChain #ZurichHardfork
4
4
15
1,922
Building an app on KUB? Your "Connect Wallet" button can find KUB Wallet without guessing what is sitting in window.ethereum. KUB Wallet exposes a standard EIP-1193 provider and offers two ways to reach it. Inside the KUB Wallet, it announces itself through EIP-6963 with the rdns com.kubwallet. When it isn't injected, users can connect through WalletConnect v2 with a QR code on desktop or a deep link on mobile web, then approve in the KUB Wallet app. Both paths give you the same provider interface, so the rest of your code stays the same. The recommended flow is simple. Dispatch eip6963:requestProvider, listen for announcements, and match on rdns rather than wallet name, because rdns is the stable identifier when several wallets inject into one page. If com.kubwallet shows up, offer one-tap connect. If it doesn't, fall back to WalletConnect. If you use wagmi v2, discovery already happens for you: look up the connector with id com.kubwallet. Newer viem versions also ship bitkub and bitkubTestnet chain definitions. Once connected, make sure users are on the right network. KUB Mainnet is chain ID 96 (RPC rpc.kubchain.io), and KUB Testnet is chain ID 25925 (RPC via WalletConnect v2 with a desktop QR code or a mobile web deep link). The docs include a helper that calls wallet_switchEthereumChain and falls back to wallet_addEthereumChain on error 4902. One more detail: KUB Wallet accounts are smart accounts, but your app-side flow is still plain EIP-1193. Start with the integration guide, test against Testnet, and tell us what you're building: via WalletConnect v2 with a desktop QR code or a mobile web deep linkBuilding an app on KUB? Your "Connect Wallet" button can find KUB Wallet without guessing what is sitting in window.ethereum. KUB Wallet exposes a standard EIP-1193 provider and offers two ways to reach it. Inside the KUB Wallet, it announces itself through EIP-6963 with the rdns com.kubwallet. When it isn't injected, users can connect through WalletConnect v2 with a QR code on desktop or a deep link on mobile web, then approve in the KUB Wallet app. Both paths give you the same provider interface, so the rest of your code stays the same. The recommended flow is simple. Dispatch eip6963:requestProvider, listen for announcements and match on rdns rather than wallet name, because rdns is the stable identifier when several wallets inject into one page. If com.kubwallet shows up, offer one-tap connect. If it doesn't, fall back to WalletConnect. If you use wagmi v2, discovery already happens for you: look up the connector with id com.kubwallet. Newer viem versions also ship bitkub and bitkubTestnet chain definitions. Once connected, make sure users are on the right network. KUB Mainnet is chain ID 96 (RPC rpc.kubchain.io) and KUB Testnet is chain ID 25925 (RPC rpc-testnet.kubchain.io). The docs include a helper that calls wallet_switchEthereumChain and falls back to wallet_addEthereumChain on error 4902. One more detail: KUB Wallet accounts are smart accounts, but your app-side flow is still plain EIP-1193. Start with the integration guide, test against Testnet, and tell us what you're building: bitkub-blockchain.gitbook.io…
1
2
69
Want cheaper, faster transactions for your app on KUB? KUB Layer 2 is an extension of the main KUB network, and you can start building on its testnet today. KUB Layer 2 is built on rollups. A rollup bundles many transactions into one compressed transaction and submits it to Layer 1, so the main chain processes far less data. For builders, that means a low-cost, high-speed environment for dApps and user transactions, while settlement still happens on KUB Layer 1. Connecting works like any EVM network. For the testnet, add RPC kublayer2.testnet.kubchain.i… with chain ID 259251 and currency tKUB, and use kublayer2.testnet.kubscan.co… as the explorer. When you're ready for production, Layer 2 Mainnet uses chain ID 9601 at kublayer2.kubchain.io. Getting test funds takes two steps. First, claim tKUB on KUB Testnet from the KUB Faucet, which gives 5 tKUB every 24 hours. Then use the bridge to KUB Layer 2 Testnet flow to move the amount you choose across, and follow the on-screen steps. Once the bridged tKUB lands, you can deploy and test with your usual EVM tooling. The Layer 2 page has the network details for both environments and the bridging steps: docs.kubchain.com/build-on-k…
45
Built an app on KUB and want it on the KUB Wallet app page? There's no form to fill in and no inbox to chase. Listings live in a public GitHub registry, and you add your app by opening a pull request. Check the requirements before you start. Your app must be live on KUB Mainnet, its contract source must be verified on KUB Scan, and it must be served over HTTPS with a valid certificate. The domain has to be one your team controls and has been registered for at least 90 days. Submitting takes three steps: fork github.com/kub-wallet/apps, add one directory containing your app.json, icon, and screenshots, and open a PR. Automated checks run within minutes. They confirm that the domain resolves, the certificate isn't close to expiry, the URL doesn't redirect to a different domain, your contracts exist and are verified on mainnet, and the domain isn't on a phishing blocklist. If a check fails, push fixes to the same branch rather than opening a new PR. Passing the checks makes your submission ready for review; it doesn't add the app yet. A reviewer then uses your app and reads what it asks users to sign, so plan for 7 to 14 business days and expect questions. Every addition needs two approvals, one of them from security, and approved apps ship in a weekly release. After you're listed, apps are re-verified every 90 to 180 days. Treat a domain change as a new submission and tell the team before you migrate. If your app has its own token, submit that separately through the Add New Tokens guide. The full guide is here: bitkub-blockchain.gitbook.io…. A listing is not a partnership, audit, or endorsement. It does give KUB Wallet users a reviewed path to your app.
1
1
431
Deploying your first Solidity contract to KUB and hitting invalid opcode: opcode 0x5f not defined? Two settings fix the most common Foundry errors on KUB, and the KUB Docs quickstart covers both. First, the EVM version. The KUB EVM predates the Shanghai upgrade, so it rejects the PUSH0 opcode that solc 0.8.20 and later emit by default. Add evm_version = "paris" to your foundry.toml under [profile.default]. You keep current Solidity language features, and because the setting applies to every forge command, the bytecode you verify matches the bytecode you deployed. Second, transaction type. KUB doesn't support EIP-1559 fee estimation, so forge create without the --legacy flag fails with "Failed to estimate EIP1559 fees". Adding --legacy sends a pre-EIP-1559 transaction with a plain gas price. With those set, the full flow is short. Point Foundry at rpc-testnet.kubchain.io. Get 5 tKUB every 24 hours from the KUB Faucet. Import your key into Foundry's encrypted keystore with cast wallet import deployer --interactive so it never sits in a .env file. Then deploy with forge create ... --account deployer --broadcast --legacy. To verify the source on KUB Scan, run forge verify-contract with --verifier blockscout and --verifier-url testnet.kubscan.com/api, or kubscan.com/api for mainnet. Keep in mind that the KUB Scan API allows 12 requests per minute per IP and blocks the IP for a minute if you go over, so don't loop verification calls in CI. Once your contract is live, the next steps in the docs walk you through connecting a frontend with wagmi or viem, launching a KAP token, and submitting your app to the KUB Developer Center. Full walkthrough: docs.kubchain.com/quickstart…
1
80
Your AI coding assistant may not know KUB's IDs, RPC endpoints, or standards, and when it guesses, it can get them wrong. Plug the official docs straight into it instead. KUB Docs runs a Model Context Protocol (MCP) server at docs.kubchain.com/~gitbook/m…. Add it as an HTTP MCP server, and your assistant can search KUB Docs and cite its answers, instead of relying on training data that may be out of date. It works with Claude (Web and Desktop: Settings > Connectors > Add custom connector), Cursor, Codex, and VS Code (Copilot). In Claude Code, it takes one command: claude mcp add --transport http kub-docs docs.kubchain.com/~gitbook/m… Building an app that connects to KUB Wallet? The KUB Wallet docs have their own Docs MCP server, covering integration methods such as EIP-6963 and WalletConnect v2. Add both: KUB Docs for the network side (RPC, contracts, KAP standards) and the KUB Wallet docs for wallet integration. To test the connection, try a prompt from the docs: "Search KUB Docs for the KUB Mainnet RPC URL and chain ID," or "Find the guide for deploying a smart contract on KUB Testnet. Summarize the required setup." The server uses HTTP transport, so tools that only support stdio or SSE can't connect. If your tool can't use MCP, KUB Docs also publishes llms.txt (a page index) and llms-full.txt (a full-text snapshot) that you can load as context. Set it up here: docs.kubchain.com/build-with…
1
1
104
Your contract is on the KUB Testnet. Now your users need a frontend to interact with it. The KUB Docs "Build an App on KUB" guide walks through a small Next.js app using wagmi and viem that connects a wallet, reads from a contract, and writes to it. Setup uses tools you likely already know: create-next-app, then wagmi, viem, and TanStack Query. Recent viem versions include KUB definitions (bitkub and bitkubTestnet in viem/chains). You can also define KUB Testnet (Chain ID 25925) and KUB Mainnet (Chain ID 96) yourself with defineChain, which works on any version. The guide also covers three details that cause real bugs. First, handle the wrong-network case. KUB is a custom network in MetaMask, so first-time users are often on another chain. Without useSwitchChain, the write button can stay on "Confirm in Wallet" forever if the user misses the popup. Second, declare your ABI with "as const", or wagmi cannot infer function names and types. Third, use ssr: true with cookieStorage and cookieToInitialState so the connection state doesn't flash on page load. Also remember to fund the browser wallet from the KUB Faucet, not just your deployer key. When your app is ready, submit it to the KUB Developer Center to be listed in the KUB Ecosystem directory. Build it step by step: docs.kubchain.com/quickstart…
1
3
7
1,094
If you're moving liquidity onto KUB network, or helping users get from Ethereum to KUB, you'll reach for KUB Bridge. Here's what it actually does, and the handful of things worth knowing before you point real funds at it. KUB Bridge connects KUB network to Ethereum, BNB Smart Chain, JFIN Chain and moves KUB (as KKUB) or any ERC-20 token between those networks. The flow is the same in either direction: 1.Hold the source chain's native gas token: you're paying a real transaction on that chain, so bridging from Ethereum still needs ETH in your wallet, same as bridging from KUB still needs KUB. 2.Connect your wallet to the source network on the bridge UI. 3.Pick the destination network, the token, and the amount. 4.If it's a token and not the network's native coin, you need to approve the bridge contract to spend it first 5.After that you can bridge through a UI and confirm in your wallet. Funds land on the destination chain in roughly 5–10 minutes, depending on how congested the source chain is. What's actually happening when you click "Bridge" Under the hood, a token bridge is doing one of a few things: locking your asset in a contract on the source chain and minting a wrapped equivalent on the destination (lock-and-mint), burning it on one side and minting the canonical version on the other (burn-and-mint), or swapping against pre-funded liquidity on both sides. Whichever pattern is used, the asset doesn't teleport. Something on the source side has to be neutralized before something on the destination side is created, and there's an off-chain party in between watching for that and authorizing the mint. That off-chain party is the part worth understanding, because it's also the part that isn't visible from the UI. It might be a small multisig the chain operator controls, a larger validator set with slashing, or a light-client design that lets the destination chain verify the source chain's state directly. Whichever it is, it's holding the keys to every asset that's ever been locked in the bridge contract, not just yours. This isn't a hypothetical concern, the bridge itself, not the underlying token or the user's wallet, was the point of failure, and the amounts lost were in the hundreds of millions because a bridge concentrates the value of everything that's ever crossed it into one place. Rule 1: A bridge transaction is not final the moment your wallet confirms it. The 5–10 minute window exists because the relayer/validator is waiting for the source chain transaction to be irreversible before authorizing anything on the destination side. Rule 2: Know what's backing the token you receive. A bridged asset on KUB (like KKUB representing bridged KUB, or a bridged USDT) is a claim on whatever the bridge is holding on the other side, not the same asset. If the bridge's custody model is ever unclear, that's a reason to ask before moving size through it, not after. Rule 3: Verify the contract address on both ends, every time. Bridge UIs are one of the most commonly spoofed surfaces in crypto precisely because users treat "the bridge" as a single trusted thing rather than two separate contracts on two separate chains. Confirm the destination token address independently, via KUB Scan, before trusting a balance you see in your wallet. Learn more at: docs.kubchain.com/tools/toke…
1
112
KUB Global 2026 wrapped up last week, a full day at ZillaSpace looking back at five years of the KUB network and laying out where it's going through 2027. A lot happened over the course of the day. The Zurich hard fork Go Ethereum moves to a recent version, and on top of that comes support for the latest Solidity. Together, they close the gap that's been the quiet friction of building here: newer language features become available, your usual tools work at their default settings, and contracts get cheaper to run. Nodes get lighter and faster to sync too. If you've been keeping a list of things that don't work on the KUB network, most of that list is about to disappear. A new fee model (KIP-100) Gas pricing moves to a base fee model. The network publishes a base fee for every block; you set a ceiling, and anything unused comes back to you, no more guessing at gas price. Part of every fee is burned on-chain, and the burn rate is a parameter the network can adjust rather than something frozen until the next hard fork. 1-second block time Block times drop to one second. Faster confirmation for anything you build, and a meaningfully different feel for payments and anything interactive. The developer toolchain 5 things exist to get you from an empty folder to a deployed contract, and most builders find them one at a time: - KUB Faucet: mint testnet tKUB and bridge it from L1 to L2 - KAP Package: the official NPM package for the KAP token standards, so you inherit audited base implementations instead of hand-rolling a token contract - KUB Scan: the block explorer, covering both mainnet and testnet - KUB Developer Center: for getting a dApp integrated and running on the KUB network - KUB Docs: the full reference for every part of the stack A say in the standards gKUB voting power is coming, and network infrastructure decisions are on the ballot, things like which standards get adopted and how the burn and gas parameters are set. If you have opinions about what you build against, that's the mechanism for them. Grants The KUB Builder Grant offers financial and technical backing for utility-focused dApps. There's a Validator Grant for node operators as well. View Grant Program: kubchain.com/grant The ecosystem side is where most of the new surface area is. Lighter brings a perp DEX. Squid handles interoperability, cross-chain routing in and out of the KUB network. And on the on-chain collaboration side, there's TRON, which means more places your users can arrive from. Stablecoins get a push as well: Tether and Agora. For real-world assets, Ondo. The short read for anyone building: more liquidity to build against, more chains to bridge from, and payment rails that settle in something stable. Visit website: kubchain.com/ View document: docs.kubchain.com/
2
3
154
KUB Developers retweeted
From the first block in 2021 to the Infrastructure Era. Coin. NFT. Real-world use cases. Five years of building, evolving, and pushing KUB Chain forward. Now, it’s time for the next chapter. What do you want to see KUB Chain build next? Find out at KUB Global Bangkok 2026: Road to Open Financial Infrastructure. 📅 28 August 2026 📍 ZillaSpace, FYI Center Tower 2, 11th Floor Register now: luma.com/nb8ge2dg #KUBChain #KUBGlobal
5
11
2
25
1,378
KUB Developers retweeted
🌍 MEET THE VOICES SHAPING THE FUTURE AT KUB GLOBAL BANGKOK 2026 From blockchain infrastructure and stablecoins to RWA, tokenization, Web3 adoption, and the future of open finance — meet the speakers bringing perspectives from across the ecosystem to one global stage. Industry leaders. Builders. Innovators. Regulators. Communities. All coming together to explore what’s next for financial infrastructure in Thailand and beyond. THE GLOBAL STAGE. ALL VOICES. ONE FUTURE. SEE YOU TOMORROW AT KUB GLOBAL BANGKOK 2026. 📍 KUB Global Bangkok 2026 📅 28 August 2026 📌 ZillaSpace, FYI Center Tower 2, 11F 🎟️ Register now: luma.com/nb8ge2dg Powered by Agora, Ondo, Superteam Thailand, and TRON. In special partnership with Liberix, 1109 Prime, and DeLorean Labs. #KUBGlobal #KUBGlobalBangkok2026 #KUBChain #OpenFinancialInfrastructure #Blockchain #Web3 #Stablecoin #RWA #Tokenization
2
7
2
19
1,979
If you're wiring up a backend, an analytics dashboard, or any off-chain service that reacts to on-chain activity, you need to read event logs. Here's how to do it on the KUB network, starting with the method that always works. The reliable path: eth_getLogs over RPC KUB network is EVM-compatible, so standard JSON-RPC log queries work exactly as they do on Ethereum. Point ethers or viem at a KUB network RPC and filter: const logs = await provider.getLogs({ address: contractAddress, topics: [ethers.id("Transfer(address,address,uint256)")], fromBlock: blockNumber, toBlock: "latest", }); Same interface you already know. The event signature hashes to topic[0]; indexed params fall into topics[1..3]; everything else lives in data. KUB Scan also exposes an HTTP API for reading network data without running your own queries: Mainnet: kubscan.com/api Testnet: testnet.kubscan.com/api Mind the rate limit: 12 requests per minute per IP. Go over, and KUB Scan will block your IP for a minute, so this is for light, periodic reads, not high-throughput indexing. For anything heavy, run eth_getLogs against an RPC node you control, or your own provider. If you're building something that needs to serve event data at scale, don't hammer a public endpoint. Run a node (KUB network supports Docker deployment), or point a self-hosted indexer at your own RPC. Query the chain once, serve it many times from your own store. Need some help? Reply to us below. Learn more at: docs.kubchain.com/tools/bloc…
1
1
1
2
788
If you have been building on the KUB network long enough to have opinions about it, there is a formal path for turning one of those opinions into a standard. It is called a KIP, a KUB Improvement Proposal. A KIP is a design document. It either describes a new feature for the KUB network, or it proposes a change to the processes and conventions around it. If you have read an EIP on Ethereum or a BIP on Bitcoin, you already understand the structure of the proposal. The KIPs repository tracks every past and ongoing proposal, which makes it the closest thing the KUB network has to a written record of why the chain works the way it does. Start with the conversation, not the document. The most common way to waste effort here is to write the proposal first. The process starts with a discussion thread on the KUB Discord forum. Ideas get worked through there before anything is drafted. Only once there is consensus that the idea is worth specifying do you read KIP-1, the proposal that describes the KIP process itself, and start writing. This ordering is not bureaucratic politeness. A proposal that arrives fully drafted with no prior discussion has skipped the step where other people tell you the constraint you did not know about. Once discussion has run its course: - You write a draft following the KIP guidelines. Including a reference implementation is optional, but a proposal that comes with working code answers a lot of questions that a proposal without it has to answer in prose. - You open a pull request on the KIPs repository at github.com/kub-chain/KIPs. - You revise. This is the long part. The draft gets edits until it is mature enough to submit for review, then it is listed on GitHub for review by KUB, and you make further changes based on that feedback. KUB conducts a final review before the proposal moves to Final status. From there the KIP is implemented and adopted, and it becomes the standard. Read KIP-1 for the required structure and section-by-section guidelines before you draft. It is the authoritative source on format, and getting the format right on the first pass saves a review cycle. Read KIP-1. Then open a thread and make your case to people who will push back on it. KIP process: docs.kubchain.com/governance… Repository: github.com/kub-chain/KIPs Working on something you think should be a standard? Reply and tell us what it is.
1
1
835
If your contract relies on another contract's function, it might behave in various ways: it could revert cleanly, succeed as expected, or do something in between. The only safe assumption is that you don't know which of these outcomes occurred until you've explicitly checked. For instance, suppose your contract calls a token's transfer function to move funds on a user's behalf. If the token has a bug or was intentionally designed this way, it might accept the call, return without reverting, and simply not move any tokens. Your contract has no way of knowing this happened unless it explicitly checks. It sees no error, assumes the transfer succeeded, updates its internal accounting to reflect a successful transfer, and moves on. As a result, the user's balance is incorrect, and funds are effectively lost because your contract trusted a call that didn't actually perform as intended. This isn't a hypothetical scenario. Several real, widely-used tokens are known to behave precisely this way. They return false on a failed transfer instead of reverting, and contracts that don't check for this have lost real money due to it. Rule 1: Checking that a call didn't revert isn't enough. A call not reverting doesn't confirm success; you must check the return value explicitly. Rule 2: Low-level calls require you to interpret responses manually. Verify success and decode returned data yourself. Rule 3: High-level interfaces revert automatically, but they don't check the result for you. Always check return values, as they may indicate failure. Rule 4: Before a low-level call, confirm code exists at the target address. A call to an empty address won't revert, potentially absorbing intended actions. Validate inputs like amounts, addresses, and timestamps to prevent exploits. External calls are the primary source of real breaches because their failure mode is often silent rather than conspicuous. Be extra safe and cautious when building protocols that affect user's funds. Docs: docs.kubchain.com
1
4
54
Access Control on Smart Contracts: Ownable vs. Role-Based Every contract on the KUB network with admin functions requires an access control strategy. The two standard options are Ownable (a single admin address) and role-based access control, typically implemented using OpenZeppelin's AccessControl. The choice between these options depends on the number of people or distinct admin responsibilities your contract actually has. Ownable grants a single address the authority to call protected functions. It's straightforward to understand. However, it comes with a significant risk: if that key is lost or compromised, the entire admin surface is compromised. You can't separate "who can mint," "who can pause," and "who can upgrade". It's all-or-nothing, tied to a single private key. Use Ownable when you're the sole admin, the project is in its early stages, and you're comfortable with a single point of failure for now. AccessControl allows you to define separate roles, such as admin, minter, and pauser, and assign them independently. One address can hold multiple roles, but revoking a role from one address doesn't affect others. Different addresses hold different powers, and compromising one role doesn't compromise the entire contract. Use Role-based when multiple people, contracts, or operational roles require distinct permissions, which is most protocols beyond a single-developer project. Which Should You Use? - Solo dApp where you control everything: Ownable is fine. - Protocol with multiple operators, contracts, or team members: AccessControl is the better choice. A Practical Note: Migrating from Ownable to Role-based later is more challenging than starting with AccessControl on day one. Deploying with AccessControl doesn't significantly increase costs. You're simply being explicit about who holds which role instead of collapsing everything into one owner.
1
4
810