Bitcoin Forum
April 18, 2024, 02:39:00 PM *
News: Latest Bitcoin Core release: 26.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 »
41  Bitcoin / Project Development / Re: [C#][Github] SharpPusher, broadcast BTC, BCC(BCH) transactions to the network on: January 18, 2022, 06:27:10 AM
Version 0.12.0 released
Added the P2P option which allows user to directly connect to bitcoin nodes and broadcast their transaction on both MainNet and TestNet.
This uses the new MinimalClient introduced in Bitcoin.Net 0.17.0.0 which is in beta and may contain bugs.
https://github.com/Coding-Enthusiast/SharpPusher/releases/tag/0.12.0.0
42  Bitcoin / Project Development / Re: HandyDandy a tool to work with entropy on: January 04, 2022, 11:44:23 AM
Sorry for a late reply, it's been challenging to find free time lately and I'm working on 5 projects in parallel which is an additional challenge. Thanks everyone for your feedback, I've released the second beta, v0.2.0.0 with the following changes:

  • Added a new input type with keyboard which captures keys pressed and treats all keys as 1 except 0, space and escape keys which are treated as 0.
  • There are 2 buttons that let you fill all bits with either 0 or 1.
  • The result or checksum are not longer dynamically computed. You have to click Finalize button to calculate checksum and get the final result.
  • Each view is now cached so even if the options are changed, the bits that are already set will not change
Yeah like bitaddress or maybe something similar like MrFreeDragon VisualBTC program but with some improvements.
While implementing this I experienced some bugs while capturing mouse event so this option will be postponed for next release.
43  Bitcoin / Development & Technical Discussion / Re: Attempting to decode a damaged Base58 WIF to hex on: December 30, 2021, 09:30:12 AM
This means that I have to find the first K..... compressed PK that makes an 0x80 version byte and that's going to correspond to the private key 0x1, right?
Yes, that would make the starting point. Although brute forcing it may take a long time itself since it is 10 missing characters so you may need to find the closest thing by manually modifying the characters.
44  Bitcoin / Development & Technical Discussion / Re: Attempting to decode a damaged Base58 WIF to hex on: December 30, 2021, 08:56:47 AM
the "80" byte on the left
Because the byte you discarded wasn't 0x80.
When you are treating the Base-58 string as an integer ignoring the checksum, etc. you have to be careful not to hit an edge case such as the one in that other topic.

When you are decoding Kw111... you end up with {0x79, 0x76, ...} bytes which is obviously an invalid permutation because of invalid version byte. So you have to increment until you get to 0x80 first and use that as your starting point. Meaning: Kw1111111112 -> Kw1111111113 -> Kw1111111114 -> ... Kw111111111z -> Kw1111111121 -> Kw1111111122 ...
If you don't do that, your "big" value using z's (Kwzzz...) would be {0x80, 0x4c, ...} and since an integer starting with 0x76 is bigger than an integer starting with 0x4c you end up with a bigger start than the end.
45  Bitcoin / Bitcoin Technical Support / Re: Missing 10 Characters in WIF Private Key - Can I recover them? on: December 30, 2021, 06:05:00 AM
Do you have a faster way I can do this with GPUs? I have used your tool, but with just CPU its going to take far too long for 10 missing characters.
Unfortunately I haven't been able to add GPU support to FinderOuter yet.
46  Bitcoin / Bitcoin Technical Support / Re: Missing 10 Characters in WIF Private Key - Can I recover them? on: December 30, 2021, 05:34:21 AM
And then I pasted the characters after the lost 10 chars inside the page. Before the characters, I pated the 'w' (since you know you have that), followed the 10 characters lowest possible private keys that still base-58 encode into w........JzXaqU2rcFSoaLaehAQHqoQX1cWCo92tAA3ihLJ7 - replace the dots with 10 "1" (the number one) characters. Because 1 is the first digit of base8 number system. The resulting hex gives the starting range.
Keep in mind that this method is significantly slower than to simply test each character permutation.
You see each character at the start of the string (from left) converts to a much bigger integer than any character from the end of the string. So even the difference between 1 char missing becomes huge.
Take the following example:
Ky**DfuvLpt8eSb8EQzhZwDCQeCaycKeAoxJMY8pfPZXmn3uB38R
Even though only 2 characters are missing the difference between Ky11Df... and KyzzDf... as integer is
Code:
13491826005831086771641399365157222283117801812915393869332949675679483454208
While the permutations are only 3364.
47  Bitcoin / Project Development / Re: HandyDandy a tool to work with entropy on: November 28, 2021, 05:44:51 AM
Interesting tool but how can I confirm it is really giving me true random results?
It is not producing the entropy, the user produces each bit by random (like by flipping a coin) and the program converts the bit-stream to whatever they need.

I tried generating few Private Keys and Mnemonic words but it always giving me number 1 (head)with one click, and I have to click again to get number 0 (tails).
That is how it is supposed to work. You flip your coin and if it came up heads you click the button once to set it to 1, if it came up tails you click it twice to set it to 0.

My suggestion is to add optional function of ''drawing'' so I could generate private keys with holding mouse button and moving around fields.
You mean something like what bitaddress.org does? I guess I could add a canvas and track mouse movement then combine it with a strong random entropy generated programmatically.

This would be faster for generating than it is currently.
Well, generating entropy by hand is slow. 128 to 256 bits is 128 to 256 coin flips. However I will add an option to use 6-16 sides die to reduce the effort.
48  Bitcoin / Development & Technical Discussion / Re: mnemonic recovery script on: November 28, 2021, 05:35:56 AM
You can also check out my project called FinderOuter: https://bitcointalk.org/index.php?topic=5214021.0
49  Bitcoin / Project Development / HandyDandy a tool to work with entropy on: November 27, 2021, 04:11:41 PM
Handy Dandy is a tool that helps visualize and work with data in different formats that are used in Bitcoin protocol such as private keys and mnemonics.

A potential use case is offline generation of private keys or mnemonics using a coin flip.
User selects what result they want to generate (eg. a 15-word BIP-39 mnemonic) by selecting the appropriate options on top of the window and the program automatically generates appropriate number of bits to be set. In this example it is 165 bits (160 bit entropy + 5 bit dynamically computed checksum).
Then the user has to flip a coin and set each bit. For example
Heads: 1
Tails: 0
Heads: 1
Heads: 1


As each bit is being set, the respective value is also printed as integer, hexadecimal and BIP-39 word.
After all bits were set the final result will be printed in the result TextBox at the bottom of the page and can be copied.



Source code and compiled binaries can be found here: https://github.com/Coding-Enthusiast/HandyDandy
This project is in beta. Please report any bugs you find here or on GitHub

If You found this tool helpful consider making a donation:
Legacy address: 1Q9swRQuwhTtjZZ2yguFWk7m7pszknkWyk
SegWit address: bc1q3n5t9gv40ayq68nwf0yth49dt5c799wpld376s

The idea for project was influenced by: https://bitcointalk.org/index.php?topic=5187401.0
50  Bitcoin / Project Development / Re: The FinderOuter, a bitcoin recovery tool (v0.12.1 2021-08-19) on: November 24, 2021, 04:44:48 PM
Can you add a decryption tool for wallets like: Electrum, Bitcoin Core etc... ?
That would be very nice. Example: I have 0.0015... BTC locked on a wallet and i can't remember what
software i used.
Wallet file encryption is a bit complicated and I haven't been able to find a good documentation I could use to implement it. So although it is in my todo list I'm not sure when I can actually implement it specially nowadays that I'm very busy, sadly.
51  Bitcoin / Project Development / Re: The FinderOuter, a bitcoin recovery tool (v0.12.1 2021-08-19) on: November 24, 2021, 04:39:01 AM
I wanted to ask what character can be substituted for *.
It doesn't matter but if you hold your mouse over the textbox you will see a popup showing what characters are accepted. This character will only be used to indicate the missing position and nothing else.

i want to try matching only uppercase and lowercase letters. is there such a possibility?
Unfortunately no.

And another question I have a privatkey in it, 9 characters are lost at the beginning. After the number 5. I tried to shorten the search options. and tried to substitute other symbols for example 5KoR ******* and the search did not give any result at all. there are suspicions that not all symbols can be in places 3 and 4.
The problem could be in existing characters but as far as the start goes the uncompressed keys start with 5H, 5J or 5K but the rest can be anything.
52  Bitcoin / Development & Technical Discussion / Re: Step by step guide to go from public key to a Bech32 encoded address on: October 27, 2021, 02:48:14 PM
How do I compute the checksum? The bip 173 page has the code in python which I do not understand. Can you explain the process so I could code in Java/Kotlin?
I haven't seen a Java/Kotlic implementation but apart from the C implementation there is JavaScript and my own C# implementations that are similar languages.

The process is:
"Expand HRP" by converting its N base-256 (8-bit) representation to 2N+1 base-32 (5-bit).
For example bc which is 0x6263 or 0b01100010_01100011 becomes 0x0303000203
In this process for each octet the highest 3 bits are placed in first half of the result and the remaining (low) 5 bits in second half. In the example above:
b=0x62=0b01100010 -> 0x0303000203 and
c=0x63=0b01100011 -> 0x0303000203
The two halves are separated with a zero (the value at the middle is always 0) -> 0x0303000203

Now we can compute checksum of [expanded HRP] | [base32 data] | [6x zeros] (note that "|" is concatenation).
The process is best explained by code
Code:
private static uint Polymod(byte[] data)
{
    uint chk = 1;
    foreach (byte b in data)
    {
        uint temp = chk >> 25;
        chk = ((chk & 0x1ffffff) << 5) ^ b;
        for (int i = 0; i < 5; i++)
        {
            if (((temp >> i) & 1) == 1)
            {
                chk ^= generator[i];
            }
        }
    }
    return chk;
}

The actual checksum used in encoding is the result of "polymod" XORed with a constant. This constant is 0x01 for Bech32 (BIP-173) encoding just flipping the least significant bit and is 0x2bc830a3 for Bech32m (BIP-350) encoding. The former is used for witness version 0 addresses and the later for 1+. This is basically the only difference that was introduced in BIP-350.
53  Bitcoin / Development & Technical Discussion / Re: Problems with P2SH transaction on: October 03, 2021, 12:07:06 PM
I have not yet understood the decoding of this script.
Which part of the script shows "witness" or P2WPKH?
There are two parts to this question, if you want to know how scripts are evaluated then you have to check the code found in interpreter.cpp. Or you look at my code in Script.cs but unlike the c++ code here the evaluation and execution are performed separately.

If you want to know how this is considered P2WPKH, I have to say it is like a contract. We agreed that any script that is between 4 and 42 bytes long and starts with a number OP (like OP_0, OP_5, OP_16, etc.) and is immediately followed by one and only 1 data push is a witness script and that number OP indicates the witness version. For version 0 the data being pushed to the stack (witness program) must either be 20 bytes (ie. P2WPKH) or 32 bytes (ie. P2WSH) and everything else is invalid and rejected.

My goal was actually to do a legacy transaction from address "2NAceVvLJopK7uSmsrSeig8F4EWYaxAK4tS" without witness data.
You can't because this address is defining a "locking mechanism" that can only be "unlocked" by providing a valid signature as its witness the way I explained above. This can not be changed since the public key script aka the lock aka the P2WPKH wrapped in P2SH address is already defined and the balance of it are protected by that "lock".
54  Bitcoin / Development & Technical Discussion / Re: Problems with P2SH transaction on: October 03, 2021, 09:53:15 AM
So the problem is with the signature script, right?
No, your signature script is actually fine. The problem is the missing witness items, there needs to be 2 items a public key and an ECDSA signature.

The signature script of the transaction in the blockchain at that time is:  255121029b6d2c97b8b7c718c325d7be3ac30f7c9d67651bce0c929f55ee77ce58efcf8451ae
My created script is: 160014404c836c0ecbc42d1b20b999814319b17327100f
Now the first difference is that mine is shorter.
The size is not important, what the script is "translated" into is. I'll explain below.

My assumption was that the OP_HASH160 of this script is compared with the one in the PK script.
I have therefore recorded the content of the Scriptest as an irrellevant.
It is but only on first step.

Your statement is now that the content of the SigScript is decisive and leads to a statement as to whether it has to be signed with a Witness-TX or not. is that correct?
Basically this is what happens:
1. We take the pubkey script from the UTXO (the inputs of the transaction we are evaluating)
2. Evaluate what type this pubkey script has
2.A. If it is not any special types then move to signature script, run that then run pubkey script then move to last step to see if tx is valid (top stack element has to be true)
2.B. If it is a witness script (OP_NUM <singlepush>) then the signature script must be empty and there must be a witness corresponding to this input, continue evaluation based on that (compare the hash, evaluate witnesses, etc).
2.C. If it is P2SH then the signature script must be all data pushes and at least 1 is needed (the last one is interpreted as redeem script). Some initial checks are done (running signature script then pubkey script) Then we start evaluating that redeem script:
2.C.A. If it is not any special type then just execute the script and move to last step
2.C.B. If it is a special type (ie. witness scripts) then continue evaluation based on that type.

In case of your transaction we take the pubkey script
Code:
a914be8755917b4c5b783d11ed205c277f9a2788785387
and see that the type is P2SH so we take a look at the signature script
Code:
160014404c836c0ecbc42d1b20b999814319b17327100f
It is a single push. So far everything is OK. Signature script is executed then top stack element is stored somewhere before pubkey script is executed. Stack is checked to see if it is true (essentially checking to see if the HASH160 was correct as you asked above).
Finally that stack element that was stored is evaluated as a script called redeem script.
Code:
0014404c836c0ecbc42d1b20b999814319b17327100f
Evaluating this shows that the type is P2WPKH so the evaluation continues by looking for 2 witness items and fails here because your transaction doesn't have any.
55  Bitcoin / Development & Technical Discussion / Re: Problems with P2SH transaction on: October 03, 2021, 08:08:22 AM
Since the lock script is a legancy P2SH script, I would expect that the Tx can be created in the legancy transaction format (without witness).
Your assumption is wrong here. It doesn't matter that the output that is being spent was P2SH and looks like legacy, what matters is that what the "S" (script that got hashed) was and since your redeem script was a witness script then the transaction must contain the required witness on top of the program pushed as a redeem script in signature script.

Since the Sig-Script was successfully tested with a script analysis tool from Coding-Enthusiast (BitcoinTransaktionsTool),
I apologize for the the inconvenience but that project is old and obsolete (I will update its readme for clarification, although it is mentioned in issues).
Try my newer project that fully supports Segregated Witness.
This is where the magic happens: https://github.com/Autarkysoft/Denovo/blob/master/Src/Denovo/ViewModels/VerifyTxViewModel.cs
If you fill the boxes with correct values and set the block height (top right corner) to the imaginary block that would contain this tx (affects consensus rules) you get the following:


As an example there is a transaction in the MainNet: "6a26d2ecb67f27d1fa5524763b49029d7106e91e3cc05743073461a719776192" which has the same properties, and since it is in the blockchain, it is obviously also valid.
That is not the same.
If you look at the redeem script (last and only push in signature script) you realize that the type of it is a simple 1of1 legacy multi-sig whereas your redeem script is a P2WPKH one.
56  Bitcoin / Development & Technical Discussion / Re: Writing/Running scripts by pressing buttons in a friendly GUI on: October 02, 2021, 10:45:40 AM
I can port this to Electron/NodeJS where it will run on any platform without the need for emulators (like Wine) or VMs. The best part is I can even deploy it as a web app.
This project is old and kind of obsolete, so I never got around to fixing its bugs and adding the missing parts. However migration of this project is one of those items in my very long to-do list. I recently finished the transaction verification part but haven't started working on the "script playground" part. The migration fixes the bugs and will cover every script that exists in Bitcoin protocol and the software can run on any operating system.
Here is an issue to track this #2.
57  Bitcoin / Development & Technical Discussion / Re: Test writing mistakes: please write down these private keys for me on: October 01, 2021, 09:38:04 AM
(the hand written key I received 3 years ago still has a substantial amount of money in it).
Do you have the corresponding public key (it starts with G and is 56 chars long)?
58  Bitcoin / Development & Technical Discussion / Re: Test writing mistakes: please write down these private keys for me on: October 01, 2021, 05:21:39 AM
Alternatively i would convert the private key to HEX/decimal if i have bad handwriting, but it takes more time and i lost advantage of checksum which offered by WIF.
Your comment woke some old ideas in me, how about converting the key to human readable words? It is easier to write down, typos occur but are less common and easier to detect, it also has a checksum.
An example can be seen below, the private key's binary form is encoded using the same BIP39 scheme which can be converted back to a WIF using the same scheme in reverse.
Code:
L28Peud5cQcijrtMthAdUS8FynpM8PKZtnoUZb1VAio9WxKoebHt
mystery omit wheel view great lemon describe output march trend govern envelope confirm delay woman sweet arrange host waste tourist impose artwork predict crack

I made a new option for it in Denovo, the first two options are for this conversion and the second two are dealing with versioned WIFs (BIP178 and what Electrum briefly used).
59  Bitcoin / Development & Technical Discussion / Re: Generating Address From 78 Bit Number on: September 13, 2021, 03:49:03 AM
I recommend you to look on Denovo. Coding Enthusiast must have probably implement it, it ain't difficult.
The following method contains all the subsequent methods that are called in order to create a private key from an integer of at most bitLen bits, convert to public key and finally get the corresponding address. You can find all those methods in Bitcoin.Net and see what they do.
It goes without saying that a key created this way is a weak key.
Code:
public static void CreateWeakAddress(int bitLen, out string comp, out string uncomp)
{
    if (bitLen > 256 || bitLen < 1)
        throw new ArgumentOutOfRangeException();

    // Create a random integer of at most bitLen bits
    BigInteger mod = BigInteger.One << bitLen;
    byte[] data = new byte[32];
    using SharpRandom rng = new();
    rng.GetBytes(data);
    BigInteger value = new BigInteger(data, true, true) % mod;

    // Convert to a private key (will check if in range and could throw ArgumentOutOfRangeException)
    using PrivateKey key = new(value);
    // Get pubkey and addresses
    PublicKey pub = key.ToPublicKey();
    comp = Address.GetP2pkh(pub, true);
    uncomp = Address.GetP2pkh(pub, false);

    // Other address types are possible too
    _ = Address.GetP2wpkh(pub, true);
    _ = Address.GetP2wpkh(pub, false);
    _ = Address.GetP2sh_P2wpkh(pub, true);
    _ = Address.GetP2sh_P2wpkh(pub, false);
}
60  Bitcoin / Bitcoin Technical Support / Re: It can be possible generate working QR of a privkey from empty squared sheet? on: September 12, 2021, 10:04:15 AM
Are you planning to implement a function to automatically calculate the checksum and the correct word final word once you've entered the last 3 or 7 bits of entropy?
Yes. I just haven't decided if I want to dynamically compute it on each click or add a "finalize" button that user has to click which computes the checksum in the end.

My only comment would be to maybe change the background color of entered squares when compared to the ? squares, just to make it easier to keep track of where in the grid you are or if you have accidentally missed a square.
Thanks for the suggestion. This is what the new buttons would look like:

I'm also thinking about adding the "math" for each value so that it can be manually verified in an easy way.
That is to show how for example 0b01011001 is equal to 89. Something like 0b01011001=1*20 + 0*21 + 0*22 + 1*23 ...
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!