Ethereum cryptocurrency: writing smart contracts for the blockchain

  1. Ethereum cryptocurrency: writing smart contracts for the blockchain

    • Commitment process

    • Development with remix

  2. First phase of the commitment protocol

  3. Hash control

  4. Test and use the contract

  5. Open contract

  6. Conclusion

Read article in c’t 12/2021

Ethereum and its currency ether are the second largest cryptocurrency system after Bitcoin, but the real highlight of Ethereum are smart contracts. These are programs on the blockchain that are distributed worldwide, tamper-proof and generally verifiable. In principle, you write a smart contract like any other program. This is usually done in a high-level language that is compiled in bytecode for the Ethereum Virtual Machine (EVM). Then you have to roll out the contract, i.e. put it on the blockchain. To do this, you need an Ethereum account and a wallet application (linked to the browser).

After a contract has been rolled out, blockchain users can interact with it. This is done via transactions like a simple money transfer, but the target account is the smart contract. Transactions can also transfer 0 ethers, so a contract interaction does not necessarily have to send money to the contract. However, there are always transaction costs. Since the state of the blockchain and all transactions are public and the EVM works purely deterministically, it is always clear when which contract was called and what the result of the call was.

Contracts are never active on their own, they are similar to objects from object-oriented programming: A contract has a number of methods, some can be called “externally”, others are only accessible internally for the contract itself. In addition to the sender, recipient and amount, transactions have a special field that specifies which public method of the contract is to be called with which parameter values. Other Ethereum transactions also have this field, but it is mostly left blank for a simple person-to-person transfer. Once called up, contracts can also interact with each other and even create new ones.

  • Access to all heise + content
  • exclusive tests, advice & background: independent, critically well-founded
  • Read c’t, iX, MIT Technology Review, Mac & i, Make, c’t photography right in your browser
  • Register once – read on all devices – can be canceled monthly
  • first month free, thereafter € 12.95 per month
  • Weekly newsletter with personal reading recommendations from the editor-in-chief

Start the FREE month

Start your FREE month now

Already subscribed to heise +?

Sign up and read

Register now and read the article right away

More information about heise +

Disclaimer: This article is generated from the feed and is not edited by our team.

Comments are closed.