美文网首页
solidity note

solidity note

作者: robertzhai | 来源:发表于2023-09-09 21:57 被阅读0次

Solidity

  • Solidity 是一门面向合约的、为实现智能合约而创建的高级编程语言。智能合约是管理以太坊状态里账户行为的程序。
  • Solidity是一种针对Ethereum虚拟机(EVM)设计的 花括号语言 。 它受到了C++、Python和JavaScript的影响。你可以在 语言影响 部分找到更多关于Solidity受到哪些语言启发的细节。
  • Solidity 是静态类型语言,支持继承、库和复杂的用户定义类型等特性。

简单的智能合约

install

compile sol file

docker run -v /root/solidity:/sources ethereum/solc:stable -o /sources/output --abi --bin /sources/Contract.sol


image.png

Comments

  • // or /* */

State Variables

  • State variables are variables whose values are permanently stored in contract storage.

types

  • Booleans
  • Integers (int8 to int256 , uint and int are aliases for uint256 and int256)

in checked mode, overflow will revert


image.png

exception

  • try/catch
  • revert statement

ref

相关文章

网友评论

      本文标题:solidity note

      本文链接:https://www.haomeiwen.com/subject/fiyaedtx.html