Share the article:
First What is Soroban?
Theoretical example
In the section we created a simple contract that saves and loads data.
Soroban contracts have storage available for persistent data storage.
Each piece of data is associated with a key, which is used to later retrieve the data.
A contract can only modify its own data.
All stored data has a time to live – TTL.
Let's take a closer look.
We know how to store and retrieve data within the Soroban ledger.
We created a contract that increases a number by one and stores its value in storage - increments it.
The key to storing this value is a variable named COUNTER.
Whenever we want to retrieve the value of a number, we use this variable.Stored data also has a TTL (time to live) = number of ledgers.
A ledger is a record in the blockchain – an accounting book.
if TTL is not regularly extended, the data is "archived" and they cannot be read.
For example, the functionextend_ttlto extend the storage TTL each time the number increases.
Additionally, we could, for example,:
Add a function to the contract
get_current_value, which returns the current value of the counter.
Add features likedecrementfor decrementing the counter orresetto reset it.
How to deploy a contract to Pi?
A contract is a kind of data sentence, just in bytes.
To obtain bytes, we need to assemble computer instructions, i.e. compile them – usingpinetwork contract build.
To upload it to the network, we need to install it using the commandpinetwork contract install.
After installation, the contract must be incorporated into circulation - that is, it must exist, and its existence is ensured by a new instance in programming.
To say that something exists requires a commandpinetwork contract deploy.
At that moment, our contract essentially becomes a specific application, meaning the contract is a program.
By its existence we obtain its ID with the contract deployed using the commandpinetwork contract invoke.
We enter the contract ID and the name of the function we want to run.

You might also like:
- Free shares worth up to €100 on Trading 212
- Pi Network and “$314,159 Value”: The Biggest Hoax in the Project’s History
- Where to watch, listen and read PiBazar.eu externally
- Pi Network News: Onramp Money Addresses Wallet Failures, Mentions Ongoing Integration
- Fitbit Versa 2 Smart Watch (NFC)
- Beware of fake Facebook and other pages about Pi
- The Simpsons' surprising prediction: Her connection to the Pi Network!
- Pi Network now available on Onramp Money
