Introduction to SCORE: Smart contract on ICON

ICON

Mar 06, 2020

4 min read

Introduction to SCORE: Smart contract on ICON

Hey Iconists👩‍💻,

We’ve talked about ICON BROOF and shared our thoughts on IISS 3.0. In this article, we’ll give you a quick run-through of ICON SCORE and what is it all about.

Part 1: What is SCORE?

SCORE stands for Smart Contract on Reliable Environment. Basically, it’s a smart-contract running on ICON Blockchain. A Smart Contract is a collection of code and data that resides at a specific address on the blockchain. The contract can self-executes based on triggered events, and transactions are transparent and trackable.

A SCORE can be seen as a state transition machine, that gets triggered by sending transactions. For example, a balanced state change is a state transition. When you send some $ICX coins to a friend, you create a transaction message and send it to the ICON Network. The network then decreases your account by the requested amount and increase your friend’s balance by the same amount. That’s a state transition. Besides this balance state change example, any other problem that can be modeled by a state transition machine can be implemented in a SCORE.

State transitions are embedded in our everyday life, the most common example being traffic lights.🚦The light is yellow, green, or red, which is called output. Each of the different scenarios is called a state, and they transition between each other. A state transition machine is a more elaborate version of your everyday traffic light.

A key point of SCORE is that it doesn’t require data migration, as usually is needed when updating a Smart Contract. This means that it’s super easy and quick to update a Smart Contract. Furthermore, ICON provides a local repository for SCORE distribution, which means developers can easily update and deploy by using the SCORE Store.

✅ What’s also highly unique about SCORE is that its programming language used is Python, which is an all-round coding language with a smooth learning curve. Python has a large community of developers, over 8 million in the world. If you are already familiar with Python, you can write SCORE code right away, without learning a new language.

In comparison, Ethereum’s Smart Contract language only has 200,000 estimated developers. ICON’s choice to use Python makes Smart Contract coding accessible.

https://www.youtube.com/watch?v=0xX28qNRHbA

PART 2: Deploy SCORE

🧐 Sandbox Policy

If you want to deploy SCORE, you should be aware of an essential aspect called Sandbox policy. The Sandbox policy can be considered as a rule book concerning what is allowed and possible. There are five aspects to it:

  1. The code should be deterministic.
  2. No random operations are possible.
  3. No network call.
  4. No system call.
  5. No long-running operation

So, what does that mean? A transaction sent from any user in the ICON Network will be executed on every node that exists in the system. Those nodes will form a consensus on the transaction reserve. Deterministic behavior is, therefore, highly crucial because every node should agree. Moreover, this concludes that you can’t use a random operation, such as a fusion, network calls, or system calls. Furthermore, you can’t execute long-running actions because they might prevent consensus between nodes.

🔻There are a couple of constraints to SCORE. Firstly, SCORE code size is limited to around 64KB after being compressed. Secondly, it’s strictly prohibited to declare member variables which are not managed by the state DB. Furthermore, the maximum inter-SCORE count or ICX send is 1024 in one transaction.

🐻 T-bears

When you write code, tools and test environments are an essential part of the development. For SCORE, ICON provides a development suite called T-bears. You can install T-Bear on your local system or use Docker 🐳. You can use these T-bears to create project templates that will help you get started. Furthermore, you can test your SCORE on a locally emulated execution environment. After verifying your code on the local environment, and when you’re ready to deploy, you can do this by using T-bears CLI (command-line-interface).

✅ Once you’ve coded a SCORE successfully onto the network, the SCORE will get a new address that starts with CX. You can send transactions to the CX address in order to interact with the SCORE.

👉 Let’s wrap it up

So, what is SCORE? SCORE means Smart Contract for a Reliable Environment, and it is the name for Smart Contracts running on the ICON blockchain. This Smart Contract is a combination of code and data that resides at a specific address on the blockchain. What’s excellent about SCORE is that it doesn’t require data migration, which makes it fast and easy to deploy. Another significant aspect of SCORE is that it’s written in an easy to learn coding language called Python.

😁 Overall, SCORE makes it easier for everyone to deploy Smart Contracts.

Get to know more about ICON

DISCLAIMER: This is not financial advice. Staking, delegation, and cryptocurrencies involve a high degree of risk, and there is always the possibility of loss, including the failure of all staked digital assets. Additionally, delegators are at risk of slashing in case of security or liveness faults on some protocols. We advise you to do your due diligence before choosing a validator.

Subscribe to Stakin Newsletter

Stay informed about the latest trends in the blockchain ecosystem and gain expert insights from a leading Web3 operator.