text:
how does GHOST protocol really work?
I am trying to wrap my head around GHOST protocol... I know it's too much to read, but not my fault. It's GHOST that's complicated (i guess)
As I read, it's said that:

instead of a longest chain consensus rule, GHOST follows the path of
the subtree with the combined hardest proof of work/difficulty.

OK, SO Let me explain how I understand it. Every node started at 0 block. Then other nodes mined 1B block, attacker mind 1A block.. and attacker solves his block(belowest one) secretly.He doesn't broadcast it.  Other nodes are at 1B and now there happened to be a fork (2D,2C,2B) since blocks got mined at the same time. then some nodes went ahead and got the longest chain ending at 5B(the most top chain). Remaining nodes(L1) are at 2C and 2B. some nodes(L2) from these remaining nodes(L1) are at 3E,3D,3C. and one of the nodes from L2 is at 4B now. Now, let's take a moment and say that everyone on the network broadcasted their blockchains. Attacker's chain won't be accepted because there's only 1 subtree(one path only).. Also, the most top chain is only one. As we can see on the image, The biggest subtree is 3E, 3D,3C. So what happens is some nodes share 0->1B->2C->3E, some share 0->1B->2C->3D->4B, some share 0->1B->2C->3C. Let's say I am nodeA and I receive all the broadcasted chains. When I get all of those, I have to choose from them. Since I found that different chains are derived from 2C, I should follow that path. I follow it and try to find the longest one in them which results in 0->1B->2C->3d->4B and that's the one i am gonna accept.
In this case, attacker's chain is doomed. so i think one of the problem's chance which is having 51% hash rate power and broadcasting the longest chain has been decreased(which is great). But I still see a couple of issues.

If blocks don't get mined at the same time, we won't have subtrees as shown on the image, Hence GHOST protocol is powerless here. and we still have 51% attack possibility and in this case, attacker's secret chain will succeed.
So, if blocks get mined at the same time, that's when GHOST protocol will help us. I guess GHOST protocol is a little bit of extra safety added on top of proof of work.
but as soon as nodes followed GHOST protocol(which means, they accepted the chain - from the image it's 0->1B->2C->3D->4B), we are back to where we were(longest chain wins). until blocks start to get mined at the same time again..
Let's say attacker broadcasted his chain, and my node received it. And let's also say that i've not received other node's chain due to network propagation delay. How will my node know that it shouldn't accept attacker's chain ? if my node had received all other node's chains, it would figure out that subtree in 0->1B->2C is bigger and would reject attacker's chain. Any idea ?

I think the main thing you've missed is the problem GHOST set out to solve.
It's first and foremost intended as a scalability/speed upgrade. We want to increase the size of each block and/or decrease the interval between blocks. Either of these would increase the ratio between propagation time and block interval.
The higher the ratio is, the more we get that blocks are mined at the same time. And then lots of honest hashrate is wasted on blocks that get orphaned.
This makes it easier for an attacker to attack, because he doesn't need to have more hashrate than the honest network - he only needs to have more hashrate than the unwasted hashrate of the honest network.
This isn't much of a problem now, when blocks are 10 minutes apart and are about 3MB. But if we were to try to, say, reduce the interval between blocks to 1 second, the time to propagate blocks will be a multiple of the average time to find a block, leading to huge waste and an easy attack.
GHOST (and the more recent SPECTRE) is designed to allow us to increase block size or speed without this waste.
Contrary to what you said, simply adopting GHOST will not cause less branching in the block tree. It will just mean that we won't waste hashrate due to this branching.
Re question 3 - I think you've got things backwards. The way a double-spending attack works is:

Attacker pays merchant, tx is included in the honest chain.
Merchant gives product.
Attacker releases secret chain, where the tx is replaced by one that credits the attacker.
Attacker has both the product and his money.

If you are not up-to-date on the network state, and think the attacker's chain is winning even if it's not, you're actually better off - you will see that the attacker intends to not pay, and you will know not to send the product.
After I send the product, I want the whole chain to recognize the tx that pays me. Even if there are nodes which are not up to date, and briefly believe the attacker's chain is valid - that will resolve quickly after they receive the blocks they've been missing (and see that the honest chain has more weight).

Thanks for the nice explanation. now i understand what the ghost protocol is for. I just don't understand how it solves the problem (waste of miner's hashrate, decrease attacker's chance)...

Could you explain how it solves the problem, starting with the scenario when there are 10 nodes and all of them mined the block at the same time. One of them is an attacker too.  Let me know if it's better to ask a new question.

@NikaKurashvili: Consider the image in your question. The attacker only has 33% of the total hashrate - he was able to find 6 blocks, while 12 were found by the honest network. But he is able to put them all in a neat row, so in the longest chain scheme, he would be able to create a chain longer than the honest network (because only a single branch of the honest network is counter). In the GHOST protocol, he can't - the tree rooted at 1B is heavier, so the attacker's long but thin branch will be ignored. All the blocks mined by the honest network are counted, despite the branching.


text:
How to split the funds and send X% to fee wallet and the remaining funds to another wallet?
Anybody have any idea about how to do it?

User send the bitcoins
X% goes to fee wallet
remaining funds goes to service wallet

I'm trying to use the "sendfrom" but it's not working because he only send the fee amount (or the first call), never the rest.
$sendingFee = $bitcoin->sendfrom($account, $addFee, $feeFormated, 0);
$sendingRest = $bitcoin->sendfrom($account, $addRest, $restMath, 0);

This is my code:
<?php

require("easybitcoin.php");
$bitcoin = new Bitcoin("root", "000000", "localhost", "18332");

function fee($fee, $bal){
    $final = ($fee / 100) * $bal;
    return $final;
}

#account
$account = "pizza";

#fee address
$addFee = "2N9xQyV6itnZNBv5NSLUy8ffXcfopVvP19v";

#Rest address
$addRest = "2MtEzMsT9eedTms9ivEQnjuHPRWw1DHnxyT";

#% charged
$tax = 10;

#balance
$balance = $bitcoin->getbalance($account, 1);

#do a math to remove X%
$feeMath = fee($tax, $balance);

#I was receiving "invalid amount" error. Fixed with this, I was giving 9 instead of 8 after zero. See satoshis for more.
$feeFormated = number_format($feeMath, 8);

#remove the fee from current balance
$restMath = $balance - $feeFormated;

#send the fee to the address xxxx
$sendingFee = $bitcoin->sendfrom($account, $addFee, $feeFormated, 0);

#send the balance minus fee to the address yyy
$sendingRest = $bitcoin->sendfrom($account, $addRest, $restMath, 0);

$err = $bitcoin->error;

#Print message for control
print_r("Fee TXID = " . $sendingFee . " Amount sent = " . "" . $feeFormated . "

");
print_r("Rest TXID = " . $sendingRest . " Amount sent = " . "" . $restMath . "

");

print_r("It's not working because: " . $err);

echo var_dump($sendingFee) . "

";
echo var_dump($sendingRest) . "

";

?>

It's not perfect (far from this) but please understand, I'm not a php guy, even a programmer, I'm just working in a personal project as a hobby.
Maybe should I use "sendmany"? If so, how to use this with php? I saw some examples on internet but nothing showing how to use with php and variables.
Thanks in advance.

Any updates on this?

Problem solved using "sendmany":
<?php
#SENDMANY WORKING
require("easybitcoin.php");
$bitcoin = new Bitcoin("root", "000000", "localhost", "18332");

$account = "pizza";

$arrayRec = array("2MsWztzmaxnsU3xetrKsD4E9ep4r2gYtXj9" => "0.00111",
                "2Mt7dkQiyExrNQTXu9D3qoCpWg3J5TJy9Up" => "0.00222" );

$send = $bitcoin->sendmany($account, $arrayRec);

print_r($send);

?>

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Bitcoin Core download
How long it normally takes to download full database of blocks in Bitcoin Core
I have fast internet, but after 72 hours I'am only on 50 percent.
Thank you

It means it takes 72 hours to download 75 GB. That's fine.

OK, thanks, I saw some similar questions and answers, but after I posted this massage.... Appreciate your time.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
How much money would it take to bribe the majority of miners to attack the system?
I think this question is just a re-formulation of the 51% attack, but it has me thinking: miners are monetarily incentivized to not perform a 51% attack, but there must be some amount of money will cause their incentives to switch. So how much is it?
It is commonly understood that miners have invested in equipment, and so doing something to harm the value of the cryptocurrency they're mining (ie, engaging in a 51% attack), undermines their investment.
But what if a very wealthy entity bribed the miners, external to the bitcoin system, with an amount that exceeds any returns the miners could possibly hope for? For example: a govt pays a majority group of miners $X billion + electricity costs to just 51% attack the network with empty blocks indefinitely.
I think an attack like this could be effective in hurting the public confidence and price, but there are ways it could be thwarted too (switching the POW algorithm, for example). So I don't think it is dangerous in a fatal way.
So my question is: can we estimate how much money it would take to successfully attack the network in this way?
Cost of attack = [(51% of block reward + fees per year)-(cost of 51% of equipment purchased for the next year)-(51% of the network's electricity costs for the next year)] * (number of years worth of income it takes to bribe the miners?)
Am I missing anything here? Or making false assumptions? Interested to hear what others think

The miners, assuming they are rational, will demand as much money as they will lose from having their ASICs turned into expensive space heaters.

@sigmabe But they can't use their hardware to do better things. These are ASICs that only do one thing. And they couldn't mine an alt coin because such an attack would cause every coin that uses their algorithm to either crash in value or change their algorithm.

@sigmabe Not sure I follow. If there's a way to resist this attack, then every PoW coin can adopt it. If there's no way to resist this attack, then it makes the ASICs worthless.

In a parallel thread on "https://bitcointalk.org/index.php?topic=2512771.0" I didn't do the exact math, but a rough calculation shows this:
Currently there is a hashing power of the equivalent to roughly 800.000 mining boxes type "AntMiner S9". For a 51% attack you'd need to buy 400.000 + 1, and bring them on the network (their power cosumption is 1200W, so you'd need a coal or gas power plant, industrial grade level). If you want to "buy" the miners (bribe), then it requires a lot of communication to them, and a financial incentive. Would the miners follow the fork (bribe), if they can see, that they will loose the value of the bitcoins to be mined? I mean, after such an attack would have worked out, the value of bitcoin would run against zero (quickly). What is the remaining incentive for a miner?
Your one-time bribe would maybe need to be equivalent to maybe a 1 year income of a miner, and this for 51% of the miners. Currently a 12,5BTC reward is ~10.000 EURO/CHF/USD, 6 per hour, 21 per day is 18mio a day. And you need 51% of miners. Big gee ...

So assuming the price remains stable, 18mil per day is $6.57 billion for the year. That is total revenue though, what matters to a miner is the profit they actually take home. If your bribe is greater than their expected profit, then maybe you could convince them. What is the estimated profit margin for an efficient miner? 10%? I know the bribe would have to be huge, I'm just interested to get a ball-park estimate of it.

fairly easy, well - nobody knows, how many miners are out there, but: you need 51% of the miners. If all miners have a revenue of 6.57 billion then you need a bit more than the half of it, plus your 10% margin...

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
What is the Bitcoin address to fill in under 'Pay to'
I have a Bitcoin Core wallet. I do not know what address is required under 'Pay to'. Is it one I must create or what?

I suggest you learning the basics of Bitcoin. Start with this video.

This should be an address belonging to the person or company you want to pay bitcoins to.  You have to get the address from them.
If you are trying to buy something from a company, usually they will tell you the payment address as part of the purchasing process.  If you are trying to send money to a friend, ask them for their address.
If you are not looking to pay money to anyone right now, then you do not need to use this screen at all.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How is the Bitcoin transaction fee calculated for small transactions
I tried to send 0.001 BTC with Bitcoin-Core, but for some reasons it charged me with a transaction fee of 0.00145271 BTC:
$ bitcoin-cli getinfo|grep balance
"balance": 0.03312022,
$ bitcoin-cli sendtoaddress my_bitcoin_address 0.001
$ bitcoin-cli getinfo|grep balance
"balance": 0.03066751,

Is there any way to know which fee am I going to pay before sending the transaction?

Possible duplicate of How to calculate transaction size before sending

Note that fees are not paid relative to the amount of value transferred but respective to the data size of the transaction. This causes small transfers to be expensive relatively.

You can use bitcoin-cli estimatefee to estimate the fees required, and settxfee to set it.  It's usually a bit trickier on the command line, a GUI wallet should show this information before you make the transaction though.

To be specific, if you use Bitcoin Core in the GUI mode, it shows you the fee rate before pressing send and the exact amount of fee in a confirmation window.


text:
Bumping unconfirmed transaction with sendrawtransaction
I have a transaction which doesn't confirms for last 3 days and is not most likely going to confirm at all in near future due to a recent situation in mempool.
Will it be working if I'll do the following? Are there any risks to loose my bitcoins forever, or even to get banned by system for double-spend?

Dump that transaction with 'getrawtransaction'
Decrease one of it's outputs by X in my hex editor, so that X will be added up to transaction fee
Sign that transaction with 'signrawtransaction' and send it

Did your original transaction opt-in to RBF?

How could I know that?

Check if any of the sequence numbers on your transaction are less than 0xffffffff - 1

All are equal to 0xffffffff - 1 (0xfffffffe). This means that I don't have RBF, I guess?

Correct. So this is the answer you need: https://bitcoin.stackexchange.com/questions/9046/why-is-my-transaction-not-getting-confirmed-and-what-can-i-do-about-it

Thanks, I have taken a look at that article - they are saying to run bitcoin-core with special options and re-send bitcoins. But can I use sendrawtransaction exactly as described above in order to do that? I want to ensure that I will use exactly the same inputs for resending transaction, and no new inputs will be tainted during transaction re-sending.

Could the free ViaBTC Transaction Accelerator service help you ? The service requires a minimum of fee rate of 0.0001 BTC/kB and has submission limit of 100 that is reset every full hour.
"https://pool.viabtc.com" under "Tool".

It always says "Submissions are beyond limit. Please try later."

This worked for me.  coinb.in reported a "duplicate" failure (duplication is the intent with a fee bump), and bitcoind refused the transaction because it sees the mempool transaction -- however sending transaction manually using viabtc seemed to go through.


text:
Status: 0/unconfirmed, in memory pool. Cnee's address expired and reject this transaction
Internet connection was lost during transaction. Bitcoins gone, but no chance to confirm transaction at cnee side. So after some hours cnee's address expired and reject this trnsctn. Now, as 24H passed, status is still unconfirmed.
As I expect, these funds will be returned for some time.
The question is - am I right and what is the time limit, usually, I have to start worrying after or what I can do now to return the bits.
Thanks for advice.

Who or what is cnee?

Crypto exchange


text:
how does bitcoin know which one is utxo?
Let's say John gave 5 BTC to me. So, John took his unspent outputs and put it into inputs to create a transaction.  Let's say John already had a transaction which was holding exactly that amount of BTC.
Now, How can John not spend 5 BTC anymore ?  The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ? how does it mark it as spent?

To answer the title, utxos are entirely consumed and refered in transactions inputs.

Now, How can John not spend 5 BTC anymore ?

As long as the transaction spending it is in the most PoW block chain, no.

The output John used to give me 5BTC is still on Blockchain. So, does node go to that output transaction and mark it as spent ?

If a valid transaction consumes it in a next block, it is marked as spent and not available anymore.

how does it mark it as spent?

By updating a database commonly refered to as "the utxo set" in which are recorded not-yet-spent UTXOs. See How is a Transaction Output Marked as Spent? .
You likely want to give a look to questions regarding coin referencing and consumption by transactions, for example:

How is the UTXOs of each partially-spent TxIn determined?
Why is there "Change" in Bitcoins?


text:
how does bitcoinjs-lib grab utxo
So, Let's say I want to create a transaction by using bitcoinjs-lib.
As far as I can see, this library doesn't provide the help so that it can automatically figure out/grab unpent transactions for inputs and create a transaction magically.
My question is: Am I the one who has to know unspent transactions that I want to use for the inputs in advance ?
If the answer is no, then can you point me to the bitcoinjs-lib file that does this ?
If the answer is yes, how do I get unspent transactions ? By looking at my transaction list on blockchain and getting each one of them's txid and vouts seem not reasonable. Any idea ?

Yes you need to provide the UTXO details when building a transaction in bitcoinjs. One should not have to trust a library to provide blockchain data, the library works like a calculator and processes the data that it is given. It's not unreasonable at all, these details are easy to get from your node or an explorer.


text:
How can't a malicious attacker generate bitcoins on his private network?
I'm new to the cryptocurrencies world and I'm trying to understand how all this stuff works, so expect a really noob question.
Suppose there's a user which generates a number of addresses and sets up his private blockchain. One of this address will start illegal transactions moving money that doesn't really exist. Since the other nodes of the network are controlled by him, the transaction will be validated. Now this address is moved from his private blockchain to a public pool.
How does the blockchain knows/prevents the malicious node from spending money that are not really there?
Thank you!

related: Can bitcoins be counterfeited?, Where do bitcoins come from and what gives them their value?, Can someone explain how the Bitcoin Blockchain works?

The blockchain will only accept blocks which are based on previously accepted blocks and have a hash value that satisfies the current difficulty requirements. A malicious attacker is in the same position as any other miner, so any block that he mines must satisfy the same conditions regarding validity. In fact, the bitcoin protocol is designed to be trustless, which means that even miners with malicious intentions are not able to destroy its integrity unless they manage to control a majority of the mining power.

I think of the individual bitcoins as all already existing, as opposed to being mined into existence by miners. There are 21 million. Period. Each “bitcoin/satoshi” has it’s own identification tag, say. What miners do is release them, sequentially (the very last one in the year 2140 or so due to the halving every four years); and as payment- for the “work” of adding the next block (or ledger entry) to the long ledger of transactions of other coin movements (the chain) -these miners are then the custodian of those newly released coin’s tags via an address that the miner controls with a key… until they are spent,  when that happens, another miner (presumably) will be the one to record the movement or transference of those “tags” as they become under the custody of someone else (ie. the payee). The address they get put “in,” say, is accessible if you know the key (ie. A bunch of random words in a specific sequence). So when the chain is transparent to all, it translates to not having any duplicates or double spends. Think of the way mailboxes at the post office are all accessible/transparent on the mailman/woman’s side, but require keys on the public side(in a roundabout sort of way).
The only way to corrupt the process or to alter which tags are currently custodies of which addresses would be to control more than half of the participating ledgers (miners/nodes) putting it in disagreement with the other half of the ledgers.


text:
Why mark a transaction as RBF (Replace-by-Fee) explicitly?
I could broadcast a second transaction that has the same inputs but a higher fee, without marking the original transaction as replaceable. Miners would most likely favor the second transaction and reject the original one. Why should I mark my transactions as replacable if they can always be replaced by broadcasting another conf-0 transaction?

I could broadcast a second transaction that has the same inputs but a higher fee, without marking the original transaction as replaceable.

Default node behaviour is to accept the first-seen transaction into the node's mempool. So your second transaction that spends the same inputs would likely be dropped by most nodes, and thus it would be less reliably broadcast across the network, and therefore be less likely to be included in a block.
Of course, the second transaction could still be included in a block, but this 'first-seen' preference makes it less likely. Even though a miner may prefer the transaction that pays higher fees, if they do not hear about that transaction in the first place then there is no chance of it confirming. An explicit RBF marking allows the user to more reliably broadcast a modified transaction spending the same inputs later.

Thanks, I wasn't aware of  the 'first-seen' preference!


text:
51% attack + ignore blocks not mined by yourself
If you own 51% of the mining power and decide to ignore all blocks not mined by yourself.
You would eventually end up having the longest chain, and would eat up the 49% of block-reward you werent getting prior.
And now control 100% of the blocks, and could censor transactions etc, since any blocks not mined by you would eventually be a stale fork.
Is there some measure that would stop this?
It seems if you control 51%, it would be in your economical interest to ignore blocks not mined by yourself.
(other than it being bad publicity for btc, and maybe crash the price)

Yes. The owner of 51% can get 100%. This is attack-51 itself.

Is there some measure that would stop this?

no


text:
Need to use two bitcoin core but issue with syncing
Need to know how we can use two bitcoin node for example. I do have two bitcoin full nodes A and B. Created wallet address at A and has all transaction details at wallet.db in node A. But I need to keep PK in DB and take those and send request to B node, but it fails as it dont have all transaction details, I dont want to re scan B node every time, is there any way we can achieve this. So that i dont need to worry on which node my request is going.
Thanks,
Prad

I think you have to explain better what you are trying to achieve. You want A and B to both be able to spend coins from the same 'wallet' ?

Yes, I would like to be node independent. If user creates wallet and say it got created on A node, will keep private key in DB, and any further transaction can be done on A or B. If we want to do on B, node B need to have all transaction history ( which is in wallet.db file of A node). So Node B need to sync before doing any transactions. I dont want to use syncing everytime. Any alternate way like peering, addnode properties.

You can just copy the wallet files from node A to node B.
Note that this is not recommended and may result in strange behavior. You will not have any labels synced across the two nodes as they really are operating independently of each other. They just have wallet files that have the same private keys.

If you just want node B to have the transaction history from node A, you can import addresses from node A into node B so that node B is watching the blockchain for those addresses.

I dont want to use scan here to watch transactions, thats the problem. Trying  to see what else option to get transaction details.

You only need to rescan once on import. The node will continue watching for transactions to those addresses whenever it is online and it will scan as it catches up the blockchain when you turn it on later.


text:
Stratum protocol - problem with mining.submit method
code was written according to documentation.
I have following lines for submit method
submit() {
    // ["<worker.name>", "<jobID>", "<ExtraNonce2>", "<ntime>", "<nonce>"]
    return this.call('mining.submit', [this.worker.name, this.worker.jobId, this.worker.extranonce2, this.worker.ntime, this.worker.extranonce2]);
}

According to documentation "When miner find the job which meets requested difficulty, it can submit share to the server" and the result should be following
{"error": null, "id": 4, "result": true}

But test was failed (result in the image)

QUESTION: Could some one clarify, waht is wrong and how to solve the problem? What does mean "low difficulty"? Why did I get that message?

The error is pretty self explanatory: you submitted a share that does not meet the requested difficulty. The pool requires that shares you submit meet a particular difficulty. If your shares do not meet that, then the pool will reject them. The shares that your software is sending to the pool do not meet the pool difficulty.
To fix this, either you are creating the submission incorrectly, or your miners are not mining at the correct difficulty.


text:
Startum protocol extranonce2 - where the extraNonce2 comes from
I'm curious where the extraNonce2 comes from in stratum protocol?
In the official documentation, I found
Extranonce2_size - Represents expected length of extranonce2 which will be generated by the miner.
Could you clarify this sentence and give more details?

Extranonce2 is generated by the miner performing the work. When a miner runs out of nonces in the block header, they can increment Extranonce2 in the coinbase transaction to be able to give themselves a much larger search space for a valid PoW for the difficulty that they are mining at.
The pool has to provide the size of Extranonce2 because Extranonce2 is not an actual field in the coinbase but rather part of the variable length arbitrary data that a miner can include in the coinbase transaction. So the pool specifies the size so that the miner knows how much space they have to work with for Extranonce2.


text:
Unconfirmed bitcoin transaction (Need help)

I have sent bitcoin since 25th May 2017 till now the transaction haven't confirmed yet.
https://blockchain.info/tx/ac0635c98af0703927f1b364d2d8c19f4b2812c97169c729cb341111adcea866
How can i do? Please kindly help me to get my bitcoin back
Thank you in advance
Tickbit

The transaction you link builds on a chain of approximately 30 unconfirmed transactions. As far as I saw when skimming through, they all pay decent fees with 295sat/B, however due to them being unconfirmed for more than two weeks, probably some have been dropped from the mempool since.
You should make sure that all the transactions are broadcast to the network again, then I think they would confirm easily within an hour or two, as currently transactions at <80sat/B get confirmed.

How can i do to make it confirm? Please kindly advise me Thank you in advance

What wallet is it that you're using? Your wallet software should automatically broadcast your transactions again. Otherwise many wallets allow you to export raw transactions which can be manually broadcast on e.g. blockchain.info.


text:
How much is this in GH/s?
I Hope i can get some help from you.
when i have 2.43 TH, how much is this in GH/s?
I'm complete confused, cause i tried to find out, how much is this.
Can someone tell me how much GH/s this is at two decimals?
Also i was looking for Hashcalculator on web, but i dont find any calculator where i can change my hashrates to other...
I find this, but i dont know if its right.
1 MH/s = 1,000 kH/s
1 GH/s = 1,000 MH/s = 1,000,000 kH/s
1 TH/s = 1,000 GH/s = 1,000,000 MH/s = 1,000,000,000 kH/s

and how much is 2.43TH/s in GH/s with 2 decimal

2.43 TH/s is 2430.00 GH/s. The conversion chart you have is correct.


text:
addnode in bitcoin.conf doesn't work (Regtest mode)
I'm trying to make to nodes on the same computer communicate.
I set up two bitcoin folder with two bitcoin.conf files.
bitcoin.conf in the second node is the following:
rpcuser=bitcoinrpc
rpcpassword=roiroiroiroiroi
addnode=127.0.0.1:18444

while in the first node is just I've just set the rpcuser and rpcpasswords
Now I start the nodes with the following command
First node
./bitcoin/src/bitcoind -regtest
Second node ./bitcoin/src/bitcoind  -regtest -rpcport=5444 -port=18888 -datadir=/Users/tommaso/.bitcoin/
But they don't connect to each other.
Only if a run the command ./bitcoin/src/bitcoin-cli  -regtest -rpcport=5444 -datadir=/Users/tommaso/.bitcoin/ addnode "127.0.0.1:18444" "onetry"
 they finally connect
Why does addnode=127.0.0.1:18444 in bitcoin.conf doesn't work?

If you just have to make one connection, you might try using connect instead of addnode

Anyway addnode should work but just to be safe I have tried as well connect but it doesn't work neither.

I have a Mac btw, this might help

Try running bitcoind with -debug and -printtoconsole flags (and not -daemon) to see if you notice anything during startup

What is the resolution to this question?

Have you tried in Linux (instead of Mac)?

well im late but i can tell.
it works, use following string
addnode IP:8333 add   but the Port you dont need to show, because everyone uses the same port, because thats the one he set as open on his router. the rpc port must only defined once at startupt. in addnode dont use it, because you could be bound on an IP too via the bind= command, then the server dont know what to do.


text:
what questions should i ask when deposing a client about hidden bitcoins
I am deposing a client's spouse about bitcoins they have mined since 2013.  What relevant questions should I ask to ascertain number of coins mined and transactions concerning those coins, such as number of coins still held and location of coins?

For legal services, you almost certainly want to hire someone with domain knowledge as a consultant on this. There's simply too many ways to move BTC, and too many ways it could have been mined (solo, pool mining, contract mining), and too many ways and places it could have been stored in for a site like Bitcoin.SE to cover all the details without a lot more information

Were the coins mined on regular PCs or stolen electricity? Mining on a standard PC would essentially net zero earnings and is not anywhere near as profitable as modern ASICs.

To 'own bitcoin' is to have knowledge of the private keys that allow some unspent transaction output (UTXO) to be spent (though in some cases, knowledge of a key may be delegated to a custodial service). So understand that the 'bitcoins' themselves are not what a user must keep safe, rather it is the keys that allow those coins to be spent.
With this in mind, consider that there are many ways to store bitcoin keys. A savvy user may be able to obfuscate their keys entirely, and there is not necessarily any way to prove that a person has current knowledge of a key.
"How much bitcoin have you mined since 2013" is the obvious question to ask. Consider that some amount of the bitcoin mined may have been sold in order to finance the mining operation, may have been traded into other cryptocurrencies or assets, may have been lost due to user error, etc.
Otherwise, I agree with @RaghavSood's comment, especially considering the legal implications of this question, it is difficult to answer comprehensively in a SE posting. This seems like a situation in which a paid consultant may be appropriate.


text:
How to retrieve transactions in realtime from bitcoind .dat files
I want to get all the data from blocks as they get updated on my local node.
Abe offers very poor performance, and fast-dat-parser creates other .dat files and doesn't have enough documentation for me to understand how to get data like block size, age, hash difficulty, Transactions and transaction fees.
Is there an alternative tool, or at least a detailed documentation that would allow me to write a parser for content of .dat files?

Why not use the Bitcoin Core RPC? It will handle the retrieval and decoding for you

Check this one https://github.com/normanvolt/blockchain-parser

Trying to read and parse the .dat files while bitcoind is running is likely a good way to have tons of errors due to partially written data. Instead of trying to read the .dat files, you can use bitcoind itself to notify you of new blocks and to use the RPC interface to decode and fetch the block information for you. You can start bitcoind with -blocknotify=<cmd> where <cmd> is a command that bitcoind will run every time a new block is accepted. You can read bitcoind -help for more information about what -blocknotify does. The command that is run can then be a script which calls the RPC interface and fetches the block data that you need by using the getblock RPC command.

Thank you for the input. Is the RPC interface fast enough to get information about the trades as fast as possible? My idea was to access trades in a .dat file as soon as the new one is created, so I'm sure bitcoind has stopped writing in it.

It depends on how fast is "fast enough". The RPC interface is fairly fast. It will certainly be faster than only reading blocks when a new .dat is created as multiple blocks (hundreds, if not thousands) go into each .dat. To humans, it is unnoticeable. It takes a few milliseconds.

Ok, so RPC is faster than reading an old .dat file, and better than corrupting the one that's being written into at the moment. Thank you very much.
Does any sort of a "listen" node exist, that serves to stream transaction data, instead of functioning as a full node and a wallet?

bitcoind has a ZMQ interface which streams blocks and transactions to a listener using the ZeroMQ messaging protocol. You can also just connect to the node using the Bitcoin P2P protocol and get blocks and transactions once they have been verified.


text:
Can't send the funds - encryption password forgotten. Copay
I know my 12 word phrase but can't remember the encryption password. What is the procedure to recover the wallet? How many times can I insert the encryption password wrong before my account gets blocked? I've got several passwords which I'd like to test.

Simply delete the app, choose "import wallet", and you're fine. This procedure applies to all wallets with seeds. There are no limits, remember that Bitcoin's motto is "Be your own bank"
Or, just look for the "import wallet" button.

I believe some wallets with seeds can require a "seed extension", "extension word" or "13th/25th word" for recovery. Someone might describe this as an "encryption password" because that is how it is used.

As @redgrittybrick notes, if this is actually a seed extension/passphrase, then you will need your "encryption password" to access your wallet - and hence your bitcoins.


text:
Modify vanitygen to generate from massive amount of given private key
I just using vanitygen recently & figure how to create address from a given hex private key, this is my code
while (!vcp->vc_halt) {
         if (++npoints >= rekey_at) {
            vg_exec_context_upgrade_lock(vxcp);
            /* Generate a new random private key */
            BIGNUM start;
            BIGNUM *res;
            BN_init(&start);
            res = &start;
            BN_hex2bn(&res, "3B1BCC5A67F38853810972B1DA8A67148FAD78C6CD6F22B2C823D141BE59C81C"); //Set up hex private key
            vg_set_privkey(res, pkey);
            //EC_KEY_generate_key(pkey); default code
            if (vcp->vc_privkey_prefix_length > 0) {
                BIGNUM *pkbn = BN_dup(EC_KEY_get0_private_key(pkey));
                unsigned char pkey_arr[32];
                assert(BN_bn2bin(pkbn, pkey_arr) < 33);
                memcpy((char *)pkey_arr, vcp->vc_privkey_prefix, vcp->vc_privkey_prefix_length);
                for (int i = 0; i < vcp->vc_privkey_prefix_length / 2; i++) {
                    int k = pkey_arr[i];
                    pkey_arr[i] = pkey_arr[vcp->vc_privkey_prefix_length - 1 - i];
                    pkey_arr[vcp->vc_privkey_prefix_length - 1 - i] = k;
                }
                BN_bin2bn(pkey_arr, 32, pkbn);
                EC_KEY_set_private_key(pkey, pkbn);

                EC_POINT *origin = EC_POINT_new(pgroup);
                EC_POINT_mul(pgroup, origin, pkbn, NULL, NULL, vxcp->vxc_bnctx);
                EC_KEY_set_public_key(pkey, origin);
            }
            npoints = 0;

            /* Determine rekey interval */
            EC_GROUP_get_order(pgroup, vxcp->vxc_bntmp,
                vxcp->vxc_bnctx);
            BN_sub(vxcp->vxc_bntmp2,
                vxcp->vxc_bntmp,
                EC_KEY_get0_private_key(pkey));
            rekey_at = BN_get_word(vxcp->vxc_bntmp2);
            if ((rekey_at == 0xffffffffL) || (rekey_at > rekey_max))
                rekey_at = rekey_max;
            assert(rekey_at > 0);

            EC_POINT_copy(ppnt[0], EC_KEY_get0_public_key(pkey));
            vg_exec_context_downgrade_lock(vxcp);

            npoints++;
            vxcp->vxc_delta = 0;

            if (vcp->vc_pubkey_base)
                EC_POINT_add(pgroup,
                    ppnt[0],
                    ppnt[0],
                    vcp->vc_pubkey_base,
                    vxcp->vxc_bnctx);

            for (nbatch = 1;
                (nbatch < ptarraysize) && (npoints < rekey_at);
                nbatch++, npoints++) {
                EC_POINT_add(pgroup,
                    ppnt[nbatch],
                    ppnt[nbatch - 1],
                    pgen, vxcp->vxc_bnctx);
            }

         }
        else {
            /*
             * Common case
             *
             * EC_POINT_add() can skip a few multiplies if
             * one or both inputs are affine (Z_is_one).
             * This is the case for every point in ppnt, as
             * well as pbatchinc.
             */
            assert(nbatch == ptarraysize);
            for (nbatch = 0;
                (nbatch < ptarraysize) && (npoints < rekey_at);
                nbatch++, npoints++) {
                EC_POINT_add(pgroup,
                    ppnt[nbatch],
                    ppnt[nbatch],
                    pbatchinc,
                    vxcp->vxc_bnctx);
            }
        }

        /*
         * The single most expensive operation performed in this
         * loop is modular inversion of ppnt->Z.  There is an
         * algorithm implemented in OpenSSL to do batched inversion
         * that only does one actual BN_mod_inverse(), and saves
         * a _lot_ of time.
         *
         * To take advantage of this, we batch up a few points,
         * and feed them to EC_POINTs_make_affine() below.
         */

        EC_POINTs_make_affine(pgroup, nbatch, ppnt, vxcp->vxc_bnctx);

        for (i = 0; i < nbatch; i++, vxcp->vxc_delta++) {
            /* Hash the public key */
            len = EC_POINT_point2oct(pgroup, ppnt[i],
                (vcp->vc_compressed) ? POINT_CONVERSION_COMPRESSED : POINT_CONVERSION_UNCOMPRESSED,
                eckey_buf,
                (vcp->vc_compressed) ? 33 : 65,
                vxcp->vxc_bnctx);
            assert(len == 65 || len == 33);

            SHA256(hash_buf, hash_len, hash1);
            RIPEMD160(hash1, sizeof(hash1), &vxcp->vxc_binres[1]);

            switch (test_func(vxcp)) {
            case 1:
                npoints = 0;
                rekey_at = 0;
                i = nbatch;
                break;
            case 2:
                goto out;
            default:
                break;
            }
        }

        c += i;
        if (c >= output_interval) {
            output_interval = vg_output_timing(vcp, c, &tvstart);
            if (output_interval > 250000)
                output_interval = 250000;
            c = 0;
        }

        vg_exec_context_yield(vxcp);
    }

I try to run the program & expect result like this

Address: 14m54cDDgC96ptqTz66431PoD7f6CPmsHE
Priv key: 5JGKRxEqgMQU1SC86uJHt6Bp6hBZCyea6PHfWvPDpuMsYFiiQpE

Technically it work when i generate a single address everytime but when i use -k to keep it generating it turn up lots of random address not as i intented to

Address: 18b9xT21uxvmwU31whAcnW7ytag7Qdz5wH
Address: 1LKHy9Y8pMTsNdwfZXYexKegNvXc6UTm9C
Address: 16esSUcRDz1um1bBWhBynSvmJUqXZWTHd7
....

What i understand is it keep multiply value of my given key to make new address & it take a while to reach loop to set private key in pkey again. Is there any way that i can skip this part & make it generate pure new private key everytime. I intened to replace this with my own random key generator to recover my paper wallet, thank you

You can change
        switch (test_func(vxcp)) {
        case 1:
            npoints = 0;
            rekey_at = 0;
            i = nbatch;
            break;
        case 2:
            goto out;
        default:
            break;
        }

to
        switch (test_func(vxcp)) {
        case 2:
            goto out;
        default:
            npoints = 0;
            rekey_at = 0;
            i = nbatch;
            break;
        }

You can also replace the test_func with a function in which you check if the public key is the one you're looking for. Since you'll always use the -k option, you can replace the switch with
        test_func(vxcp);
        npoints = 0;
        rekey_at = 0;
        i = nbatch;

OK, i just change it & it work but look like the program doesn't use 100% CPU anymore & it only generate few thoundsands private key per seconds. Do you have any suggestion?

the check public key seems to work perfectly fine though

You should add "array of private keys" in "execute context" (vxcp) in pattern.h. Above the part that contains  /* Common case, you should call the RNG for all of the points and set the points to the public keys. You should also remove the condition if (++npoints >= rekey_at) { and the else part associated with it. In vg_exec_context_consolidate_key, which is called by the test_func, youshould change the pointer to private key so that it points to your array you added to execute_context in pattern.h and takes the index of pk.Lastly, increasing ptarraysize should improveperfomnc.GoodLuck

You’re welcome. Let me know if you’re stuck or it doesn’t work.

hi, it's me again. I want to modify the same fuction on GPU, can you suggest some idea to run it on oclvanitygen without multiply key? Ididn't have expericnce with opencl. The core function was in "oclengine.c" but there're no "if (++npoints >= rekey_at)" so it was hard to know where to edit the code

@DanMinhToan Is this what you're looking for: https://github.com/samr7/vanitygen/blob/master/oclengine.c#L1906

yes, it has the same key generator but the multiply funtion was different

i tried to reduce the rekey_max value to 1 to make sure it use the seed every time generate a new privkey(normally, it'll search 100000000 keys before use the seed again), turn out it decrease the performance as well (about 85keys/s), if i change from a single EC_key to key array, there're error show up. How can i make it use only rng seed but maximize the performance at the same time?


text:
Have there been any examples of people manipulating transactions in a way that waiting for more than 1 confirmation would avoid?
A lot of bitcoin exchanges require some minimum amount of confirmations before they consider money deposited.
Is there any evidence that this actually does anything? Has someone ever before manipulated a transaction on the bitcoin ledger because the recipient didn't wait for 10+ confirmations before accepting that the bitcoin has been exchanged successfully.
Or is this just to stop a theoretical attack from happening?

What you are referring to is likely a preventative measure for the possibility of a double-spend attack. Due to the nature of the Proof-of-Work algorithm in Bitcoin, the likelihood of such event on a transaction with 6+ confirmations is very low due to probability and the cost implications of re-calculating X amount of blocks.

Is there any evidence that this actually does anything?

Suppose you have a large transaction that is very attractive to an attacker or someone looking to perform a double-spend attack. Once the transaction is included into its first block, it is considered to have 1 confirmation. Each block built on top of this chain adds to the number of confirmations of the transaction. This makes it increasingly difficult for a double-spend attack because the attacker would have to complete the same amount of computation (proof-of-work) to become the larger chain. In our example, 6 confirmations would require the attacker to mine 7 valid blocks to become large enough to be considered the valid chain. For example, having 20% of the total hash power of the network with 6 confirmations would yield a 1.42% probability of a successful attack. This number becomes exponentially smaller as the number of confirmations increases.

is this just to stop a theoretical attack from happening?

One important aspect of Bitcoin is that nodes will always favor the blockchain with the most amount of proof-of-work (longer chain), this is critical to preventing double-spending.

Has someone ever before manipulated a transaction on the bitcoin ledger

This is a slightly controversial question, and I would recommend reading this thread for various attack specifics.
The Bitcoin Wiki also has several charts and calculators that can be used to determine theoretical attack probabilities.


text:
Data for time a transaction spent in a pool before it got added to a block
Is it possible to collect data for when an transaction was added to the pool to when it was added to the block?

Kind of.
There is no "the pool" or "the mempool" (which is what I assume you are talking about when you say "the pool"). Rather each node maintains its own mempool which may be different from another node's mempool. Because each node receives a given transaction at different times, the amount of time a transaction spends in the mempool will also vary from node to node.
However, you can still run a node and track how long a transaction spends in its mempool before being included in a block. In fact, Bitcoin Core already does this in order to do fee estimation, although the raw data is not exposed to users.


text:
Cryptofinance plugin pulling wrong data for KNC
Seems there are two "KNC" tags on Coinmarketcap... Kyber Network and KingN Coin. Any idea how I should pull the Kyber Network data using this plugin? Right now it's pulling the KingN Coin info...

There are over 60 coins out there that share the same symbol. You would have to use the full name of the coin to pull the data instead of ticker. According to the documentation:

To find the coin full name, simply go to its CoinMarketCap page and copy its name from the URL. For instance Cosmos URL is https://coinmarketcap.com/currencies/cosmos/ so we’ll copy cosmos

However, you need to keep the quote currency in symbol. So if you are getting the data of Kyber Network in terms of bitcoin, you will have to use =CRYPTOFINANCE("kyber-network/btc")


text:
Proof-of-Stake: What if a bad enactor is chosen by random?
My understanding of proof-of-stake is the following:
The node that mines the next block is chosen, randomly in proportion to the amount of nodes they have in the network (ex. person who who owns 5% of all the tokens in the ecosystem has a 5% chance of being selected to mine the next block)
The block gets broadcasted throughout the network.
However, based on this principle of randomness, what if a bad enactor is chosen by chance.
What if a person wants to submit a block w/ fraudulent transactions (ex. instead of Bob sending Alice 1 cryptotoken, the fraudster changes up the transaction to make Bob send Alice 100 cryptotokens - assuming Bob owns 100+ cryptotokens)?
Thanks!

What if a person wants to submit a block w/ fraudulent transactions (ex. instead of Bob sending Alice 1 cryptotoken, the fraudster changes up the transaction to make Bob send Alice 100 cryptotokens - assuming Bob owns 100+ cryptotokens)?

In PoS, block validators lock certain amount of the network tokens into a deposit using a smart contract that designates them as validators. You cannot simply change the output as the signature used to verify 2 cryptokens being sent will not be valid if that number is changed to 100. Thus this transaction would be invalid according to the protocol. If the network determines that the validator has misbehaved then the entire deposit (or in some cases portion of the deposit depending on protocols on different chains) gets slashed. To go into exact technical details as to how it happens you can see Ethereum PoS FAQs here.


text:
Address not valid when withdrawing money from Binance
I want to withdraw the Vibrate crypto from binance. When I enter the BTC wallet address which I took from my account from coinbase, binance says invalid address. Am I missing something here?

Note: You cannot withdraw to a bitcoin wallet as it is an entirely different network.
You would need to install a wallet that supports the so called "Vibrate" cryptocurrency, then use that to generate an address to withdraw to. I have no idea what "Vibrate" is to be honest, the closet I could find was something called "Viberate" which seems to be an Ethereum ERC20 token.  So, if you want to withdraw those, you need an Ethereum wallet that handles tokens.  One popular wallet is MyEtherWallet.

You are attempting to withdraw an altcoin to a Bitcoin address. You need to withdraw to a ‘Vibrate’ wallet, not a Bitcoin wallet.

And where do I create a Vibrate wallet, in binance itself?

I just want the money back in simplest possible way? how can i get it?

I have no recommendation on where to create a Vibrate wallet, I would generally avoid any such altcoin myself. Sorry.

You can basically check the Vibrate website, usually projects post link on where to buy or store their currency. And always remember to use the BTC for BTC only, the same goes with every other coin. Except for some ETH tokens or NEO tokens, they sometimes can be sent to the coin address.


text:
how to place a bitforex api buy order
I have read the documentation for BitForex on placing a buy order here:
https://github.com/bitforexapi/API_Doc_en/wiki/Order
Then after understanding that, I read the API Call Description documentation:
https://github.com/bitforexapi/API_Doc_en/wiki/API-Call-Description
Here is what I have in my code:
var crypto = require('crypto')
var axios = require('axios');
var accessKey = 'xxx';
var secretKey = 'xxx';

var nonce = Date.now().toString();

var amount = "1"
var price = "0.00015393"
var symbol = "coin-eth-bf"

// tradeType 1 is buy , tradeType 2 is sell
var tradeType = "1"
var message = `/api/v1/trade/placeOrder?accessKey=${accessKey}&amount=${amount}&nonce=${nonce}price=${price}&symbol=${symbol}&tradeType=${tradeType}`;

var hash = crypto.createHmac('sha256', secretKey).update(message);
var signData = hash.digest('hex');
axios.post(`https://api.bitforex.com/api/v1/trade/placeOrder?accessKey=${accessKey}&amount=${amount}&nonce=${nonce}price=${price}&symbol=${symbol}&tradeType=${tradeType}`)
    .then(function (response) {
    console.log(response.data);
    })
    .catch(function (error) {
    console.log(error);
    });

I keep getting an error:
{ code: '1011',
  success: false,
  time: xxx,
  message: 'NeedParam accessKey and signData' }

I am currently at a loss to why I keep receive this error.
I am passing both the accessKey and signData in.
The part that is fuzzy to me is the signData.

Am I creating the signData properly based on the documentation?
Also, am does order matter for the parameters that are being passed
in? Anything else I may potentially be doing wrong?

I don't believe you can"t use the $() syntax to concatanate strings in node.
var message = `https://api.bitforex.com/api/v1/trade/placeOrder?accessKey=   ${accessKey} <--  &amount=  ${amount} <-- &nonce=${nonce} and beyond[...]`

you can simply do
message = "/api/blahblah" + accessKey
You obviously did this multiple times.  If the issue is something different I will return to the question but this seems simple.

unfortunately, that is not it. ES6 syntax allows template literals. If you console log message, you'll see it is a proper string, I created following the documentation.
My main concern is, is what I'm doing correct based on the documentation.


text:
Rewriting the entire blockchain: is it possible to spoof block timestamps of a privately mined chain?
According to fork.lol and Pieter's bitcoin.sipa, it would currently take ~200 days for an attacker with 100% of the current hashpower to rewrite the entire btc blockchain. My question pertains to how an attack like this could actually play out:
Lets assume that 100% of the hashpower is in an attackers hands, and the btc chain has stopped progressing. The attacker points 100% of the hashpower towards mining on the genesis block, so they will generate the first 2016 blocks SUPER fast, and then the difficulty will increase by a factor of 4. This will continue until the difficulty reaches it's current levels, and after ~200 days the attacker's chain will have a higher cumulative difficulty, despite having a much lower block height.
But I don't think that is very interesting, the rest of the network will realize there is a problem well before 200 days have passed, and probably code up a solution of some sort to keep things running smoothly.
So how possible is a more covert attack? Could an attacker with a modest amount of hashpower mine a private chain, and spoof the timestamps to keep the difficulty lower than it should be? Thus allowing the creation of a 'replica' chain with a few txs changed for the attackers benefit?
This could be done while the honest chain is still operating, and the attacker would slowly catch up to the honest chain. The further along the attacker makes it, the more hash power they will need to dedicate to the attack to keep outrunning any honest miners. But if a modest amount of hashpower can privately rewrite a good chunk of the early history, it seems like the current 200 day window might actually be a slight overestimate.
Note: In this scenario, the total time to enact the attack would be longer than 200 days, but some of this time would be spent privately mining with a portion of hash power that 'won't be missed' by the network. So the rest of the network may only be able to notice that an attack is happening inside of the 200-day window.
I do not see this as a real threat, I'm more interested in understanding what is actually possible, particularly in regards to spoofing time stamps on a private chain to keep difficulty targets low.

Your exact question is a bit unclear to me. Yes an attacker can mine a private chain with a lower difficulty.. But then no one would accept  it because it has a lower difficulty.

To clarify then: does spoofing timestamps in this way work, and if it does, how much might that allow them lower the 'proof of work equivalent days' required to rewrite the entire chain? (assuming an attacker has access to a majority of hashpower)

Waiting for Pieter Wuille to answer.......

I think you are perhaps confused about how Bitcoin calculates the "best" chain. The "best" chain contains the most work and is not necessarily the longest. If you mess with the timestamp to lower your difficulty, you've effectively made your chain "shorter". See: https://bitcoin.stackexchange.com/questions/29742/strongest-vs-longest-chain-and-orphaned-blocks

@kaykurokawa I understand the distinction between 'block height' and 'most work', I think you've misunderstood my question slightly. To rephrase: if an attacker with a modern ASIC wanted to rewrite the entire chain, but end up at the same block height/cumulative difficulty as the current chain, could timestamp spoofing a priv mined chain allow them to do so quickly? Eg. block 150k on honest chain is 52 difficulty, block 150k on attack chain is also 52 difficulty, even though attacker has what should be '1000 difficulty worth of hashpower'. Numbers obv made up, but should communicate the point

i believe that's why we have checkpoints in the source code so a user performing IBD might not be easily fooled to verify an alt-chain with the same amount of work done while the block history was still in low-diff. In relatively-higher diff blocks, this is a non-issue since its non-trivial to forge these blocks

Yes, an attacker could spoof the timestamps on the block and create a covert alternative history. However, this doesn't make much of a difference in this attack. The reason is that, if the attacker chooses to manipulate timestamps to increase the difficulty, then they will end up producing fewer, in count, high-difficulty blocks. On the other hand, if they choose to manipulate timestamps to lower the difficulty, then they will end up producing more, in count, low-difficulty blocks. In any case, the cumulative difficulty in the adversarial chain will be the same (both in expectation and, due to a Chernoff bound, with high probability, unless they increase difficulty tremendously).
I'm doubtful about your claim that the network will realize there's a problem. The attacker's chain will remain private until they have surpassed the current honest chain in cumulative difficulty. During covert mining, the honest parties are unaware that an attack is taking place (and the honest chain can continue growing, provided there is some non-majority honest power). The attack will only become visible when the attacker reveals the chain, when the honest parties will instantly switch to it. At that point, the attacker can perform a large double spending attack and walk away prior to the honest parties employing a patch.
One thing the attacker has to keep in mind is that the current blockchain is sometimes checkpointed, so if a client has a checkpoint, then the adversary can only reorg the chain up to that checkpoint. Furthermore, especially near the present, the block timestamps have to match the current time of the verifier computers, as this is checked by some clients, at least approximately. Other than that, this attack could work.


text:
How does supporting additional 'Address Chains' impact resource usage for an SPV wallet?
On Reddit I encountered a user claiming that implementing Segwit support for an SPV wallet would require supporting an 'additional address chain', but I'm not sure what exactly that entails.
I would expect that the wallet would some additional code in order to recognize the various types of segwit addresses, but I've never heard much talk about this being resource-intensive for the user device. How is it more resource-intensive exactly? How much of an increase is it?
I'm also unsure of how Schnorr would affect this further?

For reference, this is the conversation from Reddit:


text:
What is the oldest physical bitcoin artifact?
The bitcoin network has been running since early 2009, but what is the oldest physical artifact related to bitcoin?
I don't mean computer hardware that was used to run bitcoin, unless it is designed specifically for bitcoin use (ASICs, hardware wallets, etc).
I think paper wallets are an obvious answer as one of the oldest physical artifacts, but those are something best kept private. So more interestingly, what is the oldest 'public' sort of artifact? Material from an early conference? Casascius coins? Something else?


text:
How we decode output address from Bitcoin genesis transaction
Accordingly to blockchain.info, the first bitcoin transaction ever spends 50 BTC to the address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa.
The pubkey script of that transaction is
PUSHDATA(65)[04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f] CHECKSIG'

The hash160 of 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa is 62e907b15cbf27d5425399ebf6f0fb50ebb88f18, but I don't see any occurrences of it in pubkey script above (yes, I'm aware about endianness issues). How could Blockchain.info ever know that an output of that transaction is 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa?

This is a pay-to-pubkey (P2PK) script, where the transaction contains the destination public key itself. These were common in the early days of Bitcoin, and were originally the type of script that would be created by default by miners (see Why does the default miner implementation use pay-to-pubkey?), though nobody seems to know why this was chosen.
Nowadays the norm is to use a pay-to-pubkey-hash (P2PKH) script, which as you know contains the hash160 of the public key, rather than the key itself.  You can note that such a script looks different, e.g.
 DUP HASH160 PUSHDATA(20)[536ffa992491508dca0354e52f32a3a7a679a53a] EQUALVERIFY CHECKSIG

Blockchain.info is taking the pubkey from the transaction, computing its hash, and converting it to a base58 address.  This is just a convenience for the user, so that one can think of either P2PK or P2PKH transactions as crediting an "address".  So Satoshi could use the same private key to spend a P2PKH transaction sent to the address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa, as to spend the genesis coinbase transaction (disregarding the fact that it actually can't be spent at all).


text:
Bitcoin Infrastructure in Africa?
Bitcoin Infrastructure in Africa: Going by basic infrastructure requirements for mining or trading in bitcoins/cryptocurrencies, is Africa ready?

To state it as simple as possible:
For trading crypto's you just need a good internet connection and a computer (even a tablet or phone could suffice).
For mining you need cheap electricity, good internet connection and a secure location. As well as a decent capital as mining rigs aren't cheap.


text:
How many coins will be available after bitcoin cash fork?
I am confused about bitcoin cash fork.
Will Bitcoin Cash disappear and its name change to the Bitcoin cash ABC? or after hash war there will be only one coin?

There will be one additional coin after the fork. One network will keep the ticker BCH and the other will get a new one. At the moment it looks like ABC is going to keep the BCH ticker and Bitcoin SV will get the ticker BSV.
The fork is much the same as previous forks off of BTC. The coin with the most proof of work gets to keep the ticker symbol. Right now ABC chain has 55% more PoW done than SV chain.


text:
Networking in cryptocurrency
I am learning and trying to implement my own cryptocurrency and I am thinking about how could I achieve the peer to peer connections.
I read that bitcoin is using DNS seeds for discovering users.
In such case when running full node at home, one must configure his router to forward the port, firewall, etc..
What do you think about webRTC technology? Do you think this could be good way of solving p2p network? In this case, no router configuration is needed and firewall is ok.
Do you see some pros/cons of these aproaches?

What does port forwarding and firewalls have to do with DNS seeds? Those are two completely unrelated things. Even without DNS seeds you still need to port forward.

well i am trying to say, that's the way how are peers discovered in bitcoin.
And if I want for example to be full node, i need configure firewall and router. Do I understand it correctly?

No, you do not need to configure your router and firewall to run a full node. Contrary to popular belief, full nodes do not need to accept incoming connections. If you only make outbound connections, you are still helping the network because you are still receiving, verifying, and relaying blocks and transactions.

That's true, so I just implement connection from client(home) to public nodes? but what if all nodes are behind nat(homes) . Then I should configure it hm?

I read that bitcoin is using DNS seeds for discovering users. In such case when running full node at home, one must configure his router to forward the port, firewall, etc.

That isn't true for wallets at least. You can certainly run Bitcoin-core without configuring port-forwarding or changing any firewall rules.

What do you think about webRTC technology?

It seems designed for real-time communications between web-browsers.
That means it is not a good fit for cryptocurrency networks that work anything like Bitcoin.

You don't need real-time communications - predictability of response times is not at all critical.
You probably don't want to be restricted to browser-based communications or to solutions optimised for browsers.

So for wallets(SPV's) I don't configure it, but still I have to comunicate to the full node. How would you suggest establishing connection between full node and SPV(light node)?

@dtechlearn: I would probably follow the model for SPV defined in the Bitcoin whitepaper and bip-0037 etc.

To deal with WebRTC u need to understand SIP which is big deal already.
Once u understand SIP u know then that u need server. Many servers.
Read more here https://bloggeek.me/webrtc-not-p2p/
Sounds like totally away from Crypto.

I don't understand Boris... I just need the stun server and signaling server to know currently connected users,
which is similar to those addresses from bitcoin to initiate the connection
Isn't that correct?

But where is decentralization? What if I DDOS 2 ur servers?

Maybe it would be possible to make the signaling server every in node that is connected. Just thinking. So you think this is not good idea to use webRTC for such a thing?

I don't think it is secure and anonymous enough (as it was developed for another purpose) to be used in crypto.

so its purpose is to exchange media, data... So you would suggest using DNS seed... which mean If someone wants to use my app, they must configure their router to forward port right?
In bitcoin paper, they say, that core attempts to reconfigure the router. Is this possible to send request for forwarding port programaticly? thanks Boris

u can use simple ubuntu on Digital Ocean or similar (where u have public IPs). No need to keep seeding it at home.

Let us continue this discussion in chat.


text:
How is blockchain stored on disk?
Hi how is blockchain actually stored on disk?
I noticed bitcoin uses key store database level DB but what is the structure?
https://github.com/bitcoin-core/leveldb-old/blob/bitcoin-fork/doc/table_format.txt
Here I don't get it... Does anyone has simple overview how it is stored?
I have also read this... but don't get it.
What are the keys used in the blockchain levelDB (ie what are the key:value pairs)?

You may mix up block data with the UTXO set (unspent transaction outputs).
Bitcoin Core uses LevelDB for the later (the UTXO set).
Quick lookups for unspent transaction is important for performance.
The block data is a different things. If you have a non-pruned peer (normal full node mode), Core stores all block files so it can serve those blocks to other peers bootstrapping (and for chain reorganisations).
Those block files are not an API, use it with care. If you interested in parsing blocks, consider using the RPC or REST API.
The .blk files contain a bunch of blocks (raw network serialisation format). There is also a block index (a levelDB database) that contains the file offsets and the headers.
Learn more about the blocks format here (or google).

So If I wanted to try implement storing blockchain on filesystem, how would you suggest doing it?
having file with indexes and each index would represent block location inside another file?

Libbitcoin db uses memory mapped files(mmap). No data is deleted, only appended, as all public data is validated first before transferred to the store. All valid tx are permanently stored (no tx are removed from unconfirmed set). Each db (tx, block, history etc) includes a hashtable which maps the key to the respective file offset in the db file.
As a memory mapped file is just a pointer from the application point of view, the actual IO is hidden and optimized by the OS. This is one reason for the high query performance of Libbitcoin Server. The specific application of storing/indexing Bitcoin public data allows for a high performance specialized store vs a generalized one optimized for journaling/recoverability and other guarantees not needed for public Bitcoin data.


text:
what happens when their is a bicoin algorithm half?
I saw in an article something about a bitcoin algorithm half in 2020, what exactly is this, I have tried looking this up but I couldn't find anything that told me what it was only this.


text:
I made a $60 transaction to my BTC wallet and I’ve only received half of it ands it’s been 4days
Can someone pls help or explain to me what’s going on.

You don't send dollars to BTC wallets, you send bitcoins. Did you send a different amount than what you received?

I put $60 in the Bitcoin atm so I can covert the $60 into bitcoin but only half of my money is in my wallet

I put $60 in the Bitcoin atm so I can covert the $60 into bitcoin but only half of my money is in my wallet

Bitcoin ATMs charge fees for currency exchange. Sometimes they use jaw-dropping spreads on exchange rates. They are usually very expensive. Possibly more so for small amounts. Check your receipt.
If you think the machine made a mistake, contact the operator (don't contact the owner of the floorspace, they mostly just rent the floorspace they don't own the machine).

and it’s been 4 days

Waiting longer won't make any more BTC turn up. The transaction is done.

Footnote/Digression:
Bitcoin ATMs are not Automated Teller Machines (ATMs) they are automated currency exchanges, a different thing. Calling them BTMs is marginally better.

I’ll just never put $60 in at one time I’ll just put $20 in at a time

Should I have sent the bitcoin to my private key instead of public key

@ZoeGodGT it will be helpful to stop thinking in terms of "I sent this many dollars", and start thinking in terms of "I sent this amount of BTC". The issue of considering the $ value is compounded by the volatile nature of BTC. The price dropped in the last few days, so there is a good chance your bitcoin was probably just worth more at the time of purchase then it is now. Bitcoin is sent to bitcoin addresses, not private keys. Do not ever share a private key.


text:
Is there a Wiki comparing different wallets?
I am new here so please go easy on me if my question is not written to your standards. If you ask me to make changes, I will make them so that my question is more suitable for this SE.
If you look at Wikipedia's Comparison of numerical analysis software or Comparison of smartphones, you quickly see information (such as whether the software supports GPUs or only CPUs, or what year the software was first released), that is by no means not available elsewhere, but is probably unmatched in how well it's organized.
I wonder if there is such a Wiki (website where users can make their own edits, not necessarily on Wikipedia) for comparing different cryptocurrency wallets. For example the table could include information such as the year that wallet first became available, whether they currently charge a fee for transactions, etc.
Wikipedia does have a List of cryptocurrencies but doesn't seem to have a list of wallets.
There is a bitcoin-specific Wiki site which has a page on "wallets", but it only lists wallet formats, so none of the top wallets listed for example here, such as Coinbase and RobinHood are listed there.
I have done some research before coming here.
1) Is there a comparison between different blockchain.info's wallets? - is specific to blockchain.info
2) Is there a website that compares the features of different cryptocoins? - is asking about cryptocoins, not wallets (and also doesn't have any answers).
3) Comparison of different active cryptocurrencies - asks about different coins, not wallets.
Question (1) did not end up getting closed, but in the comments it says "Questions seeking product or service recommendations are off-topic because they tend to become obsolete quickly. Instead, describe your situation and the specific problem you're trying to solve."
I am therefore not seeking a product recommendation, but rather I'm asking whether or not there exists a page where I can go and study the different products myself easily. Such a page would not go "obsolete quickly" because on a Wiki, people can constantly update it to include new wallets or remove features no longer offered. I did start this research because I wanted to find something like RobinHood but not requiring for me to have an SSN card from the USA, or like Coinbase but without requiring me to be able to receive text messages (I only have a land-line phone) but still allows free transactions, but some link to a Wiki page would suffice if I can't ask directly whether or not the type of wallet I want exists.

The ‘wallets’ you’ve mentioned (Robinhood, Coinbase) are custodial exchanges, I’m not even sure I would truly call them ‘wallets’ persay. ‘Free transactions’ do not exist, in any case you will be either sacrificing privacy and/or paying in other ways.

Thank you @chytrik: They were called "wallets" in this article. By "free" I mean there's no monetary cost for the transactions. Isn't it true of Robinhood? The no-free-lunch theorem states that free things will have other disadvantages (such as privacy) but "free" transactions are more important to me than privacy.

@user1271772 Robinhood is not a wallet and it is arguable whether or not you are even trading real Bitcoin since there is no way for you to send your coins anywhere outside of their platform.

@user1271772 most 'free transaction' platforms I've seen just let you send 'free transactions' to other users of the same service, which is to say you are not sending real bitcoin transactions, instead you are just asking some third party service to update their database of user account balances. For example, if you wanted to send me a transaction, you would be unable to, because I am not a user of those services. If you want to send a real bitcoin transaction, you will need to use a real wallet.

@user1271772 Oh good, did you see the link at the bottom of the wiki: https://bitcoin.org/en/choose-your-wallet

To my knowledge, there is no such list, although many comparisons between a subset of wallets and services are available.
Although one could conceivably build such a list, perhaps on the Bitcoin wiki, there would be limits to its benefits for actual wallets.
Wallets vs. Wallet services vs. Custodians vs. Exchanges
Services such as Robinhood do not qualify as a wallet, since there is no way to send or receive bitcoin. These are simply exchanges, and you usually have no way to verifying that the bitcoin you supposedly own are actually there, or to access them.
You also have custodial services, most of which offer exchange services as well, such as Coinbase, Bitfinex, and other popular exchanges. Via these, you can send, receive, and trade bitcoin. However, you are still not in control of your keys, and are subject to a significant counterparty risk.
You then have wallet services, such as Bitpay and BitGo. These services provide mobile and desktop apps, and also allow you to maintain control of your seed words, which lead to your private keys. Here, you are still implicitly trusting that their apps will not steal your BTC, but are free to move your keys to another application if you wish, or if the service shuts down.
Lastly, you have programs that are not centralized, and allow you to maintain full control of you coins, such as Bitcoin Core and Electrum. Here, there is no single point of failure, the code is open source, verifiable, and can be compiled directly by you. Backend services are also distributed and redundant, and your keys never leave your machine. This is the only stage I would consider to be a true wallet.
At this stage, any wallet would achieve feature parity fairly quickly, since the underlying transaction mechanism of the blockchain is the same for everyone. As such, a comparison would be limited to the code/ease of use/team, and other such factors.
At higher levels where custodian and exchange services are involved, a comparison makes more sense since features diverge a fair bit. However, this is hard to put into a wiki, since it is not often black and white - for instance, some exchanges only offer certain features to residents/citizens of specific jurisdictions for legal reasons.
Moreover, such a list would also be more prone to defamation and spam attacks with competitors/bandwagons trying to artificially make someone look good or bad, which would be hard to moderate quickly and effectively - On a popular list like this, listing a scammy wallet for even a short while could easily cause someone to lose a lot of money.


text:
Coinbase "convert" API?

I use the convert functions at coinbase to take advantage of market changes to increase my position amounts.
This weekend I am going to write a php script that tracks the available conversion pairs and makes charts & notifications when a coin you are holding has increased in price and swapping coins may be beneficial.
Example: 5 BCH = 8 ETH.  BCH increases by 5%, now 5 BCH = 8.4 ETH.  You make the swap and wait.  BCH retraces AND/OR ETH increases in price... Maybe now 8.4 ETH = 5.06 BCH.
The end result in the example is an increase of .06 BCH.
Does Coinbase offer an API for the convert functions?  Could not find it...


text:
I sent 2.002 BTC using withdrawal tab in BITFOREX Exchange to Coinbase
I withdrew 2.002 BTC from my BITFOREX account to my BTC Coinbase account over a week ago and when I look up the Transaction Hash it shows it is an unconfirmed transaction with 82 inputs ans only 2 outputs. How do I get my coins into my Coinbase account now??
Please help! Anyone!
Thanks!
PAC-Man

It doesn't say anything about exchanges and how to get the transaction pushed where it stopped and into rhe

And into the Coinbase account

If the answers to the linked "duplicate" question don't help you, you should contact Bitforex support directly.


text:
bitcoind localhost port 18332: Connection refused Ubuntu 18
Trying to connect to testnet using curl from localhost on ubuntu server. Tried lots of combinations of bitcoin.conf and ports.
Here's my config:
server=1
daemon=1
testnet=1
rpcuser=user
rpcpassword=pswd
test.rpcport=18332
rpcconnect=127.0.0.1
rpcbind=127.0.0.1:18332

Any ideas?

test.rpcport=18332 that's not right.

Thanks, I've solved the issue, it was a silly mistake on my side

Please either delete the question or post an answer explaining how you solved your problem, thanks.


text:
Can I recover my seed words?
I am using MultiBit Ver. 0.5.14, I have my wallet open in it, but do not know my seed words, I had them saved most likely on my computer or printed out on paper, but after 3 moves, 2 computer crashes and 1 computer replacement I have no idea where they might be or what they are, can I recover them, if so, how?
Thank You
Michael Grace

Worst case, just create a new wallet whose seed words you do know and move all your funds to it.

I went to make a new wallet in MultiBit Ver. 0.5.14, it makes one without asking for seed words, it only wanted a password, so maybe I do not need to worry about them as I could not even remember making them but thought I must have since 2 other places I just made wallets for asked for them.

Multibit 0.5.14 is a MultiBit classic version which does not have seed words and does not support Hierarchical Deterministic wallets. So long as you know the password to your wallet and you have an up to date backup of it, you will be able to access your Bitcoin. There are no seed words for you to recover.
However, MultiBit 0.5.14 is an extremely old version of MultiBit. It is a version of MultiBit classic which was deprecated and replaced with MultiBit HD (which has seed words). Furthermore, MultiBit HD is no longer maintained and supported. So your version of MultiBit is several years out of date, contains potential vulnerabilities, and is no longer maintained whatsoever. I would highly advise that you switch to using a different wallet software such as Electrum.


text:
When is the halvening? What are the dates of past halvenings?
When a miner finds a new block, they receive a block reward that is comprised of the transaction fees from that block, plus a set amount of newly minted BTC. When the network started, this block reward was 50 BTC, but that amount is cut in half every 210,000 blocks, slowly approaching zero. This reduction is commonly referred to as a 'halvening'.
210,000 blocks is equivalent to about 4 years, but what were the actual calendar dates of the previous block reward halvenings? What are the expected dates of future halvenings? How accurately can they be predicted?

Here are the approximate dates for the halvenings of the BTC block reward, as evidenced by the timestamp on those blocks. Note that the timestamp is not a perfect measure of when the block was found, but it is reasonably accurate, with an assumed margin of error of a couple hours (for more info on this see this question). The time stamp is a component of the block's header, and it is reported in unix time.

Genesis block - 50 BTC - Unix time 1231006505 (Sat, 03 Jan 2009 18:15:05 GMT)
Block 210,000 -  25 BTC - Unix time 1354116278 (Wed, 28 Nov 2012 15:24:38 GMT)
Block 420,000 - 12.5 BTC - Unix time 1468082773 (Sat, 09 Jul 2016 16:46:13 GMT)
Block 630,000 - 6.25 BTC - Expected ~May 2020
Block 840,000 - 3.125 BTC - Expected ~May 2024
Block 1,050,000 - 1.5625 BTC - Expected ~May 2028

You may notice that the past halvenings have occurred sooner than the expected ~4 year time frame. This is because the network's hashrate has been steadily increasing on average, but the difficulty adjustment only happens every two weeks. This latency means that by the end of the two week difficulty adjustment window, there will be more hashrate pointed at the network, so blocks will be found a little quicker than the 10 minute goal. This effect compounds over time, so each past halvening has occurred a few months ahead of the implied schedule.
Likewise, if the network hashrate were seen to steadily decrease over the next years, we would expect future halvenings to occur at a rate of > 4 years, as blocks would be founds slightly slower than the 10 minute goal.
The estimates given for future halvenings were calculated assuming a ~constant hashrate. A more accurate estimate could perhaps include a range of +/- a few months, based on historical observations of the network's hashrate.


text:
Tracking inventory messages
I am trying to connect to different nodes and keep track of the inventory messages that they send to me. I tried to do this with bitcoinj and libbitcoin, but I didn't make it. The goal is to connect to much nodes as possible and listen to inv messages.
Any help? I am sure there must be a straightforward solution.
Thanks!

Using Bitcoin Core, if you start it with -debug=net (or add debug=net to your bitcoin.conf file), every single network message will be included in the debug.log file along with the node it came from. You can then parse the debug.log file to get the information you want.


text:
Is it possible to determine the wallet ID that received my fund from one account to another?
I am new to bitcoin. I opened an account with Coinbase and also an account with Blockchain.  I transferred about $35 worth bitcoin from Coinbase to an address I generated from my Blockchain wallet. HOwever, after the transaction was completed, I was not able to locate the funds in Blockchain. I have the transaction history and even the address, but am not able to unlock it with my own wallet ids.  Blockchain support has been non-exist, so i'm writing on this blog to see anyone has similar experience and can share their thoughts on this.  I presume i will not be able to get the $35 back, but thought i give this forum a try. Thanks in advance! L

Can you link the txid here? Does the address you paid to show up in your blockchain.info wallet? Did you triple check that it matched when you copy/pasted it at the time of transfer?

Hi Chytrik - i think i used the QR Code to send the payment. Honestly, I can't recall how it occurred. i just know the address that i sent to b/c it's in the transaction history.  I tried to add it to my wallet in Blockchain, but i get a message saying this is a Watch Only address.


text:
What do i do with Bitcoin? How to start my Bitcoin?
I heard a little bit about Bitcoin and people earning money from it. How do i start my Bitcoin. I am very new to this.

This is a bitcoin developer portal, here neither you will earn any bitcoin nor anybody will tell how how to earn it and stuff.  If you want to start with bitcoin developement start with fullnode. You will get all required information there


text:
Listen for transaction on specific address
How can you listen for a transaction on a specific address? I'm working on building a lightning network watchtower and the first thing I need to do is detect when someone closes a channel.

Lightning implementations already have implemented the functionality to watch the blockchain to see if the funding TX was spend (and the channel closed) Often this is outsourced to the Bitcoin fullnode. I suggest to look at their code base for this functionality and modify the relevant code snippet to include a watchtower solution you want to create.

Thanks Rene! It's for a class project. I am a CS student just trying to get started with lightning development. Where would you suggest to start if I want to create an alert when someone closes a channel?

Well if you have a Bitcoin node there should be an event you it can listen to on its api if a new block is found. You can parse the block to see if it contains a transaction that spends the funding transaction of the channel. (may I ask : which class at wich university?) there are libs in almost any programming language which help you to parse the blockdata so that it should be easy to go through then and check for a spend of your funding tx

I go to University of Colorado, Boulder. This semester is our university's first crypto class. It didn't really cover lightning network but I am really excited about it and am doing my project on it. Looking forward to your book on lightning.


text:
Multisig scripts hashing (p2sh): difference between legacy and segwit
Some time ago I noticed that, given the same inputs, addmultisigaddress and createmultisig Bitcoin core's methods were generating different p2sh (addresses).
I asked around and a user from the bitcoin dev list told me that this was because:

"addmultisigaddress uses the default address type of the wallet, which
  is p2sh-segwit and createmultisig uses a default address type of
  legacy"

An example of this behaviour is:
bitcoin-cli addmultisigaddress 1 '["045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d","02ac46c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831","0224a4dc5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e07"]'
{
  "address": "36ULucjWUTrDvaJzCyhFoVbDoNS6Zum2Du",
  "redeemScript": "5141045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d2102ac46c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831210224a4dc5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e0753ae"
}

bitcoin-cli createmultisig 1 '["045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d","02ac46c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831","0224a4dc5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e07"]'
{
  "address": "3GiimyxF1R5VixfBFAbQZbuy9EesD2r6n1",
  "redeemScript": "5141045897fee25bd7c5692510b2f50fcae9aa20fbc4d49d59814f4c7fdb5c4bc6eb1c0ce382458f9588e922e0d509ed8d34856787380075b00418b02e0bf7c652ef9d2102ac46c6d74d15e60f4f1035ff07ef740aca1d68d55ba0b8d336a73d7a35858831210224a4dc5620714a9ecf67a09583d1e4c04f5bedb8ecea99028da05bb15a2a7e0753ae"
}

The point is that, later, I noticed that with certain public keys the two methods generate the same hash:
bitcoin-cli addmultisigaddress 1 '["03fc5e16d0ece343a94735ca467d5812922fcc30e3ce43ceaf3cff7d7617631146","02ea92a0cd1738cef7502e42fe119a322845f8f1a2dd9b7216635e17dd2fffd101","04633794a75bfbd9fb2bc6bd54836831c0916dc27f9ac528045cc9352bb2cc97a003b3a6ae397101d801f3d95e6a153368b939aaf7b27bd3a5bb8a30ed92aac204"]'
{
  "address": "32AVnYUUSvm4bGgEXoQ2zuFAJBPH4P31Gi",
  "redeemScript": "512103fc5e16d0ece343a94735ca467d5812922fcc30e3ce43ceaf3cff7d76176311462102ea92a0cd1738cef7502e42fe119a322845f8f1a2dd9b7216635e17dd2fffd1014104633794a75bfbd9fb2bc6bd54836831c0916dc27f9ac528045cc9352bb2cc97a003b3a6ae397101d801f3d95e6a153368b939aaf7b27bd3a5bb8a30ed92aac20453ae"
}

bitcoin-cli createmultisig 1 '["03fc5e16d0ece343a94735ca467d5812922fcc30e3ce43ceaf3cff7d7617631146","02ea92a0cd1738cef7502e42fe119a322845f8f1a2dd9b7216635e17dd2fffd101","04633794a75bfbd9fb2bc6bd54836831c0916dc27f9ac528045cc9352bb2cc97a003b3a6ae397101d801f3d95e6a153368b939aaf7b27bd3a5bb8a30ed92aac204"]'
{
  "address": "32AVnYUUSvm4bGgEXoQ2zuFAJBPH4P31Gi",
  "redeemScript": "512103fc5e16d0ece343a94735ca467d5812922fcc30e3ce43ceaf3cff7d76176311462102ea92a0cd1738cef7502e42fe119a322845f8f1a2dd9b7216635e17dd2fffd1014104633794a75bfbd9fb2bc6bd54836831c0916dc27f9ac528045cc9352bb2cc97a003b3a6ae397101d801f3d95e6a153368b939aaf7b27bd3a5bb8a30ed92aac20453ae"
}

I don't get how this can be possible if the inputs and the redeem scripts are the same.
What's the difference between the two cases and in general between a legacy multisig transaction and a segwit one?
Reading raw transactions data from the blockchain, how is possible to know whether a script needs to be hashed using legacy or segwit?

I'm unsure why that is happening. If there is at least one uncompressed public key both methods should give legacy p2sh addresses. However, i noticed that in the first case if you push the uncompressed public key from position 1 to position 2 or 3 while passing the RPC call, we get the same p2sh addresses by both methods.

This is a good point @UgamKamat, thank you. I didn't though that if one of the pubkeys is uncompressed, the p2sh needs to be legacy because segwit does not support uncompressed keys. However, it's not enough for a general rule because I think that also in the case where all the pubkeys are compressed, the p2sh can still be legacy

that is correct, but what I am perplexed by is why the two RPC calls are giving different addresses in your first case. You can check, if you shift the uncompressed public key in the first case in the last position and run both RPC calls, they will give the same P2SH addresses. What I'm having trouble understanding is why they are different if uncompressed public key is first

In both examples, is the uncompressed pubkey part of your wallet? I think there's a bug here.

I believe the behavior you are seeing is actually a bug.
By default, addmultisigaddress uses p2sh-segwit which is the default address type for the wallet. By default createmultisig uses legacy. These are two different address types, and normally, you get two different addresses.
However segwit does not allow uncompressed public keys. So when the redeemScript is being created, if an uncompressed public key is detected, both RPCs will return legacy addresses. This is why you see the same address in the second example.
But I believe there is a bug. Your first example should also give the same legacy addresses, but it does not. I think that this is because the uncompressed pubkey is not part of the wallet, so it does not correctly detect that it is an uncompressed pubkey. Thus addmultisigaddress follows its default to give you the p2sh-segwit address and createmultisig follows its default to give you the legacy address.

Reading raw transactions data from the blockchain, how is possible to know whether a script needs to be hashed using legacy or segwit?

For p2sh-segwit, the redeemScript is not actually the redeemScript you get from the RPCs. Rather it is the script for a P2WSH output. The "redeemScript" is actually the witnessScript for the P2WSH script that is the actual redeemScript. The script type (either in the scriptPubKey or in the redeemScript) determine whether that output is segwit or not.

I agree there is a bug, but even if those public keys are not added to the wallet and you shift the uncompressed public key from the first position to last then both of them generate a legacy address. This works only if the uncompressed public key is in the last position. That is the reason why in the second case in the question, both the addresses are the same (uncompressed public key is in the last position in that example).


text:
Bitcoin (and other coin) mining seems very inefficient
No, this is not a post about the Proof of Work algorithm being a huge waste of electricity, although of course it is.
My point here is that it seems like it's just inefficient in terms of how coins are mined.  Each Pool or Solo miner has the same block, and they each work diligently to find a golden hash.. but they're duplicating each others work.  I'm sure the hashing is somewhat randomized, otherwise the fastest pool/miner would always win if it were a sequential brute force.
Still, even if every pool/miner works from a different, random set of nonces, there must be a lot of duplication of effort.
Consider a mechanism where blocks of nonces are doled out to pools and miners (like a super-pool).  These are like "claims" in the mining sense, in that a pool can "stake out" a "claim" (block of nonces) to work on, so that other miners aren't duplicating the work, and the mining is more efficient and coordinated.
My understanding is that this is how it was originally done via getwork command, and that in 2012 they moved to the getblocktemplate method that was supposed to make things less centralized.  So, I understand that having a single centralized authority to hand out work would be problematic.
So how about a system where each pools/miners broadcasts the work they are currently doing, so that other miners know not to start working on those blocks?  If all stakes have been broadcast, and no block yet found, you would fall back to the current system.
Of course workers would be free to ignore these "claims" because they're really just hints.  Nothing would require them to either listen or send updates.  However, utilizing them could be advantageous to all cooperating miners.  There's nothing inherently "wrong" with jumping another miners "claim" in this sense.
Sure, there are potential problems with this approach.  A bad actor could just randomly broadcast "claims" and cause disruption, but the worst case scenario would be to fall back to the current system.  At worst, it would be no worse than we currently do it, at best it could greatly improve the efficiency of finding a valid hash.
Another possibility is that some pools/miners will listen to these broadcasts, but not broadcast their own work.  This could, in theory, give them an advantage while causing others to do double-work... But this is disincentivized by the fact that miners would overall be better off by cooperating.. enough people cheating the system and you are, essentially, back to the current system.
Just a thought...

So how about a system where each pools/miners broadcasts the work they are currently doing, so that other miners know not to start working on those blocks?

There is no need for that; there is never any duplicated work. Since every block has at least the pool's/miner's payout address, which is:

hashed into the coinbase txid,
hashed through the Merkle tree,
hashed into the Merkle root,
hashed into the block header

all pools are always searching non-overlapping sets of block candidates already.

Interesting.  I wasn't aware of that, and need to read up more on this.  I'm still getting my feet wet on protocol specifics.  Thanks for the correction, and that makes me feel a lot better that it's more efficient than I had thought.

if another pool gets their block in first, is all the work that the pool has done on their block useless as the hash has changed?

@Childishforlife Yes, but also if no other miner finds a block. Any hashing operation a pool has done which doesn't result in a valid block is instantly useless. Having done more failed hashes before does not at all increase your chances that the next one will be valid.

there is something similar, BurstCoin, it runs on a very similar concept, except to help 'randomise' the nonces, it hashes the nonce with the user ID (meaning that there is a very good even distribution, and overlaps will happen but this is better for the network as a whole)
https://cdn.discordapp.com/attachments/335901674231037953/361288502270361610/infography_mining_comparison.png
https://www.burst-coin.org/