Self-Destruct Function Risk Explainer
Free to download on every platform. Comes pre-installed on BotFone, BotPad and BotFlip — with extra free apps included.
About this app
WHAT IT DOES
Self-Destruct Function Risk Explainer is a read-only tool that analyzes contracts for self-destruct function vulnerabilities, generating AI-powered plain-language explanations of self-destruct risks. It reads contract bytecode, selfdestruct opcode presence, selfdestruct target address, function visibility of the selfdestruct function, access controls on selfdestruct, contract balance, owner and admin address, proxy pattern detection, upgradeable contract status, selfdestruct call history, privileged function signatures, transaction history, event logs, and contract creation block. The tool then presents this data alongside an AI-generated analysis of whether the contract contains a self-destruct function, who can call it, the potential impact of self-destruction, and recommended mitigation strategies — helping you understand the risks before interacting with or relying on the contract.
HOW TO USE
Connect your wallet using the BGWallet bridge and select your target network. Enter the contract address you want to analyze. Optionally enter a contract name for reference. Click "Analyze self-destruct risk" to read on-chain contract data. The tool displays the contract address, contract name, self-destruct presence (Yes/No), access control type, and risk level (Low/Medium/High). A prominent warning banner appears if a self-destruct function is detected. Detailed information includes selfdestruct target, function visibility, contract balance, owner/admin address, proxy pattern, upgradeable status, call history, privileged functions, and creation block. A mitigation strategy box provides specific recommendations. An AI explanation appears below the on-chain data, analyzing whether the contract contains a self-destruct function, who can call it, the potential impact of self-destruction, and recommending mitigation strategies before you interact with or rely on the contract. The wallet's own signature step still protects you — this explanation is informational only and does not replace reviewing what you approve in your wallet.
TECHNICAL MECHANISM
The tool uses ethers.js v5.7.2 with the provider from the BGWallet bridge to read on-chain contract data. No hardcoded contract addresses are used — you are always in control of which contract you trust. When analyzing self-destruct risks, the tool reads the contract bytecode via provider.getCode(contract), scans for the SELFDESTRUCT opcode (0xff) in the bytecode, reads the selfdestruct target address from the contract's storage (if applicable), identifies the function visibility of the selfdestruct function by analyzing the function signature and modifiers, reads access controls on selfdestruct by analyzing function modifiers (e.g., onlyOwner), reads the contract balance via provider.getBalance(contract), reads the owner/admin address via the contract's owner() function or storage slot, detects proxy patterns by scanning for known proxy opcode patterns, detects upgradeable contract status by checking for proxy patterns and upgrade functions, reads selfdestruct call history by scanning event logs and transaction history, reads privileged function signatures by analyzing function selectors, reads transaction history via provider.getTransactionCount(contract), reads event logs by scanning for SelfDestruct events, and reads the contract creation block via provider.getTransactionReceipt(contract). The tool fetches event logs by walking backwards in chunks and halving chunk size on failure, ensuring logs are properly read despite varying RPC limitations. The data is formatted and passed to the AI bridge via BGAI.generate() with a structured prompt that includes all the on-chain data read. The AI is instructed to analyze whether the contract contains a self-destruct function, who can call it, the potential impact of self-destruction, and recommend mitigation strategies — while stating plainly that it cannot detect selfdestruct risks that involve off-chain private key compromise or social engineering, cannot guarantee that a contract will not selfdestruct even if the function appears protected, and cannot detect future changes to access controls that could enable selfdestruct. The AI response is capped at 1,024 tokens to ensure concise, focused self-destruct risk assessments. All computed values are guarded against negative numbers — if a contract balance or block number appears invalid, the tool flags it rather than displaying nonsensical values.
WHAT IT CANNOT SEE
This tool cannot detect selfdestruct risks that involve off-chain private key compromise or social engineering. It cannot guarantee that a contract will not selfdestruct even if the function appears protected. It cannot detect future changes to access controls that could enable selfdestruct. It cannot detect selfdestruct calls that are triggered via delegatecall or proxy patterns if not reflected in the bytecode. The AI explanation is generated from on-chain data only and cannot detect off-chain private key compromise, social engineering attacks, or hidden access control changes. It cannot predict whether a selfdestruct function will be called in the future. The tool does not continuously monitor selfdestruct risks; each analysis is a snapshot at the time of the lookup. It cannot detect delayed selfdestruct calls, proxy upgrades, or off-chain factors. The tool does not store any data persistently; all state is in-memory and resets on reload. The AI explanation is informational and does not constitute financial advice, legal advice, or a guarantee of contract safety or protection against self-destruction.
PLEASE NOTE
Self-Destruct Function Risk Explainer works exclusively with EVM-compatible chains. It requires a Web3 wallet (MetaMask or similar) and the BGWallet bridge. Explanations are AI-generated from data the app reads on-chain — always review what you are actually signing in your wallet before approving it. Self-destruct functions carry significant risk including permanent loss of contract code, funds, and functionality. Use this tool as a guide only; always cross-check with independent sources and contract audits for critical decisions. This is experimental software; use at your own risk.