This is part 1 out of a 2 part thread series dedicated to Signatures in Ethereum.

It was inevitable that sooner or later, we would need to talk about this.

But bear with us, as we're going to make this as digestible as possible!

First stop, Public Key Cryptography ๐Ÿ”๐Ÿ‘ฉโ€๐Ÿซ

๐Ÿ‘‡
There are two main purposes of cryptography

- prove knowledge of a secret without revealing the secret
- prove authenticity of data (digital signature)

Cryptography is used extensively within Ethereum, and one place that users meet with cryptography is via Ethereum accounts.๐Ÿ‘ฉโ€๐Ÿ’ป
Proof of ownership of Externally Owned Accounts (EOAs) is established through private keys and digital signatures.

The private keys are used almost everywhere within Ethereum during user interactions, and the Ethereum address of an EOA is derived from the private key.
In other words, the Ethereum address is the last 20 bytes of the hash of the public key controlling the account!

To prove you are the owner of an EOA, you need to sign a message with the corresponding private key๐Ÿ”‘

This means only you have access to the funds on your account.
Imagine making a transaction sending 1 Ether to a contract to mint a new NFT.

Ethereum verified the digital signature you created (using the private key) against the corresponding account's public key hash (the address).

Neat, right? But why does it work? ๐Ÿง
Public key cryptography is based on mathematical functions that allow for unique public/private key pairs ๐Ÿงฎ

Those pairs of keys have special properties, like ease of creation, but it's extremely hard (nearly impossible) to create a private key from its public key.
Having a private key makes it easy to create a public key, but just from knowing a public key, we cannot know which private key was used to create that public key.

That's why proper security of the crypto wallets is necessary ๐Ÿฆพ

medium.com/immunefi/securโ€ฆ
Public key cryptography is a cryptographic method that uses a key pair system.

The one key, called the private key, signs the message.

The other key, called the public key, verifies the signature.

This means, when we sign any message we basically create a digital signature.
This is done by hashing the message and running the ECDSA algorithm to combine the hash with the private key, producing a signature.

By doing this, any changes to the message will result in a different hash value.

Still with me?๐Ÿ˜ตโ€๐Ÿ’ซ

Good, the hardest part is behind us ๐Ÿคฅ
Just kidding, in the next thread we will dive deeper into the Digital Signatures and explain a bit the elliptic curve cryptography!

If you don't want to wait and want to dive deeper into the subject, we got you covered!

medium.com/immunefi/introโ€ฆ
Next, we will learn about digital signatures in Ethereum and why they are cool.

If you liked this thread, please like and retweet to share the knowledge at #immunefischool and other Web3 communities.

The more you know, the safer the ecosystem!โ›‘

See ya in the next one!๐Ÿ‘‹

โ€ข โ€ข โ€ข

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

Keep Current with Immunefi

Immunefi 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 @immunefi

13 Jan
This is part 3 of the thread about signatures in Ethereum.

In this thread, we will learn:

- Replay attacks
- Signature Malleability
- EIP-2
- Nonces

Ok, let's get started! ๐Ÿƒโ€โ™‚๏ธ

With signatures in Ethereum, there may be an issue if a valid signature might be used several times in other places where itโ€™s not intended to be used.

This types of security issues are called Replay Attacks. โฎ๐Ÿคบ

More about them ๐Ÿ‘‡
Imagine a scenario where we have a function that transfers funds, but only when a valid signature is provided.

At first glance, the code looks good.

But the devil is in the details ๐Ÿ˜ˆ Image
Read 19 tweets
10 Jan
This is part 2 of a thread on signatures in Ethereum.

In this thread we will learn:

- What is a digital signature in the context of Ethereum?
- ECDSA
- Meta-transactions
- ERC20-Permit

Ok, let's get started! ๐Ÿƒโ€โ™‚๏ธ

A digital signature can be created to sign any message.

For Ethereum transactions, the details of the transaction itself are used as the message.

The mathematics of cryptography provides a way for the message (i.e. the transaction details) to be combined with the private key๐Ÿ‘‡
โ˜๏ธthat in itself creates a code that can only be produced with knowledge of the private key.

That code is called the digital signature.

The above explanation was taken from the wonderful Mastering Ethereum book, which you can find free on GitHub.

github.com/ethereumbook/eโ€ฆ
Read 13 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

Too expensive? 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!

:(