Bitcoin Forum
September 21, 2024, 07:05:21 AM *
News: Latest Bitcoin Core release: 27.1 [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 »
201  Bitcoin / Electrum / Re: Looking for derivation paths used for different Electrum mnemonic types on: November 06, 2020, 08:26:42 AM
The derivation_and_script_type_dialog seems to be called when the wallet is being created using a hardware wallet not from an Electrum seed phrase. That is why path for eg. 'standard', 'legacy (p2pkh)' is being set to m/44'/0'/0' and I know for a fact that it is m/0 for Electrum mnemonics.
202  Bitcoin / Electrum / Looking for derivation paths used for different Electrum mnemonic types on: November 06, 2020, 07:54:15 AM
I just added the recovery option for Electrum mnemonics to The FinderOuter and even though the derivation path could be set manually but it would be simpler if it were set automatically based on mnemonic type selected (or the address type entered).


However I couldn't find what derivation path is used for each mnemonic type above (eg. m/0 for standard) and need help.
I'd appreciate it if you could also include the link to code where it is defined.
203  Bitcoin / Project Development / Re: The FinderOuter, a bitcoin recovery tool (v0.5.0 2020-09-17) on: November 05, 2020, 02:41:21 AM
Hi Coding Enthusiast, i cant compile it  Angry broken os.
could you get a compiled one up and ready to use, for windows 10 probably,
thanks a lot, just did fix the not compiling issue, used ps net .
Glad it worked out for you but you should know that it is not safe to handle your private keys and other secrets on Windows specifically if the system is what you regularly use for everything else too. This is why I have only released compiled version for Linux.
204  Bitcoin / Development & Technical Discussion / Re: Help with 256 bit generator on: November 04, 2020, 08:28:30 AM
Hi guys I am trying learn the relationship between 256 bit encryption and bitcoins addresses and private keys.
For starters, there is no "encryption" in this process.
Choose a number between 1 and curve order --> calculate public key point[1] --> compute hash of it[2] <--> encode the hash to get the address[3]
--> represents a one way operation while <--> represents a reversible (two way) operation.

I remember something ages ago which showed the bits (256) corresponding with the private key. Can someone point me in the direction of such a resource.
In asymmetric cryptography using elliptic curves[4] the private keys are numbers between 1 and the curve order N. In bitcoin we are using a curve called secp256k1 which is a 256-bit curve that has an order that is slightly below 2256 (0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141).
In other words bitcoin private keys are random numbers chosen in this range.

[1] https://en.wikipedia.org/wiki/Elliptic_curve_point_multiplication
[2] Depending on the address type (or more accurately the pubkey script type) the hash algorithm used can be different, but in majority of cases it is RIPEMD160 of SHA256 of 33 or 65 byte public key
[3] https://en.bitcoin.it/wiki/Base58Check_encoding or https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki again depending on the address type
[4] https://en.wikipedia.org/wiki/Elliptic-curve_cryptography and https://blog.cloudflare.com/a-relatively-easy-to-understand-primer-on-elliptic-curve-cryptography/
205  Bitcoin / Development & Technical Discussion / Re: Question regarding seeds on: November 02, 2020, 05:21:50 AM
You generate a random 128-bit number, then add a checksum in the end for every 32 bits of entropy. A 128-bit number contains 4 times 32 bits. This means that you'll add another 4 bits in the end of the entropy. Now we have 132 bits. For every 11 bits (converted to decimal) we get a number between 0 and 2047. Since 132/11=12 it means that we get 12 words.
That's correct but to cover everything the method is to generate 16, 20, 24, 28 or 32 bytes of entropy then compute SHA256 hash of that entropy, from that hash you add enough bits to your initial entropy to make it divisible by 11.

Now I would like to ask, are there any C# libraries that includes a function in which you can convert a BIP39 seed to private keys? I want to build a program that will take a seed and it'll generate me (for example) the 5 first private keys electrum would do.
BIP-39 and Electrum are two different algorithms that are not compatible with each other.
Feel free to check my project (Bitcoin.Net)
Code:
string mn = "wild father tree among universe such mobile favorite target dynamic credit identify";
var elec = new ElectrumMnemonic(mn, BIP0039.WordLists.English, passPhrase: "pass123");
var bip39 = new BIP0039(mn, BIP0039.WordLists.English, passPhrase: "pass123");
var path = new BIP0032Path("m/44'/0'/0'");
PrivateKey[] elecKeys = elec.GetPrivateKeys(path, count: 5, startIndex: 0, step: 1);
PrivateKey[] bip39Keys = bip39.GetPrivateKeys(path, count: 5, startIndex: 0, step: 1);

You can look at the Tests project for examples: BIP32Tests, BIP39Tests and ElectrumMnemonicTests

I remember forum experts talking about derivation paths (like m/44'/0'/0') but I don't get how I'll put them into code.
The derivation path is defined for BIP-32. Mnemonic (BIP-39 or what Electrum does) is a deterministic way of generating the seed (entropy) for BIP-32 using a human readable string.
206  Bitcoin / Development & Technical Discussion / Re: Why do nodes ignore the relay=false in version and send MSG_TX inv? on: October 29, 2020, 03:55:34 PM
This list seems to be simply calling the bitnodes.io API to fetch all the IP addresses they have. It doesn't look like a blacklist though.
207  Bitcoin / Wallet software / Re: Possibly improving on BIP039 with language models ? on: October 28, 2020, 10:08:08 AM
If you want to use poem as your private key, it's easier to create a new poem (or modify existing one), then perform SHA256 on that poem and use that hash result as seed.
This is how people end up losing their bitcoins.
208  Bitcoin / Development & Technical Discussion / Re: Why do nodes ignore the relay=false in version and send MSG_TX inv? on: October 28, 2020, 08:25:34 AM
I checked my last week of logs and don't see any "inv sent in violation of protocol", which is what gets logged if a relay=false peer sends an inv.
Thanks for checking. Here is an example IP that is violating it: 13.124.88.142:8333
None of the IP addresses I got from DNS seeds had this issue though. Fake user agent maybe?
209  Bitcoin / Development & Technical Discussion / Re: Why do nodes ignore the relay=false in version and send MSG_TX inv? on: October 28, 2020, 07:42:44 AM
You're either sending the flag wrong,
That is not possible.

Quote
you're sending a mempool message,
The only messages I send are: version, verack, sendheaders, ping.
Anything else that would change relay such as filters depend on my flag to be true so they aren't sent. I also don't have any code for a mempool message.

Quote
or you're getting confused by fake nodes again.
I have to investigate this but the nodes seem to be real and capable of supplying me with headers which is where I am.

Let me dig the DNS seeds and come back to you on that.
Update: I can't reproduce this on any of the IP addresses I get from DNS seeds!
210  Bitcoin / Development & Technical Discussion / Why do nodes ignore the relay=false in version and send MSG_TX inv? on: October 28, 2020, 06:45:18 AM
It is my understanding that when the relay (the last byte of a version message) is set to 0 (false) the other node is supposed to not send any inv messages containing transactions but they seem to ignore this and at the very beginning of the connection (after handshake) start sending inv messages of type MSG_TX.
Why is that?


Haven't tried all but from those that tested so far: new bitcoin core versions (0.20.1 and 0.18.0) are like this while old ones (0.12.1) aren't. In other words the new versions seem to not respect the relay flag anymore.
211  Bitcoin / Project Development / Re: Denovo (v 0.0.0) and Bitcoin.Net (v 0.6.0) on: October 15, 2020, 05:07:14 AM
Version 0.4.2 released.
Another minor version focusing on improving P2PNetwork namespace.
  • Improvements in P2PNetwork namespace (Each node now uses only 2 SAEA that are taken from a pool instantiated in IClientSettings, other improvements in ReplyManager and MessageManager)
  • New BIP: Deterministic Entropy From BIP32 Keychains (used in Coldcard) (BIP-85)
  • New RNG for nonce generation
  • Add a new word-list to BIP-39 (Czech)
  • Some bug fixes and code improvements in TransactionVerifier
  • Additional tests
Version 0.5.0 released.
A major version mainly improving and finishing the TransactionVerifier.
  • Rewrite of the TransactionVerifier with major improvements and optimization. It now uses the full potential of the powerful implementation of Bitcoin scripts in Bitcoin.Net which improves the efficiency of the transaction verification process.
  • Some fixes in custom value types such as CompactInt comparison operators.
  • Add new script special types to both PubkeyScript and RedeemScript
  • Some improvements in P2PNetwork namespace focusing on MessageManager and ReplyManger
  • Various code improvements, bug fixes and additional tests
Version 0.5.1 released.
  • BIP-39 can now measure Levenshtein distance for any word-list
  • Small bug fix in transaction class
  • NodeStatus is improved to be a better representative of the status of the connected nodes
  • General code improvement and bug fixes in P2PNetwork namespace
Version 0.6.0 released.
  • Lots of improvements in P2P protocol for handling different messages
  • Added new payload types enum
  • IClientSettings now contains everything that needs handling by nodes
  • Introduction of IStorage
  • Big refactor of IConsensus usage
  • Miner class now supports concurrency (caller can set the number of cores used for maximum efficiency)
  • Addition of a new method in `RandomNonceGenerator`
  • Various code improvements, optimization, bug fixes and some tests

A small road-map:
The significance of this version is that it marks the end of implementation of anything that doesn't involve IStorage that includes the following interfaces: IBlockchain, IMemoryPool, IUtxoDatabase.
Next versions (from 0.6.0 to 0.7.0) will focus on improving these interfaces while adding the implementations to Denovo (some may be added to the library too).
That means the work on Denovo will begin and 0.1.0 will be released soon with the testnet miner. At first the old projects such as BitcoinTransactionTool and SharpPusher are going to be merged into Denovo then new features will start coming to it afterwards.
212  Bitcoin / Development & Technical Discussion / Why was the 6th ServiceFlags bit skipped? on: October 12, 2020, 03:41:25 PM
The ServiceFlags enum is jumping from the previously defined 5th bit (1 << 4 ie XThin) to 7th bit (1 << 6 ie CompactFilters). I couldn't find the 6th bit ever being set in the history of protocol.h file so is there any reason for this jump?

https://github.com/bitcoin/bitcoin/blob/af22322dab1a2277483b2512723491a5fad1a606/src/protocol.h#L268-L302
213  Bitcoin / Development & Technical Discussion / Re: Why does core send its own addr message to inbound connections? on: October 01, 2020, 05:13:24 PM
addr messages contain the addresses of other nodes. It's how IP addresses for other nodes are spread around the network.
That's true most of the times but I'm talking about when nodes send you their own addr message.

Let me put it this way, I connect to 185.132.178.23:18333 (satoshi 0.20.0) and send it a version message saying I know you are 185.132.178.23:18333 (in the receiving node address part), I've also connected to it so I already knew that. Then it sends me its own version message that can contain 185.132.178.23:18333 again (but it doesn't but that's irrelevant for now). After the handshake is finished it sends me an addr message saying 185.132.178.23:18333 is an address of a node!


I'm trying to figure out what the reason behind all this repetition is, specifically the last addr part.
214  Bitcoin / Development & Technical Discussion / Why does core send its own addr message to inbound connections? on: October 01, 2020, 12:36:22 PM
Although the code seems to be sending addr message to outbound connections (ref) but in my experience it is sending it to inbound connections too.
And in both cases I can't think of why it is doing that. When the connection is made specially if it is initiated by the other node, they should know our address and sending it again seems pointless to me.
On top of that the addr message is sent after version message (hand-shake) which already contains connection information (ie. the addr message).
215  Bitcoin / Bitcoin Technical Support / Re: Is there any online (web) tool where I could broadcast a new block I mined? on: October 01, 2020, 04:52:19 AM
Out of curiosity, how did you actually mine the block? Huh

Did you just manually construct one, then started hashing until you found a nonce that fit the lowest difficulty and waited until a block had not been found for a while and the difficulty reset before broadcasting? (Possibly having to rehash if a new block was broadcast in the meantime)

Or are you running a more "traditional" mining setup with a CPU/GPU/ASIC miner and just got "lucky" with the TestNet difficulty? Huh
No, this is my own implementation of Bitcoin protocol and since at this point the library part (Bitcoin.Net) is almost finished I'm testing parts that don't have unit tests while improving the API.
It is a modified miner using only 2 of CPU cores and I run it only when I'm trying to create new test vectors like my last commit. I'll probably add GPU support when I start adding GPU support to FinderOuter.
As for difficulty, I'm simply manipulating it to submit my test blocks. I still have to get lucky to find a good block since I don't produce that much hashrate but it is easier.
216  Bitcoin / Bitcoin Technical Support / Re: Spending P2SH-P2WPKH that used uncompressed pubkey (who needed this?) on: September 29, 2020, 09:54:26 AM
Have you tried adding: acceptnonstdtxn=1 to your bitcoin.conf file before sending the transaction?
AFAIK, that should work in testnet/regtest and will allow some non-standard txns to your mempool (what's not clear is which ones).
I don't run a synced core but it wouldn't have mattered even if I did, the other nodes on the network are rejecting this specific type of non-standard transaction so it won't propagate. Besides I'm already sending them the transaction in a tx message which is no different than what forcing it into your local mempool in core would do.
217  Bitcoin / Bitcoin Technical Support / Re: Spending P2SH-P2WPKH that used uncompressed pubkey (who needed this?) on: September 29, 2020, 07:07:32 AM
It's easier to do in tesnet because you can easily set a configuration to accept non-standard transactions to your mempool.
While in mainnet, the config wont work.
Actually it was not possible in TestNet either. I've tried it and the transaction was rejected, hence mining the block myself.

IDK if there're other ways aside from changing the code but if there is
The problem is this flag: SCRIPT_VERIFY_WITNESS_PUBKEYTYPE
The way I understand bitcoin core's code is that it doesn't disable or change flags on different networks, it just skips the IsStandard check in validation.cpp on TestNet while the non-standard flag is still used for verification of scripts eg. in interpretter.cpp and rejects this non-standard script. This flag however is not present while verifying a block since it is not a consensus rule.
If I'm correct, removing this single line should fix it for accepting the transactions in mempool, or just not use standard flags in any other way that core allows it.
218  Bitcoin / Bitcoin Technical Support / Re: Spending P2SH-P2WPKH that used uncompressed pubkey (who needed this?) on: September 29, 2020, 06:33:53 AM
Yes it was about the other miners / nodes rejecting the block because it contained non standard.
They will never reject a "block" because blocks do not follow standard rules. However, the nodes reject non-standard transactions because mempool enforces standard rules.

Quote
Yes, that was the topic. Thanks. Since the output is still unspent I sent the starter a PM.

Quote
But there are numerous people that have the same type of problem and there are a lot of coins that are unspendable.
Could you show me some of the cases, I often visit bitcointalk, reddit and stackexchange and this is the only case I've seen so far.
219  Bitcoin / Bitcoin Technical Support / Spending P2SH-P2WPKH that used uncompressed pubkey (who needed this?) on: September 29, 2020, 05:48:30 AM
I remember a while ago there was a topic on this forum from someone who had a large amount of bitcoin stuck in a P2SH-P2WPKH output that used an uncompressed public key and since it is non-standard it wasn't being relayed or mined and miners they contacted were also worried about their block being rejected if they included this transaction.
I can't find the topic though.

Well here is an example block with such a transaction on TestNet on block #1836615 (https://tbtc.bitaps.com/1836615) which I just mined. Maybe this can help.
The transaction is the only tx in the block apart from coinbase with hash= 134112254a1d0d687af0c4aa7185e62bbacf191165369d0150206f6c369ca417
You can see the uncompressed public key in second witness item (the second PushData):
Code:
{
  "Version": 1,
  "TxInList": [
    {
      "Outpoint": {
        "TxHash": "6b16690cdc1f4f8d6a07dd241cc8526bb075b9ad62f3d9d9a9fcc710ba94db16",
        "Index": 0
      },
      "SigScript": "PushData<0014ae456b5f88b76d858802da6996e05d5c4f084314>",
      "Sequence": 4294967295
    }
  ],
  "TxOutList": [
    {
      "Amount": 999750,
      "PubScript": "OP_DUP OP_HASH160 PushData<db1c22d11851f82e3e463f3b33c83400b15e6ab4> OP_EqualVerify OP_CheckSig"
    }
  ],
  "WitnessList": [
    "PushData<3044022009c9dca57c6e4212f471169c9c89c6d5e2ef570aa9a48b55dc2dfe4f13c9f0c202205cce77d15a383b29c45deb307cd60bcc848cfd98c52778a9c0c6699390f6889401>
     PushData<04576e65bd864ff1dca1116901833d432e1bc096e0a0f037f57cd0a09e9d3f96b3a88c3a627d3f9a4dfab5fff1d0dfcf03a68411722aed8e05cb3850652b4571ee>"
  ],
  "LockTime": "0"
}
220  Bitcoin / Bitcoin Technical Support / Re: Is there any online (web) tool where I could broadcast a new block I mined? on: September 28, 2020, 09:16:54 AM
It took me some time but I finally fixed most of the issues I had with my P2PNetwork implementation so I could come back to this today to mine and submit my first block to TestNet blockchain.
Block #1,836,446 https://tbtc.bitaps.com/1836446
Block version is weird because it is copied from previous block, the block is empty because I don't have any mempool yet and it is just an experiment at this point.
Going to test more things now on TestNet, I'll probably submit some of my RegTest block experiments here too.

Thanks again for your help guys.

P.S. Interesting thing was that core nodes that I connected to sent me back the same block as Inv message for some reason (highest version was 0.19.0.1).
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!