Do we just need private key to sign a transaction ? #3539
-
When we are creating a wallet object from ethers.wallet we are only passing the private key in it, my question is how will the wallet know about the corresponding public key or address ? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
@jashjasani Private key and data we need to sign a transaction and with a public key, we can verify that this transaction is coming from that private key. The public key basically created from the private key using an Elliptic Curve algo. You should watch this part to understand more Signing Transactions (01:22:55) |
Beta Was this translation helpful? Give feedback.
-
This is how we create a
First of all, cryptographic algorithms used in this space, primarily SHA256, are collision-resistant--i.e. no different outputs from a given input will be the same. Additionally, in the blockchain space, we use asymmetric cryptography--i.e. to encrypt and decrypt data, there is no single point of failure in a single key; we have a pair of keys, which is known as the public and private keys. For an analogy, public keys are, essentially, the way to identify you on a social media site; whereas, private keys, essentially, are by which you identify yourself to the centralized provider--i.e. by "signing", similar to how a bank account functions. So, this is because of the fact that there is a pair of keys, you can cryptographically recover the public key from a sign and if you have (r, s) from the elliptic curve. |
Beta Was this translation helpful? Give feedback.
@jashjasani
This is how we create a
Wallet
instance (Wallet
extendsSigner
abstract class)--i.e. from theprivateKey
.First of all, cryptographic algorithms used in this space, primarily SHA256, are collision-resistant--i.e. no different outputs from a given input will be the same. Additionally, in the blockchain space, we use asymmetric cryptography--i.e. to encrypt and decrypt data, there is no single point of failure in a single key; we have a pair of keys, which is known as the public and private …