Solidity शब्दावली A-Z
Solidity और blockchain के सभी आवश्यक शब्द code examples के साथ समझाए गए। 48 definitions उपलब्ध हैं।
A
ABI (Application Binary Interface)
EVMABI एक specification है जो define करता है कि smart contract के साथ कैसे interact करें। यह JSON format में functions, parameters, return types और events को describe करता है। यह smart contracts के लिए API के बराबर है, जो frontend applications और दूसरे contracts को blockchain पर deployed bytecode के साथ सही तरीके से communicate करने में मदद करता है।
Address
SolidityAddress एक 20-byte value है जो Ethereum पर एक account को identify करता है। यह externally-owned account (EOA) या smart contract हो सकता है। Solidity में, address type 0x से शुरू होने वाले 42 hexadecimal characters का string होता है। Address type के special methods हैं जैसे balance, transfer(), send()।
Array
SolidityArray एक data structure है जो same type के multiple elements को store करता है। Solidity में two types के arrays होते हैं: fixed-size arrays (compile time पर size known है) और dynamic arrays (runtime पर grow/shrink हो सकते हैं)। Arrays memory या storage में store हो सकते हैं।
C
Call
SolidityCall एक low-level function है जो दूसरे contracts को invoke करने के लिए use होता है। यह ABI encoding/decoding handle नहीं करता और remaining gas को forward करता है। Call से arbitrary data भेजा जा सकता है और return value को manually decode करना पड़ता है। Modern Solidity में, सुरक्षा के लिए इसे सावधानी से use करना चाहिए।
Constructor
SolidityConstructor एक special function है जो contract deployment के time पर केवल एक बार execute होता है। यह contract की initial state set करने के लिए use होता है (जैसे owner assign करना, initial values set करना)। Constructor optional है और इसे inherit भी किया जा सकता है।
E
Emit
SolidityEmit keyword का use events को trigger करने के लिए होता है। Events blockchain के transaction logs में store होते हैं और off-chain applications (frontends, indexers) इन्हें listen कर सकते हैं। Events smart contract से data retrieve करने का एक gas-efficient तरीका है।
ERC-20
StandardsERC-20 Ethereum पर fungible tokens के लिए सबसे popular standard है। यह standard methods की एक set define करता है (transfer, balanceOf, approve, transferFrom) जो सभी ERC-20 tokens को implement करने होते हैं। यह interoperability सुनिश्चित करता है - सभी wallets, exchanges और dApps एक ही interface से सभी ERC-20 tokens के साथ काम कर सकते हैं।
ERC-721
StandardsERC-721 non-fungible tokens (NFTs) का standard है। ERC-20 के विपरीत जहां सभी tokens identical हैं, ERC-721 में हर token unique होता है और एक unique ID से identify होता है। यह digital art, collectibles, in-game items और real estate जैसी unique assets को represent करने के लिए use होता है।
Ether
SolidityEther (ETH) Ethereum blockchain की native cryptocurrency है। Solidity में, ether को wei में measure किया जाता है (1 ether = 10^18 wei)। Solidity built-in units provide करता है: wei, gwei, ether। Payable functions ether receive कर सकते हैं।
Event
SolidityEvent एक Solidity construct है जो blockchain के transaction logs में data emit करने के लिए use होता है। Events cheap हैं (storage से काफी कम gas) और off-chain applications इन्हें efficiently query कर सकते हैं। Indexed parameters filter करने के लिए use होते हैं।
EVM (Ethereum Virtual Machine)
EVMEVM वह runtime environment है जो Ethereum पर smart contracts को execute करता है। यह एक stack-based virtual machine है जो bytecode को process करता है। EVM Ethereum को Turing-complete बनाता है, मतलब यह theoretically कोई भी computation कर सकता है (gas limits के subject में)।
F
Fallback
SolidityFallback एक special function है जो तब execute होता है जब contract को एक call मिलता है जो किसी existing function से match नहीं करता, या जब ether receive करता है बिना data के। Solidity 0.6.0+ में, fallback() और receive() separate हैं।
Function
SolidityFunction Solidity में code का reusable block है। Functions different visibility levels हो सकते हैं (public, private, internal, external) और different state mutability (view, pure, payable)। Functions parameters accept करते हैं और values return कर सकते हैं।
I
Immutable
SolidityImmutable keyword variables को mark करने के लिए use होता है जिन्हें constructor में set किया जा सकता है लेकिन बाद में modify नहीं किया जा सकता। Immutable variables constant से ज्यादा flexible हैं (runtime values allow करते हैं) लेकिन regular state variables से cheaper हैं (bytecode में inline होते हैं)।
Indexed
SolidityIndexed keyword event parameters को mark करने के लिए use होता है ताकि वे searchable बन सकें। Maximum 3 indexed parameters allowed हैं per event। Indexed parameters को topics के रूप में store किया जाता है, जिससे off-chain applications efficiently filter कर सकते हैं।
Inheritance
SolidityInheritance Solidity में एक mechanism है जो contract को दूसरे contract के properties और methods को inherit करने की अनुमति देता है। Solidity multiple inheritance support करता है। यह code reuse और modular architecture के लिए powerful tool है।
Interface
SolidityInterface एक contract blueprint है जो केवल function signatures define करता है, implementation नहीं। Interfaces दूसरे contracts के साथ interact करने के लिए use होते हैं जब आपके पास पूरा code नहीं है। Interfaces किसी भी state variables या constructor नहीं रख सकते।
M
Mapping
SolidityMapping एक key-value data structure है जो Solidity में hash table की तरह काम करता है। Mapping automatically सभी possible keys को zero/default value से initialize करता है। Mappings iterate नहीं किए जा सकते (keys की list नहीं है)। Mappings केवल storage में exist हो सकते हैं।
Memory
SolidityMemory एक temporary data location है जो function execution के दौरान exist करता है। Memory variables function call के बाद erase हो जाते हैं। Memory storage से काफी cheaper है। Complex types (arrays, structs) को explicitly memory या storage specify करना पड़ता है।
Modifier
SolidityModifier एक reusable code block है जो function behavior को modify करता है। Modifiers typically access control, validation और preconditions check करने के लिए use होते हैं। Underscore (_) placeholder function body के execution को represent करता है।
msg.sender
Soliditymsg.sender एक global variable है जो current function call करने वाले address को represent करता है। यह direct caller होता है - user या contract जो immediate call कर रहा है। Authentication और access control के लिए यह most commonly used variable है।
msg.value
Soliditymsg.value एक global variable है जो current transaction के साथ भेजे गए ether की amount (wei में) को represent करता है। यह केवल payable functions में available है। msg.value को payments accept करने और deposit tracking के लिए use किया जाता है।
O
OpenZeppelin
ToolsOpenZeppelin सबसे trusted library है secure smart contracts के लिए। यह battle-tested implementations provide करता है common standards (ERC-20, ERC-721, ERC-1155) और security patterns (Ownable, Pausable, ReentrancyGuard) के लिए। OpenZeppelin contracts industry standard हैं और thoroughly audited हैं।
Override
SolidityOverride keyword का use inherited functions को redefine करने के लिए होता है। Solidity 0.6.0+ में, override explicitly specify करना mandatory है जब parent function को modify करते हैं। Multiple inheritance में, सभी parent contracts को specify करना पड़ता है।
P
Payable
SolidityPayable modifier functions और addresses को ether receive करने की अनुमति देता है। बिना payable के, function ether नहीं accept कर सकता। Payable addresses में .transfer() और .send() methods होते हैं ether भेजने के लिए।
Proxy Pattern
SecurityProxy pattern एक design pattern है जो smart contracts को upgradeable बनाता है। एक proxy contract user-facing address रहता है और सभी calls को implementation contract में delegatecall करता है। Implementation को change किया जा सकता है बिना proxy address change किए। यह complex pattern है और सावधानी से use करना चाहिए।
Pure
SolidityPure modifier functions को mark करने के लिए use होता है जो न state read करते हैं और न modify करते हैं। Pure functions केवल अपने parameters पर depend करते हैं और external data access नहीं करते। Pure functions को call करना gas-free है (view calls की तरह) जब externally call किया जाए।
R
Reentrancy
SecurityReentrancy एक critical vulnerability है जहां malicious contract एक function को recursively call कर सकता है इससे पहले कि first call complete हो। Famous DAO hack (2016) में reentrancy exploit हुआ था। इससे बचने के लिए checks-effects-interactions pattern या ReentrancyGuard use करें।
Require
SolidityRequire एक control structure है जो conditions validate करने के लिए use होता है। अगर condition false है, तो transaction revert हो जाता है और सभी state changes undo हो जाते हैं। Used gas partially refunded होता है। Require input validation और access control के लिए ideal है।
Return
SolidityReturn statement function से values को return करने के लिए use होता है। Solidity multiple return values support करता है। Return values को named किया जा सकता है, जो automatic return variables create करता है।
Revert
SolidityRevert statement transaction को abort करने और सभी state changes को undo करने के लिए use होता है। Revert require से similar है लेकिन ज्यादा flexible है (custom errors के साथ use हो सकता है)। Revert complex error handling के लिए preferred है।
S
Selector (Function Selector)
EVMFunction selector एक function signature के first 4 bytes हैं। यह function को uniquely identify करता है और EVM को बताता है कि कौन सा function call करना है। Selector को keccak256 hash से derive किया जाता है। Low-level calls और proxy patterns में selectors direct use होते हैं।
Solidity
SoliditySolidity एक high-level, object-oriented programming language है जो Ethereum smart contracts लिखने के लिए specifically designed किया गया है। यह statically-typed है और JavaScript, Python और C++ से influenced है। Solidity code EVM bytecode में compile होता है।
Storage
EVMStorage वह permanent data location है जहां state variables store होते हैं। Storage data blockchain पर persist करता है और सबसे expensive है (gas terms में)। Storage को efficiently use करना gas optimization का critical part है। हर contract की अपनी isolated storage होती है।
Struct
SolidityStruct एक custom data type है जो multiple related variables को group करता है। Structs complex data को organize करने के लिए use होते हैं। Struct members different types के हो सकते हैं। Structs को mappings और arrays में use किया जा सकता है।
T
Timestamp (block.timestamp)
EVMblock.timestamp current block का Unix timestamp (seconds में) provide करता है। यह time-based logic implement करने के लिए use होता है (deadlines, vesting, cooldowns)। ⚠️ Warning: miners timestamp को कुछ seconds तक manipulate कर सकते हैं, इसलिए critical randomness के लिए use न करें।
Token
DeFiToken एक digital asset है जो smart contract द्वारा represent किया जाता है। Tokens fungible (ERC-20, सभी identical) या non-fungible (ERC-721/ERC-1155, unique) हो सकते हैं। Tokens currencies, voting rights, access permissions, या real-world assets को represent कर सकते हैं।
Transfer
SolidityTransfer एक method है ether को payable addresses पर भेजने के लिए। यह 2300 gas forward करता है (reentrancy prevention के लिए) और failure पर revert करता है। Modern Solidity में, call{value: ...} को prefer किया जाता है क्योंकि यह ज्यादा flexible है।
tx.origin
Soliditytx.origin वह address है जिसने originally transaction initiate किया (always एक EOA)। यह msg.sender से different है जो immediate caller हो सकता है (contract)। ⚠️ Security warning: tx.origin को authentication के लिए use न करें क्योंकि यह phishing attacks के लिए vulnerable है।
U
Unchecked
SolidityUnchecked block arithmetic operations को overflow/underflow checks के बिना execute करता है। Solidity 0.8.0+ में automatic checks हैं, लेकिन unchecked gas save कर सकता है जब आप certain हैं कि overflow नहीं हो सकता। सावधानी से use करें।
Upgradeable Contracts
SecurityUpgradeable contracts वे contracts हैं जिनका logic deployment के बाद modify किया जा सकता है। यह typically proxy pattern use करके achieve होता है। Upgradeability flexibility provide करता है लेकिन complexity और centralization risks add करता है। OpenZeppelin का upgradeable contracts library widely used है।
V
View
SolidityView modifier functions को mark करने के लिए use होता है जो state read करते हैं लेकिन modify नहीं करते। View functions को externally call करना gas-free है। View functions state variables read कर सकते हैं, other view/pure functions call कर सकते हैं, लेकिन state change नहीं कर सकते।
Visibility (public, private, internal, external)
SolidityVisibility specifiers control करते हैं कि functions और state variables को कहां से access किया जा सकता है। Public = कहीं से भी, private = केवल इस contract में, internal = इस contract + derived contracts में, external = केवल बाहर से calls (not internal)। Proper visibility security के लिए critical है।
इन concepts को practice करने के लिए तैयार हैं?
1000+ interactive exercises और integrated IDE के साथ Solidity सीखें।
मुफ्त में शुरू करें