windows – Why has Bitcoin Core started acting up of late?

I couldn’t tell you the exact time when this started, nor exactly all the things I’ve tried since, but I never had this kind of issue before, and I’ve been running it for a long time on many installations.

First of all, it gets stuck at “Done loading” in the GUI box showing forever until it actually goes into the actual application.

Secondly, once it is actually displaying the GUI, it says “48 hours behind” or “2 days behind” every day lately, until it finally is done syncing. The thing is, I never keep the computer off for longer than maybe 8 hours, so it’s not possible for this to be accurate.

I’m at v0.20.1. Tried going back to v0.20.0 before and then back to v0.20.1 again. No changes of my computer have been made, and my disk where the (full) blockchain resides is not damaged or acting up.

Other than the merely practical inconvenience, this disturbs me on a deeper level. I’m witnessing how the entire desktop computer as a concept is being killed off and abandoned, and it truly frightens me as I don’t see any alternative. The “smartphones”, “tablets”, etc. are nothing but pure spyware devices, fundamentally crippled and gives me an extremely bad “vibe”. I don’t want Bitcoin Core to also fall into pieces and become so unstable and buggy that it’s unusable.

I’ve also several times tried deleting a ton of files in the data dir (except the blocks, and while Bitcoin Core is not running) to make it “reset” whatever internal statistics may be messed up, but nothing helps.

I’m frankly not up for “troubleshooting” at this point, but merely trying to figure out if others know what is causing this for sure and have experienced the same thing.

(I can’t ask on Github because that site doesn’t allow accounts to be created, like most sites today.)

What could possibly explain this very strange behaviour?

Bitcoin Core wallet – Bitcoin Stack Exchange

Stack Exchange Network


Stack Exchange network consists of 176 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

bitcoincore development – What is Valgrind? When should I use it for debugging Bitcoin Core over using gdb, lldb, pdb etc?

If you watched Fabian’s presentation (or read the transcript) you’ll have seen that he said you can use Valgrind for memory leak checks and that it can be used similarly to lldb.

valgrind --leak-check=yes src/bitcoind -regtest

There is a section in Fabian’s doc on debugging Bitcoin with instructions on how to install Valgrind on MacOS and run it.

Install Valgrind:

brew install --HEAD https://raw.githubusercontent.com/sowson/valgrind/master/valgrind.rb

Run bitcoind with Valgrind:

sudo valgrind src/bitcoind -regtest

Valgrind has also been added as flag to the functional tests in Core in PR #17633 so you can run:

test/functional/test_runner.py --valgrind

The --valgrind flag is documented as a Valgrind memory error detector and that you should expect at least a ~10x slowdown with Valgrind 3.14 or later required.

In that PR practicalswift states:

Regular functional testing under Valgrind would have caught many of the uninitialized reads we’ve seen historically.

Another great resource is a Bitcoin Core PR review club session (hosted by Jon Atack) on running the unit tests under Valgrind. In the notes for that session it describes:

Valgrind is a debugging and profiling tool suite to make programs faster and more correct. Its most popular tool, Memcheck, can detect memory-related errors common in C and C++ programs that can lead to crashes and unpredictable behavior. Here is a tutorial. Memcheck is not perfect: typical slowdown is 3-10x, memory usage is 2x, it can produce false positives (there are mechanisms for suppressing these; see the valgrind.supp file in Bitcoin Core), and it doesn’t currently detect out-of-range reads or writes to arrays allocated statically or on the stack.

bitcoincore development – Confirm Licenses for Bitcoin Core for new book by Oxford University Press

I hope that I can get you or someone else familiar with the licensing of Bitcoin Core to assist me. You can reach me at mark.radcliffe@dlapiper.com

I am writing a chapter in a book entitled on Free and Open Source Licensing by the Oxford University Press. I am writing a chapter on blockchain and open source. The audience is lawyers who are familiar with open source but not blockchain. I am seeking a review of two pages on Bitcoin (including Bitcoin Core) on open source to ensure that it is as accurate as possible. You can see the two pages below. I am using a scan by BlackDuck of the relevant repository so I am comfortable with the list of licenses but I am interested in any additional information you can provide on the background of the clients, the selection of the license and how the contributions are managed to ensure that they have licenses compatible with the “Project License” of MIT. Please feel free to propose changes to the draft. OUP is hoping to get the draft next week and I hope to get your comments early next week.

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Bitcoin is the first blockchain and is based on the Bitcoin Whitepaper by Satoshi Nakamoto (who is still unknown) which was published in 2008. The original Bitcoin client was released on January 9, 2009. This history of Bitcoin and its clients is complex and opaque. Bitcoin.org lists 54 Bitcoin clients. The chapter will review two of the more commonly used clients.

Bitcoin Core was initially named Bitcoin-Qt. It was the third Bitcoin client and developed by Wladimir van der Laan based on the original reference code by Satoshi Nakamoto. Bitcoin-Qt version 0.5.0 was released on 1 November 2011. Bitcoin-Qt introduced a front end that uses the Qt user interface toolkit.
Bitcoin SV (Satoshi’s Vision) is a fork of Bitcoin Cash client. Bitcoin Cash was released on August 1, 2017 as part of the “bitcoin scalability debate.” The hard fork of Bitcoin Cash resulted in two competing coins – Bitcoin ABC (Adjustable Blocksize Cap) and Bitcoin SV. The fork was due to a disagreement over how to best solve the problem of “scalability” in the Bitcoin blockchain. Bitcoin SV was led by Craig Wright who claims to be Satoshi Nakamoto, the original developer of Bitcoin.

BITCOIN CLIENT LICENSE ANALYSIS

Bitcoin Core Client

The scan of the Bitcoin Core client is for Version 0.19.0.1. and was performed on September 4, 2020. The project license is MIT. The project includes 83% third party open source software. The project has 30,390 files of which 25.194 files include third party open-source software. These third party open source files have 76 different third party open source components under 29 different open source licenses. BlackDuck noted that 16% of the components are licensed under licenses which could potentially cause conflicts. Under the BlackDuck analysis, three files (within one component) have a “broader reach” license conflict and no files have a “narrower reach” license conflict. The Bitcoin Core client has 1009 files within eleven components have potential component conflicts. The licenses for the project include many traditional open source licenses including many copyleft licenses such as General Public License version 2 (or later) (“GPLv2+”), General Public License version 3 (or later) (“GPLv3+”), Affero General Public License version 3, Lesser General Public License version 2.1 (or later) and Lesser General Public License version 3 (or later) as well as many permissive licenses. However, it includes some unusual licenses such as License for AMD64 Patch by Mikhail Teterin which provides a license under BSD but prohibits “Use by owners of Che Guevarra paraphernalia” where possible.

bitcoin core – How genereate pub key from priv key ? algo

Private key used in the example: a84860187211d36cddfb77fc7638c996b8b8a77d3e16f2e47a5172fe6e8e2be6

Converting Private Key to WIF (Ruby)


require 'digest'

# Checksums use hash256 (where data is hashed twice through sha256)
def hash256(hex)
    binary = (hex).pack("H*")
    hash1 = Digest::SHA256.digest(binary)
    hash2 = Digest::SHA256.digest(hash1)
    result = hash2.unpack("H*")(0)
    return result
end

def checksum(hex)
  hash = hash256(hex) # Hash the data through SHA256 twice
  return hash(0...8)  # Return the first 4 bytes (8 characters)
end

def base58_encode(hex)
  @chars = %w(
      1 2 3 4 5 6 7 8 9
    A B C D E F G H   J K L M N   P Q R S T U V W X Y Z
    a b c d e f g h i j k   m n o p q r s t u v w x y z
)
  @base = @chars.length

  i = hex.to_i(16)
  buffer = String.new

  while i > 0
    remainder = i % @base
    i = i / @base
    buffer = @chars(remainder) + buffer
  end

  #! Is it just the 00, or does 05 get converted to 3, etc.
  # add '1's to the start based on number of leading bytes of zeros
  leading_zero_bytes = (hex.match(/^((0)+)/) ? $1 : '').size / 2

  ("1"*leading_zero_bytes) + buffer
end


# Convert Private Key to WIF
privatekey = "a84860187211d36cddfb77fc7638c996b8b8a77d3e16f2e47a5172fe6e8e2be6"
extended = "80" + privatekey + "01"
extendedchecksum = extended + checksum(extended)
wif = base58_encode(extendedchecksum)

puts wif

Get Public Key from WIF (Python)


from bitcoinutils.setup import setup
from bitcoinutils.keys import PrivateKey, PublicKey

def main():
    # setup the network
    setup('mainnet')

    # existing WIF key
    priv = PrivateKey.from_wif('L2rq82XD1P9bwnyithBaRYn7v91WxRCSraTrfbu6g86VLYsnCmbt')


    # get the public key
    pub = priv.get_public_key()

    # compressed public key
    print("Public key:", pub.to_hex(compressed=True))

if __name__ == "__main__":
      main()

Source:

https://github.com/in3rsha/learnmeabitcoin-code/blob/master/keygenerator.rb

https://github.com/karask/python-bitcoin-utils/blob/master/examples/keys_addresses.py

What is ccache? When should I use it when building and reviewing Bitcoin Core PRs?

What is ccache? Can you provide some guidance on when to use it for building Bitcoin Core PRs and how to use it?

bitcoin core – ElectrumX returning 0 balance

I have a running full bitcoin node (txindex=1). I also setup electrumx and it has fully synced with current blockchain state.

Here’s the log :

    INFO:LocalRPC:(2) RPC 127.0.0.1:44806, 0 total
    INFO:BlockProcessor:our height: 505,932 daemon: 648,872 UTXOs 826MB hist 236MB
    INFO:BlockProcessor:our height: 505,941 daemon: 648,872 UTXOs 831MB hist 245MB
    INFO:DB:flushed filesystem data in 0.13s
    INFO:History:flushed history in 3.9s for 1,249,360 addrs
    INFO:DB:flush #470 took 4.1s.  Height 505,941 txs: 295,160,913 (+337,771)
    INFO:DB:tx/sec since genesis: 1,976, since last flush: 226
    INFO:DB:sync time: 1d 17h 29m  ETA: 11d 10h 54m
    INFO:BlockProcessor:our height: 505,959 daemon: 648,872 UTXOs 838MB hist 18MB
    INFO:BlockProcessor:our height: 505,967 daemon: 648,872 UTXOs 842MB hist 26MB

But when i run electrumx_rpc query , its returning like this :

  No history found
  No UTXOs found
  Balance: 0 BTC

But I have balance in that address. How to fix this?

I installed electrumx using this repo.

c# – How to call repository methods in EF core so caller can know what it returns

How to make good repository in layer so caller od repository methods knows what method returns.
If I have Student and Grades objects in database I can have one query:

GetStudentsIncludingGrades that shows that it will return Students with populated Grades list inside.
So it looks like this:

public Student GetStudentsIncludingGrades (){
    db.Students.Include(x=>x.Grades);
}

What I have some complex repository. I want to avoid to have methods like:

GetStudentsOnly 
GetStudentsIncludingGrades
GetStudentsIncludingGradesAndIncludingDetailPersonalData
GetStudentByIdWithSomethingElse
GetStudentsSomeLongNameThatDescibesEvrythingButItIsUgly.

I can make it generic so caller can give me list of navigation properties that query must include but I don’t want that my service layer knows anything about Entity Framework internals.

bitcoincore development – How do I view information on the peers my Bitcoin Core full node is connected to?

As 0xB10C posts here you can get a peer dashboard to bitcoin-cli that looks like this.

netinfo dashboard

You can get this dashboard by using

watch ./src/bitcoin-cli -netinfo 4

and you can use the -asmap flag too.

This feature was merged into Bitcoin Core in September 2020 so to use it today you will either need to build master or wait for a future major release. (The feature was built by Jon Atack.)