How to track and handle double-spend attacks? If a double-spend attack is pulled off, how to manually verify transactions via the bitcoin daemon and how to know how much amount lost? Will the saved transaction hash be re-usable to obtain info about the transactions using gettransaction?
Is it possible to pull off the attack after 48 hours?

You can just wait for enough confirmations. Most wallet and blockchain websites will show you the number of confirmations for a transaction id.

If it is a small transaction (less than 100 Bitcoins) then waiting for 3 confirmations should be enough. 6 confirmations means that roughly 10% of the network has confirmed your transaction and is the ball park used by many cautious services.

Every confirmation takes a minimum of around 10 minutes.

It has happened less than 15 times that transactions with 3-4 confirmations were reversed and it has happened almost 1000 times that transactions with only one confirmation was reversed. (What is the longest blockchain fork that has been orphaned to date?)

So, technically, it's really so difficult to pull off a double spend after 50 minutes, that nobody has ever done it.

If it does happen, the whole transaction basically just "never happened" so the transaction doesn't take place and the whole amount is "lost".


What exactly is an address in bitcoin Here is what I've understood of bitcoin:

Everybody has a public and private key.
If A sends bitcoins to B:

B is generating an address and sends it to A
This addresses are generated for each transaction.
A needs to sign something with his private key and B's address

Am I wrong?

If not, I want to understand how this address is computed.

I have read it is a kind of public key computed from private key. That's it? So we can have many public keys which match to a common private key?
I have also read the address is derived from the public key.

Everybody has a public and private key.

Everybody is able to generate any number of private keys ("randomly") and derive a public key from it.

If A sends bitcoins to B:
B is generating an address and sends it to A

B forms an address out of the public key itself derived from a "randomly" generated private key.

This addresses are generated for each transaction.

Ideally yes, unfortunately (privacy-wise) it's a decision made by the sender. Sending twice to the same address is possible.

A need to sign something with his private key and B's address

This something is, basically, the transaction itself.
EDIT: To answer the question title :-)

What is physically an address in bitcoin

Some bytes either stored on your hard disk or in memory, which are part of a transaction and which are to be interpreted as a script describing what conditions should be met to spend the coins "next to" this address.


bitcoin node take transactions fee and validate them a bitcoin node check transactions and validate them . does it take transaction s fee. when validate transactions how much bitcoin transaction fees for a node.and possible reduce fees in a bitcoin node

Transaction fees are paid to the miner that includes that transaction in their block. Nodes do not earn transaction fees (or any other fees) for validating transactions.
You can reduce fees by using segwit inputs, and by waiting for periods when the mempool is relatively empty.


How can one remain relatively anonymous while using Bitcoin? Bitcoin transactions are pseudo-anonymous. What can an individual that uses Bitcoin do in order to remain as anonymous as possible?

Don't publicly disclose any address in your wallet, or associate any address with your true identity.
Use currency exchanges to break the 'money trail' of bitcoin addresses associated with you.*
Use anonymizing services such as TOR when conducting business.
Break up your transactions between online and offline (person to person) transactions.
Buy bitcoins for cash.
Mine bitcoins yourself either directly (solo), or with pools such as Eligius that do not require registration.

*If you transfer bitcoins into a large currency exchange or other large private repository of bitcoins, then pay bitcoin back out to a new address that is not associated with you it is difficult (without a warrant) to track the bitcoins.


What goes in the id/BTCUSD field for Mt. Gox "submit an order" API call? I am trying to place a new order using Mt. Gox's submit an order API call. However I keep on getting the error object

{ result: 'error', error: 'Bad API call' }

I'm fairly certain I'm doing everything right, except I suppose the order Id which is referred to as BTCUSD in the documentation.

https://data.mtgox.com/api/1/BTCUSD/private/order/add

It gives no other explanation on what this field is, and I have found other projects calling it ID, so I'm using the node-uuid v1() method to generate a unique ID for the field.

So this is the URL I create:

/api/1/36c1f990-a4a4-11e2-84fd-a100a9f27dd2/private/order/add

and the object I send with it

{ type: 'ask', amount_int: '100000.000', price_int: '20000000' }

What am I doing wrong?

This field is used to spcify the currency pair type of the return data, so leaving in BTCUSD works fine or changing it to a different accepted currency pair, such as BTCEUR, also works and just changes the currency denomination of the returned data.


LND How to reset pending_open_channels? I am using LND (most recent version 0.6.1-beta) and I have a lot of pending channels in state
pending_open_channels
which are stuck for many days (perhaps because of low fee and  full mempool) so I want to reset those transactions from my LND/bitcoind or just increase a fee so that could be mined and the channel open.

What options do I have? Can I just delete/reset all pending channels somehow? Or wait or what.

Many thanks for your attention and ideas.

Bitcoind v0.18 was unable to broadcasst my channel transactions because of bug in LND. This error has been found in lnd log:

Second argument must be numeric (maxfeerate) and no longer supports a boolean. To allow a transaction with high fees, set maxfeerate to 0.

https://github.com/lightningnetwork/lnd/issues/2961

I have downgraded bitcoind and the stuck transactions moved.


How to use bitcoin-python I'm trying to create a bitcoin address with the bitcoin-python library.  I tried this code:

import bitcoinrpc
bitcoinrpc.connect_to_local().getnewaddress()

But I got this error:

error: [Errno 10061] No connection could be made because the target machine actively refused it

I am running the bitcoind daemon.  Why am I getting this error and how do I fix it?
or can someone direct me to an easier way to learn to develop with bitcoin -

Most likely you have not enabled JSON-RPC server in your bitcoin.conf.

You need to have:

# Enable JSON-RPC
server=1

# Username and password
rpcuser=foo
rpcpassword=bar

# This must be enabled for gettransaction() to work
txindex=1

For more information see

http://cryptoassetscore.readthedocs.org/en/latest/backends.html#module-cryptoassets.core.backend.bitcoind


How to save the bitcoin core (bitcoin-qt) database for later? Say I've received some Bitcoin using the Bitcoin Core wallet on some linux machine. Say I'm done playing for now.

So now I want to free some disk space by deleting the huge database from this machine (and maybe uninstalling the program after backing up wallet.dat?), but I do not want to have to download the whole blockchain again (which took forever the first time), so I want to back it up on some external drive, so I can just copy it back when I want to use Bitcoin Core again (on the same machine or on any other).

What are all the files and directories that I need to copy?
Are there any extra steps needed to be done other than copying the files?
What are the steps to load the saved database to a new installation of Bitcoin Core?

This will help me with my situation, but also, I thought our community could use such a guide posted here. Thanks!

Ok, I think I got it.
Here is a short guide based on this bitcoin wiki article.

Notes:

This does not concern backing up your keys. If you lost your wallet, or your keys, and you made the backup discussed here beforehand, this backup will not help you recover your lost coins. This will only save you some bandwidth/time/storage.
Don't load a database to your node unless you absolutely 100% trust the integrity of that database copy:

  when you copy someone's database in this way, you are trusting them
  absolutely. Bitcoin Core treats its block database files as 100%
  accurate and trustworthy, whereas during the normal initial sync it
  treats each block offered by a peer as invalid until proven otherwise.
  If an attacker is able to modify your block database files, then they
  can do all sorts of evil things which could cause you to lose
  bitcoins. Therefore, you should only copy block databases from Bitcoin
  installations under your personal control, and only over a secure
  connection.

Answers to the questions in the post

The directories that need to be (fully) copied are:

.bitcoin/blocks/
.bitcoin/chainstate/

No extra steps needed to be done in order to just back-up the database. (This does not cover backing up your own bitcoin and keys, also there are extra steps in order to also load the database to another installation, read on to the next point)
In order to load a saved database to another installation, first delete the database of the target installation, than copy the backed up blockchain database files in their place.

Detailed guide

I'm going to assume that you're in your target installation's folder (probably ~/.bitcoin) so this is the time to do

cd /path/to/your/target/installation/folder/.bitcoin/

Back up your database:

first, make sure this node is shut off. than make the backup:

tar cfz /path/to/your/backup/blockchain_database.tar.gz blocks/ chainstate/

Now you have a backup of the database. You are probably going to take this backup to some other computer, or just keep it somewhere and than do the next steps when you want to load the database to some other node.

now again, make sure that the relevant node is shut off.

Delete the target installation's database

rm -r blocks/ chainstate/
Extract the database from backup to target installation:

tar xfz /path/to/your/backup/blockchain_database.tar.gz


How to generate Bitcoin private - public keys with ECDSA module? Pretty same question was asked here, but maybe there is a way to generate keys using ecdsa module in just a few lines of code?

Yes:

import ecdsa
print(ecdsa.SigningKey.generate(curve=ecdsa.SECP256k1).to_string())


What differences exist between the Lightning Network implementation versus the white paper? I'm reading the Lightning Network WP and came across SIGHASH_NOINPUT, then came across this: Lightning network: how was malleability actually fixed?

Are there any other design considerations in the White Paper that have changed in the actual implementation?

So far I found two further differences between the Whitepaper and the BOLT specifications:

Funding

Whitepaper: One or both participants have to fund the channel (page 7)

BOLT: Only one participant can fund the channel (BOLT #2 - Channel Establishment)

Penalty handling

For a particular channel state, each participant has their own Commitment Transaction version which has two outputs: One for Alice and one for Bob. The output that is intended for oneself can only be spent after a delay. But the output for the other party can be spent immediately. For the sake of simplicity the following description considers just the view of one party who is Alice.

Whitepaper

Alice has her versions of the Commitment Transaction and Revocable Delivery Transaction. The output in the Commitment Transaction that is intended for Alice requires signatures from both parties and is referenced in the input of the Revocable Delivery Transaction. This input can only be spent after a delay which is specified by the sequence number (relative timelock via BIP 68)

Commitment TX 1 {Alice's version)

 Out 0: 2-of-2 multisig (Pubkey_Alice_1, Pubkey_Bob_1)
 Out 1: Pubkey_Bob_2

Revocable Delivery TX 1 (Alice's version)

 In: sig_Alice_1, sig_Bob_1   // timelocked via BIP 68 (nSequence < MAX_INT)
 Out: <Pubkey_Alice_2>

So Alice can (unilaterally) close the channel at anytime by broadcasting both of the above transactions. However, if she'd do that she'd have to wait for some time until she can actually spend the money from the Revocable Delivery Transaction.

Now, if both parties would like to update the channel state, they have to revoke their current commitment transactions. Alice revokes her Commitment Transaction by sending Bob her private key of her Commitment Transaction output. Now, if Alice tries to cheat by broadcasting her old Commitment Transaction and Revocable Delivery Transaction, she has to wait because she can only spend her money through her Revocable Delivery Transaction which is timelocked. However, as Bob now has both private keys for Alice's output of Commitment Transaction 1, he can immediately spend this output (and thereby invalidate Alice's Revocable Delivery Transaction) with the following transaction:

Breach Remedy TX

 In: sig_Alice_1, sig_Bob_1
 Out: Pubkey_Bob_3

In short: Alice revokes her Commitment Transaction by giving Bob her private key. Also the time delay for Alice is implemented in a separate transaction via a BIP 68 timelock.

BOLT

Alice has only a Commitment Transaction. The output that is intended for Alice has two possible redemption paths. The first path requires the revocation private key and the second path requires Alice's private key and is delayed with a relative timelock using OP_CHECKSEQUENCEVERIFY (BIP 112).

Commitment TX 1 (Alice's version)

 Out 0: IF
           <Revocation_Pubkey>   // first path
        ELSE
           <time_delay>          // second path
           <Pubkey_Alice>

 Out 1: <Pubkey_Bob>

When both parties proceed to the next channel state, they revoke their commitment transactions. Alice revokes her Commitment Transaction by sending her half of the revocation private key to Bob. So if Alice tries to cheat by broadcasting the old Commitment Transaction, Bob can broadcast a transaction that spends Alice's money through the first path as he now has the full revocation private key:

Breach Remedy TX 1

 In: <Revocation_Privkey>
 Out: <Pubkey_Bob>


What are Ripple's weaknesses? Bitcoin's vulnerabilities are well documented. Is there are similar document for Ripple?

These are Ripple's largest known weaknesses (not including weaknesses common to Ripple and Bitcoin):

Because the Ripple network can't move actual fiat currencies, balances in Ripple act like bank balances. If the bank somehow defaults on its obligation, people won't actually have the money they thought they had. This is not a big problem if you're just using Ripple to make payments, but it's a weakness if you're using Ripple as a store of value for fiat currencies. Your money is only as safe as the "bank" that holds it for you.
If some unified group were able to get control over a significant number of validators that other validators trusted, they could temporarily disable the Ripple network (by refusing to reach a consensus) until manual intervention by other validators removed them.
Ripple's internal mechanics are still largely untested. As happened with Bitcoin, problems may be discovered as people begin to heavily use the system. Ripple's scalability has only been tested in simulation.
While the hope is that gateways will be all close enough to equal that people will be able to just sum their balances to get a sensible total, it's possible that different redemption policies or perceived trustworthiness will result in some balances being "devalued". So you might deposit $10 at a gateway, get a "$10" balance in Ripple, but find that because your gateway is not considered reliable, nobody actually values that balance at $10.
People might get tricked into extending trust to entities that are untrustworthy. We are already seeing "you trust me and I'll trust you" type offers. People may not realize that the system will give them what they ask for, giving them balances they have no way to collect on. Essentially, Ripple simply records balances. The system can't force people to settle them outside the system.
The stability and possible future changes in the value of XRP is unknown. If XRP is usable as a bridging currency, that should make cross-currency payments cheaper. But there's no assurance that it will be.
Until the network is decentralized, OpenCoin is a single point of control and possible failure.

In exchange, Ripple provides a way to perform fast (ten seconds), cheap (less than a penny) cross-currency payments with no way to lose money unless someone you chose to trust defaults. Ripple provides decentralized exchanges between any number of currency pairs. Ripple provides a way to seamlessly federate payment systems so people who use one payment system can pay people who use another, even across currencies. Ripple's design requires no central authorities and OpenCoin is committed to making it an open source, decentralized payment network.


When I buy a Bitcoin with dollars, where does the money go to? I understand the networking concept of the coin, but I am not sure I understand the purchase process.

Let's say I have 1000$ that I want to spend on Bitcoins, who do I give this money to?

You give the money to someone who has bitcoins available to sell to you.

This might happen via an exchange such as bitstamp.net which matches buyers and sellers.


Upper bound on the Bitcoin transaction size Assume that I want to store some arbitrary data on the Bitcoin blockchain via a single transaction.

Question: Is there any upper bound on the size of data I want to send via a single transaction?

--

Edit: I need to know how much "arbitrary data" I can store in the blockchain via a single transaction. Is there any upper bound on the field of the transaction that allows "some arbitrary data" to be stored in it?

Typically people will store arbitrary data in a separate output in a transaction beginning with OP_RETURN.

Any output with this OP code will be considered invalid or provably unspendable, but will still exist as part of the blockchain.

As mentioned in this thread Bitcoin-core options will allow for up to 80 bytes of arbitrary data by default. It is worth noting that 80 bytes is simply a default value. Nodes can change the -datacarriersize parameter to manually adjust the limit for the acceptance of larger or smaller amounts of data. For example, this transaction is 1155 bytes with 983 bytes of arbitrary data and has still been validated into the network.

The history of the default value is actually quite interesting and has been switched around a few times throughout Bitcoin's existance.


Why is the Mastercoin Exodus address used in every mastercoin transaction? Mastercoin initially did fundraising through 1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P. It now seems to be used in every Mastercoin transaction (it has been used in thousands of transactions).

Why is the address still being used in every mastercoin transaction? Is this built into the protocol somehow? I suppose it could be a spam prevention mechanism, but I would think the bitcoin transaction fee already prevents spam.

This was a shortcut to easily identify all Mastercoin (now Omni) transactions. We considered removing it when we were concerned our transactions might be identified that way for censorship, but that never happened thankfully. If you list all transactions to 1EXoDus, you list all transactions in the Omni protocol.


Can you delete / remove / update a decentralized asset in the NXT Asset Exchange? I made a mistake when creating a nxt asset on the asset exchange. How do I delete it or just update the description?

If I can't do neither, how do I get it delisted if its even possible.

Deleting, updating and delisting are not supported now.


What will happen to mining after the 20 999 999th Bitcoin? After the 21 millionth bitcoin or 20,999,999th bitcoin is mined, what will happen to bitcoin mining? - will it just stop, or will we make a further division of the satoshi thanks to Bitcoin's infinite divisibility? Or maybe miners could mine a share of the Bitcoin transaction fee...

Any suggestions/mathematical answers are appreciated.

Assuming Bitcoin is still active at that point in time, mining will continue, because transaction fees will make it worthwhile to do so.

This topic has been discussed heavily in other answers, including:

What happens once the mining reward gets cut in half?
How many bitcoins will there eventually be?
How much will transaction fees eventually be?

The last link has suggestions that the fee mechanism of Bitcoin may need changing, though that's yet to be proven whether or not it will be a real problem.


Choosing a mining pool I've read that some mining pools disappears all of a sudden, and your hard earned coins also disappear if you didn't transfer them ontime.

My question is, how do you go about picking a pool which isn't going to disappear?

I've not done mining before, but want to try out litecoin mining.

Or is it better for me to start mining without using a pool if that's possible?

If you are starting off, I will assume you do not have the computing power to solo-mine.

It's just easier to join a pool, and with regards to trusting one, I would stick with something that has been around for a while. For Litecoin I've used wemineltc and have no complaints.


How do my bitcoin peers become diversified from the set of stable nodes? I read through a variety of threads on initial peer discovery like How do Bitcoin clients find each other? and How does the bitcoin client make the initial connection to the bitcoin network? and they all say that if it is your first time connecting then you connect to the DNS seeds which give you a list of hard-coded stable nodes. If it is not my first time connecting, then I connect to whoever I was connected to before.

It is not clear to me why every client would not everyone always connect to these same set stable nodes every time (after the first connection, they are now in my dat file and I always use them)? By what process do my peers become diversified from the hard-coded stable nodes?

DNS seeds which give you a list of hard-coded stable nodes.

No, they don't do that and you are reading those answers incorrectly.

The DNS seeders give you a list of random nodes from a set of stable nodes. They are not hard coded and hard coding nodes is against the DNS seed policy. Furthermore, these are used as seed nodes, which means that your node only connects to them briefly to get more nodes to connect to. These nodes are not necessarily the ones that your node actually connects to for its normal connections.

The hard coded seed nodes are only used if the DNS seeders cannot be connected to. Again, these are seed nodes so they are used to get more nodes to connect to, not the only ones that your node actually connects to for its normal connections.

Because the nodes that are received from the DNS seeders and hard coded into the client itself are seed nodes, you get a diverse set of nodes to connect to because those seed nodes will give you a random list of nodes that they know about that are probably good to connect to.


Transaction unconfirmed after almost 2 day,please help I tried to send a bitcoin transfer monday afternoon and it is still unconfirmed. Paid the default fee and the transaction has said high priority since i sent it.Can anyone help me get this confirmed? Would greatly appreciate any help!

The transaction is:
https://blockchain.info/tx/907e8e446585be642bf85d89b15a55e306fe9868ed713c0cec84781761bcbd7a

Your transaction's fee is pretty high and its size is small. It usually should get confirmed right in the next block.

The reason it's still unconfirmed is that there currently is a very big number of unconfirmed transactions. Around 57'000. Usually, it's somewhere around 1'000 to 3'000.

This already happened a few months ago. The mempool back then was 8 MB big. Right now, it's 35 to 43 MB big (depending on who you ask) and a block being mined (which statistically happens every 10 minutes) can only reduce it by about 1 MB.

Inconveniently for you, the size of the mempool has skyrocketed since you made the transaction due increased frequency of transactions.

(Source)

If it continues like this, the blocksize limit will likely be increased so a block can decrease the mempool by more than 1 MB.

Your fee (0.5907 mBTC/kB) is above the current mempool average (0.2871 mBTC/kB) but there are a lot of transactions with higher fees than yours. Because of this, the miners will pick other transactions instead of yours.

The only thing you can do if you really need the transaction to go through fast is to send it again with a higher fee, this time.


Debug log for RPC access log How can I enable RPC access debug log on my bitcoind. My application calls some commands to the bitcoind via RPC. I want to see all of RPC accesses with their parameters like command name and caller IP address as well if possible.

I found the way. I confirmed the logs are saved as I expected.

bitcoin.conf

debug=mempool
debug=rpc


How do I accept bitcoin payments at a real world store? From what I understand, there are some requirements for using bitcoins at a physical store:

Both the store owner and the client must have Internet access
The client must have a cellphone or a laptop to issue the payment
The seller must have a way to confirm that the coins were sent.

The biggest problem is the confirmation. Since it is risky to accept transactions with 0 confirmations, it will take around 10 minutes before a single confirmation occurs and allows the real world transaction to be completed.  The more confirmations that occur, the less risky it is.

That said, what is the best way for a store owner to securely accept bitcoins?

Green address technique from Instawallet. System sends bitcoins from well known address called Green Address and if recipient trusts Instawallet or any other major organization that uses same technique, then he or she can accept payment without waiting for confirmations. This is what already implemented but it solves only the third problem.

Instant TX for established business relationships is in early development stage but it can solve all three of the problems, with an exception that only retailer needs to have internet access. For example, transaction could be printed by customer on a piece of paper, handed over and accepted instantly by retailer, and it still would be secure. The idea is very promising because such transaction could be sent over internet or by any other way directly from buyer to seller and won't use any of Bitcoin Network resources, and it would be economically fisible to make automatic payments for a service that costs several micro bitcoins.


How to extract the signature of a transaction using bitcoinj I am trying to extract the signatures from a transaction. What is the best way to do this given a com.google.bitcoin.core.Transaction object I just received from the network?

This works for P2PK, and P2PKH, but multisig will not work.

int index = (the index you want);
List<TransactionInput> inputs = Transaction.getInputs()
TransactionInput input = inputs.get(index);
Script scriptSig = input.getScriptSig();
List<ScriptChunk> signature_and_pubkey = scriptSig.getChunks();
ScriptChunk sig_chunk = signature_and_pubkey.get(0);
bytes[] sig_bytes = sig_chunk.data;

If you want a TransactionSignature object instead of raw bytes:

TransactionSignature ts = TransactionSignature.decodeFromBitcoin(sig_bytes, false)


Is there an OS X desktop client for BlockChain.info? I know it may be  possible to achieve on Bitcoin-Qt app but don't want to download the whole blockchain into my laptop. I just want a desktop GUI for my BlockChain.info wallets. Is this possible? If so, what client does that?

There is a chrome extension that can operate offline.

https://chrome.google.com/webstore/detail/my-wallet/djjkppdfofjnpcbnkkangbhanjdnoocd?utm_source=chrome-ntp-icon


How to get a VanityGenerated public address for a hardware wallet? (Ledger Nano S) I recently bought a Nano Ledger S and have not opened or set it up yet. I read that you can use a VanityGen to create a Vanity public address. How would I do this for my Nano Ledger, if I want to make sure that I keep my keys 100% safe?

You can't use custom keys with ledger since the addresses Ledger uses are all derived from your (randomly generated) seed.


Received coins in offline Armory wallet that had not yet been synced I'm new to the Bitcoin world and I have an issue. I created a wallet in Armory but did not realize that it was offline and the db had not been spawned.

I have no way of downloading the full armory ledger at this point due to space issue.

I created a wallet and got a delivery address and initiated a transaction of 0.1 btc to it that I cannot cancel.

Is the delivery address valid even though armory was never connected to the internet?

Can I access the funds at a later time with the private key that was generated by armory?

Thanks

Is the delivery address valid even though armory was never connected to the internet ?

Yes. There is no need for a wallet to be online to receive Bitcoin.

  can i access the funds at a later time with the private key that was generated by armory ?

Yes. Once Armory and Core are fully synced, you can access the funds. Alternatively you can export your private keys and import/sweep them into another wallet and access your funds from there.


Calculate the difficulty of Bitcoin network Which variable among the components of the block header is computed (or rather obtained) to achieve the difficulty posed by the bitcoin network?

Nonce or Previous block hash?

I think you're confusing terms here.

  Which variable among the components of the block header is computed

The block components which are computed (hashed) are all of the components which make up the block header: version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce.

Difficulty
A value which represents how hard it will be to mine a block. Higher difficulty value = harder to solve. The difficulty of the genesis block is 1. All block difficulties are calculated as a ratio to the difficulty of the genesis block.

Proof of Work
When you calculate a proof of work, you must meet the minimum difficulty posed by the network, as you state. This validation step makes sure that the value of the block hash you provide is less than or equal to the difficulty target.

Example

To illustrate this concept, you can validate one of the block hashes manually.

Grab a block (eg. block 3): Block 3 in json or Block 3 in hex
Concatenate (in this order, little endian, hex format) the version, previous block hash, merkle root, unix epoch time, difficulty target (bits), and nonce. You’ll see you can copy the first 160 characters from the Block 3 in hex link.

01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d
Run the command:

$ echo 01000000bddd99ccfda39da1b108ce1a5d70038d0a967bacb68b6b63065f626a0000000044f672226090d85db9a9f2fbfe5f0f9609b387af7be5b7fbb7a1767c831c9e995dbe6649ffff001d05e0ed6d | xxd -r -p | openssl sha -sha256 | xxd -r -p | openssl sha -sha256
Reverse the output from
4944469562ae1c2c74d9a535e00b6f3e40ffbad4f2fda3895501b58200000000 to
0000000082b5015589a3fdf2d4baff403e6f0be035a5d9742c1cae6295464449

And there’s the block hash!


Where is bitcoin.exe? I need to make a request through cmd.exe (commandline), but the only .exe file I can find is bitcoin-qt.exe, which doesn't respond to "getinfo", "getaddressbalance", etc. How can I find bitcoin.exe to make these requests?

The same executable is both the server and the client. Run it as a server, and then you can use it to issue commands like getinfo to the server instance.


guiminer shares 0 accepted 6 stale/invalid,what does the message mean? I am using guiminer .The pool is deepbit.com.
when I start mining, states show shares 0 accepted 6 stale/invalid
What does the message mean?

Uh Oh, the high level answer is it means you are not getting any bitcoins.

The lower level answer is harder to figure out without more information, basically, somewhere in the software/hardware stack is a problem that is preventing you from returning valid shares.  It could be a hardware problem but most likely it is just a configuration problem.

In the comments below, can you answer:
1:  What hardware are you running this on?  CPU?  GPU? model?
2:  What does your GUIminer window look like (attach a screen shot).
3:  Did you create a worker on deepbit.com?

Welcome to StackExchange!


University Bitcoin event ideas Can you give me ideas for interesting Bitcoin-related events/projects that I could launch at my university in order to attract people to the club?

You could:

Wear a Bitcoin shirt (people will ask ;))
Have a Bitcoin themed party in a student bar
Offer a Bitcoin meetup
Walk around on Campus with a sign "Ask me anything about Bitcoin"
Start a Bitcoin student club
Convince a Campus shop to accept Bitcoin
Convince a food delivery service close to campus to accept Bitcoin
Offer a competition where you offer a price in Bitcoin
Organize a Presentation/Lecture/Panel about Bitcoin
Write an article for your student newspaper/newsletter
Organize a viewing of one of the Bitcoin documentaries on campus


Trezor issue - "The bitcore server does not reply. Cannot connect to wallet" I bought a Trezor, installed everything, and sent some BTC to my wallet. Everything was working correctly. Then today, after not using the Trezor for a few days, I tried to connect and am unable to. After connecting the Trezor and putting the password in, I have a constant error message that says the bitcore server does not seem to reply, please select another server (as in screenshot). What does it mean and what should I do to connect to my wallet? It is the first time something like this has happened.

Try the other servers.

This means Trezor's blockchain explorers (for example, this one: https://btc-bitcore3.trezor.io) are under maintenance, or restarting, or can't be connected (DNS/ISP problems)...

If your Trezor can't connect to Trezor's servers, then it won't be able to make transaction (as it'll be unable to find older transactions, unspent outputs). Try the other servers. If it still doesn't work, contact Trezor support.


A couple questions on lightning network I want to develop Exchange where people would use my service to make payments using lightning network

I configured the LND node and created a wallet.

To implement this I would like to allow users to create addresses, and then to send money from one address to another (under same wallet)
Moreover, If they wanted to withdraw money to random simple-bitcoin address (like 1BzVLSNcwznjoynyuFgMXwaGeevycLgDEN)

Therefore the very general question is: Is it possible?

The  questions are:

Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?
Is it possible to send funds from address in lightning network to simple bitcoin address?
Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

Assume I created address#1 and address#2 under same wallet. How to transfer funds? Should I open a channel to do that?

You seem to confuse bitcoin addresses and lightning network ids. If you have a lightning node you have a node pubkey (called the node_id). Of course there is a corresponding private key / secret. From this you can derive bitcoin addresses in your bitcoin wallet that is attached to the lightning node. Those addresses are used to fund your node or to claim funds from channels that for some reason hit the chain.

  Is it possible to send funds from address in lightning network to simple bitcoin address?

As from the first part of the answer. once the channels hit the chain they are in the bitcon network and can be send to any other bitcoin address. There are exchange-services that allow and atomic on/off-chain swap. means you pay in invoice on lightning so that onchain bitcoin arrive at some address and vice versa.

  Are there any ways to choose sender address (in case users created thousands different addresses and user wants to send satoshis on behalf of himself)

If I understand your question correctly I would say it is possible. In the current setting people who offer a custodial wallet service seem to sign all invoices with the node ID of the lightningnode that is powering the custodial wallet. There speaks nothing against giving every user their own secrete and their own node id / bitcoin keys. You could even have virtual payment channels between the exchanges lightning network node that you maintain an run and between the "virtual" nodes of your customers which are basically private and suggest in the routing hints of the invoice to use the lightning node of your service.
In order to do these kinds of tricks you might want to switch to c-lightning as with their plugin infrastructure have an API that allow easier customization for such features.


Bitcoind not publishing blocks via ZMQ after reorganization On the testnet, I am running a bitcoin core deamon (bitcoind) and am using ZMQ to receive updates about transactions and blocks (subscribed to both 'rawblock' and 'rawtx').

I was curious as to how the ZMQ would handle chain-reorganizations, so I left it running overnight, logging the hash of every block I am notified about.

The next morning, using the getchaintips RPC, I can see that a fork did occur, as seen below:

[
  {
    "height": 1664502,
    "hash": "00000000000000315e8e11c0babc400475f3a9bfc21678f32ca8f0f878f7e807",
    "branchlen": 0,
    "status": "active"
  },
  {
    "height": 1664491,
    "hash": "00000000002d324cbfe1261d506f85e9baf61d30e762e342f4f44429d4d6e1fb",
    "branchlen": 1,
    "status": "valid-fork"
  }
]

According to my own logs however, I only received one block at height 1664491, which was the (now stale) block "...d4d6e1fb", as seen below:

Received block 000000000001a2a613d4c66e78233f4d9fbfcf8e08502507c39c95460120cbda at height 1664490
Received block 00000000002d324cbfe1261d506f85e9baf61d30e762e342f4f44429d4d6e1fb at height 1664491
Received block 000000000000001b8f4e6ba531411eae489a6dc5e9c9c07ef9e2288f3f623014 at height 1664492
Received block 00000000000000436dfb1f1bb687bca8b905a994bcaece65ede27170fd453462 at height 1664493
Received block 00000000002753e7d21158cb6bcb8093779c7a3e7868762161edf7bedf50ce3c at height 1664494
Received block 00000000000000f18a226b32ae8399a3faf3a4c4155e153e7067f02e31c02385 at height 1664495
Received block 00000000000000ff309ae5442d7e5a271fb22cd7cac97d95d8a47a3d9d135c18 at height 1664496
Received block 000000000000606889000756962c02619a11158559d6f060daf68cef25cd0726 at height 1664497
Received block 000000000016c716d24a9dbd115807be235bf74e4fd4dec33d2e84a55a3c3a8a at height 1664498
Received block 000000000000012f5a3553526f751cb385a630cad7c285ba84a5468e8085213a at height 1664499
Received block 0000000000000119e1f42b0d345c59eb9bbf7dc9ed7591b3716ebbc26a9930b9 at height 1664500
Received block 00000000000000022b963361b5b33dcc733f1b9a20adff75336ce48d29be2227 at height 1664501

Curious, I looked up the hash of the now-correct block at height 1664491, which is actually 000000000001d39f8f818382632fd4c4929a34da542103d37ebfba85980d6496.

Using the RPC command getblock, I can get the information about this block from my bitcoind daemon, which means that it knows about it. However, I was never notified about this block through ZMQ, which is somewhat concerning.

Is this expected behaviour? During a chain-reorganization, can I only expect ZMQ to publish the tip of the new chain, leaving me to figure out that a reorganization has occurred and then having to manually retrieve the new blocks?

Is this behaviour documented somewhere? I am not entirely confident in relying on my own experimentation, to figure out how to handle this.

Is this expected behaviour? During a chain-reorganization, can I only expect ZMQ to publish the tip of the new chain

Yes, a ZMQ notification is emitted any time the active tip of the chain changes.

If you have a chain B1-B2-B3, and there is a 1-deep reorg that rewrites B3, you end up with B1-B2-B3'-B4. The tip changes here from B3 to B4; it does not go back to B2 in between.

  leaving me to figure out that a reorganization has occurred and then having to manually retrieve the new blocks?

You have to do that anyway. ZMQ is not a reliable protocol, so you must be able to recover from missing messages (and in general, with a node going down temporarily). Dealing with this means discovering that the latest tip is a reorganization compared to what you had before.

This is true in general for ZMQ, you can use it as a notification mechanism to perform an update right when it happens, but you need infrastructure for fetching to recover too.

For more information, see the ZMQ documentation for Bitcoin Core at https://github.com/bitcoin/bitcoin/blob/master/doc/zmq.md.


Serialized Block doesn't have all the fields of a Block bitcoin-cli getblock 000000000003b9c88b8a4bf0bac7059913381bba300cdfddffc54a3d8c6e8105 false

This command will give block related data in the form of Hex. This Serialized data doesn't contain certain fields like confirmations, chainwork nextblockhash. Is there any reason for this?

This Serialized data doesn't contain certain fields like confirmations, chainwork nextblockhash. Is there any reason for this?

Those fields are not actually part of a block and cannot be contained in a block.

The number of confirmations for a block constantly changes as more blocks are found on top of that block. Thus it cannot be part of a block in the serialized data.

The chainwork does not need to be included in a block because it can be dynamically calculated, unlike the other data in a block.

The nextblockhash cannot be known at the time of creation for a block because miners can't see the future. The nextblockhash cannot be known wihtout the current block already existing.


Broadcasting an OP_RETURN transaction I am facing two problems below,

First is that I am trying to broadcast transaction which have OP_RETURN but blockchain.info continuously rejecting it, though I have broadcast it using bitcoind.

Second is that what is the best way to insert an OP_RETURN data into the raw transaction. Currently I am following this method ---> What is a step by step way to insert data in OP_RETURN?

but i know this is not a standard way.

I am using php and bitcoind server!

Any help would be appreciated :)

Thanks

blockchain.info's pushtx feature will reject transactions with OP_RETURN in it.

You might want to try my tool https://github.com/kaykurokawa/pushtx


Get the address from the transaction I'm from Ukraine and do not know much English, sorry. For example first block https://blockchain.info/block/000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f, when miner confirm this block he get bonus (50 BTC). And he make transaction https://blockchain.info/ru/tx/4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b, but in the first block be kept info about coinbase and script sig

Coin Base - 04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73

Script sig - 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f OP_CHECKSIG

And address 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa and hash for generate address 62e907b15cbf27d5425399ebf6f0fb50ebb88f18

where did you get the address?

EDIT

How get address or hash for generate adress from publicScriptSig

The initial Bitcoin transactions are slightly different from what we use today.

Addresses don't technically exist as far as the blockchain is concerned. They are simply a human-friendly representation of the underlying Bitcoin Scripts, that come with some properties like checksums to prevent typographical errors.

Original Bitcoin transactions were simply Pay-to-pubkey (P2PK), such as the one you see in the Coinbase above. In this, 04678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5f is the public key (note that this is the full public key, and not hashed).

Many coin explorers choose to treat this as a regular Bitcoin address, and perform the encoding steps outlined here. You can use this tool to check the public key creates 1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa as an uncompressed address (compressed keys were not known at the time of the genesis block, they were discovered later).

Modern day addresses are either P2PKH Pay-to-pubkey-hash (this hash is 62e907b15cbf27d5425399ebf6f0fb50ebb88f18 for the above key), P2SH pay-to-script-hash (this is used for multisig, and P2SH wrapped segwit), and P2WPKH pay-to-witness-pubkey-hash and P2WPSH pay-to-witness-script-hash segwit addresses (these start with bc1).

However, on the raw blockchain, all you will see is the Bitcoin Script that the addresses are encoding. Addresses are a purely human addition on top of the underlying transaction standards.


Solving PyCrypto 2.6.1 errors for Python 3.4 (Windows7 x64)? Whilst there's less of an issue with Python 2.7, Python 3.4 relies on the pycrypto library for numerous wrappers/APIs/tools such as BlockTrail, pycoin, pybitcointools, etc etc.

The error I'm getting:

building 'Crypto.Random.OSRNG.winrandom' extension

warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

error: Unable to find vcvarsall.bat

It's an issue with the gcc C++ compiler for Windows, I understand, however the binaries offered in that solution, sadly, don't cover Python 3.4 (version for 3.3 won't cut it, unfortunately).

A solution - other than installing pseudo-Posix (ie Ming32) - would be very useful for those transitioning to Python 3.xenter preformatted text here

Binaries available for Python 3.4:

https://github.com/axper/python3-pycrypto-windows-installer 32 & 64 bits

As outlined here on SE, binaries available for Python 2.x - 3.3:

http://www.voidspace.org.uk/python/modules.shtml#pycrypto

This solves the dependencies issues error compile failed with error code 1 using pip. Also, the following error screen (at the CLI) should not be appearing any more following installation, via pip or setup install, of pycrypto dependent libraries!

Skipping implicit fixer: ws_comma
running build_ext
building 'Crypto.Random.OSRNG.winrandom' extension
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
error: Unable to find vcvarsall.bat


How to make transaction with many inputs and one output in BitcoinJ? I'm trying to send all coins from my accounts (generated by HD Wallet) to one account with this code:
fun sendAllFundsOnAddress(address: String) {
        val receiver = Address.fromString(params, address)
        val tx = Transaction(params)

        val balance = Coin.valueOf(walletAppKit.wallet().unspents.map { it.value.value }.sum())
        tx.addOutput(balance, receiver)

        walletAppKit.wallet().unspents.forEach {
            val key = walletAppKit.wallet().findKeyFromAddress(Address.fromString(params, it.scriptPubKey.getToAddress(params).toString()))
            tx.addSignedInput(it.outPointFor, it.scriptPubKey, key, Transaction.SigHash.ALL, true)
        }

        walletAppKit.wallet().commitTx(tx)
        val sendRequest = SendRequest.forTx(tx)
        walletAppKit.wallet().completeTx(sendRequest)
    }

But I get NullPointerException, while it calculates witness (in input signing process).
Could you give any ideas, what's wrong?

SendRequest sendRequest = SendRequest.emptyWallet(receiver);
Transaction tx = walletAppKit().wallet().sendCoinsOffline(sendRequest);
System.out.println(Hex.toHexString(tx.bitcoinSerialize()));

In your original code, you loop through each UTXO in your wallet and add it as a signed input, essentially emptying the wallet to the output specified.
The code above does the same but using a different method.
You should also be calling completeTx() before commitTx(), but sendCoinsOffline() takes care of that for you.
The raw transaction hex is then printed out in my code, which you can then send to a node to broadcast. If you want bitcoinj's WalletAppKit to do that for you as well, look into Wallet.sendCoins().
The transaction generated with your code would be invalid either way, as you aren't subtracting enough (or anything, in your case) for transaction fees.


Pay to many addresses transaction time? I read here about the fees difference when paying to many addresses at once instead of doing it one after another.
I was wondering whether this applies to the transaction time as well.
Is it significantly faster if paying to N addresses at one?
If so, could you please give an example, say N = 20.

For all transactions, "transaction time" is effectively 0. A transaction is created nearly instantaneously and broadcast to the network with no noticeable delay to a human.

What you are confirmed about are confirmation times. The time it takes to get a confirmation is only related to the transaction fee rate paid and the time it takes to mine a block. The size of the transaction is irrelevant.


How would one "Encrypt" a message using a Bitcoin *public key* and use its private key to decrypt it? I have the following text string:

This is a test message.

Using my bitcoin public key (bitcoin address?), how can I encrypt this message?
How would I decrypt the message using a bitcoin private key?

Yes, this is possible.

However, I want to upfront state that this is not advisable for multiple reasons:

Bitcoin keys are intended to be single use for privacy reasons, and leveraging them for encryption unnecessarily encourages treating them as a long-lived identity.
There may be ugly and dangerous interactions when keys are used for multiple protocols independently.
You're much better off using systems that were actually designed for encryption than trying to piggy-back off Bitcoin's cryptography.
Implementing your own cryptography is very dangerous (in general, unless you know what you're doing, and get plenty of review from experts).

A scheme called ECIES exists that lets you leverage elliptic curve keys to create an encryption system.

In short, it works by:

The sender:

generates an ephemeral private key k using a strong cryptographic random number generator, with associated public key k = kG (multiplication refers to Elliptic Curve multiplication here).
computes an ECDH shared secret s = H(kP), where P is the public key of the recipient.
computes two symmetric keys x1 and x2 using a KDF seeded by s: (x1, x2) = KDF(s).
encrypts the message m using AES, with x1 as the key, to obtain c = AECEncx1(m).
compute a MAC on K and c with x2 as key: h = MACx2(K || c).
sends (K, c, h) to the recipient.

The recipient:

computes the ECDH shared secret, using s = H(pK), where p is his private key.
computes the same two symmetric keys x1 and x2: (x1, x2) = KDF(s).
computes the same MAC h' = MACx2(K || c)
verifies that h' = h, and fails if not.
decrypts the message using s, m' = AESDecx1(c).


Is there an efficient way to exploit arbitrages between the different exchanges? The Bitcoin ratio vs other currencies is not the same among exchanges. Is there currently a way to exploit this arbitrage and profit?

Yes.  Simply hold accounts on multiple exchanges.  In the account you should try to keep your holdings at 50% bitcoin and 50% other currency.

When there is an arbitrage opportunity you can execute "complimentary" transactions on both exchanges.  On one you buy the difference, and the other you sell the difference.  You can then equalize the accounts by transferring bitcoins between them, or withdrawing profits.  Don't forget to account for transaction fees on each exchange.

If you are so skilled most exchanges have APIs that would allow you to script interfaces for doing this automatically.  I recommend against accepting other people's scripts to do this since it gives the script access to your funds and it would be trivial for them to write the script to transfer your funds to them.


I want to use another wallet.dat file with bitcoin-qt. Is this possible? my situation is the following: I have a laptop with not much space on disk and therefore using bitcoin on a stick (I start bitcoin-qt with the argument "-datadir=location/to/stick). Now I wanted to transfer some bitcoins from my mobile phone to that account. Accidentaly I typed in a wrong directory (which doesnt exist) and bitcoin-qt lead me to the standard bitcoin directory (which is ~/.bitcoin). I didn't realize this and transferred the bitcoins to that address.

Now I would like to change the wallet.dat file from the ~/.bitcoin/ directory with the wallet.dat file from the directory on my stick, because my stick has all the blockchain already loaded. Is this possible?

What I have tried so far:

simply changing the wallet.dat files: when I now start bitcoin-qt it goes in a very very long loop (probably even an endless-loop). It just says "Dursuche erneut..." (german), what means translated: "Researching..."
doing the above, but with the additional argument "-rescan" ("bitcoin-qt -rescan -datadir=/location/of/stick"): it happens the same as above
trying to backup the relevant wallet.dat file inside the console of bitcoin-qt: when trying to back it up i get the error: "Error: Wallet backup failed! (code: -4)"

Can someone help me with this problem? Thanks in advance!

Edit: I wanted to rewrite my problem in another (probably easier understandable) way: I would like to overwrite the wallet.dat file inside the ~/.bitcoin/ folder. But doing so, bitcoin-qt doesnt stop loading (it just says "Researching...". Is there another way to do what I want?

You're on the right track -- in fact you're already using the correct command line switch, which is "-rescan".  But your mistake is thinking this is a quick solution.  It's not.  Rescanning the blockchain will take hours, depending on your processor speed.

This is a task you'll want to leave running overnight.  If the problem persists even then, record the error message you get once the rescanning has completed, and ask another question with that error message.

Your next option would probably be to actually transfer the Bitcoins using a tool like pywallet, but I'd wait until you've left this rescanning overnight before you try that, and seek guidance on how to use pywallet.


Is it possible that malicious bitcoin wallet providers provide pre-generated private-keys for users? We trust wallets like Ledger, Trezor, and etc. We believe the math that the randomly generated private keys are safe. But could it be possible that the private keys you thought are “generated” are actually provided and already stored in the database?
Imagine I am the cold wallet company, and I pre-generated like one trillion private keys secretly and saved them in my own database. For each wallet chip, I carefully choose 100 private keys and write them into the chip, and mark the keys in my database as used. When a user received the wallet and tries to generate a private key, the program in the chip just picks one of the 100 keys I wrote in. No one knows whether the keys are really generated or given by the wallet provider.
When I’ve already sold enough wallets, I can iterate all the used private keys and steal all my customs bitcoins.
That sounds practical and horrible. I am using a wallet but I cannot convince myself that my private key really belongs to me. Is that scenario possible? Is there any way to guarantee that the private key is not saved by others when the wallet is not open source?
Thank you.

You can verify the legitimacy of Coinkite's Coldcard key generation, assuming that you've used Coldcard's feature of generating the entropy for the seed words by throwing dice (the key generated will be based on your dice throws and so wasn't surreptitiously built into the card).
The web page https://coldcardwallet.com/docs/verifying-dice-roll-math gives details on how you can verify that the Coldcard honestly generated your seed words and key from your dice throws.
I should mention that I haven't actually carried out the verification, but it looks doable.  (Just be sure that you never enter the dice throws, seed words, private keys, etc., on any Internet-connected device, and never attach the Coldcard itself to the Internet or to any Internet-connected device.)


Made Consecutive Transactions But Unconfirmed at Blockchain.info wallet I received a sum of bitcoins and when i start spending it they are now unconfirmed.

When the first happened, i made another transaction immediately.
When the second shows that the problem still persist i made a third
Why is this happening. I paid the fees automatically generated by the blockchain.info system.

Is this due to my fee's are too?
will it still be unconfirmed if i made a forth transaction?

Was hoping to make a forth transaction of a dollar with a dollar fee. By percentage, and amount, those miners will be dying for my fee right?

why i wanna do this bcos according to my understanding, if they confirm my forth transaction, they would have to confirm the first 3 as well as the balance have to tally anyways for it to be legit and valid.

PLease advice and correct me if i am wrong
its been many hours and im tired of waiting
worried that the btc is gone or something

p.s i kinda spend the received btc before 1st confirmation, does it matter?
any solutions, advice, remedies etc will be much appreciated!

According to blockchain.info, the receipt of bitcoins to 17wWzcAXjKjG3LQcGCYJbu7cdi6LgaXB4t has been confirmed (43 times so far).

However, the proceeding transaction that removes the bitcoins from 17wWzcAXjKjG3LQcGCYJbu7cdi6LgaXB4t has not yet been confirmed.

This is likely being caused by the current transaction backlog of about 62,000 unconfirmed transactions. Blockchain.info does regard your transaction as a "High Priority" transaction, so hopefully it will confirm soon, but keep in mind that the backlog is considerably large right now.

Your bitcoins are safe, but they may be in limbo for several hours. The transaction will eventually either be confirmed or be dropped from the network. If confirmed, the coins will go to the intended recipient addresses. If dropped, the coins will remain in 17wWzcAXjKjG3LQcGCYJbu7cdi6LgaXB4t.


Get transaction details using bitcoinj library I am trying to develop an application using bitcoinj library. I want to get the bitcoin transaction details.

The details, that I want to extract from a transaction includes the following.

1) Who send me the transaction (Address and Public Key of the sender).

2) The amount that I received.

3) When was the transaction issued.

4) Get the data stored in the transaction in OP_RETURN.

maybe this helps

private void txHistory()
        {
            List<Transaction> txx = kit.wallet().getTransactionsByTime();
            if (!txx.isEmpty())
            {
                int i = 1;
                for (Transaction tx : txx)
                {
                    System.out.println(i + "  ________________________");
                    System.out.println("Date and Time: " + tx.getUpdateTime().toString());
                    System.out.println("From Address: " + tx.getOutput(1).getAddressFromP2PKHScript(params));
                    System.out.println("To Address: " + tx.getOutput(0).getAddressFromP2PKHScript(params));
                    System.out.println("Amount Sent to me: " + tx.getValueSentToMe(kit.wallet()).toFriendlyString());
                    System.out.println("Amount Sent from me: " + tx.getValueSentFromMe(kit.wallet()).toFriendlyString());
                    long fee = (tx.getInputSum().getValue() > 0 ? tx.getInputSum().getValue() - tx.getOutputSum().getValue() : 0);
                    System.out.println("Fee: " + Coin.valueOf(fee).toFriendlyString());
                    System.out.println("Transaction Depth: " + tx.getConfidence().getDepthInBlocks());
                    System.out.println("Transaction Blocks: " + tx.getConfidence().toString());
                    System.out.println("Tx Hex: " + tx.getHashAsString());
                    System.out.println("Tx: " + tx.toString());
                    i++;
                }
            }
            else
            {

                System.err.println("No Transaction Found");
            }
        }


Are there any legal implications when using localbitcoins.com? You can get BitCoins for under 100 bucks via CoinBase and there are people on LocalBitCoins who are advertising offers to buy BitCoin for over 100 bucks.  The spread is around $10; so I was considering arbitraging.  Are there any laws that would apply to transactions conducted through the LocalBitcoins website that I might not be aware of?  I'm thinking of a situation where a person you sell BitCoins to might, unbeknownst to you, turn around and do something illegal with them, and get caught.  Would the seller of those coins some how be in the wrong in the eyes of the law?

Edit: I'm looking specifically for applicable US laws it would probably have to be several thousand bucks a week to be worth the time.

I'm not a lawyer. In the U.S., the lack of mens rea in your example would not cause you to have violated any laws.  As a person selling your coins, it is not your responsibility to determine your buyer's intentions.

Of course, this is not quite so simple.  Money transmitters have regulations that include AML/KYC (know your customer) requirements which might be a factor here.   FinCEN has asserted that the conversion of bitcoins to and from cash (or other substitutes for value) is transmission of money.  So if you are engaged in trading as a business (i.e., not as an "infrequent" trader) you would likely be expected to be registered as a money service business (MSB), be licensed as a money transmitter and follow the AML/KYC requirements when conducting those trades.   Those requirements would involve gathering identity in certain instances, keeping records (for five years), and reporting suspicious activity.

Now, whether law enforcement will pursue a trader for trading without registering or following AML/KYC is unknown.  There are multiple individual traders whose banks have taken action to shut down service to their customers whose banking activity might be linked to providing Bitcoin exchange services.

So regardless of whether there is legal risk, there are other hurdles when engaging in trading to consider.


Unable to find peers when connecting through tor proxy I have tor running as a service on my computer and start bitcoind with -proxy=127.0.0.1:9050 but it fails to find any seeds through DNS or anything during startup, and even after leaving it on for more than a day it still not finding peers. I'm not getting any errors with connection or anything, and if I change port to for example 9051, it complains indicating that tor is running ok.
Also, if I run it without the proxy option I get peers immediately and syncing starts right away. Can someone please help me? I'm running 0.17.1.

Here is also a little bit of the console print during startup. I was running it without proxy right before this so it got a few blocks:

2019-03-12T00:45:31Z Loaded 8954 addresses from peers.dat  23ms
2019-03-12T00:45:31Z init message: Loading banlist...
2019-03-12T00:45:31Z init message: Starting network threads...
2019-03-12T00:45:31Z addcon thread start
2019-03-12T00:45:31Z init message: Done loading
2019-03-12T00:45:31Z net thread start
2019-03-12T00:45:31Z opencon thread start
2019-03-12T00:45:31Z dnsseed thread start
2019-03-12T00:45:31Z msghand thread start
2019-03-12T00:45:42Z Loading addresses from DNS seeds (could take a while)
2019-03-12T00:45:42Z 0 addresses found from DNS seeds
2019-03-12T00:45:42Z dnsseed thread exit
2019-03-12T00:46:02Z Syncing txindex with block chain from height 13187

Have you confirmed that tor is working correctly, say with a web browser? Temporarily set it to use a SOCKS5 proxy at 127.0.0.1:9050.

For more verbose information, try starting bitcoin with

commandline:
-debug=1
or
-debug=tor

bitcoin.conf:
debug=1
or
debug=tor


Can a bitcoin transaction hold an arbitrary string or strings for reference? I'm not too sure how I can expand on this.

Let's say that you want to tag the actual transaction with 'Rent' or 'Bill'.

Is there a field where I can insert a string for the other party? Note that this doesn't need to be hashed, it can be clear text.

No such support exists in the bitcoin protocol. Use a different receiving address for every transaction to uniquely identify them, if you do this correctly then no external labels are necessary.


Which transaction would get confirmed in an uncongested network? Scenario:

Mallory sends some bitcoin with a $1 fee
Later, Mallory double spends her transaction with a $5 fee
A new block is found

In an uncongested network with an average transaction fee of ~20 cents, which transaction would most likely go through?

On an uncongested network with an average tx fee of ~20 cents. Which transaction would most likely go through?

The transaction which confirms is the one chosen by the miner which finds the next block. There is no way to know which one they may choose. It may be the first one they saw, or it may be the one with the highest fees, or it may depend on some other factor that is relevant to the miner in question. It is simply up to them.


How do I find out what getwork would have returned for an already mined block? Lets say I want to find out what getwork would have returned for an already mined block http://blockexplorer.com/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d. How would I go about doing this?

Since we have quite a few questions about mining I took the liberty of creating a tool that demonstrates how to get from the getwork to the actual hashes and testing them against the target.

Your question is simply the reverse direction of mining, so let's get started.

All parameters are taken from the actual block.
This is a version 1 block so we start with the 01000000 (1 little
endian). This is followed with the 32 byte prev_hash, again in little
endian:

00000000000008a3a41b85b8b29ad444def299fee21793cd8b9e567eab02cd81

becomes

81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000

same goes for the merkle root:

2b12fcf1b09288fcaff797d71e950e71ae42b91e8bdb2304758dfcffc2b620e3

becomes

e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b

Next comes the timestamp. 1305998791 (4dd7f5c7 in big endian) is
c7f5d74d in little endian. Then the bits (encoded difficulty)
440711666 is 1a44b9f2 in big endian and f2b9441a in little endian. And
finally the nonce. Since you are asking for the getwork this is the
part that your miner will have to find, hence we just mark it out with
0 (00000000).

Putting it all together we have a data field of the getwork request
that is

0100000081cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122bc7f5d74df2b9441a00000000

Then getwork does a strange thing: it chunks the header up into groups
of 4 byte and switches the endianness. So that this string becomes

00000001ab02cd818b9e567ee21793cddef299feb29ad444a41b85b8000008a300000000c2b620e3758dfcff8bdb2304ae42b91e1e950e71aff797d7b09288fc2b12fcf14dd7f5c71a44b9f200000000

This is exactly 80 bytes in length and corresponds to the data field
(without padding). The getwork however includes some padding to become
two SHA-256 blocks of length 64 bytes.

The padding is discarded by the miner, but for completeness:

000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000

Next in the getwork we have the midstate. This is simply first 64
bytes of the header with a partially applied first round of hashing,
hence we can recover it from the block header (or data):

93c524951367c505ba69e616a010282d376ee807daa9562f69ce5bcd2dda787a

The getwork also includes an additional field that keeps some internal
state from the SHA-256 algorithm, the hash1 field:

 00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000

It is always constant, and is pretty useless.

The final field in our reconstruction of the getwork request is the
target. This is the one field we cannot actually reconstruct as it
depends on the pool setting that provided the work. It is likely to be
difficulty 1, hence the field itself is:

00000000FFFF0000000000000000000000000000000000000000000000000000

which is a long, below which the found hash has to be. Due to this
being Bitcoin it is again little endian and becomes

0000000000000000000000000000000000000000000000000000ffff00000000

The entire reconstructed getwork should look something like this

{
  "midstate" : "bfc1dbf82dd6335830eb42a5258fb7ceb4c566ed2ae7ec4ed1d23bd9dbbff68f",
  "data" : "00000001ab02cd818b9e567ee21793cddef299feb29ad444a41b85b8000008a300000000c2b620e3758dfcff8bdb2304ae42b91e1e950e71aff797d7b09288fc2b12fcf14dd7f5c71a44b9f200000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000000080020000",
  "hash1" : "00000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000010000",
  "target" : "0000000000000000000000000000000000000000000000000000ffff00000000"
}

To see how a miner finds a block from these parameters just enter them in the manual miner I created. Notice that if we fill in the nonce that is in the block (2504433986 or 9546a142 in its hex representation), we indeed get a block of the required difficulty.

Edit: Frank Buss contacted me for a correction: the midstate I posted above was wrong.


Bitcoin Cash totally different from BTC? I hear everyone talking as if when you have Bitcoin it is a matter of transferring in order to access your Bitcoin Cash instead of trading like other coins.

I was under the impression that it was an entirely separate coin and one would obtain it in the same way that one would obtain Ethereum if he had bitcoin by trading it correct?

Or if you have bitcoin do you at the same time have that much in BCC and it just needs to be moved somewhere?

BTC and BCC share a transaction history. Thus, to each blockchain, anyone holding a coin before the split has a coin in their address on each blockchain.


Scalability problem: is the end of Bitcoin near? I was reading in Wikipedia that the blockchain can only handle around 7 transactions per second:
https://en.wikipedia.org/wiki/Bitcoin_scalability_problem
With the soft fork for SegWi, I can imagine it could handle a little bit more, maybe 10 transactions per second.
That would mean that in one day we could have:
60 second * 60 minutes * 24 hours * 10 transactions = 864000 transactions/day
Here the official chart showing that we are often getting close to 400000 transactions/day
https://www.blockchain.com/charts/n-transactions
Does that mean that when we double the number of transactions, Bitcoin cannot scale anymore? Am I missing something?
If that's the case, considered the recent bull crypto market, we can expect there is a high chance Bitcoin reaches the maximum number of transactions per day, which will cause the crash of the Bitcoin price and a big shift in the crypto world.

TL;DR:
No, the end is not near—we're just getting started. 20× is boring, let's figure out how to do 100,000×.

Let's first talk about what we are trying to achieve. We are not actually trying to increase just the number of transactions. What we're actually trying to do is to grow the network's utility: allow more people to use Bitcoin with better privacy, UX, features, and security.
While increasing the count of transactions would increase the utility, it would do so only linearly. Ten times the cost for ten times the utility—it's a bit trite. It also leads down a path that endangers other properties that we relish about Bitcoin: e.g. financial privacy, rules without rulers, censorship resistance, and the ability to validate the blockchain individually. So, instead, we aim to get leverage on the cost.
For example, stop thinking in terms of transactions, but rather think in terms of payments. By batching multiple payments into one transaction, the transaction count doesn't increase, but for a slight increase of the transaction weight, we can increase the payment count. You mentioned segwit which introduced new output formats that have less transaction weight for equivalent effect. The upcoming taproot soft fork will add another weight efficiency improvement in the same vein.
Networks scale in layers. We can use the base layer of Bitcoin as a foundation to build other services on top. These other layers can operate with different trade-offs and make use of the base layer as a "court" to resolve contracts and settle disputes. An example is the Lightning Network which facilitates instant payments and enables a user to perform manifold payments via a single base layer transaction to open their channel. Timestamping of events and documents has moved from one nulldata output per timestamp to off-chain data structures that anchor to a single output per batch. Sidechains like Liquid and Rootstock provide new scripting and privacy capabilities, but limit the on-chain cost by performing most transactions in their own blockchains.
By being restrictive in the use of the base layer, the network forces us to do the hard work to make efficient use of a scarce resource. It's also honest in setting expectations: we would never be able to put every imaginable payment on the base layer, so kicking the can down the road by doubling the payments a few times only delays the necessary work. However, after exploring other avenues, and squeezing the most out of a small base layer, we can always come back to talk about increasing the base layer capacity, eventually.


Heartbleed: When will bitcoind 0.9.1 be released for Ubuntu 12.04? I am running bitcoind 9.0 on a server (without GUI) with Ubuntu 12.04 (Precise Pangolin)

When I enter in my shell

bitcoind getinfo

I get

{
    "version" : 90000,
    "protocolversion" : 70002,
    "walletversion" : 10500,
    ...
    "errors" : "URGENT: Upgrade required: see https://www.bitcoin.org/heartbleed"
}

When I go to https://www.bitcoin.org/heartbleed I find a link to the download-page: https://bitcoin.org/en/download. On this page is a link for Ubuntu:

https://launchpad.net/~bitcoin/+archive/bitcoin

There I can read, that I must add this lines to /etc/apt/sources.list

deb http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu precise main
deb-src http://ppa.launchpad.net/bitcoin/bitcoin/ubuntu precise main

I already had entered this lines some weeks before (to be able to install version 0.9)

But when I enter

bitcoind stop
apt-get update
apt-get upgrade
bitcoind
bitcoind getinfo

I get exactly the same message:

"version" : 90000,
...
"errors" : "URGENT: Upgrade required: see https://www.bitcoin.org/heartbleed"

What must I do to get a version of bitcoind that is not vulnerable to heartbleed?

See my answer here.  Short version: if you upgrade your system OpenSSL libraries, it is not necessary to upgrade to Bitcoin Core 0.9.1.

(If someone will upvote the other answer, we can close this question as a duplicate of the other one.)


how to explain to a child WHAT is BTC made of which is received as reward for mining a block? i looked at different questions in this forum but cannot still clearly figure out. i am not a developer.
ok, we have currently 6,25 bitcoin as reward for miners. how to understand in 1-2 non-technical sentences what do these 6,25 bitcoins (or millions of satoshis) represent? is this just a line of code (just numbers) which was programmed at the beginning?
i understand principle of bitcoin monetary policy, mining main principles, etc... i just do not understand WHAT is this 'coin' exactly... imagine me as child, how would you tell me what do these 6,25 numbers represent itself, what are they made of, are they just numbers we send to each other in transaction? any comparison to any currently mainstream store of values like numbers on banknote, gold ounce, etc...
thanks in advance

The 'coin' is an unspent transaction output (UTXO). It's a long number which specifies a location and some code to allow the UTXO to be accessed by a further transaction which supplies the right key. So ...

it's not a coin really
you never get sent the 'coin'. It remains on the blockchain.
you specified the utxo location before the block was mined, back when you put it in the block you mined. At that time you also created the right key to access the utxo value later.
if you have trouble with the idea that a number can have value, I suggest you consider what value your bank password has.
the value is on the blockchain, visible to all. You have control of it with the right key in your wallet.


Delete bitcoin address using Pywallet sorry for the stupid question but I can not understand that I have missed.
I'm trying to use the wallet for removing unused addresses. I get a message has been deleted successfully, but the client I still see those addresses, it seems that the removal does not work. Maybe I missed something, please help.

Hmm this is very strange, make sure that on deleting your bitcoin client (Bitcoin QT etc) is closed.


If in order to verify a block your hash just has to be lower than the hash in the block, then why won't 00000000000000000000000000001 work every time? So if in order to verify a block you just need a hash lower than the block in the hash, then why do you need to do a bunch of calculations rather than just using 0000000000000000000000000000000000000000000000000000000000000000000000000000001 every time?

It's not that you need a hash that is lower than the target - that's trivial as you pointed out. Rather you need to have a block whose block header must hash to a hash that is lower than the target. That is much harder to do because to find it either requires SHA256d to not have preimage resistance (i.e. given a hash, you can find the data used to produce that hash) or via brute force. Proof of Work works via the latter.


How does bitcoin find peers? I've seen a few questions about this already and they talk in generalities. I'm talking about specifics. If I start the bitcoin client from scratch, where in the source code does it actually add nodes.

http://bitcoin.sipa.be/seeds.txt seems to be a list of known clients, which is fine, but where in source does it connect. If I wanted to create my own private network, how would I accomplish this?

If there's just one client on the network, is that client still doing all of the work that bitcoin does? Mining, etc.

The peer discovery process, in order of priority:

the client attempts to connect to peers in it's local peers.dat database
the client attempts to gain peers from one of four DNS-based seed nodes, hosted by Bitcoin developers
the client gives up

The peers.dat database is filled with information using addr messages, which connected peers use to exchange their knowledge of other existing nodes in the network.

If you want to make your own local nodes, you need to set discovery to 0, which will disable advertising of the peers as available for incoming connections. You can then forge connections using local DNS or simply ip addresses of other local nodes with the connect option. At least one of these will need to be connecting out to the wider network for you to be able to stay up to date, and to mine on using p2pool. More than one connection out is vital to the stability of your private nodes.


How do you inspect a transaction? How do you inspect a bitcoin transaction to avoid getting scammed by a double spender?   I'm buying bitcoins in cash and the seller said I could inspect a transaction instead of waiting 6 blocks.   Is this safe?

There are no means of inspection that could lead to a safe assumption that a transaction will not get invalidated by a double-spent input.

Giving up your money and leaving the trade with zero-confirmed coins is asking to get scammed.

Waiting for one confirmation is only safe if you are certain that the seller exchanged a total of less than 25 coins over the past few minutes (both in-person and online) and does not control 50% or more of the network's total hashing power (so it wouldn't cost him a penny to perform this kind of attack). Luckily for you the most a mining pool currently holds is 25% of the network's total hashing power (attacks are still possible at that rate but less likely to succeed and cost more for the attacker) but unfortunately you can never be sure that the seller or a partner-in-crime didn't spend more than 25 coins online so one confirmation won't do the trick either.

Waiting for more confirmations will always increase your security to a great extent. 6-blocks confirmations are not 100% safe either but they are way much more secure than single-block confirmations in all aspects.

On a side note, a reliable escrow service could take the hassle away and make your life easier when trading with strangers on the street.


0 hashes per second in Qt for new altcoin Lately I have become interested in the way crytocurrency works. So I decided to make my own cryptocurrency to learn it's internal workings.
I used a clone of SmallChange and followed this guide.
Everything compiled well, but when I run the program, be it via command line or the qt interface, when I tell it to start mining it just tells me that it is mining but the hashespersecond are 0.
I tried building the litecoin source on my machine and used the exact same configuration that I used in my own altcoin (the same ".conf" file) and when I tell it to mine it does mine.
For my altcoin I used the ports:

55883 for RCP
55884 for P2P

My question is, is my computer not mining my altcoin because I'm alone on the network or it is happening because I have made some mistake in my code?
Thank you in advance :)
Edit: my output for "getinfo" is:
{
 "version" : 1000000,
 "protocolversion" : 60001,
 "walletversion" : 60000,
 "balance" : 0.00000000,
 "blocks" : 0,
 "connections" : 0,
 "proxy" : "",
 "difficulty" : 0.00024414,
 "testnet" : false,
 "keypoololdest" : 1369621665,
 "keypoolsize" : 101,
 "paytxfee" : 0.00000000,
 "mininput" : 0.00010000,
 "errors" : ""
}

and the output for "getmininginfo" is:
 {
 "blocks" : 0,
 "currentblocksize" : 1000,
 "currentblocktx" : 0,
 "difficulty" : 0.00024414,
 "errors" : "",
 "generate" : true,
 "genproclimit" : 4,
 "hashespersec" : 0,
 "networkhashps" : -9223372036854775808,
 "pooledtx" : 0,
 "testnet" : false

}

i did same thing bro :) i am very happy when you saw your question :) firstly you have to connect another computer . and you have to see "connection=1" To do that, you have use command: ./testcoin -connect= # . and you have to add listen=1 to main pc and addnode for both pcs.However, hashespersec is also zero for me :(


why aren't transactions on the blockchain stored like "from, to, amount"? Wouldn't it save lots of block space and reduce transaction fees? It seems to me the current method wastes lots of space. I wasn't able to find a technical reason for the current method

On some blockchains, they are. They just don't work that way on the bitcoin blockchain. There are advantages to the way bitcoin does it. What if you want to send bitcoins to more than one destination or from more than one source?

Also, bitcoin's scheme is much simpler. Either a particular transaction output exists and is unspent or it isn't. A balance is the end result of a very large number of transactions and much more complex to verify.


Is it possible to create multisig wallet from command line? In a situation where electrum script is included in PATH so that electrum command args... is possible from terminal command line, is it possible to create multisig wallet in this terminal?

I know that electrum create -w path/to/wallet will create wallet in the path path/to/wallet.  I'm wondering if it's possible to create multisig wallet from command line also.

Not entirely via the CLI. The create command can be used to create new wallet and the restore command can be used to restore from seed, xprv, xpub, private keys or addresses. Neither supports multisig though.

There is createmultisig that lets you create a multisig address from public keys. But it won't create a full fledged wallet.


Monitor bitcoind node traffic? I was wondering how I would go about measuring the traffic being used on my network for the bitcoind node I am running. It's running  on the standard 8333 port, using linux as the OS.

I was looking at iftop which seems to be a tool for doing what I want to do, but I am specifically looking to only monitor traffic associated with the bitcoind node.

Basically I'm trying to see if my implementation of a QOS for the node is working properly.

The RPC interface has a command getpeerinfo which will give a breakdown of upload and download metrics per connected peer.

  {
    ..
    "bytessent": 67619177,
    "bytesrecv": 47229533,
    "conntime": 1446238156,
    ..
  }

Totals for the session for all peers are available with getnettotals.

{
  "totalbytesrecv": 3664310320,
  "totalbytessent": 619085268,
  "timemillis": 1446521403149
}

vnstatis an external tool which will do system-wide monitoring and statistics collection over extremely long time periods. There is no per process breakdown, but it's a good thing to have around for a global view anyway.

eth0:
       Oct '15     70.88 GiB  /    2.65 GiB  /   73.53 GiB
       Nov '15     19.61 GiB  /  976.31 MiB  /   20.57 GiB  /  288.12 GiB
     yesterday      9.40 GiB  /  471.48 MiB  /    9.86 GiB
         today      1.13 GiB  /   66.35 MiB  /    1.20 GiB  /    8.49 GiB


Who generates a new block in bitcoin blockchain? I know miner is a generator who finds nonce which provides hash value starting with a bunch of 0's.
I have a question who the miner is.
Suppose Alice wants to send one dollar to Bob.
In this case is Alice a miner?
I dont understand yet.

Yes. Miners are the ones who generate new blocks on the blockchain. But in your example, Alice and Bob act as sender and receiver, neither is considered a miner.

When Alice sends Bob $1 (0.0002384 BTC), their transaction gets added to the blockchain's memory pool or mempool of still pending transactions. From there miners compete to see who can find the correct solution nonce to solve the math problem, validate a block of mempool transactions, and receive the 12.5 BTC mining reward.

Once Alice and Bob's transaction is validated by a miner it is considered confirmed. 6 confirmations (the original, plus the next 5 blocks) is considered to be irreversible and safe to classify as complete.

Additionally, it's important to notice that there is no way to find out or expect who will be the next miner due to the nature of mining (proof-of-work) which is based on randomness. Indeed, randomness provides robustness to the network. For example, an attacker won't be able expect from where the next block will be generated. Here is nice paper on that.

A miner can be anyone who is running a full bitcoin node (with the mining flag enabled). However, because of how difficult it is to solve the math problem, the majority of miners choose to pool their resources into a mining pool. The pool's participants then collectively share the 12.5 BTC reward proportionally to how much work (read computing power) each miner contributes to finding the solution.

To gain an advantage, most of today's miners use specialized hardware called ASICs.

From Wikipedia

  An application-specific integrated circuit (ASIC) /ˈeɪsɪk/, is an integrated circuit (IC) customized for a particular use, rather than intended for general-purpose use.

Asics are designed to maximize the efficiency of the problem solving process and have basically made CPU and GPU mining pointless for Bitcoin. However, GPU mining is still extremely popular with several Altcoins, which were specifically designed to thwart ASICs and level the playing field.

Take a look at this Reddit thread for more info on which coins you can still GPU mine effectively.


Bitcoin in wallet transactions but not on the blockchain (old wallet) I've been checking old wallets and found an unconfirmed transaction that's on the wallet but not on the blockchain
transaction id (missing from blockchain)
ab5eb776a36b5552570088ba7bf3563780c91f0044c2a170481f75a5004dfe2a

receive address (showing 0 BTC)
1LwBvLheVfjP3RUTipZtPRRPa13GSH2sAY

My wallet showing a transaction

How do I access these BTC and get them onto the blockchain? I could be wrong but I believe that it's such an old unconfirmed transaction that it doesn't even show on the blockchain.
So far I have tried forcing the transaction to go through again with a hex code of the transaction on https://blockchain.info/pushtx, but it didn't work
Please help! It's a long shot but the amount of BTC is huge, so I want to try every approach at accessing the BTC before giving up.

I'm afraid you won't be able to access these funds.

How do I access these BTC and get them onto the blockchain? I could be wrong but I believe that it's such an old unconfirmed transaction that it doesn't even show on the blockchain.

The transaction is not, and has never been, confirmed on chain. From the perspective of the network, it doesn't exist.

So far I have tried forcing the transaction to go through again with a hex code of the transaction on https://blockchain.info/pushtx, but it didn't work

If that doesn't work, it likely means the transaction is spending funds that no longer exist (i.e., it was double spent). The error you get from sendrawtransaction does not mean anything, as your node is not fully synchronized yet.
Regardless, I'd suggest to let your node synchronize with the network. It's possible that it has received other transactions at that time, which did get confirmed.


Bitcoin taxes question for USA If one were to receive Bitcoins then immediately use a conversion service (for example to PayPal) would gains/losses need to be recorded?
If so, is there any software that can do this automatically?
Thanks in advance.

Bitcoin is taxed as capital property (see IRS Notice 2014-21), and a tax event occurs any time it is converted into fiat (e.g. USD) or other assets. You would have to record each transaction and include it in 1040 Schedule D.

This is the difference between how much USD you received less the value of those BTC when bought/acquired them. If you had owned those coins for more than a year, you can report it as "long-term" gains, which has a reduced tax rate. Otherwise, it "short-term", which is just taxed as normal income.

You can use https://bitcoin.tax to help work it out.


Is it possible to reduce the block interval in the future? Is it possible in future to reduce the confirmation time of the transactions? Can it somehow be reduced to less than 10 minutes? Can it be made faster?

Yes and no. Any change to the protocol is possible if and only if > 50% of the active nodes "agree" to it by adopting that protocol change.
Getting everyone to agree is very hard though. For example, Bitcoin Cash (BHC) exists as a fork of Bitcoin because of a dispute over increasing the block size. It seems likely such a push to lower the block time would lead to a similar messy debate and ultimately a split.


Mine BitCoins on a Mac? Ok, so I can mine BitCoins on my Mac... using my Windows Partition.

Like a lot of people I hate Windows.

I'd use Linux first (I have a WUBi partition), but I'd like a BitCoin miner for Mac that does not use OpenCL!

I'm using

a Mid 2012 MacBook Pro
with integrated Graphics,
2.5GHz processor Core i5
4GB RAM.

My laptop does not support OpenCL. I know of MacMiner, but I believe that needs OpenCL. Using my CPU to mine (on Windows) I get 1.7MHz, but on the GPU (on Windows) I get 4.7 and sometimes 5MHz.

I'm getting an iMac this Christmas, so maybe it'll be a little better for this.

So yeah, how can I start mining BitCoins on my Mac? Any software?

Your hardware is useless for mining. You'd spend more money on power than you could ever make back mining on a rig that isn't built for mining.


Recover the bitcoin using my bank account transaction details I lost my wallet and i purchased using my internet banking and Is there possible way to recover my bitcoin using my bank account transaction.

Bitcoin has no relation to the banking network - if you're lucky, you might have purchased BTC on a custodial platform (one which keeps the private keys for you) and your bank account's transaction history can help you identify which platform you had sent funds to. You should then be able to contact their support to regain access to your account.

If you moved the BTC to a wallet where you maintain the private keys and have lost access to that, you are out of luck unless you made a backup.

If someone asked you to transfer them fiat through the banking system, promising Bitcoin or high investment returns in exchange, you may have been scammed.


How can I check the hash of a bitcoin block? Let's pick an example bitcoin block: #499583

This is the block: https://insight.bitpay.com/api/rawblock/000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da

It starts with 00000020164a1e4a7f34b96b0e201d....

I'm trying to hash it so that the hash is 000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da again. This is my Javascript-Code:

var Bitcoin = require('bitcoinjs-lib');
var request = require('request');
var crypto = require('crypto');

function getRawBlock(blockHash) {
  return new Promise((resolve, reject) => {
    request('https://insight.bitpay.com/api/rawblock/' + blockHash, // hitting an insight API to get the full block
      (error, response, body) => {
        try {
          var block = JSON.parse(body); // result is in JSON
          resolve(block.rawblock)
        } catch (error) {
          reject(error)
        }
      })
  })
}

getRawBlock('000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da')
  .then((rawBlock) => {
    var hash = crypto.createHash('sha256').update(rawBlock).digest('hex');
     console.log(hash);
  })
})

But the result is 484cd10be70dbc7615dd9a71b1f91375b100715d9b2a0ecc6a05b9d247a8cda9.
What am I doing wrong? The result should be 000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da. Do I hash something in the wrong format?

Seems to me that you are hashing the whole block instead of header only. Take my code (in C++).

void test ( )
{
  const MyByteArray header ( QByteArray::fromHex (
     "00000020" // version
     "164a1e4a7f34b96b0e201dcc6a623c63fe3874696e4875000000000000000000" // prev hash
     "49de8b4f4bfa9fc890d3d28a93156a111f891dc680090cd497b58a7d5c2b09cf" // merkle
     "2f62345a"      // timestamp
     "edb00018"      // bits
     "ffdfd257" ) ); // nonce
  const MyKey32 key ( header.sha256d ( ) );
  qDebug ( ) << key.toString ( );
}

and the output is:

000000000000000000677c4077da7c9f01dde5f332ba2fbff962ee699714d5da


Can a two-block-sized chain override the main chain? After i read this:

Honest generators only build onto a block (by referencing it in blocks they create) if it is the latest block in the longest valid chain. "Length" is calculated as total combined difficulty of that chain, not number of blocks, though this distinction is only important in the context of a few potential attacks. A chain is valid if all of the blocks and transactions within it are valid, and only if it starts with the genesis block.
https://en.bitcoin.it/wiki/Block_chain

Would it be possible to mine a block after the genisis block, which has a higher difficulty then all blocks in the mainchain together and override the blockchain with my own one? --- just hypothetical, i know that such a difficulty is ismost impossible to reach... but with some luck?

No, it would have to be much longer.

Besides the fact that there are checkpoints, the difficulty of a block is defined by its target value, not the actual value of the block hash. The block hash just has to be less than that target value. So you would need to make the target value be very small (i.e. make the difficulty very large). In order to do this, you would need to mine at least 2016 blocks to trigger a difficulty adjustment. But difficulty adjustments are capped at being no more than 4 times harder (and no less than 4 times easier) than the previous difficulty. So you would need to trigger many difficulty adjustments in order to get your difficulty up to the necessary value.

Once you get your difficulty high enough, yes then you could mine a block which has a higher difficulty than the sum of the entire blockchain's difficulty, and then nodes will accept your blockchain (assuming you started from the last checkpoint).

However doing this would be extremely computationally infeasible. In order to mine said block, you would need to have the sum of all the mining power at each block in order to mine one of these large difficulty blocks. What this means is that if block 1 was mined by one machine, and block 2 was mined by the same machine, then you would have to have at least two of those machines in order to mine a replacement block 1 that has a higher difficulty than the sum of the difficulties of blocks 1 and 2.


storing bitcoin's database directory on an external drive? I have a new-ish powerful laptop with SSD, limited to 128GB.
It came with a RAID which somehow didn't work for installing linux, so I had to disable the RAID and now I have actually two 64GB disks really.

That's just not enough to run the bitcoin client on it, the arch linux wiki recommends 80GB of disk space, and even ignoring that rather generous amount, it would fill up my disk.

Is it possible to run the client with a local wallet and all that but having the bitcoin DB on an external drive?

Bitcoind requires your wallet file to be in the same location as the rest of the files, so I think what you want to do will be difficult, as it might require editing the source/recompiling

However, you can just store your wallet on the external drive too.

You can encrypt the wallet if you don't want it to fall in the wrong hands

You can use the backupwallet command to back it up if you are affraid of the quality of your external drive...