Review of Smart Contract Blockchains

Arnaud
3 min readOct 20, 2021

Blockchain becomes more common every day and smart contracts are now very easy to implement. In this article, we will check the different possibilities offered to us.

Smart contract = small program executed on blockchain

Last update: 2021/11/04

Ethereum: the most used

Ethereum's contract are written in Solidity, which is based on JavaScript.

Website: https://www.etherchain.org

Consensus: proof-of-work (will be updated to proof-of-stake)

contract Storage {
uint256 number;
function store(uint256 num) public {
number = num;
}
function retrieve() public view returns (uint256){
return number;
}
}

You can test your contract using Remix.

payable keyword: make function require an amount of ETH

Sender address is accessible with msg.sender and the amount of ETH with msg.value.

function buyPizza() payable public {
paied[msg.sender] += msg.value;
}

The sent amount will be hold by the smart contract.

Ethereum classic: less popular but can be more effective

Fork of Ethereum, Ethereum classic uses similar technologies as Ethereum: Solidity smart contract. Since, it is less popular and used, it can be cheaper and faster.

Website: https://ethereumclassic.org/

Consensus: proof-of-work

Smart contract example: https://ethereum.org/en/developers/docs/smart-contracts/

Avalanche: easy if you know Ethereum

Avalanche’s smart contract are written in Solidity like Ethereum.

Website: https://www.avax.network

Consensus: proof-of-stake

Launch Ethereum dapps that confirm transactions instantly and process thousands of transactions per second, far beyond any decentralized blockchain platform today.

Harmony: easy if you know Ethereum

Harmony’s smart contracts are written in Solidity like Ethereum.

Website: https://beta.harmony.one/

Consensus: consensus protocol uses design principles such as sharding and pipelining to parallelize transaction processing.

Harmony is an open and fast blockchain. Our mainnet runs Ethereum applications with 2-second transaction finality and 100 times lower fees.

Cosmos: write contract in Go

Website: https://cosmos.network/

Consensus: Byzantine Fault Tolerant (BFT) consensus mechanism

Flow: write using Cadence

Website: https://www.onflow.org

Consensus: HotStuff

pub contract HelloWorld {
pub let greeting: String
init() {
self.greeting = "Hello, World!"
}
pub fun hello(): String {
return self.greeting
}
}

Polkadot: create parachains

The Polkadot relay chain itself will not support smart contracts. However, since the parachains that connect to Polkadot can support arbitrary state transitions, they can support smart contracts.

Website: https://polkadot.network

Consensus: proof-of-stake

Solana: write contract in Rust

Solana’s smart contracts are written in Rust., which is based on Haskell language.

Website: https://solana.com

Consensus: Tower BFT (kind of proof-of-history)

use std::convert::TryInto;
use solana_program::program_error::ProgramError;
use crate::error::EscrowError::InvalidInstruction;pub enum EscrowInstruction {
InitEscrow {
/// The amount party A expects to receive of token Y
amount: u64
}
}
impl EscrowInstruction {
/// Unpacks a byte buffer into a [EscrowInstruction](enum.EscrowInstruction.html).
pub fn unpack(input: &[u8]) -> Result<Self, ProgramError> {
let (tag, rest) = input.split_first().ok_or(InvalidInstruction)?;
Ok(match tag {
0 => Self::InitEscrow {
amount: Self::unpack_amount(rest)?,
},
_ => return Err(InvalidInstruction.into()),
})
}
fn unpack_amount(input: &[u8]) -> Result<u64, ProgramError> {
let amount = input
.get(..8)
.and_then(|slice| slice.try_into().ok())
.map(u64::from_le_bytes)
.ok_or(InvalidInstruction)?;
Ok(amount)
}
}

Cardano: write contract in Haskell

Cardano’s smart contracts are written in Plutus, which is based on Haskell language.

Website: https://cardano.org

Consensus: proof-of-stack

hello :: Contract () EmptySchema T.Text ()
hello = logInfo @String "Hello, world"

You can test your contract using Plutus playground.

Tezos: choose your language

Tezos’ smart contracts are written in Michelson. However, you can write it in SmartPy (Python), LIGO, Indigo, Archetype and then compile it in Michelson.

Website: https://tezos.com/

SmartPy IDE: https://smartpy.io/ide

Consensus: Emmy+ (proof-of-stack)

Conclusion

It’s only my humble opinion, but I think Solidity seems to be the most developer-friendly language. Rust or Haskell have a robust and secure image, but it is too verbose to use. So, for me, Ethereum or Ethereum compatible blockchain are the easiest to use for common developers.

--

--