How to move/sweep your Bitcoin Core bitcoins safely and air-gapped to your new fancy cold storage? I have stored my bitcoins on Bitcoin Core in a few P2PKH addresses with many UTXOs. I would like to have a plan, how these bitcoins can be moved air-gapped to a more up-to-date setup (not discussed here).
I have not touched this computer (OFFLINE) for many years and I am afraid to connect it to the internet.
I assume that I need to have access to the lastest UTXO set and then create air-gapped transactions. But how exactly can this be done?
Is it possible to setup a Bitcoin Core on another online computer (ONLINE) and import the addresses using "importaddress"?

Is it (and how) possible to create an unsigned transaction on this ONLINE computer including all UTXOs of one of the imported (watch-only) addresses?

And then move this unsigned transaction to the old offline computer (OFFLINE) with the old wallet.dat file and sign the transaction?
Is this possible or is there another way to do this air-gapped?
Has anyone documented all the necessary steps?
Thanks for your help!
-A frightened hodler

Yes, it's possible using descriptors and PSBTs.
How to spend/sweep p2pkh UTXOs air-gapped using Bitcoin Core's GUI and  PSBTs.
Here are the required steps, most of them have to be entered into Bitcoin Core's console.
OFFLINE

export the descriptor of the p2pkh address:  getaddressinfo ADDRESS

copy the "desc": "pkh([....", output to the ONLINE computer

ONLINE

optional: create a new wallet in Bitcoin Core
import the descriptor from above into Bitcoin Core:  importmulti '[{ "desc": "pkh([....", "timestamp":0, "label":"import", "watchonly":true }]'
optional: check that the following is now "solvable":  getaddressinfo ADDRESS
now create the unsigned PSBT using Bitcoin Core's GUI
copy the unsigned PSBT (YOUR-PSBT) to the OFFLINE computer

OFFLINE

if needed unlock your wallet walletpassphrase "YOUR_WALLET-PASSWORD" 600
optional: check the PSBT  decodepsbt YOUR-PSBT and  analyzepsbt YOUR-PSBT
sign your PSBT: walletprocesspsbt YOUR-PSBT
finalize your PSBT: finalizepsbt OUTPUT-FROM-WALLETPROCESSPSBT-ABOVE
copy the hex output from above to your ONLINE computer

ONLINE

send the raw transaction using sendrawtransaction HEX-FROM-ABOVE
optional: copy the raw transaction into an block explorer like blockstream.info instead

Done!
Feedback is welcome!


Banning Bitcoin through packet filtering There's been a lot of talk about governments banning Bitcoin.

In theoretical terms, this is possible but, how could a government effectively ban bitcoin through technological means? Are there packet filtering techniques which a government could impose on ISP's?

Similarly, could private networks such as universities or businesses filter and block bitcoin traffic?

The Bitcoin network operates over TCP sockets between nodes. This has several consequences.

Blocking URL's or domain names is not possible.
By default, Bitcoin uses port 8333. It's possible for a school/uni to block this port. For an ISP, however, this is not possible, other applications might use port 8333 as well. Also keep in mind that it is very easy to change the port your Bitcoin client is using.
All Bitcoin packets start with the same "magic byte". This means that it might be possible to inspect all TCP packets looking for this magic byte. However, this might break many other internet functionalities, so I doubt if this type of blocking would ever be performed.

Important to note is that this two ways of blocking can easily be dodged by using an encrypted connection, f.e. with a VPN.

So basically, it is really infeasible for any party to block Bitcoin traffic because all possible blocking methods can easily be avoided. This holds for most P2P technologies, look at BitTorrent f.e.


What am I doing wrong with my BitcoinXT test net setup? I installed bitcoind and bitcoin-cli, set the configuration file so that I am using test-net and requested funds from TP's TestNet Faucet. The funds never appeared in my account.

I thought at first that it was a matter of syncing the blockchain.  I waited several days, and my block count remains at least 400 blocks behind the most current block displayed on this blockchain (testnet) viewer.  The network traffic displayed in my system monitor makes it clear that no new blocks are being downloaded to bridge the 400 block gap that exists between my block height and the block height displayed on the public testnet blockchain; blocks are being downloaded once every 10 minutes allowing my system to at least keep pace with the network with a constant gap.

It took several more days for me to get to a block height that includes the faucet transaction described in the first paragraph, but even after my block height exceeded the needed block number in which the transaction occured, my account balances remained at zero.

I display a screen shot below that includes the confirmed transaction as viewed on the publicly visible blockchain (testnet), and the terminal window that shows the results of my "getinfo", "getaccountaddress", and "getblockcount" commands.  There are 12 peers, which are a mixture of inbound and outbound connections, none-of-which were manually entered, all of which were automatically discovered through P2P discovery.

Thinking there was something wrong with the faucet, I installed the Mycelium Testnet Wallet on my phone and made a faucet withdrawal to that new account.  That faucet transaction appeared in my phone immediately with 0 confirmations and has since been fully confirmed.

Given all the above, I am thinking that my "failed" testnet connection with 12 peers is somehow on a separate testnet that uses a different blockchain than the one that is used by the faucet.  It is my understanding of BitcoinXT that it should be fully compatible with the Bitcoin testnet in the same way that BitcoinXT is designed to be fully compatible with the real Bitcoin network, unless in test-net that condition has been met which causes the networks to diverge and separate.

If this is the case, is there a separate BitcoinXT faucet that can be used?

Or, have I set up my system incorrectly, perhaps?

The graphic of the browser window below shows the successful and confirmed faucet transaction visible in block number 68146. It also shows that the block is in the testnet. The terminal window inside that graphic shows that my server is running on testnet and that my blockchain includes the block numbered 68146, which should have included the transaction depicted, but does not.  As confirmation that the account is right, I display the account address in the terminal, and it is the same address that displays as the recipient of the testnet transaction appearing in the browser window.

Solution
This solution gains access to the coins that are unavailable via BitcoinXT.

Using the bitcoin client, export the private key using the command bitcoin-cli dumpprivkey "accountname".
Uninstall BitcoinXT and remove the existing block chain (usually stored in ~/.bitcoin ).
Install Bitcoin Core (not Bitcoin XT), start the bitcoin-d server.
While the new chain is syncing, import the old key with bitcoin-cli importprivkey "keyExportedInStep1"
Wait for blockchain to sync.

Discussion and Lessons Learned

I was not sure that the testnet work had separated, but the fact that the transaction I was looking for was not in the corresponding block number was a huge indication.  After uninstalling BitcoinXT and installing Bitcoin, I now see the "missing" funds referenced above.

What this means is that the test network has reached that point where BitcoinXT no longer recognizes transactions and block chains that are approved by standard Bitcoin Core clients.  While BitcoinXT is compatible still on a public network, the test network is no longer compatible.

This also means that there is a need for a BitcoinXT faucet. At the time of this writing, I have not found a faucet for BitcoinXT compatible transactions.

The screen shot below shows that I now have access to the coins that were previously lost.


Bitcoin Solo Mining with bfgminer I am trying to do solo mining with bfgminer but it does not seems to be working

./bfgminer --url 127.0.0.1:18443 --user test --pass test

On bitcoind logs I can see the request logs

2018-05-14T10:36:25Z Received a POST request for / from 127.0.0.1:43312

2018-05-14T10:36:25Z ThreadRPCServer method=getwork user=test

2018-05-14T10:36:57Z Received a POST request for / from 127.0.0.1:43330

2018-05-14T10:36:57Z ThreadRPCServer method=getblocktemplate user=test

2018-05-14T10:36:57Z Received a POST request for / from 127.0.0.1:43332

2018-05-14T10:36:57Z ThreadRPCServer method=getwork user=test

On bfgMiner I can see the following messages

[2018-05-14 16:10:49] No servers were found that could be used to get work from.

[2018-05-14 16:10:49] Please check the details from the list below of the servers you have input

[2018-05-14 16:10:49] Most likely you have input the wrong URL, forgotten to add a port, or have not set up workers

[2018-05-14 16:10:17] Pool: 0  URL: http://127.0.0.1:18443  User: test  Password: test

[2018-05-14 16:10:17] Pool: 1  URL:
http://localhost:8332/#getcbaddr#allblocks  User: test  Password: test

Any help

The error messages you see are exactly what you get if you just start bitcoind without any proper configuration.

Did you make sure

you started your bitcoind with the -server flag at all? Only that will prepare your bitcoin node to allow connections from external workers such as bfgminer.
you waited for it to sync with the network? That can take up to some
hours


What is the cheapest Bitcoin -> prepaid VISA/Mastercard service? I am looking for the cheapest Bitcoin to prepaid VISA/Mastercard service for the amount of $5000. I have noticed some with a maximum of $100, and inquired whether it would be possible to increase this cap. It is really not interesting to have to buy 50 cards, and ensure that one empties each of them. $1000 on each card is acceptable though.

The card needs to work for purchases in any country.

That's quite a lot of money to try to load onto a prepaid card and likely not something you'll find easily done.

Some options are:

http://www.okpay.com/en/services/debit-card/index.html
https://www.aurumxchange.com/cards Expect to get their cards program back soon.

With OKPay, you can reload using bitcoins, which OKPay will exchange into USDs for you (the cost of this was just reduced from 5% to 2.5% of transfered amount).
With AurumXChange, you can reload using USDs from Mt. Gox codes.

For that amount though you'll probably be best arranging trades with some buyers willing to exchange Moneypak to you.  For instance, on the #bitcoin-otc there often times are traders looking for BTC and for larger amounts will go out and buy a MoneyPak to do the trade.

You can load a number of different prepaid cards with MoneyPak, up to $1,000 each.  See the Prepaid Cards section for the list: https://www.moneypak.com/WhoAccepts.aspx

Along the same lines, you might find a trader that would deposit cash at Western Union to reload a Western Union prepaid card.


What client-side checks does blockchain's android client do? Blockchain just came out with a great Android client, based on bitcoin-wallet.

In the description it says "No blockchain downlaod [sic.]". However, in the documentation of their sources, they say "When run for the first time, the block chain needs to be downloaded".

I'd be optimistic and guess they download all headers, and fully check the transactions regarding the local wallet, ignoring the unrelated transactions. However this is just a guess and I'd like to know which checks does it actually do client side, and how much does it instead "just trust" blockchain.info (which is very reputable anyway, but still I'd rather know).

The quote in the documentation is a remnant from the http://code.google.com/p/bitcoin-wallet/ which the app was forked from.

At present it does not do any blockchain validation. I would like to have it so instead of downloading the full transactions from blockchain.info the client asks for the block hashes that contain transactions of interest. It can then download the full blocks from the p2p network and only the headers for other blocks to verify the proof of work. However this is not currently implemented.


Deriving the Bitcoin address from the raw block script I'm just starting to write a bitcoin script parser and I am wondering how to get the address from the genesis block? blockexplorer.com shows the coinbase value to be

  04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

in the raw block data. But it also shows the receiving address for this transaction to be

  1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa

How can I derive the address from the raw transaction? I found a page in the wiki that talks about creating an address, but this seems like it is going about the process in a back-to-front order. Surely the address must exist first before the raw block can allocate the mined coins to it? Otherwise, the blockchain would simply have to allocate mined funds into the ether. The receiving address must have been known to the mining algorithm before it generated the very first mining transaction.

Please could someone walk me through the steps of deriving the address from the raw transaction script.

Surely the address must exist first before the raw block can allocate the mined coins to it?

No. The network has no concept of addresses. When you send money, you're actually sending funds to a public key or public key hash. The Bitcoin address format you're familiar with is just a way of representing public key hashes in a human-readable way.

This is especially true of generation transactions, which typically send money directly to a public key. Bitcoin-Qt normally doesn't calculate or display the address in such cases, though it's still possible to calculate it.

The "coinbase" doesn't contain the address or public key. That's just mostly-arbitrary data. It contains the block height, extraNonce, etc. The address is in "scriptPubKey". In the genesis block's generation transaction, the scriptPubKey is:

04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG

This is a direct-to-public-key transaction, not a normal address transaction. 04678... is the uncompressed ECDSA public key. Follow the instructions on that wiki page to get the address, 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa. But again, this transaction doesn't contain this address, or even its base58-decoded (binary) equivalent. The address is just a way of representing the public key.


BIP44 and change addresses I always wondered why BIP44 HD wallet differentiate between internal change addresses (m/44'/0'/0'/1/*) and external receiving (m/44'/0'/0'/0/*)? Why do some wallets advice me not using internal address to receive funds? It seems to me superfluous complexity.

Why do some wallets advice me not using internal address to receive funds?

From this article on HD Wallets

  Then we have the chain node, derived to a path of either 0 or 1. 0 is the external key pair chain, and is used for generating new public addresses. 1 is the internal keychain and is used for things like change addresses (in Bitcoin every transaction must have an address to send the excess funds to. The “change” of the transaction)...It’s because this is a derivation path that’s been formally agreed upon by the different crypto communities. This is significant because if I wanted to, I could create my own tree following any made up standard I want and create and sign valid transactions from the public/private keys. But could any other wallet ever regenerate that structure? What happens if my app goes off the market? The user’s money is locked into a completely arbitrary private/public key tree. Not the best situation to be in. Therefore, we hold on to these artifacts of the past because an extra derivation or two is a small price to pay for consensus.

TLDR: It is for organizational purposes. Wallet developers follow BIP44's derivation path regardless of currency for consensus reasons. It doesn't make a lot of sense for Ethereum HD wallets to utilize the account field since addresses are already accounts in ethereum, but some wallets do.


Does my money still grow if I have it in Coinbase Vault? I just created a Vault account on my Coinbase account. When the money is deposited into the Vault does it stop growing or will it continue to grow based on the coin?

The amount of cryptocurrency you deposited into the 'Coinbase Vault' will remain the same (unless there are some fees levied by Coinbase for the storage, etc). So if you put 1 bitcoin in, later you will be able to withdraw 1 bitcoin. The value of that 1 bitcoin (measured in USD) may change during that time, but you will still own the same amount (1 bitcoin).


What percentage of Bitcoins are held by exchanges? was wondering how much is held by exchanges vs. hard wallets (which I dont really understand) how does someone with a hard wallet sell their Bitcoin?

was wondering how much is held by exchanges vs. hard wallets

It's not possible to know for certain how much bitcoin is currently held by exchanges as it is trivial to create pseudo-anonymous addresses and it is generally good practice for an exchange to not disclose their addresses.

  how does someone with a hard wallet sell their Bitcoin?

By "hard wallet", I assume you meant hardware wallet instead.

A hardware wallet is usually used to interface with software installed on an online machine to sign transactions. The key advantage with using a hardware wallet is that the private key (if properly implemented) never has to leave the device. Once the transaction is signed, then software on the machine connected to the internet may broadcast the transaction to the bitcoin network.


I used edge wallet to send my bitcoin from my wallet to my cash app but i used a low fee soo its been unconfirmed for 10 days what can i do? My transaction 5c8552a6744b3428d3ec4b5c0dd8b378ffeb4efd703b76a2b9d106250234d766
Has been unconfirmed for 10 days is there anything I can do to get it confirmed or do I just have to wait?

ViaBTC's Transaction Accelerator service can be used and you can pay with BTC but it will cost $100 or more.
You can wait for your transaction to be confirmed by Monday or you could have tried to spend unconfirmed UTXO if it was not cash app and some non custodial bitcoin wallet by following the below steps :

Generate a new Bitcoin address in wallet.

Make sure RBF (Replace By Fee) is ON. Send some or all of the unconfirmed balance (from the parent) to that address.

Copy the new transaction ID (TX ID) and paste it in the 'Child TX ID' field here: https://cpfp.djbooth007.com/

Enter the desired sats/vB amount. This can be determined by looking at the range of sat/vB in recently confirmed blocks or mempool stats on https://mempool.space

Click 'Calculate Fee'

Perform RBF (Replace By Fee) with the calculated result highlighted as 'Child to Pay'.

Other things you can use in future is RBF for every transaction and a change address if possible.
Some open source bitcoin wallets that support RBF:
Bitcoin Core
Electrum
Bluewallet
Sparrow
Wasabi
Green


Private key generation bitaddress.org vs application wallet (armory / bitcoin-qt) Is an application like armory or bitcoin-qt more secure/ trustable in generating the public and private keys than a locally installed version of bitaddress.org ?

There are different issues with generating cryptographic keys in general (including private keys for bitcoin) on a downloaded client versus a client served online, as bitaddress.org does. However, I think you yourself should be the judge of what is "more trustable." Here are the issues:

Code integrity
The problem in both cases is if your client is trustworthy, or possibly compromised. There are many aspects to this question, including if you trust the original programmer to get everything right, and not actually put in some bitcoin-stealing spyware. Possibly more interesting is the question if you would detect it if somebody (maybe a cybercriminal?) were to alter the code before you execute it. For downloadable clients, the question is basically if you check its integrity by comparing its checksum with what is published by a reputable source. This gives some security if you do, and if you trust whatever source you may get the checksum from, but in the end, even if you do, it essentially boils down to, at best, trusting whatever entity compiled the client for you. For the web-served javascript program from bitaddress.org, you do not even get a chance to check it yourself---meaning you absolutely have to trust its operator (and possibly the NSA) to serve an uncompromised program.

Quality of random number generator
Any private key is generated from randomness. If too much of it were predictable, that would defeat its ability to remain a secret. And that's the weak spot, because many computers in actual use are not too good at generating random numbers, either because they do not have a dedicated source of randomness built-in, or because the software used does not have access to it. With a computer you use interactively, you should be mostly fine, because timing jitter in your key presses, mouse motion, etc., is typically used to harvest strongly random numbers. A well-written downloadable client should have access to such facilities via your operating system and, typically, the SSL libraries---and yet, in practice, a lot of weak implementations have been found, including in a mainstream Linux distribution years back and, recently, in the Android operating system, actually affecting Bitcoin key generation. See the Guardian's article about Google confirming the problem. Any javascript implementation, like bitaddress.org, may be both worse and better off by having less direct access to such random number facilities.

Execution environment
Could any malware you might unwittingly have on your computer interfere, either spying on your keys or by weakening the keys your generate? For the downloadable client, we are essentially talking about vulnerabilities of your OS (plus your usage of your computer). For the javascript-based bitaddress.org, some vulnerabilities of your web browser that "only" allow interfering with something inside the browser might pose additional risk.

Opportunity and effort vs. reward trade-off for an adversary
Sometimes it is more dangerous to go the same route as everybody else by presenting, collectively, a larger incentive to exploit this route. Sometimes it could be more dangerous to do the opposite and possibly ending up using a solution that has received less public scrutiny and might, without one's knowledge, contain critical vulnerabilities.


Is there any part of a bitcoin transaction that is 'random' or could not be predicted? I am just curious if when a transaction is sent and you view it on the blockchain. Is any of that information impossible to predict what it will be?

I am looking at perhaps the time received ? (you may be able to guess close but maybe not down to the second?) or the relayed by ip?

Does that make sense? I am guessing not since according to: Are transaction hashes random? the transaction hash is not random, but still want to clarify.

Likewise, looking at the coinbase api:

GET https://coinbase.com/api/v1/transactions/5018f833f8182b129c00002f

# Response
{
"transaction": {
"id": "5018f833f8182b129c00002f",
"created_at": "2012-08-01T02:34:43-07:00",
"amount": {
  "amount": "-1.10000000",
  "currency": "BTC"
},
"request": true,
"status": "pending",
"sender": {
  "id": "5011f33df8182b142400000e",
  "name": "User Two",
  "email": "user2@example.com"
},
"recipient": {
  "id": "5011f33df8182b142400000a",
  "name": "User One",
  "email": "user1@example.com"
}
 }
 }

Could the 'created_at' time be considered random?

Thanks.

There is always an inherent way to control the transaction. Try to create it, if you don't like the result, try again.

If your game gets popular enough, it may be economically viable to effectively spend computing power on mining transactions that game it.


What is ment by the "value of the output spent by this input" in BIP 143? I'm looking into BIP 143 and I'm confused by item 6 in the specification of the transaction digest algorithm. It says:

  The item 6 is a 8-byte value of the amount of bitcoin spent in this input.

I thought the whole amount of the input is always spent. In case the spender doesn't want to spend it whole, some of it goes to the same address (called change) returning the bitcoins.

What do they mean by that? Does it mean the full available amount in the input?

I thought the whole amount of the input is always spent.

That's correct.

  In case the spender doesn't want to spend it whole, some of it goes to the same address (called change) returning the bitcoins.

No, if the amount in the outputs is less than the inputs being spent, the difference is converted into fee.

Software that creates transactions can explicitly add an output for change that goes back to the former owner. This can be to the same address, but generally isn't. It is called change indeed, but it's not part of the protocol. It's just how wallets deal with inputs that are too large.

  What do they mean by that? Does it mean the full available amount in the input?

Exactly. It's redundant information that is already implied by referencing the transactions that created the outputs. However, it simplifies the operation of some pieces of infrastructure.

In particular, right now if you want to use a hardware signing device ("hardware wallet"), and that wallet wants to show you how much fee you'll be creating, it needs to know the amounts of the outputs being spent (as the fee is the difference between outputs and inputs). That means it needs to be given the full transactions those outputs belonged to - which can be big. Otherwise, the software that created the transaction could lie, and in fact convert a giant portion of your money into fee without you knowing it.

With the fee explicitly part of the signature hash in BIP143, if the wallet software lies about the amounts to the hardware signer, the signature will simply be invalid.


Is there a cudaminer difficulty parameter option I try to mine some btc using cudaminer on cex.io.
I'm using cudaminer for that. I have a lot 'low' rejected shares due to low difficulty (On the ghash.io they say the minimum stratum difficulty is 16).

I think my rejected shares is due to this difficulty but I dunno if I can change that on my side to avoid rejected shares.

Any idea?

No. Difficulty is handled server-side rather than client-side.

Different pools have different policies regarding difficulty. Some pools have a fixed difficulty. Others automatically calibrate the difficulty depending on your hashrate (this is called vardiff). And some let you set the difficulty, on the pool website. But in any case, it is ultimately the stratum that sends out and accepts work, so it is the pool that dictates difficulty.


Creating Payment system using Blockchain API I see a whole lot of websites using the blockchain API to create bitcoin wallets (if i am correct), send and receive payments, I know how to ordinarily make a payment system using C#/MSSQL or PHP/MySQL but it seems a whole lot of things are different implementing the blockchain API, hence I wanted to know how can I go about setting up a wallet, like using PHP to implement an online wallet so I can create user accounts, create wallets, send payment from my site (which has a wallet) to another bitcoin wallet on another site, since I think all of them actually use the same blockchain API, any ideas how to go about something like this?

The question is pretty general in that you may be using Blockchain API in the generic way.  Blockchain.info is a company that provides an API to use on the Bitcoin network.   If you want to write applications using that API can read about it here. https://blockchain.info/api/

Along with that API you could look into other services like BitPay or even Stripe which provide ways to accept Bitcoin payments without having to know a lot of detail on the protocol.

If you're using Blockchain API in a generic sense and want your website to not be dependant on external companies and APIs you would run a full node yourself.

Bitcoin full nodes allow communication via RPC calls to create wallets, transactions etc..  There are many examples of how to connect to a bitcoin node via RPC with PHP.  You would run the node on TestNet so you can build and test without fear of losing money to errors or fees.

Bitcoin Core is the obvious choice for a full node, but I would also look at bcoin implementation if I were doing significant wallet management.


Transaction will not confirm! Big transaction, sender put good miner fee on it but it is not confirming. Can anyone help me or tell me why it isn't confirming?

https://blockchain.info/tx/a95f4d5fa41b194454bdd6d665f002ec31b5e8b25c12bc22c39497f2a7139b2f

Although the fee is roughly 0.0002 BTC/KByte (corresonds to 20 Satoshis/Byte), at the moment there is a congestion of transactions happening in the network, with roughly 30,000 unconfirmed transactions:
https://tradeblock.com/bitcoin/

Therefore the required fee has increased dramatically for high priority transactions:
https://bitcoinfees.21.co/#delay

So it looks like your transaction fee should have been three times as high to be regarded with high priority.

But just wait some more time, the transaction should be confirmed soon.


OP_ADD operation in bitcoin script for integers greater than 128 in java I want to execute a simple series of instructions to implement a bitcoin script in java using bitcoinj API. All I am looking for is performing arithmetic operations for negative integers or integers greater than 128. An example bitcoin script for the task would look like this:

150 120 OP_ADD 270 OP_CHECKNUMEQUAL

This script should return True eventually. To implement this in java, to push integer values like 150, 270 etc i have to first convert them to byte arrays. I have followed answers given in https://stackoverflow.com/questions/1936857/convert-integer-into-byte-array-java but none of them works in here probably because of differently defined arithmetic operations in bitcoinj API script. Can anyone please help me in this.

you should use Litte-endian encoding. if the highest bit is set (range 128-255, 32768-65535 and so on) you should append the zero byte to mark these bytes as positive number.

So, 150(dec) will be encoded as 9600

270(dec) will be encoded as 0e01


Why are broadcast checkpoints considered bad? warren, a LiteCoin dev, said of Peercoin:

Good Luck Removing PPC's Centralized Checkpoints
Regarding PPC... these amount to empty obfuscating defensive excuses.  Sure he wants to remove the broadcast checkpoints.  Novacoin's Balthasar made similar promises because he too knows that it is indefensible.  Unfortunately for PPC, in the age of ASIC's it will be impossible to keep a sha256d network stable without it, so I would be highly surprised if it is actually removed.

Why are broadcast checkpoints so indefensible? It would seem to make sense to have a protocol-level mechanism whereby the nodes agree not to go back past a certain number of blocks (say 10 or 20 blocks). What about the mechanism is flawed? It sounds like it's able to keep a network stable without requiring as much hashing power.

Centralized checkpoints is a mechanism whereby nodes trust a certain hardcoded key to make new checkpoints. This means that in case of a fork, the key owner can make the network choose any branch he wants, even the one which is shorter. If this key is compromised, an attacker can use it to mount an equivalent to 51% attack with any hash rate. This, together with that the developer should constantly do something (produce checkpoints) to keep the network secure, goes totally against the idea of decentralization. Without decentralization, a cryptocurrency has little advantage over traditional banking system.


Multibit wallet says my balance is unconfirmed, even though I've not sent a transaction in months I haven't sent any transactions for months, but my Multibit HD wallet says my entire balance is unconfirmed. I've used Wallet > Repair Wallet several times. I've close it and opened it. There is only about 1% of the balance confirmed, and it changes each time I repair the wallet.

I see that very old transactions from 2015 are showing as unconfirmed (but they are).

I tried to install version 0.1.1 and that restored the balance, but the highest fee possible is 10,000 satoshis/KB and the current fees are 400,000 satoshis/KB so I cannot send any transactions with it.

Multibit 0.5.1

OK found a way! It cost me $8 and four days to switch wallets! WTF?

Install Electrum bitcoin wallet. https://electrum.org/
Go here and save the web page to disk: https://iancoleman.github.io/bip39/
Download, install, & start TOR browser. https://www.torproject.org/ We are using TOR because it is made for anonymity and privacy, and doesn't keep cookies, storage, cache, etc. We are going offline, but a Javascript page can store data in your browser so next time you visit, it can send your secret info back. If you are not worried and think you'll just use a private browser session, look up permanent cookies and see how creepy your browser is when it comes to protecting your data.
Open the web page you saved in TOR browser. Turn on Javascript.
Start Electrum, create a new wallet, and select Import Private Keys. Wait at the input box.
Unplug your network cable, and disable your WiFi network connections.
Input your Multibit seed words into the BIP39 tool. Select BIP32 tab, and MultibitHD for client.
Scroll down and view the addresses generated. Verify the addresses match the addresses in Multibit, starting from the earliest to latest.
Copy & paste all of the private keys from the private key column. Yes, you will have to freakin' copy & paste like 20-100 keys depending on how much you have been using Multibit! (Oh it get's worse!)
These are only the original keys. Whenever you send a payment, you get change to a 'change address'. Those are not listed! If you have sent any payments, you need the change address keys also. To get the change address keys, read the following.

https://www.reddit.com/r/Bitcoin/comments/6btevz/how_do_i_import_my_12_breadwallet_seed_words_into/dhqvy31/?context=3

  If you use the BIP39 tool that I linked, put your seed in and go to the BIP32 tab, in the "client" box change it to "custom derivation path" and start with m/0'/0
  You should be able to manually go through addresses and get private keys by changing the path. (example: m/0'/0 --> m/0'/1 --> m/0'/2 and I think change addresses are probably m/1'/0 --> m/1'/1 --> m/1'/2 --> etc.)

However, the change addresses are m/0'/1 not as mentioned above.
Change the Client to Custom, and change the BIP32 derivation path to m/0'/1.
Verify the change addresses match. To find the change address, open the first transaction where you sent, view the transaction on BlockExplorer blockchain.info, and see which address the excess change went to. This is one of your change addresses. You can verify as many as you want but more than likely if the first matches the rest do.
Now repeat the copy & paste of the addresses private keys into Electrum.
Click Next on Electrum and enter a password. You must encrypt your wallet or else the private keys are in plain text on your disk!
Close TOR browser with the BIP39 tool.
Plug in your network cable and turn on your WiFi network adapter.
Electrum will synchronize and show your balance.
Go to File > New/Restore and create a new wallet, with new seed words.
Write down your seed words.
Send your bitcoins from the old wallet to the new wallet. The fees will be high due to many inputs!


Restoring a hardware wallet Sure this asked many times before and is available but I cannot find it!
I understand that all that is stored on a hardware wallet is private and public keys etc.
My lack of understanding arises when the need to recover a lost hardware wallet occurs. How is it that entering my seed words on a new device regenerates the essential data which was on the original. Is it encoded in the seed sequence? Seems like a simple question but I cannot see it anywhere explicitly stated. Been through Trezor manual and nothing!
Much obliged if you have been able to bear with my ignorance (stupidity) and can stand to reply

I am now aware that data reconstructed from seed. Where else? Sorry to have had to ask the obvious. Got this off your forum.

The 12, 18, or 24 word mnemonic that you have (colloquially referred to as the seed) is a BIP 39 mnemonic. This encodes a 256 bit number which is then used to derive the private keys in your wallet.

All of the private keys in your wallet are derived using the method described in BIP 32. This allows for private keys to be derived from a fixed seed (which is encoded by your BIP 39 mnemonic) and to be done so deterministically, i.e. the same keys are always derived.

So when you restore a hardware wallet or any other wallet that supports BIP 39 and BIP 32, you are really just setting a fixed seed which is then later used to derive all of your private keys.


Bitcoin hash calculation Best regards

I have been doing a lot of research about bitcoin and blockchain. A lot of informacion across the Internet can be found where many people explains the basics of bitcoin an it´s underlaying technology, but I have a question that I can´t quite find the answer and beg for this community help

If one searchs in Google Almighty one can track down bitcoin to the first block issued which is told  to have the hash:

000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f

on Blockchain.info the transaction info made is available:

https://blockchain.info/block-index/14849

And I even found a blog where the original block data containing the now famous ¨The Times 03/Jan/2009 Chancellor on brink of the second bailout for banks¨ is given

https://en.bitcoin.it/wiki/Genesis_block

But, to which data I have to apply SHA256 in order to get the given hash?

Many people say that is to block header copossed by Version - Previous block hash - Merkle Root - Timestamp - Difficulty Target - Nonce in the block structure, but another question arises for me:

When a pool is mining, does it receives the block info and its hash? From who receives that data?

Hope you can help me, any readings/books/videos/resources you can recommend will be appreciated or threads where this question has already been answered!

Thanks in advance!

But, to which data I have to apply SHA256 in order to get the given hash?

You need to apply recursive hashing to all the transactions in the block(in a correct order) to create a merkel tree, and then hash the final hash from the merkel tree with infos that you mentioned

  When a pool is mining, does it receives the block info and its hash? From who receives that data?

When mining, the miners get the hash of the previous block. Transactions are read from the Mempool. And try to create a valid block(that satisfy the difficulty target) by doing trillions of trillions of hashing (POW)

I would recommend Mastering Bitcoin by A.Antonopoulos. It's my reference to everything in the Bitcoin space

PS: answering by email is definitely against stackexchange policy


Does extra outbound connection when tip is stale disable feeler connection? I run a Bitcoin node for about 1.5 months and I notice that there is no feeler connection is made in 25 days, hence the IPs in the tried table does not grow.

I also notice in the debug.log during the same period of time, many potential stale tips are detected:

  2019-02-20T13:26:59Z Potential stale tip detected, will try using extra outbound peer (last tip update: 2737 seconds ago)

Does extra outbound connection when tip is stale disable feeler connection?
If yes, is it normal to have stale tip for 20+ days?

The problem is because the netgroup of the feeler connection was not properly handled.
Check further pull requests and fixes here: https://github.com/bitcoin/bitcoin/issues/15484


How do I see the IP address of a bitcoin transaction? How do I see the IP address that someone used to send or receive bitcoins with? Is it stored in the blockchain?

No, IP addresses are not stored in the blockchain.

But Gavin Andreson indeed notes that

  Unless you are very careful in the way you use Bitcoin (and you have
  the technical know-how to use it with other anonymizing technologies
  like Tor or i2p), you should assume that a persistent, motivated
  attacker will be able to associate your IP address with your bitcoin
  transactions.

One way to do this is to simply run bitcoin peer-to-peer clients that connect to a large fraction of the active nodes.  It's not as hard as you might think.  See Dan Kaminsky's Black Hat 2011 talk, starting at slide 21, for more.  (Thanks to kirian for reminding me of the link).  Then see An Analysis of Anonymity in the Bitcoin System 2011-07-22 by Fergal Reid, Martin Harrigan for how to link together the various bitcoin addresses that each user uses.

Some related background is outlined by Craig Reading:
Bitcoin Theft – The Top Ten Threats | Genesys Guru Blog


What does the "relayed_by" field in the BlockCypher API represent? Is there a way to gather geographical data of transactions? The transaction data returned by the BlockCypher's API includes the "relayed_by" field, which the documentation describes as "Address of the peer that sent us this transaction". Is this the IP address of the original node that broadcasts the transaction?

In general, we're trying to gather geographical data of the transactions; is there a reliable way to do so?

It's the IP address of the node that first sent us the transaction. As transaction broadcast works a bit like gossip, it's not guaranteed to be the original node (it could be a node "in the middle"). However, as BlockCypher is connected to quite a few nodes on the network, so over multiple transactions you're highly likely to be able to identify the right originating IP.

This is not a bulletproof method, as a more sophisticated attacker could just use Tor for transactions broadcast. Practically this is the exception and quite frankly, simply using a web wallet with a good VPN is a much simpler way to achieve a similar level of anonimity.

So for most applications you can get a fairly accurate originating IP address using relayed_by over multiple transactions.

Full disclosure: I'm CTO and co-founder at BlockCypher.


Are there Bitcoin users in Asia especially Southeast Asia ? I'm from Malaysia Are there many users of Bitcoins in Asian countries ?  I am from Malaysia.
If there are, I would like to give it a try too.

At LocalBitcoins.com you find some Malaysian traders:

Malyasian LocalBitcoins.com trades country listing

Also, there is Asian specific discussion forum.


Android Bitcoin Wallet freshly installed, two addresses. Why two? First off, I am rather new to Bitcoins — will be obvious after I asked my question I guess. I have read some theory about it, like it's a distributed crypto-currency based on the Bit Torrent protocol, but I still have some difficulty putting everything together.

I have freshly installed Android Bitcoin Wallet on my phone, just wanted to start somewhere. I opened the preferences and I see I have two addresses without a label — which I guess I shall define. My first question is : why are there two addresses?

I understand an address is like an SSH private public (EDIT: sorry for the confusion, seems obvious indeed) key and I think I understood it's best to have one address for my phone, one for my computer... whatever. Since I read an address shall be a single-use token, is one of them for giving and the other for receiving bitcoins?

Since an address is a single use token does that mean I should create an address each time I want to pay using bitcoins? What about receiving bitcoins then? How do people send bitcoins if change my addresses constantly?

And what if I delete an address? Will it have an effect on bitcoins I'd eventually "collected"?

You are asking multiple questions, which is not how this website works. Also: all of them have been answered several times already if you search a little. I'll try to answer some anyway, to take away some of your misconceptions, which should help you back on the right track.

Misconception: Bitcoin is not based on the BitTorrent protocol. It has nothing to do with it. Bitcoin uses a peer 2 peer network, BitTorrent does too. But neither were the first or are all that similar.

Misconception: An address is NOT like an SSH private key. An address is "like" a public key (not exactly, but that distinction is not important right now). An address is what you give to someone else to have them pay you.

Hidden inside the wallet is the private key or more precisely in current wallets: the Master key from which multiple private keys are generated. If you make a backup of your wallet (which you should do!) you will get to see that master key: it's simply a list of 12 or 24 English words.

The address is used to receive bitcoins. The private key is what you need to be able to spend them. But the private is pretty much invisible to you, you don't need to care as long as you have the Master key backed up (and protected!) properly.

Address re-use is very much discouraged, for privacy reasons. Once you "use" an address, the wallet will automatically prepare a new address for the next use.

The specific wallet app you are using generates two addresses in advance to get you started.

I don't think you can delete an address in this app.

It is possible to have multiple devices use the same Master key, but it will mean that if one of those devices gets compromised and someone steals your Master key, you will lose ALL your money. It's probably better to keep things seperate until you're ready for more advanced setups. (multi-signature for example)


why did blockchain .info recovery not recover all transactions? My phone was stolen. I went to recover my bitcoins that were in my Blockchain.info wallet with my pass phrase. I recover the wallet but it doesn't contain any of the transactions of the last 7 months. I was told the pass phrase would recover all my coins! What happened?

Maybe you used an imported address or an old address thus it can't be found by the wallet software. Only the addresses generated using the new format (bip-39) can be discovered(are deterministic). Shortly said if you used legacy addresses the wallet won't discover them because they were not derived from  a bip-39 master/wallet key.


OpenSSL generate Bitcoin address I am building a script to generate secp256k1 using OpenSSL in MacOS.
Seems to work fine.
My question: is this SECURE enough?

#!/bin/bash

if [ $# -eq 0 ]; then
  echo "Missing name, for example generate_key.sh bob"
  exit 1
fi

FILE_NAME=$1
PRIVATE_KEY=${FILE_NAME}_private.pem
PUBLIC_KEY=${FILE_NAME}_public.pem
BITCOIN_PRIVATE_KEY=bitcoin_${FILE_NAME}_private.key
BITCOIN_PUBLIC_KEY=bitcoin_${FILE_NAME}_public.key

echo "Generating private key"
openssl ecparam -genkey -name secp256k1 -rand /dev/urandom -out $PRIVATE_KEY

echo "Generating public key"
openssl ec -in $PRIVATE_KEY -pubout -out $PUBLIC_KEY

echo "Generating BitCoin private key"
openssl ec -in $PRIVATE_KEY -outform DER|tail -c +8|head -c 32|xxd -p -c 32 > $BITCOIN_PRIVATE_KEY

echo "Generating BitCoin public key"
openssl ec -in $PRIVATE_KEY -pubout -outform DER|tail -c 65|xxd -p -c 65 > $BITCOIN_PUBLIC_KEY

echo "Files created!"

OpenSSL's RNG is considered secure, so there should be no problem with this method. I don't think you need to use -rand /dev/urandom since OpenSSL already uses /dev/urandom for seeding the RNG.


How do I safely accept bitcoins without waiting for confirmations? Are there any arbitrators that would guarantee the bitcoin transaction such that no one has to wait ten minutes to confirm the transfer of the said bitcoins?

There are no such arbitrators currently, as far as I know. There have been plans discussed to create trusted sources of Bitcoins. The idea would be that I'd hold my Bitcoins with an e-wallet service and ask them to transfer my coins to you. The e-wallet service would confirm (outside the Bitcoin network) that it was going to send you so many coins.

In one plan, the e-wallet service would send you a signed email containing the transaction ID and a copy of the transaction. If a conflicting transaction ever appears in the public block chain, you would have proof that the e-wallet service had cheated you, destroying its reputation.

There is another method that doesn't require the sender to use an e-wallet service. In this method, a verifier connects to as many Bitcoin clients as possible over as much of the network as possible. He monitors the transactions appearing. If he sees a transaction on all points and doesn't see a conflicting transaction anywhere, the only possible double-spend attack would be to conspire with a miner who happens to mine the next block by luck.

For most transactions, just seeing the transaction posted is sufficient. But if you add in making sure the transaction is seen over most of the network, the risk is low enough to be worth taking for all but the highest-value transactions (say $5,000 or more). For transactions higher than that, it's hard to see how a 10 minute delay is a big deal. But if it is, you'll need to develop a method to handle it.

There have also been proposals for "side chains" that generate blocks more quickly and permit transactions to be confirmed faster. However, they're really not suitable for large transactions as they are unlikely to ever see enough hashing power to ensure they're resistant to a 51% attack.

Note that if you are ever ripped off in this way, you can always prove it. If you see the unconfirmed transaction, you can save it. If no conflicting transaction gets in the block chain, you can still post that unconfirmed transaction. If a conflicting transaction does get in, you'll have both transactions. So you can at least name and shame.


How to transfer bitcoin? No third party, no exchange, no hard wallet, no mobile wallet I have two paper wallets and want to transfer 10 bitcoins between them. I do not want to use any other 3rd party software or hard wallet because they're created by individuals, so they can access my data if they try hard enough. And no exchanges, for the same reason.
Once I enter my private key anywhere but receiver side, it gets stolen. So naturally I have a question, how, if regardless of the way someone is involved?
Please correct me if I misunderstand something.

If you want to avoid all third parties, you need to run a node yourself. Download bitcoin-core and let it sync might take a day or two depending on your machine.
You can import your paper wallet by taking the WIF private key and using the importprivkey command in the bitcoin console. Note the rescan will take a while, but once it is done you can spend to any address you like.


Why miners need to broadcast blocks that contains full transactions in Bitcoin? Does anyone know why Bitcoin requires miners to broadcast blocks that contains full transactions?

When a user want to make a payment on Bitcion, he/she needs to broadcast a signed transaction, and miners will gather all transactions in a transaction pool. Later, when a miner successfully mined a 1MB block, he/she will broadcast this block including thousands of transactions. My question is that why cannot the miner only include transaction hashes in the block so that more transactions can be included?

In current versions of Bitcoin Core, most transactions are only relayed once and all transaction are only validated once.

New blocks and transactions in Bitcoin are usually advertised to peers by use of inv (inventory) messages. Blocks are thereby identified with the hash of their header, while transactions are identified by a hash over the complete transaction (also called txid). The peer that receives the inv message will respond by requesting the block header, the full block, a compact block, a Merkle block, or the transaction data if they want it.

Transactions are only relayed twice on older implementations of Bitcoin Core that always request the full block when it is announced by a peer for the first time. Newer implementations use Compact Blocks which transfer only the block header, an encoding of the transactions and up to a handful of transactions that the sending node didn't have when it received the block itself. Nodes don't revalidate transactions that they already had in their mempool, as transactions get validated before a node adds them to their the mempool.

via Compact Blocks FAQ

The full list of transactions must be stored in the blockchain to allow new peers to independently validate the entire transaction history of Bitcoin.


How much space does the blockchain take up per day and per hour when running bitcoinQT on my computer? the blockchain is about 20GB today, but i was wondering how much space does it take up each day if i were to leave bitcoinqt on regularly? also by hour? reason why im asking is im thinking about just putting the blockchain in my cloud drive (bitcasa.com) as my laptop has only so much space. if its not too much space that means it wont be a bandwidth hog when its uploading it to cloud drive after it downloads it.

The blockchain size growth is kind of approximately linear at this time (although I wouldn't expect it to continue linearly). See the nice graph at https://blockchain.info/charts/blocks-size and particularly check the "All Time" scale option.

Over the past year, the blockchain size has grown by approximately 10 GB. On average, that would be around 27 MB per day, or 1.1 MB per hour.


Will bitcoin not work any more? I am not an expert on bitcoin, so please pardon me for dumb questions.

1, Will bitcoin not work any more in the far future? I think, not sure, every bitcoin transactions are recorded into memory or a block, and since this memory is so limited and hard to get, let's assure that your memory card is full or corrupted, then your expensive digital camera simply won't work anymore. So I think bitcoin owners pay too much on their memory card and forget about that the real value is in the camera.

2, What are the differences between a bitcoin and a memory block? I think they are the same thing, but on the other hand, I can spend a bitcoin, but I don't think I can spent a memory block.

3, I notice a payment that I sent days ago still haven't got confirmed. I sent 0.003 BTC and the fee I pick is 0.0003 BTC which was all I got in my wallet. That is too slow. I understand why, but I just can't accept it. So my third question will be what happen when everyone pick the same "priority" or Sat/b value, how long will it take for a transaction to go through in this unrealistic scenario?

4, It's basic economy, Supply and Demand. Since people are paying priority fee every new day, why would anyone want to process the lower fee transactions at all?

5, Is bitcoin really decentralized? but how can anything be decentralized when it's controlled by a group of people, namely those with a super computer. Well, it sorts of like the internet. Internet is controlled by few huge tech companies, some even controlled by its government.

I will try to respond to what I've understood about your question. Correct me if I miss your point.

1

Transactions are stored inside blocks in the blockchain. The blockchain is a distributed database, stored on thousands of computers around the world. This means that corrupted memory on a node won't affect the net, because the same information is on every other "sane" machine. It is true though that the size of such database is ever increasing and less people want to become full nodes for the size of it. Memory is not limited and is not hard to get (in this case). The current dimension of the blockchain is of about 140 GB and almost anyone can affort a 1 TB Hard Disk. Your camera (your bitcoin's) won't be useless if you fill up every tiny byte of memory in your machine because the same data will be in every node in the network

2

When you want to send bitcoins you create a transaction.

A group of transaction is put together to form a block.

Therefore you can't spend blocks, because they are just a data structure.

So bitcoins are just numbers sent and received by people. Blocks are the structures that contain the information about the excange if bitcoins between people.

3/4

A transaction's priority is based on its fee and the time elapsed from the moment it was sent to the network. The older a transaction is, the more priority it has.
So if you send a transaction with a low fee then you should be prepared to wait a long time (days) until it will get confirmed. If the fee is extremely low, it may occurr that the transaction won't get through for years!.

A fee of 0.0003 is a bit low. I understand that you had 0.0033 BTC and sent 0.003 and paid another 0.0003 as a fee.

5

It was born as super decentralized and now it's becoming less decentralized because of the difficulties bounded with running a full node and mine. We will se what the future holds for us.

Note
I suggest you read some basic article about Bitcoin (you can find a lot of them just looking at the first results of a google search) to understand the basics

read this

FROM THE START

I'll try to explain you in a simple way how Bitcoin works.

Bitcoins is a peer to peer network that organizes the excange of data between people using a chain of blocks. This chain is protected by cryptography and every node shares the same chain. That chain of blocks is just a bunch of data files. Whenever two people want to send bitcoin between themselves in the blockchain they create a transaction, which then is included in a block by a miner. The miner gets a reward for creating the block (which costs computing power) and the fees attached to the transactions. The block he creates is just a simple plain old file, it is not some sort of magical and costly paper. Every block can at most be 1MB in size so it isn't storage demanding either.

As for the price of bitcoins it only depends on how much people are willing to pay them. If everyone wants a bitcoin then the price goes up. If no one wants a bitcoin the price goes down (to put it in an exaggeratly simple way).


unconfirmed bitcoin transaction since last 10 days (0d868f6d6459be4b343ac6442c8d4c484fd28370c4e7753f59f8b8669ef828c3)
This is he transaction which i have  done at 16 december and it is still pending
what to do ?

Unfortunately you paid a very low fee 53.223 sat/B

And the transaction may never get any confirmations a very little chance

In this case the transaction will be cancelled after a period of time and return to original address.

The next time you create a transaction you need to look for current average fee which is now as an example 620 sat/B (Satoshi per byte).


Taproot and Large multisigs I have seen lot of people saying that taproot is only for large multisigs used in few projects or companies.
BlueMatt mentioned similar thing in last Taproot activation meeting:

13:01 < BlueMatt> only large multisigs care, really. plus whole new sig algorithm

http://gnusha.org/taproot-activation/2021-03-23.log

Is this true? Do you think only large multisigs care and it will benefit only large multisigs? What is a large multisig? (Main question)

Related questions which can be ignored.

If Taproot also involves a new signature algorithm: Schnorr, why would only large multisigs care?

Is usage of multisig in bitcoin projects an issue? Which projects already use multisig? Is everything possible without multisig?

Is this true? Do you think only large multisigs care and it will benefit only large multisigs? What is a large multisig? (Main question)

No. I assume large multisig is a term used for multisig with more keys used in quorum or multisig with more users. Taproot is more than just changes to multisigs.
Everyone who cares about secure key management, LN, atomic swaps, privacy, batch validation, etc. should care about Taproot IMO
Even if you ignore all the cool things that are possible after Taproot, it will improve IBD for full nodes which was the biggest reason to avoid increasing blocksize every few months as it will lead to centralization.
Every node on the network must validate every digital signature of every input of every transaction. With currently implemented Schnorr batch verification, verifying all signatures in a block in a batch will become over twice as fast as individually verifying each signature.
Potentially even more exciting, during initial block download (IBD), new nodes must verify every single signature on the entire blockchain. The speedup of using batch verification grows logarithmically with the number of signatures being verified so that one could use batch verification to verify one billion signatures with at least a four-fold speedup! (Though I will note that this may be somewhat infeasible today as it would require a crazy amount of RAM). There are somewhere on the order of a billion signatures on the blockchain right now but sadly this speedup won’t apply to them, since they are all ECDSA signatures. However, future blocks containing Schnorr signatures could benefit from the speedup of batch verification for IBD in decades to come.
https://suredbits.com/schnorr-applications-batch-verification/
I think it's important to note first that BIP341-BIP342 are improvements to the Bitcoin script "framework" more than they are improvements to the smart contracting "functionality".
https://bitcoin.stackexchange.com/a/100051/

If Taproot also involves a new signature algorithm: Schnorr, why would only large multisigs care?

What does signing a transaction mean?
Currently, Bitcoin uses the Elliptic Curve Digital Signature Algorithm (ECDSA). With the Taproot upgrade, Bitcoin will integrate Schnorr, a second type of signature.
What are the advantages of Schnorr vs ECDSA?
When Schnorr signatures are part of Bitcoin will it be possible validate each block with only one signature validation?
Schnorr signatures will not replace ECDSA. Only outputs that are locked in v1 SegWit version are expected to produce a valid Schnorr signatures. ECDSA will continue to be used for spending current non-SegWit and v0 SegWit outputs.
https://bitcoin.stackexchange.com/a/90856/
According to P2SH.info 7% of all the BTC value locked belong to native SegWit scripts, we might see increase in this percentage considering the incentives involved in using Schnorr.

Is usage of multisig in bitcoin projects an issue? Which projects already use multisig? Is everything possible without multisig?

No. Multisigs are used and required for lot of things. There are lot of Bitcoin projects that already use multisig. And there are lot of ideas, projects, updates etc. which will be possible after Taproot.
Example: Atomic swaps will make it easier to trade on Bisq without security deposit
Few Taproot related projects: https://en.bitcoin.it/wiki/Taproot_Uses (Do not consider this list as final, anyone can edit the wiki to update list)
One interesting blog post by Andrew Poelstra about use of covenants with Taproot and few opcodes: https://www.wpsoftware.net/andrew/blog/cat-and-schnorr-tricks-i.html
New opcodes could potentially be introduced in a future soft fork: https://bitcoin.stackexchange.com/a/100047/


Unconfirmed/pending transaction in MultiBit no longer exists, but my coin is still gone! Last night, I transferred some coin to my MultiBit local wallet, which worked fine. Then I tried sending some to another wallet, and the transaction showed up as "unconfirmed/pending" after taking my coin. It didn't show up on blockchain or blockexplorer.

After a few hours with no change, I exported my transactions, then reset the blockchain and transactions. Now, the outgoing transaction has disappeared, along with my coin. I've got a TXID saved, but it doesn't exist. Is there any way to get my coin back?

Use your backup to restore your wallet. Re-import your private keys and re-scan the block chain for your incoming transactions. If you can't find the outgoing transaction, then it was never sent and the coins are still in your private address.

If you have Multibit HD, then keep pressing 'receive' to generate a new address until it gets to the address that you received the coins on. Then it should show in your balance. I think you are using Multibit Classic though, so it only generated random addresses each time, and you would need your private keys for each address.


How to calculate conversion exchange fees? According to Exchange A, I can withdraw 1 BTC as 90 fiat. Or I can send them 1 fiat in return for 0.01 BTC. How do I calculate percentage fees for one way conversion?

The formula to calculate that is:
100% x (1-√(BTC x fiat))

where BTC and fiat are the two values highlighted in gray above.
Using the values given in the quesiton, it is 5.1%.
(Assuming that the conversion fees in both ways are calculated as a percentage, with the multiplier)


I can't send a transaction uses BitGo API I have a test BitGo account, and there are test wallets. One of this wallet has 1.1000 TBTC (test btc). I want to send transaction uses BitGo API.

I do this request:

http://localhost:3080/api/v2/tbtc/wallet/"my_wallet_id"/sendcoins

with this headers:
Content-Type application/json
Authorization Bearer "my_token"

and this body:

{
    "address":"address_where_i_send",
    "amount":0.1,
    "walletPassphrase":"my_test_passphrase"
}

and I get this response:

{
    "error": "sub-dust-threshold amount for 2N4ebmhA3FDuPiULXUEu1jBdPc3y2hk1NrD: 0.5",
    "message": "sub-dust-threshold amount for 2N4ebmhA3FDuPiULXUEu1jBdPc3y2hk1NrD: 0.5"
}

Can somebody explain why I have this response, and how fix it?
(I have V2 BTC wallet)

Thanks!

According to BitGo Documentation:

  amount    number  Yes Amount to be sent (in Satoshis), e.g. 0.1 * 1e8 for
  a tenth of a Bitcoin

https://bitgo.github.io/bitgo-docs/#send-coins-to-address

So, the amount should be passed as 0.1 * 1e8 = 10000000


Is it possible to transfer money from another country to the U.S.? I came from China and am a international student in U.S.. My family would like to transfer some money to me for my tuition and living expenses.

Transferring via banks incurs fees, and loss of money value due to the difference between change rates from RMB to U.S. dollars and the other way around.

Can bitcoin be used for transferring money with less cost? I am totally new to Bitcoin, and will appreciate your advice.

Thanks!

You can certainly transfer fees internationally with Bitcoin, and in many cases this is a great way to do so.

Keep some things in mind, however. For one, you will have to pay conversion fees when you convert from currency, to Bitcoin, and then back into currency.

Also, with some exchanges and traders it can take awhile to convert your Bitcoins into money. The Bitcoin system is growing, but it's not as efficient as a bank or wire transfer, at least not yet.

In the meantime, as you are trying to conduct your transfer, Bitcoin prices can swing up and down. If Bitcoin prices go up, good for you, you'll make extra money. If Bitcoin prices drop, however, you could end up losing more money than if you just went with a bank.

If you are new to Bitcoin, I'd wait another semester before using this method. You should familiarize yourself with the whole system first before conducting such transactions.


How do I know if an output is unspent when looking through the raw transaction data of a transaction? When looking through the data represented in JSON, how do I know if a particular output has been spent as input in another transaction?

You don't. To know if an output was spent you must check the blockchain, the information is not encoded in the transaction itself.

In Bitoin, you don't need to scan the entire blockchain, though. There's a database maintained by nodes, wallets and other software called unspent transaction output, or UTXO. Other coins may be different.


What if an intruder modify scriptSig to get the same hashMerkleRoot of a block? What if an intruder try to modify the coinbase transaction of a block buried in the blockchain, writing as output some other address. The arbitrary content of the scriptSig field could be modified as much as necessary so that the hashMerkleRoot hash match with the one in the original block. What prevents this thing happen?

Thanks.

I assume you mean scriptPubKey in the outputs of the coinbase transaction.

Assuming that, what you are describing is popularly known in cryptography as a pre-image attack. If you can find a 'collision' with fixed existing message (in your example that is the original coinbase transaction) in such a way that they both produce identical hashes then you have a pre-image attack. If you change the scriptPubKey in the output of coinbase transaction, assuming no 'collision' happens, it will change the txid and hence change the merkleroot, which would in turn change the block header hash.

SHA-256 algorithm outputs 32 bytes, which means there are a total of 2^256 (or 10^77 combination). SHA256 is a one way mathematical function, as a result  you will have to brute force your way to actually produce hash similar to the one before. Running that kind of brute force is not only computationally impossible, but also impossible due to the energy that it consumes (check this).


How can you distinguish the source of Bitcoins? As reported on Tech Dirt here the address of where the bitcoins seized from SilkRoad are being stored has been identified here.

This has resulted in many people making micro payments to the wallet and attaching their own messages, I assume for the fun of it.

Can the original funds the FBI paid to their wallet still be distinguished from the total fund now in the wallet after the additional transactions from 3rd parties? I assume they kept a tally of how much they transferred in but for the purposes of evidence I imagine they would need to know the actual coins and not just an amount.

Whenever a payment is sent to an address, it is received as a distinct transaction output. It should be a trivial task for the FBI to label the output or outputs accordingly to know which were created in the confiscation of Silk-Road's funds.

On the other hand, there is no such thing as the "actual coins". Whenever bitcoins are transferred, the outputs that feed the transaction are destroyed and new transaction outputs are created.


creating your own bitcoin block I've just started reading about bitcoin, and I had this question, what if :

I created two bitcoin addresses.
added for example 1 btc to one of them.
then I start sending that 1 btc back and forth between the two
addresses till I complete one block but somehow I don't broadcast
those transactions.
I calculate the magic number.
broadcast the block and I claim the mining fee without any
competition.

I know there is something preventing this from being possible I just don't know what it is ?
thank you for time.

That is not how bitcoin works. You can't just "add" bitcoin to an address without a valid UTXO. There is not a minimum number of transactions required to create a block. A miner can create a block with no transactions included if they wanted, so the sending back and forth idea makes no sense. Calculating the magic number isn't something you can do on your own, all the other miners in the world are racing to solve for the same block, and once they do, you need to update your equation to solve for a new magic number. I think you need to do a bit more research on how bitcoin works.


Is there a remote Bitcoin API that doesn't require anything to be stored locally? What I imagine is a trusted centralized server (say run by Mt. Gox or some other exchange), that exposes a simple medium/low level API (let's say in JSON):

getTransaction(fromAddress)
getTxDetails()
executeTransaction()
...

I know BitcoinJ does't store the whole blockchain, but it does store and update the headers. The method I seek will save me the hassle of managing any local data except the actual keys/addresses.

I would not have to give this transaction my private key, but rather use some sort of Offline Transaction equivalent. Is there something close to this? Is somebody building this? (If not, someone should!)

This question is a little old now. But you could use the blockchain.info JSON RPC api. It is designed to be compatible with the original Bitcoind implementation and most functions can operate without private keys.

http://blockchain.info/json_rpc_api


QT-Wallet not sync properly for altcoin I tried to create altcoin using litecoin source code. I am able to generate genesis block for same. After setup on ubuntu VPS qt wallet connect to server and disconnect within seconds. Please help me to get out of this.

Here is log

trying connection xx.xx.xx.xx:9293 lastseen=113.8hrs
connected xx.xx.xx.xx:9293
send version message: version 70001, blocks=0, us=0.0.0.0:0, them=xx.xx.xx.xx:9293, peer=xx.xx.xx.xx:9293
disconnecting node xx.xx.xx.xx:29293

I resolve this. Just need to check your VPS connections and its configuration. Make sure socket handshake is proper it resolve my issue.


I don't have my 12 word question but I do have my PIN and my computers MAC address I have been using my Hivewallet on my laptop for over 3 months and not once has it asked me for my 12 security words. In the past I figured it had picked up my MAC address because all it ever asked for was my PIN. I recently had problem and all my newer folders have been destroyed and cannot be taken.

I was hoping there would be a way I could still get into my folder. It has about $500-$550 worth of bitcoins and I did nothing wrong. I know everything that went on - even $750 worth or BTC that was taken only hours before the $500 of BTC was sent.

I'm pretty sure Hive is like the other web wallets in that they literally can't access your funds, they are encrypted. You would have been told in no uncertain terms to keep those 12 words safe and secure, it is not their fault if you haven't done that. Passwords are not recoverable on other web wallets either (e.g. blockchain.info).

Good luck, there's a chance some polite emails to their support may yield something if you have enough info for them to investigate but don't be surprised if they can't help.

Next time, store your funds somewhere safer and just keep day-to-day funds on the web wallet.


Xapo bitcoin transaction stuck ive been using bitcoin since early 2013 and yesterday my transaction got "stuck" when trying to send some bitcoin to my Xapo wallet, this has never happened to me before.

im kind of scared that i can lose this 250$, any help/information would be nice :)

heres the transaction: https://insight.bitpay.com/tx/ce5a327293c4f4b046bc7e1ab5ee9f06ecbdf4da37e78c75a506627d6ecd12d7

Where did you send the bitcoins from? Anyways, due to the many unconfirmed bitcoin transactions in the network right now, your fee is relatively low and it therefore takes so long to confirm. If you did send them from a wallet you control, then you can try to use RBF or double-spend it with a higher fee. Otherwise contact the sender of the bitcoins, or wait some more time for it to confirm.

See also here:
Why is my transaction not getting confirmed and what can I do about it?


Why are m-of-n transactions not used today? BIP 11 supports m-of-n transactions. While BIP 16 and BIP 17 are being debated and voted upon, I have to ask: why haven't there been evidence of BIP 11 used in for m-of-n transactions?

All that BIP 16 and BIP 17 do is shift the cost to the recipient. This is healthy for the long term cost structure, but it doesn't mean that BIP 11 style m-of-n transactions aren't usable today, does it?

Have it been used somewhere and I just don't know about it? Or is the current protocol not usable for m-of-n transactions?

See also this question about BIP 12, 16 and 17.

There are some m-of-n transactions in the blockchain (blockchain.info - block explorer) but they have only been recently added to the standard transaction types.

However the reason why they are probably not in wide spread use yet is there is no gui based client that can construct one. My Wallet will be able to construct them soon, I don't know how much demand there will be for usage.

The way I see it BIP 16//17 and m-of-n have different use cases. The drawback of P2SH is that you need to share the script with the recipient in order for them to know they have received a payment - you also need to store the script. While this might be ideal for split key wallets, (where the wallet owner already has the script) it is awkward for use with escrow transactions. If you receive an M-Of-N escrow payment notifications can work out of the box and you can use existing vanity addresses.


is there any viable rust implementation of Bitcoin Request :
I am wondering if any developer has already developed a Rust implementation of the Bitcoin protocol.

if there is any repos, post or any relevant document please share it with me.

Andrew Poelstra has a rust Bitcoin library: https://github.com/apoelstra/rust-bitcoin. I don't know how complete it is though, so use at your own risk.

There's also the parity bitcoin wallet: https://github.com/paritytech/parity-bitcoin which is also written in rust.


Can the Antminer S3 mine Bitcoin using Blake2s algorithm? If so, how? Nicehash can also do this, so what I'm trying to do is point my Antminer S3 to Nicehash's Blake2s stratum. But will changing the stratum URL be enough? Do I have to set up Blake2s first?

No, Bitcoin uses SHA-256 only, BLAKE2s is a different and incompatible algorithm.


Hardware Wallets vs second mobile or airgapped computer What are the advantages of a hardware wallet vs an airgapped mobile phone or computer? It is the memory quality so much different from a good RAID?
How are people with multiples of coins and over 100k storing their keys?

Hardware wallets have Hardware Security Modules which are specially designed hardware for storing and securing cryptographic keys. In general, HSMs are better than generic laptops or phones as HSMs are often validated for HSM standards like FIPS 140-2. These standards require that the HSM meet certain specifications for security, tamper resistance, etc. The use of HSMs means that the private keys can basically never leave the device.

Hardware wallets are also much easier to use than an air gapped machine and less prone to human error (e.g. accidentally allowing the air gapped machine to go online).


If Bitcoin is not controlled by the state, how come in some countries it is illegal? From my understanding, Bitcoin is decentralized and not controlled by any company or organization (so, for example, no bank is behind Bitcoin).

However, this seems to not be powerful enough to resist to the country laws.

There are quite a few countries where Bitcoin is illegal, for example, Bangladesh:

  In September 2014, Bangladesh Bank said that "anybody caught using the virtual currency could be jailed under the country's strict anti-money laundering laws"

So, why is the fact that Bitcoin is not controlled by governments/organizations/banks/etc so important, if the government can actually say don't use Bitcoin and it becomes illegal?

As one who has bitcoins, what should I do if my country will Bitcoin one day?

A party can send a hexadecimal string to another party and nobody in the world can prove bitcoin or any form of money was sent. Governments can ban bitcoin usage but the bitcoin protocol is indistinguishable and can be implemented using plain speech, so it would be a matter of banning freedom of speech.


Public API to verify transactions to a unique address as they occur? I'm creating a WordPress plugin for bitcoin donations. I want it to behave similar to the checkout process for many bitcoin shopping carts, where the QR code is displayed then once the user scans and sends bitcoin to the address, it swaps out with a "thank you" message.

I was thinking of using messages attached to the donation, or a specific amount for each donation, but it's getting complicated. How can I have a single receiving address for each donation, yet have the system know when the user Joe has donated vs when Bob donated, so they both get thank you message at the appropriate time.

Is this possible, or do I need to generate a middleman address for every transaction, and just check the balance on that one?

I only want to go this route so I'm not responsible for a screw up if someone donates, the site glitches, and the private key to the middleman address is lost before the funds can be forwarded on to the final receiving address.

Yes you can.

If you're using a third party service to store your coins, they usually allow you to add a callback address when generating a new address, where they trigger a POST request to your server with a JSON object containing transaction details. Here are some examples:

Coinbase's API: https://developers.coinbase.com/api#callbacks
Blockchain.info's API: https://blockchain.info/api/api_receive

If you're rolling your own addresses, you can use some block explorers to notify you of new transactions to existing addresses. One I know of is Chain.com's notification system. I haven't used this, but Chain is quite a developer friendly service.

Personally, I've only used Coinbase's API, and It worked quite well for me. I trust Coinbase to take care of my coins better than myself, but if you're more paranoid and better at security than I am, use Chain.

IMHO I don't recommend Blockchain.info for anything. Their service really isn't that polished from all I've seen, and I just get a bad vibe from them. Coinbase has very nice support and a developer community where you can talk about all the problems you face.


Why does bitcoind not recognize the uncompressed version of my address? I have an address representing a compressed public address, which bitcoind is recognizing as "ismine":

compressed_address = n2HCyN8GWPuc8CrwbiiBASCS7iWku3Ke8S
compressed_key     = 03c6debc01d8cf1c7eae826b8acb0ba6ff5d37b8d840b2bfc5244cdebab83a6781
> bitcoind  -testnet validateaddress n2HCyN8GWPuc8CrwbiiBASCS7iWku3Ke8S
{
    "isvalid" : true,
    "address" : "n2HCyN8GWPuc8CrwbiiBASCS7iWku3Ke8S",
    "ismine" : true,
    "isscript" : false,
    "pubkey" : "03c6debc01d8cf1c7eae826b8acb0ba6ff5d37b8d840b2bfc5244cdebab83a6781",
    "iscompressed" : true,
    "account" : ""
}

I extract the y value from the compressed public keys, and create an address from that (with the same function I wrote for compressed keys):

decompressed_key     = 04c6debc01d8cf1c7eae826b8acb0ba6ff5d37b8d840b2bfc5244cdebab83a6781a8b69757635c64ce32eed71115b68174d7241c716b1f76d317c6440635d8bc01
decompressed_address = mfjsW5m8CL5EazGBvjutZ4dgJwd6AjHM11

The address is valid since if satisfies the curve equation... x, y values are as follows:

x = 89951481645973345162937095289811840492311042685266238084455665220379660150657
y = 76311169247456070080081989221882104208438035444189442719121845261776897752065
y * y         = 107822876231389859288843816887520488062823501023166616425651229464214081607136
x * x * x - 7 = 107822876231389859288843816887520488062823501023166616425651229464214081607136

However, bitcoind does not recognize the decompressed address as "ismine".

> bitcoind  -testnet validateaddress mfjsW5m8CL5EazGBvjutZ4dgJwd6AjHM11
{
    "isvalid" : true,
    "address" : "mfjsW5m8CL5EazGBvjutZ4dgJwd6AjHM11",
    "ismine" : false
}

I don't understand... the only difference between the two is that one key is compressed to save 32 bytes... the private key should be the same!  Shouldn't they be interchangeable? Does this mean I won't be able to spend to spend coins send to the de/uncompressed address?

Compressed and uncompressed keys are treated completely separately. Funds sent to the compressed point address will not be available to a client that has the uncompressed key in their wallet.

That is to say, although mfjsW5m8CL5EazGBvjutZ4dgJwd6AjHM11 and n2HCyN8GWPuc8CrwbiiBASCS7iWku3Ke8S have the same private key, they are treated as completely separate to the Bitcoin network. Ideally they would be treated the same, but compressed ECDSA keys just weren't considered by Satoshi originally, it's only a more recent addition (sipa's, probably) to the client.


How widespread is OP_RETURN forwarding and mining (as of February 2014)? As of now (February 2014), how easy is it to have a transaction which makes use of OP_RETURN data confirmed into a block?

Do standard nodes forward such transactions yet? Have major mining pools committed to support?

Are there specific steps that can improve the chances of such a transaction being mined, like connecting to certain nodes with advertised support, or adding extra transaction fees?

It will take until bitcoind version 0.9 for wide spread support for relaying OP_RETURN.

Adding fees will not help. Currently, transactions with OP_RETURN are by default not relayed by the main net (last sentence):
https://en.bitcoin.it/wiki/Script#Provably_Unspendable.2FPrunable_Outputs

P2Pool seems to accept them, so that could be a solution for you: submit them to a P2Pool node.


When does MtGox lock accounts? When you sign up at MtGox, they say: please fill out the following to avoid your account getting locked.  They're referring to the member verification process (using govt ID and utility bill).

But under what circumstances will they lock my account if I cannot provide verification docs at the moment?  And what does "locked" prevent me from doing?  Does it prevent me from, for example, transferring BTC to another exchange or wallet?

I recently got mine locked because my YubiKey broke.

When you want to disable the YubiKey for your account, your account will be frozen for two weeks. I had my account information verified and still got locked.


Bitcoin promotional campaigns Have there been any notable promotional campaigns for the Bitcoin project or some of the major Bitcoin-relatd websites?

There has been a bitcoin billboard on the Lawrence Expressway in Silicon Valley, California, paid for by memmorydealers.com.

Also the same company paid for a radio advertisement across a number of US radio stations I believe.


Unconfirmed Blockchain Status Need Help,
Transaction invalid: some outputs that it attempts to spend have been already spent or are no longer valid.
This is the message appearing on the Summary report from block chain. It was process last January 08,2021 and the result until right now is Invalid and no progress at all. How to fix the issue.
Thanks in advance...

That message means that the sender created two transactions that attempted to spend the same coins. This is called "double spending" and is not allowed. One of the two transactions has to be marked as invalid by any Bitcoin node that sees the two. I believe most Bitcoin nodes will initially set aside whichever they received last. Over a short time time, the network as a whole comes to a common view about which transaction is accepted (so some nodes may change their decision after a few tens of minutes from their initial decision).
The transaction that you are looking at has long ago been determined, by all participants in the Bitcoin network, to be the incorrect one of the two.

How to fix the issue.

You can't.
If you are the creator of the transaction, you should be able to find the other transaction where you spent that money.
If you are a recipient, you just treat that transaction as if it never happened, you were not paid.

Related

Can this double-spend attack happen in Bitcoin?
Other quesions about double spending attack


What is the Default Rounding for 8 digits in Binance,tradingview,etc I have a problem. I am struggling to calculate programmatically the number of cryptocurrencies because I sometimes have inaccuracies in the last digit. Does anybody know what the problem is? (Of course, I have calculated the appropriate fees that need). For example, Binance uses accuracy for 8 Digits. What is the Rounding that they used? I would appreciate an answer if someone have the appropriate knowledge on this matter

RoundingMode.CEILING
RoundingMode.DOWN
RoundingMode.FLOOR
RoundingMode.HALF_DOWN
RoundingMode.HALF_EVEN
RoundingMode.HALF_UP
RoundingMode.UNNECESSARY
RoundingMode.UP

There should not be any rounding because all operations are integer operations. The 8 digits is because they calculate using the base unit of Bitcoin, the satoshi, which is 0.00000001 Bitcoin (8 digits). It is calculated as an integer (i.e. calculation uses satoshis, not Bitcoin) multiplied by an integer for the number of bytes, thus the result will also be an integer. The decimal then comes back as they shift the decimal point to represent the value in Bitcoin. There is no rounding involved, if there is, you are doing something wrong.


Can eavesdropping help mining at all? My understanding is that if a miner uses a particular coinbase address then already this address is offsetting the computation to a whole different set of results… Can someone, mathematically speaking, gain anything from watching what others compute given that every pool or solo-miner is computing in their own interest, their own corner of computation universe?
For context in which I thought of this question see https://github.com/bitcoin/bitcoin/issues/3658

From #bitcoin IRC channel at freenode:
17:41 <fireduck> jasan: I don't understand the question.  In the bug you pointed it to, it seems that ghash got block X, and was in the processing of sending it for validation.  Then the bug poster got block X+1 based on that
17:42 <fireduck> but bitcoind hadn't processed/validated block X yet, so it rejected X+1
17:42 <fireduck> this is what I would expect.  The mining pool software should have waited and retried a few times.
17:42 <fireduck> The coinbase address has nothing to do with this
17:42 <jasan> fireduck: Thank you for thinking about it. Yes, my question is slightly off-topic from that issue itself.
17:42 <-- melande1 (~melande@gateway/tor-sasl/melande) has quit (Remote host closed the connection)
17:42 <fireduck> other than each block has one (or more)
17:43 <fireduck> ah, I think i understand your question
17:43 --> melande1 (~melande@gateway/tor-sasl/melande) has joined #bitcoin
17:43 <fireduck> Lets say you could observe all stratum calls and all work submits for all mining pools in existence ( a tall order)
17:44 <fireduck> would that help you solve blocks faster?
17:44 <jasan> Yes. Nicely rephrased.
17:44 <fireduck> (making sure I understand the question)
17:44 <fireduck> cool.  That would not help at all.
17:44 <jasan> OK. Thank you.
17:44 <fireduck> Each of those mining pools is using a differnet coinbase with different addresses, values, nonces, etc
17:45 <fireduck> So knowing the state of all that won't help you find a solution to your address
17:45 <jasan> Originally I thought the issue author is suggesting otherwise, but then I even re-read the issue and realized it says something else.
17:45 <fireduck> got it.  The issue is a little hard to parse.
17:46 <jasan> fireduck: Thank you! I really appreciate your answer!
17:46 <fireduck> no problem.  I've written mining pool software so this in the area I've worked in


Incentive for validating block When miners find a solution to a block and broadcast it, what is the incentive for the other miners to actually validate that it is correct? It seems that they might save time by just starting to work in the next block instead of validating. Do they get some kind of reward or penalty?

what is the incentive for the other miners to actually validate that it is correct?

The incentive is to not mine a block on top of something that is invalid. If they do end up mining on top of an invalid block, then they waste effort (and thus money) on something that will never be accepted by the rest of the network.

  It seems that they might save time by just starting to work in the next block instead of validating.

They do save time, and in fact, many miners actually do not validate the previous block before they start mining on it. While there is an incentive to validate blocks, no one can force anyone else to validate a block and the incentive is not high enough for miners to always validate a block before mining on it. Since invalid blocks happen rarely, many miners have found it unnecessary to validate blocks before beginning to mine on top of the block.

Many miners will still validate the block, just after they have begun mining on it. They instead will validate a block whilst they are already mining on it and only stop mining on it if it turns out to be invalid. Although they can lost money by doing this, the risk is not that great because blocks are rarely invalid but the reward is great due to the extra mining time.


Extract lightning network funding transactions with python bitcoin blockchain parser lib My ultimate goal is to parse funding transactions (as well as channel closes in a later step) from the blockchain. In order to do so I wanted to start with a funding transaction and disect it. Unfortunately I am kind of stuck and hope you can help out.

via #recksplorer I clicked on an edge and found this transaction to be the funding transaction of a payment channel.  I found this transaction in my local copy of the blockchain using bitcoin-blockchain-parser (in python) lib

using this code

for i,h in enumerate(tx.hex):
    print('{:02x}'.format(h),end=" ")
    if i%8==7:
        print(" ",end="")
    if i%16==15:
       print()
print()

I get the following hex representation of my transaction (the two asterix ** where included to emphasize the output script of interest):

02 00 00 00 00 01 01 e3  3d f6 39 1a 02 5c 79 b3
1a 2a ab 94 9f b5 6d f8  f9 2d 9f 3a bb ab 7d d3
92 47 7f 31 9f b6 69 01  00 00 00 00 ff ff ff ff
02 21 4e 00 00 00 00 00  00 22 **00 20 98 2b 53 22
31 08 07 d3 68 d1 dc 26  11 43 09 5d c7 d0 2f ba
6d 67 08 bb 76 21 51 9f  31 29 08 b2** e1 99 0d 00
00 00 00 00 16 00 14 8c  35 c6 98 4d f9 d6 a2 9e
4e 7d 76 21 19 3c fe 53  82 ce 60 02 48 30 45 02
21 00 ba 9e 6e 56 a6 4f  a2 53 4a 02 e9 30 20 8e
80 38 f6 f0 7c a8 d2 0e  b3 e4 03 59 99 20 8f 9d
a1 15 02 20 3a 12 73 72  c4 bc ee 6f 76 9e 07 fd
05 0e f0 62 9b 4d e8 e6  43 84 26 46 53 56 03 46
07 f3 9a eb 01 21 03 0c  fa b1 4c d0 4a 01 5a 58
40 2a 5e a6 84 e4 d9 b3  4b 33 23 73 04 0c 57 5e
83 b1 0a d3 90 79 66 00  00 00 00

I also found the two output scripts in particular the first one (after byte 58!) which sends 20001 satoshi to a payment channel:

output = tx.outputs[0]
for x in output.script.hex:
    print('{:02x}'.format(h),end=" ")

00 20 98 2b 53 22 31 08 07 d3 68 d1 dc 26 11 43 09 5d c7 d0 2f ba 6d 67 08 bb 76 21 51 9f 31 29 08 b2

I have not been able to understand the format of the funding transaction itself. according to BOLT3 it should look like this:

  2 < pubkey1 > < pubkey2 > 2 OP_CHECKMULTISIG

I asusme that 2 means OP_2. However with the help of bitcoin wiki I cannot find the hex values of OP_2 and OP_CHECKMULTISIG.

I guess (but can't verify this at the moment) that I am running into problems similar to this question here on this site. Or I am messing up with the endian notations? As mentioned my future goal would be to automatically extract all funding transactions therefor I need to be able to pursue my endeavor and would appreciate your help a lot! Thanks!

Firstly, you are off by two bytes. The output script is 0020982b5322310807d368d1dc261143095dc7d02fba6d6708bb7621519f312908b2, but you have selected 00220020982b5322310807d368d1dc261143095dc7d02fba6d6708bb7621519f312908b2.

Secondly, complex output scripts are never just put in the output. They are always wrapped in some form of Pay to Script Hash. In this case, because it is segwit, it's Pay to Witness Script Hash (P2WSH). So you can't know the actual script used without the output being spent from. Everything in LN is P2WSH, no scripts are just put in the outputs.

To break down this script, first you have 00. This is the witness version number, version 0. Then you have 20 which is a length indicator for the next chunk of data. In this case, that is 32 bytes. Lastly 982b5322310807d368d1dc261143095dc7d02fba6d6708bb7621519f312908b2 is the SHA256 hash of the script itself. That script will be a 2-of-2 multisig, but you won't be able to know what it actually is until this output is spent from.


How to prevent selfish mining? I'm exploring the topic of selfish mining attacks and how to detect and stop them. I do not really understand any of given solutions. Can someone please explain in plain English, how selfish mining gets detected, how to stop it from happening and how to react to it when the attack happens? Were there any selfish mining attacks so far? Were there any mitigations of the selfish mining attack added to the Bitcoin protocol since it was described?

I do not really understand any of given solutions. Can someone please explain in plain English

I also find this stuff difficult to understand however I'm a little skeptical of the idea that complex issues can always be simply explained. There is a reason why people spend decades studying a subject in order to understand something. Selfish mining isn't one one of these, it isn't quantum mechanics or some esoteric branch of mathematics, however it probably isn't simple.
I find this website works best when you ask one, specific question rather than bundling a bunch of questions together. So far as I can tell, this isn't a place where you can routinely expect volunteers to write substantially long multi-page essays.
A google search finds Majority is not Enough: Bitcoin Mining is Vulnerable; Ittay Eyal and Emin Gun Sirer; Department of Computer Science, Cornell University which, looking at the first few pages, seems to be readable. I would start there and ask here about any single specific points that I needed clarification for.
Cornell is a reputable institution and a peer-reviewed paper with substantial citations ought to be a reasonable starting point.


Should there be a minimum transaction limit to prevent dust spam? With all these reports of people receiving spam through dust transactions (e.g. Enjoy Sotchi, Bitwars etc) what would be the implications of setting a minimum transaction amount on the network? Why would anybody wish to send 1 Satoshi (0.00000001 BTC) it seems to have almost no economic benefit? Would such a limit disrupt any legitimate activity on the network?

There already is a limit of 5460 satoshi. It's unlikely any transaction smaller than this will be ever relayed or included in a block without colluding with a miner.

https://github.com/bitcoin/bitcoin/blob/b78d1cdf82fb12cc0c8eb9049074b359b9589b7c/src/core.h#L153