ซอลิดิตี (อังกฤษ: Solidity) เป็นภาษาโปรแกรมในการเขียนโปรแกรมเชิงวัตถุสำหรับการเขียนสัญญาอัจฉริยะ[1] ซึ่งได้ถูกนำมาใช้ในการสร้างและจัดการทำสัญญาอัจฉริยะ[2] ในหลายแพลตฟอร์มบล็อกเชน โดยส่วนใหญ่จะเป็นอีเธอร์เรียม[3] ซอลิดิตีพัฒนาโดย คริสเตียน ไรต์วิสเนอร์ (Reitwiessner) และ แอเล็กซ์ แบเรจส์ซัสซี (Alex Beregszaszi) พร้อมกับนักพัฒนาอีเธอร์เรียม[4] โดยตัวโปรแกรมคอมไพล์และทำงานบนเครื่องจักรเสมือนของอีเธอร์เรียม

ซอลิดิตี
The Solidity language logo
เว็บไซต์github.com/ethereum/solidity
ได้รับอิทธิพลจาก
JavaScript, C++, Eiffel, Python

แพลตฟอร์ม แก้

ตัวอย่างโค้ด แก้

pragma solidity >= 0.7.0 <0.8.0;

contract Coin {
    // The keyword "public" makes variables
    // accessible from other contracts
    address public minter;
    mapping (address => uint) public balances;

    // Events allow clients to react to specific
    // contract changes you declare
    event Sent (address from, address to, uint amount);

    // Constructor code is only run when the contract
    // is created
    constructor() public {
        minter = msg.sender;
    }

    // Sends an amount of newly created coins to an address
    // Can only be called by the contract creator
    function mint(address receiver, uint amount) public {
        require(msg.sender == minter);
        require(amount < 1e60);
        balances[receiver] += amount;
    }

    // Sends an amount of existing coins
    // from any caller to an address
    function send(address receiver, uint amount) public {
        require(amount <= balances[msg.sender], "Insufficient balance.");
        balances[msg.sender] -= amount;
        balances[receiver] += amount;
        emit Sent (msg.sender, receiver, amount);
    }
}

อ้างอิง แก้

  1. Afshar, Vala; Evangelist, ContributorChief Digital; Salesforce (2017-07-17). "Ethereum Is The Second Most Valuable Digital Currency, Behind Bitcoin". HuffPost (ภาษาอังกฤษ). สืบค้นเมื่อ 2019-04-10. {{cite web}}: |first2= มีชื่อเรียกทั่วไป (help)
  2. "SOFE Berlin: Swift unveils blockchain proof-of-concept". Finextra (News). 24 November 2016. สืบค้นเมื่อ 24 November 2016.
  3. "Someone Just Stole $50 Million from the Biggest Crowdfunded Project Ever. (Humans Can't Be Trusted)". Wired (ภาษาอังกฤษแบบอเมริกัน).
  4. "List of contributors".
  5. Teeter, Cale (2016-04-01). "Solidity Integration with Visual Studio". Medium (website). เก็บจากแหล่งเดิมเมื่อ 2016-11-27. สืบค้นเมื่อ 2021-06-10.
  6. PatAltimore. "Use Visual Studio Code to connect to Azure Blockchain Service - Azure Blockchain". docs.microsoft.com (ภาษาอังกฤษแบบอเมริกัน). สืบค้นเมื่อ 2020-03-27.