Sooraj 🚢 Profile picture
Jun 1 31 tweets 15 min read
#Ethereum's account-based model & smart contract based on Solidity is a marriage made in hell

Vasil-HFC Event is on the horizon

& its time to unleash synergies of #Cardano's EUTxO model & Plutus

Here's a thread on why EUTxO model & functional programming is what DeFi needs🧵👇
The ultimate goal of #Blockchain

Is to replace the corrupt & centralized traditional financial system

To create an inclusive global financial system to bank the unbanked

But are we going to do it with a system that is more problematic than what we have now?
#Crypto in general & DeFi has seen massive growth in the last decade

DeFi-exploits have also seen proportional or even bigger growth

This makes us realize the fundamental requirement of the system we want to be a part of

A blockchain architecture that offers safety & security
A blockchain architecture that is designed to host mission-critical DApps

And when it comes to simple & elegant design that offers safety & security

There are two examples out there

•UTxO model of #Bitcoin

•& functional programming with #Haskell
#Cardano combines both of these worlds

• By Extending #Bitcoin's EUTxO-model

#Cardano created the EUTxO-ledger architecture

• Powered by smart contracts based on Plutus

• Which in turn provides a safe, full-stack programming environment based on #Haskell
So why is the combination of

#Bitcoin's UTxO-ledger model & functional programming with #Haskell

A marriage made in heaven!!

When compared to something terrible like

#Ethreum's Accounts-based model & imperative programming based on Solidity
So to understand why #Cardano choose a fundamentally different architecture to #Ethereum

We should understand the synergies between

• UTxO-Model & functional programming

So let's dig a bit deeper !!

To understand the principles behind functional programming
So what is functional programming?

Functional programming is the process of building software

By composing pure functions

Which avoids 👇

• shared state

• mutable data

• & side-effects
So what are pure functions?

In the context of computation,

A pure function is analogous to a mathematical function

Which is the basis for all formal scientific reasoning

It is a function (a block of code)

that always returns the same result if the same arguments are passed
A function must follow four rules to behave like a function in math:

• It must always take an argument

• It must always return a value

• It must not depend on anything that changes

• It must not change anything by itself

A function with such properties is called "Pure"
Pure functions are "Stateless" and "timeless"

Meaning

Pure functions are easily parallelizable since they encourage immutable data structures

Which reduces the side-effects

That makes code hard to run on multiple processors
Just like #Bitcoin's UTxOs

Functions are also just mappings from inputs to outputs 

It does not depend on any state or data change during a program’s execution

There are no external states & side effects

This gives certainty & predictability to the behavior of the code
Haskell has 1st-class functions

A programming language is said to have 1st-class functions

When functions are no different from any other variable

Where,

•Functions can be used as arguments

•Can be returned as values from other functions

•& can be assigned to a variable
1st-class functions allow to abstract out

Any repetitive computation from the code

And ultimately enables to write functions that produce other functions

These functions are referred to as higher-order functions
Higher-order functions simply mean

Functions that are operating on other functions

Why is it useful?

1. Higher-order functions raise the level of abstraction

Meaning

It allows to abstract over actions & not just values

Thus, we don’t have to reason about lower-level details
2. Higher-order functions are key to parameterizing code by behavior

Meaning

It allows us to define common programming patterns

And write functions about functions

Having higher-order functions is where a lot of the benefits of functional programming come from
In a nutshell,

•Functional programming uses mathematics-like values & functions

•To yield results that have no outside influence & are well-evaluated throughout

•leading to a more parallelizable transparent & cleaner code

•That helps the user in debugging & maintenance
On the other hand

Programming in a dynamic environment with object-oriented programming

Results in the creation of huge "Dependency Hell"

Resulting in adding abstraction on top of abstraction to modularize complex systems

This results in a "shared mutable state/global state"
When submodules try to access the global state simultaneously

complexity arises & it results in a chaotic programming environment

Just like the Account model of #Ethereum

Where there's Global State & transactions fail in mid-script execution

After taking fees from the user
If we could use our common sense and consider the above-mentioned reasons

A pure functional programming language like #Haskell

should ideally be the go-to programming language for dApps

which are enabling financial transactions north of billions of dollars
Haskell is similar to the UTxOs of #Bitcoin

where the pure function is a mapping from input to output 

& #Ethreum's account model is similar to object-oriented programming

Accounts are similar to objects

where they send messages to each other in a dynamic & distributed setup
Although he had the knowledge of the Account-based model

When Satoshi invented #Bitcoin , he choose the UTxO-Model

Because the semantic model of the ledger stays simple

In a complex distributed and dynamic computing environment
The UTxO-model has very limited expressiveness of programmability

This limitation of #Bitcoin is what motivated Vitalik

To choose the Account-based ledger model for #Ethereum

But this resulted in the creation of a "Global state"

& this complicates the programming of dApps
#Cardano took a methodical approach

Extending #Bitcoin's UTxO model with scripts & arbitrary data

& by using #Haskell based Plutus programming language

Where the side-effect free nature of E-UTXO transactions

Maps perfectly into the pure-functional nature of Haskell functions
The arbitrary logic/scripts allow the E-UTxO model to have more expressiveness

The arbitrary data carries with it information about the state of outputs

which enables the contract state to be localized as the state is localized

There is no notion of a ''Global state''
In #Ethereum

to write a smart contract you write the on-chain code in solidity

then a Javascript code for the off-chain part that runs in the wallet

This is inconvenient

As you have to develop an ad-hoc integration between the two pieces of code

Which is Complex and Fragile
#Cardano's Plutus Platform uses Haskell for the off-chain & PlutusTX for the on-chain code

That compiles down to Plutus Core

Enabling the use of same syntax, compiler & data types in both parts of the code

Which translates into an integrated, compact & robust programming model
Meaning

Its a lot easier to reason about the behavior of a smart contract

While programming a smart contract in Plutus

It won't be too difficult to actually prove that

Code will behave exactly how it is supposed to

Enabling easily verifiable code for secure & safe dApps
We cant build the future of open global finance on platforms where multimillion-dollar hacks occur on a weekly basis

It has to be built on a platform

That has put enough work and thought

To build not only scalable but secure & safe dApps
#Cardano is melding the best of both worlds with E-UTxO-model

combining the elegant & simple architecture of #Bitcoin's UTxO-model

that maps perfectly into the pure-functional nature of Haskell functions

bringing

•safety

•security

•& scalability

To the #Blockchain world
If you found this thread valuable:

1. Toss me a follow for more threads on #blockchain technical deep dives

2. Here’s another thread on "EUTxO and Parallelism" that you may find useful :

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Sooraj 🚢

Sooraj 🚢 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @Soorajksaju2

May 16
'Parallelism' is a core feature of #Cardano's EUTxO ledger model
 
This is one of those features that enable the  creation of scalable DApp on #Cardano
 
So let's dive in and explore the concept of 'Parallelism':🧵👇
So what is ''Parallelism'' ??

In the context of computation

The term Parallelism refers to techniques to make programs faster by performing several computations at the same time
Why is parallelism important in the context of #Blockchain?

A blockchain architecture that allows transaction parallelism is a requirement to have high throughput on-chain

and it allows for the building of scalable Dapps on top of the #Blockchain
Read 16 tweets
May 10
Djed was the Quintessence of ''stability'' in ancient Egypt

The symbolic backbone of the god Osiris, the god of Afterlife & Ressurection

And Stability is what Djed is bringing to the #Cardano ecosystem

Here’s a deepdive on the tech behind Djed, stable coin on #Cardano🧵👇
So what is a stable coin?

A stable coin is a price-stable digital asset

that behaves like a fiat currency

but maintains the mobility and utility of a cryptocurrency

It offers a way to bridge the gap between fiat currencies like the U.S dollar and cryptocurrencies
Stable coins are important for crypto markets

Because price stability is built into the assets themselves

It opens up many opportunities for DeFi and value transfer without the risk of price fluctuations

They achieve this price stability is through the underlying collateral
Read 31 tweets
May 8
#CardanoCommunity is in the top three and growing & more and more Projects are building on #Cardano

99% of the fud on #Cardano is not honest criticism

They do it to legitimize the drawbacks of the platform they are invested in

Or to do engagement farming
The most honest criticism that #Cardano gets is from the people who are engaged in building projects on #Cardano

So let's not focus our attention on fud that says ''global state is a necessity for DeFi''

But let's put our heads down, focus on building & educating
Respect is not earned by begging for it!!

Let's do it by demonstrating the capabilities of the platform that #Cardano is building

the upgrades that are planned for the second half of 2022 are of paramount importance in demonstrating these capabilities

so let's focus on that👇
Read 8 tweets
Apr 24
@orbisproject is one of the first projects engaged in building mission-critical scalability infrastructure on #Cardano

Bringing L2 scalability to Cardano through Zero-Knowledge(ZK) Rollup

Here’s a breakdown of the tech that scales #Cardano to be a global financial platform:🧵👇
@orbisproject is a general purpose ZK Rollup on #Cardano

So, what are Rollups?

They are L2 solutions

• that settles the transactions outside of the L1, eg. #Cardano

• but post the transaction data back to the L1

• which allows rollups to be secured by native L1 security
• Rollups are fully general-purpose

meaning

any one can even run an copy of L1 (eg: #Cardano) inside a rollup

allowing existing dApps and native assets to migrate to rollups

with almost no need to write any new code
Read 26 tweets
Apr 21
Hydra: The Layer 2 scaling solution with ''Isomorphic state channels''

is one of the most anticipated scaling solutions on #Cardano

which awaits its implementation in 2022

Here’s a breakdown of the tech that brings Layer 2 (L2) scaling to #Cardano: 🧵👇 Image
Let's start from the basics!

So what's an L2 scaling solution?

It's a collective term used for solutions created to help scale a Blockchain

by processing transactions off of the Mainnet/L1

while still maintaining the same security measures and decentralization as the mainnet
So what are the main types of L2 scaling solutions?

•Sidechains

•Optimistic rollups

•Zero-knowledge rollups

•Channels (state channels and payment channels) Image
Read 23 tweets
Apr 18
#Cardano is anticipating a new wave of upgrades with the Vasil HFC event on the 29th of June 2022

Upgrades on Plutus- #Cardano's smart contract platform (CIPs)

are among the most anticipated components of this HFC event

Here’s a breakdown of each one of those upgrades:🧵👇
Plutus is the smart contract platform of the #Cardano blockchain

It allows you to write applications that interact with the Cardano blockchain

The capabilities that Plutus enable range from

• NFTs
• dApps
• native assets &
• on-chain conditional logic
So let's go a bit deep into how programming in Plutus works!

This starts with the compiler pipeline

Plutus contracts are currently written in the functional programming language ''Haskell'

The source code in Haskell is then converted into Plutus IR (Intermediate Representation
Read 26 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(