Solidity
Solidity es un lenguaje de alto nivel, orientado a objetos, para implementar smart contracts en la blockchain de Ethereum y otras plataformas compatibles.
Solidity está diseñado para la Máquina Virtual de Ethereum (EVM). Es de tipado estático, soporta herencia, librerías y tipos complejos definidos por el usuario. Los desarrolladores usan Solidity para escribir smart contracts que rigen el comportamiento de las cuentas y aplicaciones en la blockchain. La sintaxis del lenguaje es similar a JavaScript y C++, lo que lo hace relativamente accesible para los programadores familiarizados con estos lenguajes. El código Solidity se compila en bytecode, que luego se despliega y ejecuta en la EVM.
Las características de Solidity incluyen soporte para variables de estado, funciones, eventos y modificadores. También proporciona funciones criptográficas integradas y acceso a datos de la blockchain. Sin embargo, los smart contracts de Solidity son inmutables una vez desplegados, por lo que una planificación cuidadosa y pruebas exhaustivas son cruciales para evitar vulnerabilidades. Las auditorías de seguridad y la verificación formal son prácticas comunes para mitigar los riesgos.
graph LR
Center["Solidity"]:::main
Pre_javascript["javascript"]:::pre --> Center
click Pre_javascript "/terms/javascript"
Pre_smart_contract["smart-contract"]:::pre --> Center
click Pre_smart_contract "/terms/smart-contract"
Rel_ethereum["ethereum"]:::related -.-> Center
click Rel_ethereum "/terms/ethereum"
Rel_smart_contract_architecture["smart-contract-architecture"]:::related -.-> Center
click Rel_smart_contract_architecture "/terms/smart-contract-architecture"
Rel_java["java"]:::related -.-> Center
click Rel_java "/terms/java"
classDef main fill:#7c3aed,stroke:#8b5cf6,stroke-width:2px,color:white,font-weight:bold,rx:5,ry:5;
classDef pre fill:#0f172a,stroke:#3b82f6,color:#94a3b8,rx:5,ry:5;
classDef child fill:#0f172a,stroke:#10b981,color:#94a3b8,rx:5,ry:5;
classDef related fill:#0f172a,stroke:#8b5cf6,stroke-dasharray: 5 5,color:#94a3b8,rx:5,ry:5;
linkStyle default stroke:#4b5563,stroke-width:2px;
🧠 Prueba de conocimiento
🧒 Explícalo como si tuviera 5 años
📜 Solidity is a special code language used to write 'digital rules' for the world's computer ([Ethereum](/es/terms/ethereum)). It's like writing a contract that nobody can cheat on because the computer follows the rules exactly as they are written.
🤓 Expert Deep Dive
Solidity's design prioritizes deterministic execution within the EVM, crucial for consensus. Its static typing catches many errors at compile time, reducing runtime surprises. The language's object-oriented features, while convenient, introduce complexities in inheritance and state management that can lead to subtle bugs if not managed carefully. Gas optimization is a primary concern; inefficient Solidity code can lead to prohibitively expensive transactions. The compiler itself is a critical component, and its evolution (e.g., introduction of Yul IR, optimizer improvements) significantly impacts gas costs and security. [Formal verification tools](/es/terms/formal-verification-tools) are increasingly important for auditing Solidity contracts due to the high stakes of immutable, on-chain logic.