Python vs R in 2019

A detailed look at how each language is suited to Machine Learning with code samples and performance tests

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Solana Smart Contracts Overview

Hey Readers👩‍💻,

In our previous article about the Solana Network, we discussed the basics of what makes it such a unique project. In this article, we’re taking a look at Smart Contracts and how they work on Solana.

Solana’s mission is to support all high-growth and high-frequency blockchain applications and to democratize the world’s financial systems. So, let’s start from the beginning; what are smart contracts?

The overall term to describe smart contracts is a self-enforcing software piece managed by a peer-to-peer network of devices. Smart contracts provide a coordination and enforcement framework for agreements between network stakeholders without the need for third parties or traditional legal contracts. They are often implemented to formalize simple agreements between parties, create digital assets, or support organizational processes.

Smart contracts, from a user’s point-of-view, work a lot like a vending machine. You select the product you’d like to have, such as a contract, ownership form, or anything else. Once you’ve entered the right amount of digital currency, you’ll get the product delivered right to your lap. Within the contract itself, enforcement rules and specifications are registered, and they will also automatically be enforced.

Smart contracts give autonomy because they eradicate the need for a third-party intermediary. They also give trust, as no one can steal or lose documents since they are encrypted and stored on a shared ledger. Furthermore, you don’t need to trust the second party you’re dealing with or require them to trust you. Thirdly, you can save money on real estate agents, advisors, assistance, etc. It is also safer and more efficient, smart contracts save you a lot of time because you’re no longer stuck on complicated processes.

For a further explanation about smart contracts and why they are a vital part of the blockchain world, check the video below.

As some of you might be aware, the Solana Network works on a Proof-of-History consensus. Solana’s approach to smart contract execution is based on how operating systems load and execute dynamic code. So, let’s have a look at the image below. As you can see, the client creates a program in whichever coding language, and then compiles it together with something called LLVM and sends it to the Solana Bytecode.

The output file is called an ELF. It has a specific bytecode as its target, which is designed for quick verification and conversion on the local machine instruction set (on which Solana is running).

A kernel is an essential part of a modern computing operating system used to initialize and manage critical resources such as CPU and Memory. It also provides a platform to run other programs on. Most of the time, smart contracts’ performance focusses on WASM, which we’ve discussed in earlier articles. However, Solana has also emphasized the bytecode, which is based on the Berkeley Packet Filter (BPF). BPF is a technology used in operating systems for programs that need to analyze network traffic, as is the case with smart contract technology. In a nutshell, it provides an interface to data link layers, allowing raw link-layer packets to be sent and received. The reason that Solana is basing their bytecode on BPF is that what the kernel does with untrusted code overlaps the requirements that they have. Which are:

If you’re wondering what bytecode is, it is a program code compiled from source code into low-level code designed for a software interpreter. As discussed with the LLVM, it can be executed by a virtual machine or compiled into machine code. See the video below for a further explanation.

Another aspect of importance is memory management. It all starts with the ELF file itself. At first, contracts are constrained to be read-only code and data segments: meaning, no mutable globals, or mutable static variables. As the Solana Network develops, this requirement can be relaxed. Since smart contracts do not hold state, Solana had to develop a way to manage the contract. Therefore, they’ve decided to create an interface for creating state; the interface is invoked through a transaction similar to any other contract method.

So, what are the pros and cons of building smart contracts on Solana? First, as mentioned in our previous article, Solana has implemented eight different key technologies that are essential for its existence. One of those is called Sealevel, which makes parallel smart contracts runtime possible. In many blockchain networks, one smart contract at a time influences and modifies the blockchain state. However, on Solana, the runtime can process tens of thousands of contracts in parallel. This allows for non-overlapping transactions to execute concurrently, and for transactions that are only reading the same state to execute concurrently as well.

Smart Contract networks such as Solana have been among the hottest topics in the blockchain and specifically the Proof-of-Stake blockchain world. Many platforms are competing with each other. And while all platforms have some shortcomings, we’re interested to see how Solana is going to develop the smart contracts for the future.

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 loss 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.

Add a comment

Related posts:

Dissociation

One line poetry prompt July 22 “Squander”. “Dissociation” is published by Anna Rozwadowska in Chalkboard.

My Idea of an Ally

Are we going to war? Who is the enemy? Why do I need an ally, we’ve known each other for years? I cringe at the thought because as a black man I know what it means, I’m not oblivious to social fads…

Just keep creating

Sometimes you have to be a little bit like Dory from Finding Nemo, only instead of chanting “just keep swimming, swimming, swimming”, you need to chant “Just keep creating, creating, creating.” I get…