Questions tagged [cryptography]

Discipline or techniques employed in protecting integrity or secrecy of electronic messages by converting them into unreadable (cipher text) form.

Filter by
Sorted by
Tagged with
134
votes
5answers
99k views

How are ethereum addresses generated?

What criteria does a valid Ethereum address need to fulfill? Is it just a random number in hexadecimal? Or does it need to be derived in a specific way, according to some cryptographic algorithms? ...
106
votes
2answers
73k views

Which cryptographic hash function does Ethereum use?

Many sources refer to the use of the "SHA3" cryptographic hash function within Ethereum, but the Ethereum project began before the SHA3 standard was finalised, and there was some confusion/controversy ...
55
votes
5answers
33k views

Get public key of any ethereum account

Can I somehow get the public key of an ethereum account knowing just the corresponding ethereum address (e.g. 0x54dbb737eac5007103e729e9ab7ce64a6850a310)?
40
votes
2answers
4k views

What's a precompiled contract and how are they different from native opcodes?

The Yellow Paper states: These are four so-called ‘precompiled’ contracts, meant as a preliminary piece of architecture that may later become native extensions. The four contracts in addresses ...
35
votes
1answer
21k views

What does v, r, s in eth_getTransactionByHash mean?

In Ethereum JSON-RPC I found the return is: Returns Object - A transaction object, or null when no transaction was found: hash: DATA, 32 Bytes - hash of the transaction. nonce: QUANTITY - the number ...
33
votes
6answers
23k views

ecrecover from Geth and web3.eth.sign

I have tried to use ecrecover() to verify the signature of a message. I have looked at lots of references here and elsewhere, like: https://lab-blog.ey.com/2016/12/19/ecrecover/ How does one ...
32
votes
2answers
14k views

How to encrypt a message with the public-key of an Ethereum address

I am writing some code in nodejs/browser. I have successfully created ethereum-addresses with the secp256k1-library. I was also able to sign and verify messages. Now I want to encrypt/decrypt a ...
30
votes
1answer
5k views

When can BLOCKHASH be safely used for a random number? When would it be unsafe?

I've seen more complicated ways for a contract to generate a random number. But the Ethereum Yellow Paper itself suggests a "trivial solution" using the BLOCKHASH opcode (see below, bold is mine). ...
29
votes
5answers
11k views

How can I sign a piece of data with the private key of an Ethereum address?

I would like to use the key pair of one of my Ethereum accounts to sign a piece of data. How can this be done?
29
votes
1answer
12k views

How can I verify a cryptographic signature that was produced by an Ethereum address key pair

If I have a cryptographic signature from an Ethereum address key pair, how can I verify that signature?
27
votes
3answers
4k views

Is Ethereum secure against an attack by quantum computers?

Does Ethereum implement Post-quantum cryptography? Or will the network break once a malicious actor gains control of an effective quantum computer?
22
votes
2answers
8k views

Why aren't Solidity sha3 hashes not matching what other sha3 libraries produce?

Solidity has a function named sha3 and I tested it with an empty string input. It is not matching what other sha3 libraries produce. I see contracts written by others using the same sha3 function ...
21
votes
3answers
5k views

Account uniqueness guaranteed?

When we create an account in the Ethereum main network, how does the protocol guarantee the unique address of an account? Since even if we are not connected to the network we can create an account, is ...
21
votes
2answers
7k views

Is it safe to reuse Ether addresses?

I believe it's viewed as unsafe in Bitcoin because of the way transactions are signed. Is this also true for Ether addresses?
21
votes
1answer
746 views

Out of Gas invoking precompiled contracts on private blockchains

Why do precompiled contracts lead to Out of Gas on private blockchains? Some tidbits are provided in the Solidity docs but can it be explained more? It might be that you run into Out-of-Gas for ...
20
votes
3answers
5k views

How does Oraclize handle the TLSnotary secret?

Oraclize claims to offer a provably honest secure retrieval of a webpage by taking advantage of TLSnotary (a service that allows an auditor to verify if a specific web page was accurately retrieved) ...
19
votes
2answers
27k views

How can I get a mnemonic phrase from a private key?

I have a private key for my wallet and also a keystore for it. I want to use it in MEWConnect. Is there a way to get a mnemonic phrase from a private key?
17
votes
3answers
2k views

What are effective and secure ways of shuffling a deck of cards in a contract?

We want to write a card game in Ethereum. What are effective and secure ways of shuffling a deck of cards in a contract, and dealing them to players? It needs to be done in a way so that no one can ...
16
votes
1answer
3k views

Getting the wrong address back from ecrecover

When I sign a string using the following code I get back a different address to the one I signed with. The address returned is different for different strings. const util = require('ethereumjs-util') ...
15
votes
2answers
9k views

How can I verify a signature with the web3 javascript API?

Using the javascript web3 API I can create a signature like this: > web3.eth.sign(eth.coinbase, "0xdeadbeef") "...
14
votes
8answers
3k views

Would it be profitable enough to do a Master's degree in blockchain technologies (focused on ethereum above all)?

The end of my university studies is getting closer and closer. I'm sure I want to do a Masters degree, but I have some doubts. About a month ago my university released a Masters degree completely on ...
14
votes
1answer
901 views

Does Ethereum Suffer From Transaction Malleability?

Does Ethereum in its current form (Homestead, specifically Geth v1.3.6) have transaction malleability issues similar to Bitcoin? If so, is there a standard method for deriving a normalized hash for ...
13
votes
1answer
7k views

arguments of the sha256 function in Solidity

In Solidity, I find that the sha256 function can be used like this a = sha256(uint b, string c, bool d, ......) (the arguments can be a combination of different types, and the other types can also be ...
12
votes
2answers
960 views

What are zkSNARKs? How do they work?

From my brief exposure to the concept, zkSNARKs seems to be a form of zero-knowledge cryptography. What can zkSNARKs bring to the table for Ethereum? I have looked at projects like this but still ...
12
votes
1answer
975 views

Ethereum signature verification not matching

What I want to achieve is sign a message and then verify the signature whether verified by same address or not. Contract to Invoke ecrecover method to verify the address contract MyAuth { ...
11
votes
1answer
2k views

Why are Ethereum addresses hashes of public keys?

I understand how Ethereum addresses are generated. This thread has a great explanation: How are ethereum addresses generated? However, what this explanation is missing is why a hash is used. There ...
11
votes
2answers
2k views

Secure paper wallet creation for ETH using JS

I am about to start the process of transferring my ETH to paper wallets for safe keeping. Currently the funds are stored on an online exchange. History shows that this is a very bad idea. It is not ...
11
votes
3answers
1k views

Can ZKSnarks be implemented on the Ethereum ecosystem?

Since Zcash seems to have it's ZKSnarks implementation finished (or almost at least). And versions of JPMorgan's Quorum had appeared with ZKsnarks implementations included see: https://www.coindesk....
9
votes
1answer
7k views

Getting an address from ethereumjs-utils ecrecover

I am trying to sign a string using web3.eth.sign() and then get the public key I signed with from the signature. To do this I am using ecrecover() from ethereumjs-utils, which returns a buffer. When I ...
9
votes
1answer
501 views

Are there any plans to switch Ethereum's primary hash algorithm from Keccak-256 to SHA3?

The Ethereum project was started before the SHA3 standard was finalised, and currently uses an earlier version of Keccak-256 which does not precisely match the FIPS-202 standard for SHA. Are there ...
8
votes
1answer
1k views

Why are the last 20 bytes of the public key used as the address?

According to this post regarding how to derive the Ethereum address from a public key: Take the last 40 characters / 20 bytes of this public key (Keccak-256). Or, in other words, drop the first ...
8
votes
1answer
2k views

Authentication using ethereum account

Trying to figure out a way to Authenticate users them having an ethereum account. New to ethereum and cryptography in general and my thought may not be adequate. In essence I am thinking to be able ...
8
votes
4answers
2k views

How can I verify a secp256r1 signature using solidity

Sorry if you find these questions are basic, but I am new to encryption. As far as I know, Solidity have ecrecover function for this purpose, but it use secp256k1 signature. which I am intend to use ...
7
votes
2answers
612 views

How does the system enforce correct execution of smart contracts?

If I understand correctly, the smart contracts are run by the miners. What incentive do the miners have to execute the smart contracts correctly? What stops a malicious miner from changing the result, ...
7
votes
2answers
930 views

Store encrypted private keys on-chain

How secure is it to store encrypted private keys on chain ? Are the assets in the example below easer to brute-force than the master-key that encrypts them ? contract MyPrivateKeys { struct ...
6
votes
1answer
362 views

Any understandable cryptography book/article/lecture to introduce to signatures, hashes, ECDSA etc..? [closed]

It's a long time I'm searching for cryptography lectures related to ethereum inside mechanisms, and everything I found has a high mathematical level. I'm an engineer, not a mathematics, so any article ...
5
votes
1answer
2k views

Understanding Ethereum signatures

I would like to understand exactly which signatures are used in the Ethereum. Here https://bitcoin.stackexchange.com/questions/12554/why-the-signature-is-always-65-13232-bytes-long it says that there ...
5
votes
2answers
3k views

How to implement cryptographic algorithms in smart contracts?

I need to implement cryptographic algorithms such as AESCCM and elliptic curve algorithms (ECDSA, ECIES) within a smart contract. Is there any implementation of such algorithms in Solidity or Serpent? ...
5
votes
2answers
1k views

How to guarantee IPFS file access based on Non Fungible Token ownership (or security)?

The file is too big to be stored on the blockchain, so it is stored on IPFS. Only the person who owns a unique Non Fungible Token (or a Security Token) can access it. Of course I can encrypt the file ...
5
votes
1answer
1k views

How can we verify BGLS aggregate signatures in Solidity?

BGLS [1] is an aggregate signature scheme by Boneh et al., that allows aggregation of signatures on n different messages from n different signers. What I want to achieve is to verify such signatures ...
5
votes
2answers
538 views

Why does ecrecover() take signature parameters (v,r,s) instead of the full signature?

Is there any reason ecrecover() takes the (v, r, s) signature parameters instead of the full signature, given that these can be easily computed inside the function itself? I am asking because ...
5
votes
1answer
1k views

Is it possible to create an X.509 certificate from an Ethereum/Bitcoin private key?

We all love Ethereum/Bitcoin (i.e. EC secp256k1) private keys, because they let us sign transactions. However, browsers don't support those keys for authentication -- what they do (sort of) support is ...
5
votes
1answer
598 views

Generate key in Ruby, import in Geth

I'm a Ruby newbie and I need to implement a Geth-compatible key import/export in Ruby. I was looking at the Geth implementation in Go, as well as keythereum. For generating the key, I am using the ...
5
votes
1answer
162 views

How can one use the tokens provided by a crowdfunding platform?

I was reading about Weifund crowdfunding. In it, some custom crypto-tokens are provided to investors in exchange for an invested amount. I just want to know how will that investor use that token so ...
5
votes
1answer
2k views

Ethereum Authentication/Authorization

Lately I've been thinking about how to integrate Ethereum with other non-Ethereum systems. Would it be a bad idea to import and Ethereum keypair into an external (mobile/desktop) application, which ...
4
votes
2answers
6k views

Defi-Staking is it 100% safe?

I was reading on crypto staking, more precisely Defi-Staking on Binance: https://www.binance.com/en/defi-staking While I am not a native english speaker I could understand that there is no risk in ...
4
votes
3answers
1k views

Will be a ring signature scheme possible to implement at Ethereum?

It's been quite a few days I'm wondering if a Ring Signature Scheme (like Monero (XMR) has) can be implemented on Ethereum blockchains. As far as I know, that will be so nice in order to increase ...
4
votes
4answers
2k views

How to calculate an Ethereum Contract's address during its creation using the Solidity language?

Now I know and have read the other thread saying that a contract's address is created deterministically via RLP encoding the creator's address and his nonce and then hashed with Keccak-256 but the ...
4
votes
2answers
4k views

How Ethereum confirm the transaction?

Am I right, that Ethereum do it the same way as Bitcoin (Bitcoin dev guide), and the only difference is that the Ethereum use it's own OP_CODES? UPD I mean, what is the Ethereum's alternative for &...
4
votes
1answer
107 views

How to convert public key (64 bytes) to compressed public key (33 bytes)

I currently have a generated 64-byte public key that has been recovered from an Ethereum transaction. How do I convert this key into a 33-byte compressed public-key? The problem I'm having seems ...