Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Hot answers tagged

21

ECDSA signatures are pairs (r,s) where r=(kG).x mod n, and s = (m + rx)/k mod n, where x is the secret key, k is the random nonce, and m is the message. If you have two s values s1 and s2 for the same secret key and with the same nonce k (and thus the same value r), the following holds: s1 = (m1 + r*x)/k s2 = (m2 + r*x)/k From that we can derive: s1 * k =...


11

This question may be opinion based in some ways, but I'm going to attempt to answer it as it is an important concept, and somewhat unlike traditional systems. Bitcoin is governed by math, in some places. At the end of the day, it's software, and even the math rules can be updated to use different rules, or removed altogether by means of a soft or hard fork (...


5

That the network is secure by means of math instead of some central authority (e.g. a bank overseeing everything)? If so, what math? The math that makes PoW possible? The math that makes proof of work possible is a one-way function, specifically the SHA256 algorithm. This combined with public key cryptography secures the ownership of digital assets in a ...


3

every detail of bitcoin can be changed by the developer by editing the source code. 21million was satoshi nakamotos design decision. afaik this number is not directly contained in the source-code. every ~10minutes a new block will be created. every 210000 (~every 4 years) blocks will the block reward be halved. so in many years (after many halvings) miner ...


3

Average coins/day for a miner can be estimated by comparing the miner's hashrate with the hashrate of the network. where, Cm is total coins for the miner subsidy is the number of coins/block a miner gets as a reward blocktime is the average time per block Hm is the miner's hashrate (Hash/sec) Hn is the total network hashpower (Hash/sec) 1440 is minutes ...


2

The signatures in Bitcoin (and Bitcoin Cash, Ethereum, and many other cryptocurrencies) are generated using elliptic curve curve cryptography. I found these videos very helpful in that regard: https://www.youtube.com/watch?v=jQLmaBjYrk4 Other than that, you probably want to look into hash functions and asymmetric cryptography in general. As a general ...


2

Keep in mind that both types of address, assuming we are comparing P2PKH with P2WPKH addresses, are just encoding a hash of a public key. The hash used in both addresses is a RIPEMD-160(SHA-256(public key)), so regardless of the encoding, the same number of possible valid addresses remains the same. Each address format is simply encoded with a different ...


2

Details are in BIP 146: We require that the S value inside ECDSA signatures is at most the curve order divided by 2... ... A high S value in signature could be trivially replaced by S' = 0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE BAAEDCE6 AF48A03B BFD25E8C D0364141 - S. Signatures encode two important values for verification r and S. If (r, S) is a ...


2

To proof the validity of the signature we must see that the tuple (R,s) actually came from the private key x in particular s was derived as s=r+cx. Obviously we should not possess x (which is the reason why we need this verification equation) so Looking at gs = RXc we relize that we know (R,s), X and c. (Since c = H(X,R,m) and the public key X is obiously ...


1

Try using the an open source program called ent. Here are the results for rolling a die six times with the result vector of <666666>. % echo -n "666666" | ./ent Entropy = 0.000000 bits per byte. Optimum compression would reduce the size of this 6 byte file by 100 percent. Chi square distribution for 6 samples is 1530.00, and randomly would exceed this ...


1

If you know two signatures about one random number, you can calculate the private key.


1

There is two issues with your calculation: You are assuming that you are both a Maker and Taker (either maker when buying and Taker when selling, or taker on the buy and maker on the sell) which could be true, but might not always be the case You are calculating both fees based on the Buy Price (which is not accurate because the corresponding maker/taker ...


1

Any Elliptic Curve could work in the BIP32 scheme. The only property of a Curve that BIP32 relies on is that a * G + b *G = (a + b mod N) * G, which is true for any Elliptic Curve. Secp256k1 is a 'Koblitz' curve, which just means its choice of parameters enables very fast scalar multiplication (computing a multiple of the Generator point). With that said,...


1

You can use bouncycastle ECPoint to do this conversion: static ECParameterSpec SPEC = ECNamedCurveTable.getParameterSpec("secp256k1"); static byte[] compressedToUncompressed(byte[] compKey) { ECPoint point = SPEC.getCurve().decodePoint(compKey); byte[] x = point.getXCoord().getEncoded(); byte[] y = point.getYCoord().getEncoded(); // concat ...


1

Yes, you can convert a 33-byte compressed public key into a 65-byte uncompressed public key in Java. Here is the code to perform the operation. It is correct, robust, and only requires Java SE classes (no other libraries) - but I apologize for the implementation length. import java.math.BigInteger; import java.util.Arrays; static final BigInteger MODULUS =...


Only top voted, non community-wiki answers of a minimum length are eligible