Bitcoin Forum
May 25, 2024, 01:40:20 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 »
161  Bitcoin / Development & Technical Discussion / Re: tBTC loans on: January 04, 2021, 10:07:26 AM
Do you need donations? I've been meaning to get rid of ~4.18 tBTC for some time now but faucets that I checked a while back were rich already (100-500 balance in their hot wallet) so I kept it. If you have less I could donate it to you.
You could also give me a testnet address and I will use that if I had any test that required mining a new block in the future, I won't need the reward myself anyways and it usually goes to waste.
162  Bitcoin / Development & Technical Discussion / Re: Is there any research on different key-value DBs suitable for bitcoin? on: January 03, 2021, 06:51:44 AM
I think the question is so underspecified its hard to tell what they're asking exactly.
I tried keeping the question short and precise without adding any complications. I'm also not solving a problem so there is nothing specific I could include, I simply have been learning everything there is about Bitcoin for the past couple of years and at this point only a handful of subjects are remaining (P2P network protocol, blockchain as in storage and handling reorgs, second layer protocol(s) and finally optimization).


I got some good insights here that gave me some directions. I'll probably start with a primitive way of handling UTXOs and indexes for now but abstract it away like everything else for future flexibility.
163  Bitcoin / Development & Technical Discussion / Re: How many of you check the code of open source software? on: December 29, 2020, 01:40:15 PM
It's not as easy as you'd think. I dare say that less than a handful of projects have "readable" code. Trying to read bad code is like trying to read a terrible handwriting, and going through the entire code is like reading an entire book in terrible handwriting.
Another common issue is lack of documentation. A single line of comment (on parts that need it) can reduce the time reader needs to understand the code drastically.

The less readable the code is the easier for a bug or even malicious code to hide in it even if reviewed by experts.
164  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: December 29, 2020, 01:24:18 PM
I wouldn't start adding random altcoins, there are way too many of those. But if there's any demand for a certain coin recovery, don't let me stop you Smiley
The biggest challenge is the lack of documentation and I can't go dig around in their code trying to figure things out. Otherwise I've written my code in a very scalable way that adding an altcoin in most cases is trivial.
165  Bitcoin / Development & Technical Discussion / Re: Is there any research on different key-value DBs suitable for bitcoin? on: December 26, 2020, 03:35:54 PM
But obviously it's not efficient since it's written on pure Python and JSON doesn't scale well.
The lack of efficiency is not about the language, it is because the entire file is read and written each time instead of partial read/writes which can't really scale. It woks well for small sizes which is why there is only a handful of complaints so far.
But you are right JSON itself doesn't scale well.
166  Bitcoin / Development & Technical Discussion / Re: Is there any research on different key-value DBs suitable for bitcoin? on: December 26, 2020, 06:41:20 AM
There isn't a single "Bitcoin use case". Are you talking about UTXO set storage? An index?
I currently have both UTXO set and wallet in mind but lets start with UTXO. Index will be my future interest.
167  Bitcoin / Development & Technical Discussion / Is there any research on different key-value DBs suitable for bitcoin? on: December 26, 2020, 05:42:41 AM
I'm starting to look into key-value stores and I'm curious whether there has been any research and comparison between different options from a bitcoin usage point of view.
I'm looking into MongoDB, Redis, PostGres, Cassandra and of course BerkeleyDB since bitcoin core uses it. There are a lot more options which make things even harder.

The information I've found so far are for purposes different than bitcoin, for instance PostGres is used by Reddit and they claim it is the fastest based on their benchmarks.

Hopefully a comparison into their performance (speed) and scalability but also I'm also interested in concurrency and whether it could be taken advantage of using these DBs. I know that Cassandra and Redis support concurrency but BerkeleyDB doesn't seem to.
168  Bitcoin / Bitcoin Technical Support / Re: [overview] Recover Bitcoin from any old storage format on: December 24, 2020, 06:00:01 AM
By request I've created a new branch in FinderOuter that could be used to recover Tron private keys. They are in hexadecimal and use SHA3 to hash the public key.
https://github.com/Coding-Enthusiast/FinderOuter/tree/Tron

I have not yet decided whether I should start adding altcoins to FinderOuter which is why this won't be among FinderOuter's regular options and the branch has to be built by cloning the repository.
What do you think, is there any demand for it?
169  Bitcoin / Project Development / Re: The FinderOuter, a bitcoin recovery tool (v0.6.0 2020-12-24) on: December 24, 2020, 05:40:29 AM
Version 0.6.0 is released.
https://github.com/Coding-Enthusiast/FinderOuter/releases/tag/v0.6.0.0
See changelog for details.
  • Move to .net 5.0
  • Added small icons at the bottom showing the current state of the program
  • New recovery option: ELectrum mnemonics
  • Base16 recovery now has more options for secondary input (to check against)
  • Add a new word list to mnemonic recovery: Portuguese

As you may already know FinderOuter has always been a bitcoin recovery tool but we may add altcoin recovery options some day.
By request I created a new branch for recovering Tron private keys, it can recover a hexadecimal Tron private key if you have the damaged hex and your public key or address. https://github.com/Coding-Enthusiast/FinderOuter/tree/Tron
170  Bitcoin / Development & Technical Discussion / Re: Developing Branded Bitcoin Wallet App from open source resource on: December 22, 2020, 12:29:51 PM
It is worth adding that "shall be" in legal terms is not just a word, it is used about something that "is a requirement" and there is no way around it.
171  Bitcoin / Development & Technical Discussion / Re: BIP-39 List of words in Portuguese submitted! on: December 21, 2020, 10:12:24 AM
Our list just got merged! 🎉
I just added the new wordlist to Bitcoin.Net which means next version of my other project FinderOuter will also be able to automatically recover any mnemonics that uses Portuguese word list. Wink
172  Bitcoin / Development & Technical Discussion / Re: Question about ServiceFlags: None and NetworkLimited on: December 16, 2020, 03:19:40 PM
They user agent name sounds like an unsynchronized bitcoin cash node back from when they could still connect to bitcoin nodes (CMIIW but I believe there was a timeframe when BCH nodes could connect to BTC nodes before a BIP was rolled out that prevented this?), maybe they defined a bunch of flags that are unrecognized in bitcoin. But the height doesn't correspond, but even then we know that someone had to have forked Bitcoin core to add those extra flags.
As far as I can tell there is no code in bitcoin core that blocks connection based on user-agent. There was a optional patch back in 2017 that people could use to block certain ones if they chose to IIRC.
That is irrelevant here since any of those fork-coins start from blocks in 2017 (height 500k maybe), this was a fake block in early days (height <20k).
173  Bitcoin / Development & Technical Discussion / Re: Question about ServiceFlags: None and NetworkLimited on: December 16, 2020, 02:46:40 PM
I don't think fake, Sybil-kind nodes would use this ServiceFlag because they have to run in NodeNetwork mode for peers to download blockchain data from them.
There are all kinds of crazy "nodes" out there that weird service flag doesn't surprise me.
Just before I started this topic I received fake block headers with height <20000 from one; sadly I thought there was a bug in my code so I didn't record its IP address or the block hashes, just remember the useragent was saying bitcoinABC.
174  Bitcoin / Development & Technical Discussion / Question about ServiceFlags: None and NetworkLimited on: December 15, 2020, 09:34:58 AM
1. Why or when would a node set its ServiceFlags to NONE?
I'm probably testing "fake" nodes again but they seem to be providing me with headers without an issue.

2. Are NetworkLimited nodes capable of supplying all block headers even though they don't have most of the blocks?
175  Bitcoin / Project Development / Re: Denovo (v 0.1.0) and Bitcoin.Net (v 0.7.0) on: December 14, 2020, 07:00:17 AM
This is what a bitcoin library should be like. You've done some brilliant work on both Denovo and Bitcoin.Net. I'm getting really interested to it so I would like to make a question as a beginner about the calls of node functionalities within Bitcoin.net, because I'm planning to create another software in which I'll use this.
The P2PNetwork namespace is still under construction so you may need to write extra code to use it and have to do extensive tests to not face NotImplementedExceptions!
Good news is that almost all parts of the library are loosely coupled (so they can be replaced). For example look at the TestNet miner option inside Denovo to see how I inject mostly mocked dependencies to the NodeConnector (this will eventually be simplified as MinimalClient as explained below).

What exactly am I sending to nodes once I process a handshake? I mean, after I connect with a node, do I simply call functions like getblockchaininfo and get a response? If yes how do I do that?
It depends on what you want to do, for instance "info about blockchain" is not something you get from node, it would be a local thing that you get from your own local instance of IBlockchain (like your best chain height, next difficulty target, ...). Node is just a wrapper around Socket to handle TCP communication.

Eventually when the P2PNetwork is finished you'll have to choose and instantiate a Client (FullClient, SpvClient, MinimalClient,...) and then simply call their public methods. I'm currently working on FullClient.

P.S. Feel free to use the new discussion feature on GitHub https://github.com/Autarkysoft/Denovo/discussions/3
176  Bitcoin / Project Development / Re: Denovo (v 0.1.0) and Bitcoin.Net (v 0.7.0) on: December 09, 2020, 04:55:55 AM
Version 0.6.1 released.
  • BIP-14: you can now set how many version components to return in ToString() method
  • Block headers is a separate class now
  • Multiple improvements in P2PNetwork for handling messages, violations, etc.
  • ReplyManger will send the correct IP and port in version message now.
  • Some optimization, bug fixes and tests
Denovo's new feature
TestNet miner:
This is meant to be used for testing anything that can not be tested otherwise (like transactions that don't propagate even through TestNet) ergo it intentionally has limited functionality.
Version 0.7.0 released.
  • Introduce FullClient
  • Add an implementation of IBlockchain
  • Add NodePool (a thread safe observable collection of Nodes)
  • Introduce IFileManager (planning to remove IStorage entirely)
  • Add ECIES, new methods to encrypt and decrypt messages with Elliptic Curve Integrated Encryption Scheme
  • String normalization method used by Electrum mnemonic is now public static
  • IConsensus instance can now build genesis blocks
  • Some additional node violation cases
  • Some improvements in ReplyManager
  • Various code improvements, optimization, bug fixes and some tests
177  Bitcoin / Project Development / Re: [Open Source] Booknemonic - Convenience on digital signatures and encryption on: December 08, 2020, 01:13:44 PM
As I said, I'm a beginner on C#, so my code may be messed up. I would like to tell me if you think that I've done something wrong.
I opened an issue.
It is mostly a clean code but the only "messed up" part is lack of tests, and tests aren't possible unless you decouple your UI and business logic. For example you can't write any tests for a simple method like this simply because it "depends" on UI.

I have to look at your code more to understand what it does to be able to comment on the cryptography part though.

To be clear Autarkysoft is the name of the organization (like Microsoft, Newtonsoft), Bitcoin is the name of the library and to avoid conflict we use both when referring to the name of a library meaning Autarkysoft.Bitcoin (like Microsoft.NET.Test.Sdk, Newtonsoft.Json).
178  Bitcoin / Bitcoin Technical Support / Re: C# - From hexadecimal to mnemonic? on: December 03, 2020, 04:18:03 PM
What's next? What will I have to write on my main csharp file to run that backwards (mnemonic->hex) function?
I don't really get what you're trying to make but based on your other topic (public key to mnemonic) I assume you don't want the checksum validation and you want to enter a mnemonic and get the 264 bit entropy out. With that assumption the code would be this:
Code:
using Autarkysoft.Bitcoin;
using Autarkysoft.Bitcoin.Encoders;
using Autarkysoft.Bitcoin.ImprovementProposals;
using System;
using System.Linq;
using System.Text;
Code:
public string MnToHex(string mnemonic, BIP0039.WordLists wl = BIP0039.WordLists.English)
{
    if (string.IsNullOrWhiteSpace(mnemonic))
        throw new ArgumentNullException(nameof(mnemonic), "Seed can not be null or empty!");
    string[] allWords = BIP0039.GetAllWords(wl);

    string[] words = mnemonic.Normalize(NormalizationForm.FormKD)
                                .Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    if (!words.All(x => allWords.Contains(x)))
    {
        throw new ArgumentException(nameof(mnemonic), "Seed has invalid words.");
    }
    if (!new int[] { 12, 15, 18, 21, 24 }.Contains(words.Length))
    {
        throw new FormatException("Invalid seed length. It should be ∈{12, 15, 18, 21, 24}");
    }

    uint[] wordIndexes = new uint[words.Length];
    for (int i = 0; i < words.Length; i++)
    {
        wordIndexes[i] = (uint)Array.IndexOf(allWords, words[i]);
    }

    int ENTCS = words.Length * 11;
    int CS = ENTCS % 32;
    int ENT = ENTCS - CS;

    byte[] entropy = new byte[(ENT / 8) + 1];

    int itemIndex = 0;
    int bitIndex = 0;
    for (int i = 0; i < entropy.Length - 1; i++)
    {
        if (bitIndex + 8 <= 11)
        {
            entropy[i] = (byte)(wordIndexes[itemIndex] >> (3 - bitIndex));
        }
        else
        {
            entropy[i] = (byte)(((wordIndexes[itemIndex] << (bitIndex - 3)) & 0xff) |
                                    (wordIndexes[itemIndex + 1] >> (14 - bitIndex)));
        }

        bitIndex += 8;
        if (bitIndex >= 11)
        {
            bitIndex -= 11;
            itemIndex++;
        }
    }

    uint mask = (1U << CS) - 1;
    entropy[^1] = (byte)(wordIndexes[itemIndex] & mask);

    return entropy.ToBase16();
}
HexToMn works only with 33 byte entropy (66 char hex):
Code:
public string HexToMn(string hex, BIP0039.WordLists wl = BIP0039.WordLists.English)
{
    byte[] entropy = Base16.Decode(hex);
    if (entropy.Length != 33)
        throw new ArgumentOutOfRangeException();

    byte[] ba = entropy.ConcatFast(new byte[3]);

    uint[] bits = new uint[9];
    for (int i = 0, j = 0; i < ba.Length - 1; i += 4, j++)
    {
        bits[j] = (uint)(ba[i + 3] | (ba[i + 2] << 8) | (ba[i + 1] << 16) | (ba[i] << 24));
    }

    int itemIndex = 0;
    int bitIndex = 0;
    uint[] wordIndexes = new uint[24];
    for (int i = 0; i < 24; i++)
    {
        if (bitIndex + 11 <= 32)
        {
            wordIndexes[i] = (bits[itemIndex] << bitIndex) >> 21;
        }
        else
        {
            wordIndexes[i] = ((bits[itemIndex] << bitIndex) >> 21) |
                                (bits[itemIndex + 1] >> (53 - bitIndex));
        }

        bitIndex += 11;
        if (bitIndex >= 32)
        {
            bitIndex -= 32;
            itemIndex++;
        }
    }

    StringBuilder sb = new StringBuilder(wordIndexes.Length * 8);
    string[] allWords = BIP0039.GetAllWords(wl);
    for (int i = 0; i < wordIndexes.Length; i++)
    {
        sb.Append($"{allWords[wordIndexes[i]]} ");
    }

    sb.Length--;
    return sb.ToString();
}
179  Bitcoin / Bitcoin Technical Support / Re: C# - From hexadecimal to mnemonic? on: December 01, 2020, 05:23:54 PM
That is because in the application window only the easy-to-convert target frameworks are listed, and since converting a project that is already targeting ".net framewoek" to ".net core" is not easy it can not be automated so the list excludes all .net core options.
You have to do it manually with some additional steps, I've already posted the migration link here, but the easier and better solution is to first decide what type of application* you want to make then create a new project of that type while selecting .net core as your target from the start. Then copy the code from this project over there, it doesn't seem to be that big.

* NO GUI -> console app with .net core as its target can run on any OS
* GUI -> Winforms or WPF both limited to Windows but can target .net core but still run on Windows only
* GUI -> other multi platform open source GUI such as Avalonia that I told you about, can target .net core and run on any OS
180  Bitcoin / Bitcoin Technical Support / Re: C# - From hexadecimal to mnemonic? on: December 01, 2020, 01:45:50 PM
It's done: https://github.com/Autarkysoft/Denovo/commit/ddd3a6318a57aef2364f05a5a3e3bde18ada243c
You have to compile the library yourself or wait for the next release (this can take a while since I'm working on P2PNetwork namespace and it is very time consuming).

You encrypt messages using the PublicKey instance:
Code:
bool success = PublicKey.TryRead(Base16.Decode("replace_with_pubkey_hex"), out PublicKey pubkey);
// Make sure success is true
string encrypted = pubkey.Encrypt("replace_with_message");
and decrypt using the PrivateKey instance:
Code:
using PrivateKey key = new PrivateKey("replace_with_private_key_wif");
string decrypted = key.Decrypt(encrypted );
See the accompanying tests for more details.
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!