Chapter 2: sCrypt Contract

sCrypt is a high-level programming language for writing Bitcoin smart contracts.

An sCrypt contract is the basic module of Bitcoin dApp. All variables and functions belong to a contract. It is the starting point for all your dApps.

An sCrypt contract is defined by the keyword contract, similar to class in object-oriented languages such as Java/C++. An contract called HelloWorld is as follows:

contract HelloWorld { public function unlock(bytes message) { require(message == "hello world, sCrypt 😊"); } }

Put it to the test

Before writing the TicTacToe contract, you should first find the position of TODO in the editor on the right and create an empty contract named TicTacToe. This will be the case for all subsequent lessons.

Click the "Show Answer" button below to display the answer.

back2 / 12next