Solidity
Solidity
Solidityのロゴ
最新リリース 0.8.27 / 2024年9月4日[1]
影響を受けた言語 JavaScript, C++, Eiffel, Python
ウェブサイト github.com/ethereum/solidity
テンプレートを表示

Solidityとは、ブロックチェーン上で実行されるスマート・コントラクトを記述するための手続き型プログラミング言語である。キャビン・ウッドによって作成された。JavaScriptやC++に似た構文を持つとされる[2]。SolidityによってコンパイルしたプログラムはEthereum Virtual Machine上での実行が想定されている[3]。

例

Solidityのプログラムの例は以下のようになっている[4]。

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);
    }
}

実行環境

Solodityを使えるウェブベース開発環境として、代表的に以下がある[5]。

Solidityが使えるブロックチェーンプラットフォームは、代表的には以下がある。

脚注

  1. ↑ 出典URL: https://github.com/ethereum/solidity/releases/tag/v0.8.27, 閲覧日: 2024年9月26日, 題名: Release 0.8.27, 出版日: 2024年9月4日
  2. ↑ Antonopoulos, Andreas『マスタリング・イーサリアム ―スマートコントラクトとDAppの構築』Gavin Wood, 宇野 雅晴, 鳩貝 淳一郎, 中城 元臣, 落合 渉悟, 落合 庸介(1st edition)、オイラリージャパン、[Erscheinungsort nicht ermittelbar]、2019年、xxxix頁。ISBN 978-4-87311-896-3。OCLC 1226442243。
  3. ↑ “Hyperledger Fabric code pattern - Create a blockchain app for loyalty points” (英語). IBM Developer. 2021年12月29日閲覧。
  4. ↑ “Introduction to Smart Contracts — Solidity 0.5.14 documentation”. docs.soliditylang.org. 2021年12月29日閲覧。
  5. ↑ Antonopoulos, Andreas『マスタリング・イーサリアム ―スマートコントラクトとDAppの構築』Gavin Wood, 宇野 雅晴, 鳩貝 淳一郎, 中城 元臣, 落合 渉悟, 落合 庸介(1st edition)、オイラリージャパン、[Erscheinungsort nicht ermittelbar]、2019年、139頁。ISBN 978-4-87311-896-3。OCLC 1226442243。
  6. ↑ binance-chain/bsc, binance-chain, (2021-12-29) 2021年12月29日閲覧。
  7. ↑ “What is Tendermint | Tendermint Core”. docs.tendermint.com. 2021年12月29日閲覧。
  8. ↑ Vigna, Michael J. Casey and Paul (2014年11月12日). “BitBeat: Bitcoin 2.0 Firm Counterparty Adopts Ethereum’s Software” (英語). Wall Street Journal. ISSN 0099-9660 2021年12月29日閲覧。
  9. ↑ Swan, Melanie (2015). Blockchain : blueprint for a new economy (First edition ed.). [Sebastopol, Calif.]. ISBN 978-1-4919-2047-3. OCLC 900781291
  10. ↑ “What is Avalanche? | Avalanche Docs” (英語). docs.avax.network. 2021年12月29日閲覧。
  11. ↑ https://dcspark.gitbook.io/milkomeda/
⌬ Phoenix Mesh CID: 未登録 IPFS未登録 📡 0ピア N=1 CRITICAL PQS B69