What is the function of LOCK(cs_main)?

Does LOCK(cs_main) pause and branach the program in order to do some necessary job before going on?

I’m trying to publish blocks reactively (as a selfish miner) upon receipt of inventory message from pfrom and react to it after *pfrom* catches up with the height of my secret block.

Following lines didn’t help/there was no reaction on selfish node’s side:
added following lines in main.cpp: after l. 3662

   ...
        {
            LOCK(cs_main);
            pfrom->PushMessage("inv", pfrom->vPrivateInv);
        }
   ...

Blockchain as a way to host truly free social website like reddit

Some time ago I started wondering: what if we create a new coin and use its Blockchain to store a website content?

Bitcoin is P2P, that way it is almost impossible to block bitcoin. Everything in the ledger is public and saved for eternity, would be good for some subreddits which were deleted recently.

What if the mining process would be just making backup of already existing specified social media websites?

Are there any similar projects, which could be used as a base?

Bitcoin resistance against forged slow chain

I’m implementing a new protocol with a custom blockchain, and I’m trying to figure out what is the correct way to deal with the “slow chain” problem.

In the Bitcoin protocol, nodes constantly gossip the newest block and try to produce a block after it. However, it sometimes happens that concurrent branches emerge, and from time to time nodes have to perform a rollback, 2 or 3 blocks into the past.

As we know, block difficulty depends on the time differences between blocks. A malicious entity can easily forge a chain of arbitrarily many blocks by simply starting from the genesis block and producing blocks with consecutive timestamps differing by more than 10 minutes. This way the difficulty would never increase, and the chain can be produced cheaply.

Of course, as a result of this approach, timestamps in the forged chain would increase much faster than in the real chain. This would cause the forged chain to be discarded by nodes, as legal blocks must have timestamps less than or equal to current timestamp (plus/minus some tolerance).

But the problem is:

Alice controls a bitcoin node, and has 500,000 blocks in storage. Bob advertises that he has 600,000 blocks, but the last common ancestor has number 1000. Bob’s chain is a forged slow chain, but Alice does not know it. Alice wants to download Bob’s blocks and check if these are correct.

QUESTION: How can Alice detect that Bob’s chain is invalid before actually storing it?

Approach 1: A downloads all blocks after the last common ancestor with B, checks if everything is correct, and if all seems to be ok, reverts storage state by undoing block changes till reaching common ancestor, and then applying newly received blocks.

In our case, Alice would start downloading 599,000 blocks and eventually find out that the timestamp is too big. She would need to store the tentative chain in memory (possibly expensive) and check all the conditions. She would waste a lot of time, and every troll can trick her to do so.

Approach 2: A reverts the storage to the a common ancestor advertised by B, then tries to apply the blocks received from B as they come.

In our case, Alice reverts her storage back to block 1000, applies operations received from Bob, eventually discards a block with illegal timestamp, reverts back to common ancestor, and aplies the blocks she had before communicating with Bob. Again, time and resources wasted.

Approach 3: A can only revert a fixed, small number of blocks in the past. This way, B can do minimal damage, and forging a slow chain is very costly.

But in the case of a long-term network partition (split brain), the network parts would diverge and never achieve consensus on which chain is the longest. This situation would require manually removing records from storage.

Approach 4: A stores all the blocks ever observed, (including abandoned branches), and dynamically keeps track of which branch is the longest. This approach, while safe, requires a lot of storage space and is tricky to implement efficiently.

I’m leaning towards the third approach, but I’m wondering how is this being solved in various bitcoin clients.

I’ve seen that the core client stores only the longest chain and skips the orphaned blocks. The details of leveldb-based storage are described here:

What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

Thank you very much for your help.

How to pay no fees?

Is there any API where I can create some addresses and making a transaction beetween them just once a month without paying fees?
Or if you can recommend me somewhere with a fee under 5000 satoshis it would be great.

What’s happening in regtest mode? – Wireshark analysis

Motivated to watch data exchange on Bitcoin Newtwork, especially on regtest, and with hints from David Harding I decided to analyse traffic on regtest with Wireshark.

I’ve installed and setup (I’ve got a list of interfaces) Wireshark and start capturing from all interfaces available and immediately run one regtest node with following connection specification:

...
Bound to [::]:11111
Bound to 0.0.0.0:11111
...

I put a tcp.port==18444 filter (in the style of this description) and apply.

Problem: There’s no traffic shown!
Question: What am I doing wrong and what interface should I capture from?

Turnkey webwallet and blockchain digital currency – the simplest to run?

So I’d like to demonstrate a blockchain based digital currency within my firm. For various reasons, I can’t just use bitcoin (or of course I would).

I also can’t distribute pc exes, hence the requirement for a web based wallet. Security does not need to be paramount. There does not need to be a competition for mining although mining does need to be a component (ie there will probably be just one miner running on one cpu / low priority).

Is there an open source web wallet and counterpart configurable mining system ? I took a quick look at coinpunk but I’m not sure that is still supported / running (last update almost a year ago, website offline?).

All suggestions gratefully received.

Installing Electrum on a cold wallet linux usb

I don’t usually use linux but I’m looking to start using it more, if I can just figure out how to do anything. . .

I’m using Ubuntu on a usb, I’ve downloaded Electrum (from the site since I couldn’t download python-pip or electrum through the terminal). So in the terminal I’m in the Electrum folder and trying to install electrum, but the message Unable to locate package electrum. I think I need to enable the component called 'universe' but I’ve had no luck with the answers as depicted here

If you can offer any advice as to how or why I couldn’t originally install pip, or why electrum won’t work now I could really use the help. I need to make this wallet, and I’ve been trying for a very long stupid time trying to, and I have btc idly sitting by that need to go into a wallet. Sorry for such a basic question, but I’m running out of time with this.