Vyper Compilerの使い方


Ethereumとは

Ethereumはパブリックブロックチェーンネットワークです。Ethereumを使用すると、開発者は独自のDappを構築して展開できます。EtherはEthereumブロックチェーンの通貨です。Etherは、Ethereumネットワーク上で取引やサービスを支払うために使用されます。

Ethereumの詳細については、リンクを参照してください:
https://blockgeeks.com/guides/what-is-ethereum/
https://www.ethereum.org/

Vyperとは

Vyperは、Ethereumブロックチェーンでスマートコントラクトを開発するために使用できる新しい言語です。Vyperはスマートコントラクトの作成プロセスを大幅に簡素化するように設計されています。VyperはSolidityと同じロジックを持ちますが、Pythonと同じ構文です。Vyperは2018年6月現在でもv0.1.0 - beta.1にあります!

Vyper Compilerとは

Vyper Compilerを使用してVyperコードをコンパイルします。コンパイラを使用して、コードが正しいかどうかを確認します。 エラーがある場合、実行されません。

Compilerの準備

Vyperは、Python 3.6以降を使用して構築することができます。Python 3.6をインストールする手順は次のとおりです。

Ubuntu

sudo apt-get update
sudo apt-get install python3.6

MacOS

brew install python
brew install gmp leveldb

Installation

git clone https://github.com/ethereum/vyper.git
cd vyper
make
make test

Vyper Compilerの使い方

コントラクトをコンパイルするには、以下を使用します:

vyper yourFileName.vy

迅速に契約をテストできるように、Vyperは関数を即座に実行するためのコマンドラインツールを提供しています:

vyper-run yourFileName.vy "yourFunction();" -i some_init_param, another_init_param

The vyper-run command is composed of 4 parts:

  1. vyper-run
  2. the name of the contract file you want to execute (for example: coolContract.vy)
  3. a string (wrapped in double quotes) with the function you want to trigger, you can trigger multiple functions by adding a semicolon at the end of each function and then call the next function (for example: "myFunction1(100,4);myFunction2()") +
  4. (Optional) the parameters for the init function of the contract (for example: given init(a: int128, b: int128) the syntax would be -i 8,27).

vyper-runコマンドは、呼び出された関数の戻り値と、関数の実行中に出力されたすべてのログ出力を出力します。

Vyperを練習したい場合は、このリンクにアクセスしてください。https://vyper.online/

このリンクでVyperの詳細を知ることもできます:https://vyper.readthedocs.io/en/latest/