Solidity

De ALDEA WIKI
Ir a la navegación Ir a la búsqueda

Solidity

<img src="" width="140" height="140" />

Qué es? Solidity es un lenguaje de programación diseñado para desarrollar contratos inteligentes que se ejecutan en la máquina virtual Ethereum, también conocida como EVM. Es el lenguage primario para desarrollar contrats inteligentes en la blockchain de Ehtereum, asi como también blockchains privadas orientadas a empresas como Hyperledger Fabric.

Historia

Solidity fue propuesto en Agosto 2014 por Gavin Woods, posteriormente desarrollado por el equipo de desarrolladores liderado por Christian Retwiessner

Descripción

Solidity es un lenguage de tipaje estatico, orientados a objetvos (los contratos), utiliza sintaxis similar a ECMAScript (utilizada por JavaScript). Es un lenguage de llaves {}, por tener una gran influencia de C++. En contrate con otros lenguages de programación de contratos inteligentes para la EVM como Serpent, Viper o Mutant soporta variables miembro complejas para los contratos, incluyendo asignaciones jerárquicas arbitrarias y estructuras de datos . Los contratos admiten herencia, incluyendo herencia múltiple Linealización de superclase C3 . Además tiene una interfaz binaria de aplicación (ABI)


That’s where the EVM comes in: it compiles (converts) Solidity, Vyper etc. into a simpler language called EVM bytecode, which is then executed by the virtual machine.This concept isn’t unique to Ethereum: for example, Java Virtual Machine has its own bytecode.

Librerías y SDK

Un SDK está disponible para desarrolladores el cual incluye librerías, APIs y toda la documentación necesaria para comenzar a utilizar en un ambiente local. La versión más actualizada de Plutus se encuentra en su repositorio oficial [5].

Herramientas

Brownie Python-based development and testing framework for smart contracts targeting the Ethereum Virtual Machine.

Dapp Tool for building, testing and deploying smart contracts from the command line.

Embark Developer platform for building and deploying decentralized applications.

Foundry Fast, portable and modular toolkit for Ethereum application development written in Rust.

Hardhat Ethereum development environment with local Ethereum network, debugging features and plugin ecosystem.

Remix Browser-based IDE with integrated compiler and Solidity runtime environment without server-side components.

Truffle Ethereum development framework.


Ejemplo de Hola Mundo en Solidity

Ejemplo de Token en Solididy

-- SPDX-License-Identifier: MIT pragma solidity ^0.8.13;

-- https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.0.0/contracts/token/ERC20/IERC20.sol

interface IERC20 {

   function totalSupply() external view returns (uint);

   function balanceOf(address account) external view returns (uint);

   function transfer(address recipient, uint amount) external returns (bool);

   function allowance(address owner, address spender) external view returns (uint);

   function approve(address spender, uint amount) external returns (bool);

   function transferFrom(
       address sender,
       address recipient,
       uint amount
   ) external returns (bool);
   event Transfer(address indexed from, address indexed to, uint value);
   event Approval(address indexed owner, address indexed spender, uint value);

} // SPDX-License-Identifier: MIT pragma solidity ^0.8.13;

import "./IERC20.sol";

contract ERC20 is IERC20 {

   uint public totalSupply;
   mapping(address => uint) public balanceOf;
   mapping(address => mapping(address => uint)) public allowance;
   string public name = "Solidity by Example";
   string public symbol = "SOLBYEX";
   uint8 public decimals = 18;
   function transfer(address recipient, uint amount) external returns (bool) {
       balanceOf[msg.sender] -= amount;
       balanceOf[recipient] += amount;
       emit Transfer(msg.sender, recipient, amount);
       return true;
   }
   function approve(address spender, uint amount) external returns (bool) {
       allowance[msg.sender][spender] = amount;
       emit Approval(msg.sender, spender, amount);
       return true;
   }
   function transferFrom(
       address sender,
       address recipient,
       uint amount
   ) external returns (bool) {
       allowance[sender][msg.sender] -= amount;
       balanceOf[sender] -= amount;
       balanceOf[recipient] += amount;
       emit Transfer(sender, recipient, amount);
       return true;
   }
   function mint(uint amount) external {
       balanceOf[msg.sender] += amount;
       totalSupply += amount;
       emit Transfer(address(0), msg.sender, amount);
   }
   function burn(uint amount) external {
       balanceOf[msg.sender] -= amount;
       totalSupply -= amount;
       emit Transfer(msg.sender, address(0), amount);
   }

}


Projectos que usan Solidity

  • Ethereum Mainnet
  • Ethereum Testnet (ROP, RIN, GOR, KOV)
  • Expanse Network Ethereum Classic
  • Ubiq Network Metadium Mainnet / Testnet
  • ThaiChain
  • ELA-ETH Sidechain
  • RSK Network Mainnet / Testnet
  • GoodData
  • Telos EVM Mainnet / Testnet
  • XinFin
  • CoinEx Smart Chain
  • Zyx Mainnet
  • Binance Smart Chain
  • Ontology Mainnet
  • EOS Mainnet
  • Ellaism OKExChain Mainnet / Testnet Optimistic Ethereum
  • SoterOne Mainnet
  • GateChain
  • GeneChain
  • PrimusChain
  • TomoChain (TOMO)
  • xDAI Chain (xDAI/STAKE)
  • Velas EVM Mainnet
  • ThunderCore
  • EtherLite Chain
  • Huobi
  • ECO Chain Polygon Mainnet (Matic Network) Lightstreams Mainnet / TestnetBitTorrent Chain
  • Arbitrum One Permission Energy Web Chain Fantom Opera Boba Network KCC Mainnet / Testnet Shiden Theta Mainnet / Testnet PulseChain Mainnet Rupaya Tao Network cheapETH Callisto Mainnet / Testnet Acala Network Wanchain Mainnet / T estnet
  • Ambros Chain PulseChain Lucky Network MathChain Popcateum Mainnet HALO Mainnet
  • Moonbeam
  • Moonriver
  • Moonrock
  • Moonshadow
  • Catecoin
  • Chain
  • Teslafunds EtherGem Edgeware Ecoball IoTeX Network SyscoinEraSwap
  • Smart Bitcoin Cash MetaDot Ethersocial Network Celo Mainnet Athereum Avalanche Mainnet / Fuji Testnet Polyjuice QuarkChain Mainnet / Devnet Akroma ARTIS Polis Mainnet / Testnet Etho Protocol Xerom Auxilium Network Aquachain
  • Joys Digital Mainnet
  • Neon EVM OneLedger
  • IPOS Network
  • Aurora MainNet / Testnet / BetaNet
  • Harmony Mainnet / Testnet Pirl Palm Mainnet / Testnet xDAI Chain Newton Sakura
  • Clover





Referencias

[1] [Solidity Official website] [1]


[2] [2]

[3] [[wikipedia: Solidity](https://es.wikipedia.org/wiki/Solidity)]]

[4] [[Documentacion de Solidity v0.8.15 - 31 de Agosto de 2022][3]]

[4] [[Solidity, El lenguage de programación más usado para crear smart contratcs][4]]

[5] [5]

[6] [6]

[7] [7]

[8] [] [8]