Bitcoin Forum
May 25, 2024, 04:15:33 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 »
561  Bitcoin / Development & Technical Discussion / Re: The duplicate input vulnerability shouldn't be forgotten on: September 22, 2018, 07:27:09 PM
But you just described Sybil Attack which can happen with or without multiple implementations of bitcoin. It doesn't even need a vulnerability or hashrate to happen.
It's easier to perform this type of attack when you can get other people to voluntarily be your sybil nodes. That's what multiple implementations do in this situation: other people are voluntarily being the sybil nodes.
I may be wrong about this but the way I see it, like everything else such as block size this is purely about what is less bad.

On one hand we have a network of nodes that all run one implementation that if that has a vulnerability which is exploited the whole network will be crippled and the damage will be big.
On the other hand we have new different implementation(s) that might have vulnerabilities and might introduce attack surfaces that will not cripple the network and we have ways to fight these attacks to some extent. So any damage done won't be near as big.

What is the damage of this sybil attack? Some exchange and the traders losing money? That is not new.
What is the damage of a vulnerability like this being exploited? We would be forced to do a "roll back" and lose immutability of bitcoin.
562  Bitcoin / Development & Technical Discussion / Re: The duplicate input vulnerability shouldn't be forgotten on: September 22, 2018, 06:49:00 PM
Suppose there is an exchange that happens to be connected to some nodes that are vulnerable to some kind of attack. Or perhaps they aren't connected directly to those nodes, but connected to node which are connected to those nodes. Suppose this attack causes those nodes to go offline or otherwise become disconnected from the network. Even if there are a very small number of these vulnerable nodes, if they happen to form a ring around the exchange, an attacker can attack those nodes and cause the network to partition.

But you just described Sybil Attack which can happen with or without multiple implementations of bitcoin. It doesn't even need a vulnerability or hashrate to happen.

I do say we need more implementations of bitcoin from scratch. It won't be a perfect solution and it will take time for the software to reach maturity of bitcoin core but the benefits of it are more.
563  Bitcoin / Development & Technical Discussion / Re: How can I verify ECDsa signature that I made? on: September 21, 2018, 01:21:51 PM
then your length fields are screwed up.

YUP. That was it. Thanks.
I missed the fact that 47 (or the right one 48) is the size of the first stack Tongue I mistook it for a DER-length.

If I am not mistaken 48 should be a Compact size integer?
564  Bitcoin / Development & Technical Discussion / Re: How can I verify ECDsa signature that I made? on: September 21, 2018, 01:07:12 PM
(there is an extra 01 in yours)

That is not "extra", that is sigHashType (01 for signall).
An example tx from last block:
https://blockexplorer.com/api/rawtx/85478be31ee805af627562a4b30b44a3321acdf593fb72c99660065a0c7bf301
Quote
48
  30
  45
    02
    21
      008115527f88cf17c6a81ae98e5024ce9839faacba2c78d0005e7413be933397b4
    02
    20
      33792c5f9f76dae8346cab3e69a891101f65ec160bfaba823740a17784c38504
  01
21
  03f63338b081b576f9308066dd1b869eed6f999cff1f24620b416ea7b65fc4e8db
565  Bitcoin / Development & Technical Discussion / How can I verify ECDsa signature that I made? on: September 21, 2018, 12:37:02 PM
I have been working on EC calculations, ECDsa signatures and DER-encoding, considering the randomness of the results and the fact that I am not using any kind of external libraries for any of the steps, I don't know how correct my resulting signatures are!

Lets take the transaction in this example with the following private key:
Code:
18E14A7B6A307F426A94F8114701E7C8E774E7F9A47E2C2035DB29A206321725

How can I verify whether the following transaction has a valid signature (ignore the fact that the transaction it is spending does not exist):
Code:
0100000001eccf7e3034189b851985d871f91384b8ee357cd47c3024736e5676eb2debb3f2010000006b473045022100c3835cd9615ad7bf13ce68498ca4262794f8e1b481020107234e99a675710b40022070cd0c818f53b937e308ce4a824e75657875b3dabeea2eb9e377f18efdeb86e901210250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352ffffffff01605af405000000001976a914097072524438d003d23a2f23edb65aae1bb3e46988ac00000000

I will try with TestNet coins later, but for now I would like to know which part I messed up (if any) for today.
566  Bitcoin / Development & Technical Discussion / Re: Generating public compressed/uncompressed key from given private key in C# on: September 19, 2018, 04:36:13 AM
If you want a vanity address then use the project here:
Source: https://github.com/samr7/vanitygen
ANN: https://bitcointalk.org/index.php?topic=25804.0
It is fast and tested.

If you want to create your own code then I'm afraid you have to write it from scratch if you want it to be fast. NBitcoin has a lot of bottlenecks that is slowing the process down. That library was not meant to be used for speed.

I can't understand parts of your code. For instance what is currentAddress in part 1, is it public key? And why perform double sha256 on it?
Also try Buffer.BlockCopy it is slightly faster.

In your part 2 the base58 encoding is entirely unnecessary since BitcoinSecret constructor will decode it again! https://github.com/MetacoSA/NBitcoin/blob/master/NBitcoin/Base58Data.cs#L63
Create a new instance of Key and pass that in the ctor instead:
https://github.com/MetacoSA/NBitcoin/blob/d21f31311180041a15524588b443767cf95951ec/NBitcoin/Key.cs#L48-L62

Your part 3 has multiple cases where it slows down. The ECC which is unavoidable to convert private to public key (although some methods of scalar multiplications are way faster than others, I believe NBitcoin uses bouncy castle for that which will most probably use a fixed time method. This can be improved if you care to rewrite ECC but I wouldn't recommend it), then another base58 decode and check of the input which can be avoided if you code it from scratch yourself and another base58 encode which may be avoided but I am not sure, have to really check how vanity address creation works under the hood.

P.S. All the Base58 encode/decode functions are slow because they are all using BigInteger which will slow things down drastically (specifically 6 times slower based on my tests)
567  Bitcoin / Development & Technical Discussion / Re: How many possibly bitcoin addresses are there exactly? And how long does it... on: September 15, 2018, 04:01:19 AM
In case you are wondering where are these numbers coming from, you should know that these aren't magic numbers or constants anywhere. These are simply the size of the "data" that represent an address! The first thing you should ask is "what is an address?" This will also clarify things for the question above regarding Bech32 and @theymos answer regarding 2160 and 2256 number of addresses.

An address such as 1BgGZ9tcN4rm9KBzDn7KprQz87SZ26SAMH or bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4 is simply the "human readable" encoding of some data. Now that data simply has a fixed size. In case of P2PKH and P2WPH address examples above this data is RIPEMD160(SHA256(publickey)). Basically you are encoding (to be human readable) the result of RIPEMD160 cryptographic hash function. The encoding can be anything, in bitcoin we use Base58 encoding for first address example and use bech32 for the second.
This hash function as its name suggests is 160 bits in size. So the number of possible results it can have is 2160.
Math:
Code:
1 bit (2^1): 
0
1

2 bit (2^2):
00
01
10
11

160 bit (2^160)
...

What about 2256 then?
That "data" is not always the same. We have different types of addresses. For instance it can be a scriptHash, in which case it is the result of a SHA256 cryptographic hash function which is obviously 256 bits of data hence the 2256 possible addresses.
568  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: September 14, 2018, 07:38:10 AM
~ my brain is fried right now. I have no idea how you are getting the list!
I just created it by changing each character to all possible options. That would only work if there's only one mistake in the key.

I don't have Visual Studio and can't run a .exe either (Linux here).

Try this one then: https://github.com/Coding-Enthusiast/StellarCracker-NetCore
The released (compiled) version: https://github.com/Coding-Enthusiast/StellarCracker-NetCore/releases
It is using .Net core so it would be cross platform. You need to install .NetCore on your Linux though. Here is a guide by Microsoft: https://www.microsoft.com/net/download/linux-package-manager/ubuntu16-04/runtime-2.1.2
In the last line just install dotnet-runtime-2.1/, it is about 20 MB, tested on Ubuntu 14 myself.
Run it with:
Code:
dotnet ./StellarCracker\ NetCore.dll

For preview and stats purposes:
mode1:

mode2:
https://i.imgur.com/9FKMlfy.jpg
569  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: September 13, 2018, 02:40:21 PM
I was working on ECC today, specifically to get Y from X and X from Y so my brain is fried right now. I have no idea how you are getting the list!
Here is the repository: https://github.com/Coding-Enthusiast/Stellar-Key-Brute-Force
You just have to put the keys (1 per line) in a .txt file named keys in your C:\ drive and run the app. It will loop through the keys and take the valid key(s) and puts them in a new file called validkeys.txt in same directory.
Do you need a compiled .exe version or do you have Visual Studio?

P.S. Checking 1000 keys only takes 0.019 seconds.
570  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: September 13, 2018, 01:34:26 PM
You can not brute force a private key like this. The possibilities are limitless. You need to at least know where the wrong character is and limit the search to a couple of million keys at most. Otherwise if you try to put 32 characters in each place and check all the possibilities then you have to check 32^55 keys!

I'll try to make a quick tool to do the check on a given list it in a little while.
571  Other / Beginners & Help / Re: Difficulty factors added to bruteforcing multisig private keys on: September 13, 2018, 09:26:51 AM
A hash is just a mathematical operation... So both rare technically correct.

Well, 2*5 and 2+5 are also both mathematical operations but you call the first one multiplication and the second one addition and you can't call both of them addition!
572  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: September 13, 2018, 04:21:13 AM
In my short search, I haven't been able to find anything that can help you recover your private key. I don't know the details of Stellar private keys either.
Based on a quick research: An stellar private key is a base32 encoding of the (version byte + private key + checksum) and checksum is the CRC16-XModem hash of (version byte + private key) and is 2 bytes. Version byte is 144 for private keys and I believe it uses the default rfc4648 charset but I may be wrong (ABCDEFGHIJKLMNOPQRSTUVWXYZ234567).
573  Other / Beginners & Help / Re: Difficulty factors added to bruteforcing multisig private keys on: September 13, 2018, 03:36:32 AM
In simpler terms, a private key is hashed to create a public key

NO! Private key is NOT hashed to create public key.

The way you get a public key is by using a elliptic curve cryptography techniques. And that is basically a set of operations on points on this plane curve over a finite field. This operation only works in one way and not in reverse. In other words you can easily find the public key from private key but if you try to find the private key from your public key it would be impossible. It requires solving Elliptic Curve Discrete Logarithm Problem which was introduced in 1985 and so far the mathematicians have not been able to find any solution for it.

Have fun reading: https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
574  Bitcoin / Bitcoin Technical Support / Re: Need help to find out what is 72 Character Starting with "S" on: September 11, 2018, 04:23:23 AM
Could be a Mini Private key, starts with S and consists of 30 characters, he just added random symbols for security purposes.

There are different versions of mini private key, it can be 22, 26 or 30 characters long. By the way the character <1> is invalid.
575  Bitcoin / Bitcoin Technical Support / Re: Make and sign a transaction with core unsynced on: September 09, 2018, 03:34:26 AM
I'm considering bitcoin is clearly not as decentralised as I'd like it to be at the moment... Although litecoin does the same, maybe i'll have to move to doge or another coin that allows for free transactions.

Nodes not accepting 0 fee transactions doesn't make bitcoin centralized. If you don't like this then start from yourself by accepting and relaying 0 fee transactions. Change your minrelaytxfee to 0 and then you can share your node IP address so that others who want this connect to you instead of other nodes. There are other nodes that would relay 0 fee transactions.
By the way are you sure Doge or LTC have free transactions? Last time I checked they had empty blocks but nobody relayed 0 fee transactions.
576  Bitcoin / Bitcoin Technical Support / Re: Make and sign a transaction with core unsynced on: September 08, 2018, 12:41:01 PM
Also OP_LOCKTIME also requires a fee

There is no OP_Locktime as far as I know. There is OP_Hold and that is irrelevant here. He is talking about locktime, as in the last 4 bytes of every transaction. When you set it to a specific number (it can be datetime or block height) your transaction can not be mined unless that time is reached.
And by the way your transaction will be rejected by the whole network if it is supposed to be mined in the future.
577  Bitcoin / Bitcoin Technical Support / Re: Coinomi TX Signing Issues on: September 07, 2018, 06:18:14 PM
I'm not entirely sure if that code actually works but it looks quite funny anyway Grin.

These are just bytes, think of it as another language between two computers talking to each other. This is what your bitcoin core node is doing in the background. It is sending and receiving thee messages to "communicate".
f9beb4d9 says start here.
76657273696f6e0000000000 says the type of message I am sending you is "version"
766572616b00000000000000 says the type of message I am sending you is "verak"
The rest is other information such as IP addresses, ports, latest block height you have,...
That's the "greeting" part.
747800000000000000000000 says the type of message I am sending you is a "tx"
The rest is the transaction itself.
https://bitcoin.org/en/developer-reference#p2p-network
578  Bitcoin / Bitcoin Technical Support / Re: Coinomi TX Signing Issues on: September 07, 2018, 04:10:43 PM
It is so easy to broadcast your transaction, you don't even need a client Tongue
Just connect to a seed node IP and ask for a list of node IP addresses.
Take one of the addresses and open a socket over port 8333 and use that IP to connect to and say "hi" like this (you may want to change the IP in it but it doesn't matter because it is flexible):
Code:
f9beb4d976657273696f6e0000000000660000008a94bbe97f1101000d00000000000000131b805900000000010000000000000000000000000000000000ffff05ef60c22acf0d0000000000000000000000000000000000ffff23a7f609208df65ca61c4a15f201102f5361746f7368693a302e31342e312f374d070001
Then wait to hear "hi" and a "handshake" back. Then "shake" the hand like this:
Code:
f9beb4d976657261636b000000000000000000005df6e0e2

Now that the greeting is over you can start talking with that node. In your case you just wanna tell them about your transaction, so just do that:
Code:
f9beb4d9747800000000000000000000bd000000eae844bb0100000001d9c9f7d12419848477506c8ca09b47f55d6dd4ce8442a467b3cc78596405af211c0000006b483045022100e4feb502f883057194cb0f3dff802177036b52714c94852b6e6f0656a2adbe830220381b45ef1cf7c4937981c3a534364f7b0e7fa7e70de9cae2bc35b62104833043012102d2f573c371c17ae32225044fe2f7582a5ed5ae5835fe0408228f0149ee9a6a12ffffffff01a0860100000000001600146ca8c500e1894e369350c9b0f4f436adf007869500000000

Rejected? Try another IP.

This, although being correct steps, was posted just for fun. I may have made mistakes since I didn't use a code, I just made them by hand. If you are interested I can explain with more details.
579  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: September 06, 2018, 04:54:19 AM
Code:
    a2b_hashed_base58(key)

If using it for missing 1 char, it doesn't matter but FWIW there seems to be a couple of bottlenecks in this function that will slow things down drastically.

First is the fact that each time an invalid key is passed to this function it raises an exception. I have 0 experience in Python but in C♯ throwing exceptions is "expensive" apparently it is not so different in python either[1]. This can be changed to simply returning false if the key is invalid. This will probably make things faster at least 10 times (not benchmarked)

Second thing I could notice is that it is converting the input back to a bignum (or what we call BigInteger) and then converts it back to a byte array and starts performing hashes (for checksum) on it. This step is slow and unnecessary. Converting the base58 input directly to base256 (byte array) made it 6 times faster (I did benchmark this!)

[1] https://stackoverflow.com/questions/2522005/cost-of-exception-handlers-in-python
580  Bitcoin / Development & Technical Discussion / Re: Step by step guide to go from public key to a Bech32 encoded address on: September 02, 2018, 02:47:35 PM
I feel that your description is confusing. You write "array of 5-bit integers", but displaying the results as a hex string implies that it is a string of 8-bit values.
I get what you are talking about but base-16 is just another representation of an array of "numbers", it doesn't really make a difference if I write 14 12 15 with spaces or 0e 14 0f with or without spaces, they are both representing the same set of numbers in base-256. The only possible way to clarify things is if I start typing them in binary like this but that's just impossible to read:
Code:
01110 10100 01111 ...


Additionally hex or base-16 is a very easy and convenient way to transfer arrays of "numbers". For instance you can not input each of those "numbers" (14, 20, 15...) one by one in an array when coding, it would take a long time and it is easy to make a mistake. But you can very easily give your code the hexadecimal string representation of it and decode it into the array of "numbers" then treat those "numbers" however you like.

I am going to add both numbers and binary, maybe that helps visualizing it better.

I recommend removing "byte" since the witness version is not a byte. Note that bip-173 also calls it a "byte" when it isn't.
Well, "version byte" is the name of the "0" we are appending to it, I can't just change that name:
https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program
https://github.com/bitcoin/bips/blob/master/bip-0142.mediawiki#rationale
Pages: « 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 [29] 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 »
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!