This is a simple demonstration of reentrancy attack in solidity

Reentrancy attacks are one of the most dangerous threats to be aware of when implementing smart contracts with Solidity. They’re dangerous for two reasons: they can exhaust your smart contract’s ether and, if you’re not careful, they can find their way into your code.

Demonstrating the attack using Banking contract and Attacker contract.

What is Blockchain?

The technology that underpins digital currencies like Bitcoin and Ethereum is known as blockchain.It’s a cutting-edge distributed public ledger system that keeps track of a constantly increasing list of records, known as blocks, that are securely linked using cryptography.

How to create a block?

Now that we’ve covered the basics of blockchain technology and how it works, let’s look at how we can use the principles to create a block.
Blocks, as previously mentioned, are what connect each other to create a blockchain.

Let’s get our hands dirty

Here is the code for the Block class:

Ethereum is often described as “the world computer.”
You are executing transactions and changing the state of the Ethereum blockchain when you communicate with it.

Have you ever wondered what happens when you perform an Ethereum transaction?Let’s look at an example transaction and see if we can grasp it.


Abhilash Sreedharan

Blockchain Developer and Educator

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store