Как стать автором
Обновить
  • по релевантности
  • по времени
  • по рейтингу

How to Write a Smart Contract with Python on Ontology? Part 1: the Blockchain & Block API

Python *Распределённые системы *Криптовалюты
Из песочницы
image

This is an official tutorial published earlier on Ontology Medium blog
Excited to publish it for Habr readers. Feel free to ask any related questions and suggest a better format for tutorial materials

Foreword


In this article, we will begin to introduce the smart contract API of Ontology. The Ontology’s smart contract API is divided into 7 modules:


In this article, we will introduce the Blockchain & Block API, which is the most basic part of the Ontology smart contract system. The Blockchain API supports basic blockchain query operations, such as obtaining the current block height, whereas the Block API supports basic block query operations, such as querying the number of transactions for a given block.

Let’s get started!

First, create a new contract in SmartX and then follow the instructions below.

1. How to Use Blockchain API


References to smart contract functions are identical to Python’s references. Developers can introduce the appropriate functions as needed. For example, the following statement introduces GetHeight, the function to get the current block height, and GetHeader, the function to get the block header.
Read more →
Всего голосов 20: ↑18 и ↓2 +16
Просмотры 1.9K
Комментарии 0

How to Write a Smart Contract with Python on Ontology? Part 3: Runtime API

Криптография *Python *Программирование *DevOps *Криптовалюты
Tutorial
image

Introduction


Earlier, I have introduced the Ontology Smart Contract in
Part 1: Blockchain & Block API and
Part 2: Storage API
Now when you have an idea about how to call the relevant API for persistent storage when developing Python smart contract on Ontology, let’s go on to Runtime API (Contract Execution API). The Runtime API has 8 related APIs that provide common interfaces for contract execution and help developers get, convert, and validate data. Here’s a brief description of these 8 APIs:
Read more →
Рейтинг 0
Просмотры 622
Комментарии 0

Blockchain Is Changing The Way Rail Industry Works

Распределённые системы *IT-компании
Из песочницы
image

Railways had made our transportation very easy since 1830 when the first railway began in England. From 1830 to 2020, the development in the railways has been quite significant. The concept of blockchain is expanding widely; hence the public interests are also growing on a vast scale. Major enthusiasts about blockchain are the investors and businessmen who wish for transparency and equity in the transaction. Now since blockchain is no more just a concept its application in railways is expected to smoothen the transportation.
Read more →
Всего голосов 3: ↑2 и ↓1 +1
Просмотры 1.7K
Комментарии 0