How to transfer addresses from Satoshi client to MultiBit? I'm trying to take an address from my Satoshi client and transfer it into my new MultiBit client. I have found several questions similar to this, and have tried all their solutions, but to no avail.

This is the basic process I go through: (Note: The address & private key I use in the example are empty; made for this example)

On the Satoshi client, I go to the console and type: dumpprivkey 16tTCqoguKk7ZvLXsUyUE5JKJQ2VMDpCQj
I get the private key
KzD6eDjxCwPf8YTGiGhNWAyg4HU4H6iWXYEqCyKGhH8Dy9ZKhdui
I confirm on bitaddress.org that the private key does indeed output the public key above.
I then export the private keys on MultiBit (Version 0.4.19 BTW), and add the private key listed above into the exported file.
Importing the private keys back, the public address 1GWqf362pUzGfrZ7K7Thazd27aRBsakGcX is imported, rather than 16tTCqoguKk7ZvLXsUyUE5JKJQ2VMDpCQj.

I'm not exactly sure if I'm doing something wrong, or the problem is some sort of bug in the software...
Please excuse me if I sound "Bitcoin-Illiterate", I'm kinda new to this stuff.

Notice that your private key retrieved from the Satoshi client begins with a K. According to the List of Address Prefixes, that means the key is exported in compressed form.

MultiBit's export file saves private keys in uncompressed form. Private keys in uncompressed form begin with a 5.

You can divine the uncompressed key using Bitaddress's wallet details page. Just look for the private key that begins with a 5. It's the private key that has a QR code next to it.

Repeat the latter part of your steps, adding the uncompressed key to the export file and then importing that file.


Can I store the whole blockchain yet keep my actual wallet with bitcoins offline? I want to have the full blockchain "just in case" yet have my wallet be OFF the internet.  Like, on a laptop that's just for bitcoin, with wireless turned off.  Or possibly on an external drive that is backed up on multiple other external drives.  So can I use bitcoin core, and just store the blockchain there.  And use my other wallet when I want to receive money.  I have a substantial amount of money in coinbase and I don't trust keeping it there.

Yes you can,
https://bitcoin.org/en/developer-reference#importaddress

What you need to do is to create a watch-only address on your online computer.
This can be done by "importaddress" in console and use no rescan. Rescan, after you have imported all the addresses to get their respective balances.

To spend BTC from your offline computer, you need to sign the raw-transaction offline( created on your online computer).
Take a look here how-to: https://bitcointalk.org/index.php?topic=651344.msg7306076#msg7306076

If you use Electrum wallet, all these steps can be simplified a lot.


How does Bitcoin get over the capital controls problem? So, people now talk about Bitcoin as a store of value instead of as a currency. I'm confused as to how central banks will respond to this? Right now, bitcoin is not widespread. Assuming bitcoin becomes more used by financial institutes and ordinary people and starts to be comparable to Gold as a store of value (in terms of number of users), wouldn't central banks lose capital controls? That would be against the interests of every government on earth and wouldn't that create a huge incentive for governments to ban bitcoin? Thanks.

Bitcoin is hard, but not impossible, to censor so if governments really wanted to censor bitcoin transactions they could do it. Right now governments seem more interested in wooing bitcoin related businesses to their countries because they see it as something that can contribute to economic growth. But, yes, if they changed their minds they could shut it down.

However, what would happen if they shut it down? Would developers and users just give up? The answer is that we won't. We'll switch to crypto currencies that are even harder to shut down. Crypto currencies with anonymous ledgers like Monero. I don't think governments want that to happen. At least with bitcoin the ledger is transparent.

There is a historical precedent to this. Bitcoin isn't the first attempt to make a digital currency. I suggest you read about digicash and the problems it encountered getting traction. If governments push people will push back!


Adding «Donate» Bitcoin button in README.md file GitHub repository 1. Summary

I would like to add a «Donate» Bitcoin button on my README.md file located on my GitHub repository.

2. Not helped

2.1. Manually button

HTML-code using bitcoin protocol:

It's work on HTML page of my GitHub Pages site, demonstration.

But in .md GitHub files not one codes of Meta Stack Exchange answer not work for bitcoin protocol, demonstration.

[**![Bitcoin Donate Button**](https://www.drupal.org/files/project-images/bitcoindonate.png)](bitcoin:1DF9jgzftTFn4ZnDV2YEjUtZ3uHtBywj57?label=In%20the%20treatment%20of%20Sasha's%20teeth&amp;amount=0.0037)

![Bitcoin Donate Button](https://www.drupal.org/files/project-images/bitcoindonate.png)

2.2. Third-party

JavaScript not supported on GitHub README.md pages. By this reason doesn't help me:

Bitcoinate
Bitcoin donate
Leo Bogert simple button

1. Demonstration

Click to donate button on page:

https://github.com/KristinitaTest/KristinitaTest.github.io/blob/master/donate/README.md

Link must be opened in your Bitcoin client, example:

2. Relevance

This answer is relevant for April 2018. In the future, the data of this answer may be obsolete.

3. Redirect

You need to use redirect.

User click on Donate button → is redirected to Bitcoin-Redirect page in current tab → then opened bitcoin wallet of user → in current tab is opened page, on which Donate button is situated.

4. Details

4.1. Source of Donate button

[![Bitcoin Donate Button](https://i.stack.imgur.com/MnQ6V.png)](http://KristinitaTest.github.io/donate/Bitcoin-Redirect)

If you click the image, you will go to a page http://KristinitaTest.github.io/donate/Bitcoin-Redirect. See answer on Meta Stack Exchange, how use Markdown markup for this construction. Alternative worked HTML source:

4.2. Source of Bitcoin-Redirect page

Use JavaScript methods window.location.href and history.back.


Is it possible to skip verification of blockchain data when using bitcoin core? Because I need bitcoin core client only for JSON-RPC requests. Will I need pruned initialization or normal initialization of bitcoin core client for successfully running such requests? (I guess client software does full verification in both modes, just avoids storing of blocks in former mode.) From what I understand if I prune the block data, It will only store around 2GB of data on my local system. However, I am not sure if I need nth block data using JSON-RPC call, which can be any block from beginning itself, will my pruned client get it from the main chain with the help of its peers? I just wanna save my bandwidth and also wanna use JSON-RPC feature. I am really confused. Any help will be appreciated.

I just wanna save my bandwidth

Running a node in pruned mode will not save you bandwidth during the initial block download (sync), you still need to download all blocks and validate them, even if you don't store them longer term (pruning lowers disk space requirements). You can fine-tune your data upload limits in the bitcoin.conf file though.

Most RPC calls will work with a pruned node, some will not though. From a quick search for some examples, see:

https://github.com/bitcoin/bitcoin/blob/v0.11.0/doc/release-notes.md#block-file-pruning

https://github.com/bitcoin/bitcoin/blob/v0.12.0/doc/release-notes.md#wallet-pruning


Miners conceding forks When bitcoin forks, does anyone know how many blocks ahead one chain gets before the miners on the shorter chain concede?

I am doing a research project on modeling Bitcoin, and I am wondering how realistic it is for miners to abandon their chain as soon as they receive a chain that is one longer than the one they have.

I imagine that as chains get longer (and more money/computational work is at stake) miners are more likely to try to catch up from a 'deficit' of one block.

There is also the fact that a miner with sufficient hashing power (40+ percent) has a reasonable chance of catching up from being behind.

Any thoughts on this stuff?

Miners are incentivized to always mine at the longest valid chain tip. If there were incentives to not mine on the longest known chain, then we would expect the network to be unable to maintain consensus on the blockchain's state. And without that, it would be impossible to build a reliable financial system.

So it isn't about 'miners conceding a shorter chain', its just that miners will always all be mining at the chain tip. Currently, the majority of the block reward is constant (the newly minted coins), so a miner should not really care if they mine block X or block X+1: their reward will be ~the same in either case. As such, a miner is incentivized to just mine at the chain tip, because the chance of finding a valid block at either height is equivalent, but the potential reward for finding one at the chain tip (thus extending the longest chain) is much larger. Finding a block at a height that has already been found will likely mean the miner gets no reward, since that block will be rejected by the network as not being a part of the longest chain.

All of the above concerns situations in which there is not a fork due to a change in consensus code, just the regular competition between miners. If you mean to ask about forks caused by changes in consensus code, you'll need to be a little more specific, as the nature of the code change will affect the game theory. But in general: Bitcoin works because miners are incentivized to mine at the chain tip. Without this incentive, the system would likely not achieve the stability required to give any sort of reliability guarantee.


How does Bitcoin choose to which miner the reward will go? Let's say 100 miners with similar hashrate all try at the same time to mine the same block and finish at the same time, how will Bitcoin choose to which miner the reward will go? Is there some prority protocol?

It's all about probability. In about 10 minutes, a miner among those 100 will finally achieve to solve the proof of work for the given block before others will. So, he then will write that block on the blockchain, using it's address in the receiving address field of the coinbase transaction, thus obtaining it's reward.
what happen if they all mine the block at the same time
In that case, the blockchain would be temporary forked on the block at height X, given X the number of the block been mined at the same time by more than one miner. This won't last forever. Remember the golden rule of bitcoin: the longest chain win. Among those forks, one will definitely be resolved (again, it's all about probability at the end of the day), meaning more hashrate will be brought to it, so it will grow faster (speaking about blockheight) than the other. That one will become the current blockchain.
What happens to the other forks? Well, they're simply not valid blockchains. They contain outdated data. If forking miner continue to mine on those blockchain, they'll do at a lost, because they will get rewards on a blockchain which is not the main one
Is there some priority protocol? No, absolutely. Just probability. The more hashrate you have, the more probably you can mine the next block
how the precise time of completion is calculated (is it using the miner's computer clock as timestamp? From the bitcoin wiki

A timestamp is accepted as valid if it is greater than the median
timestamp of previous 11 blocks, and less than the network-adjusted
time + 2 hours. "Network-adjusted time" is the median of the
timestamps returned by all nodes connected to you. As a result block
timestamps are not exactly accurate, and they do not need to be. Block
times are accurate only to within an hour or two.Whenever a node connects to another node, it gets a UTC timestamp from it, and stores its offset from node-local UTC. The network-adjusted time is then the node-local UTC plus the median offset from all connected nodes.


Allowing bitcoind startup script to access daemon commands I'm trying to create multiple full nodes on a single machine each using a different data directory and static ip's.
My directory layout is

~/bitcoin1
~/bitcoin2
~/bitcoin3

For each direcotry I have a bash script named btc(number) with this:

!/bin/bash
~/bitcoin1/bitcoind -conf=~/bitcoin1/.bitcoin/bitcoin.conf

With the config files respectively stating the data directories and parameters.
My issue is whenever I try to run a command like "Getinfo", I have to pass the whole config file argument to the daemon like so:

~/bitcoin1/bitcoind -conf=~/bitcoin1/.bitcoin/bitcoin.conf getinfo

How can I make my start up bash script allow the daemon commands as well?
I'd like to achieve this:

~/bitcoin1/./btc1 getinfo
or btc1 stop

Thanks!
P.S. Sorry for the formatting. Never posted here before...

Add $1 to the end of the command in your script. This is more a general scripting question. Doesn't have much to do with bitcoin.

~/bitcoin1/bitcoind -conf=~/bitcoin1/.bitcoin/bitcoin.conf $1


Possible to estimate next difficulty based on terahashes? Here is what I have estimates on: There exists hardware capable of 60 gigahashes per second. Over the next few months, X amount of these will be mining bitcoins.

Difficulty is recalculated every 2016 blocks.  X * 60,000 megahashes = Y terahashes to total mining.

At current difficulty it will take a machine calculating at 60 gigahashes about 3.6 days to solve 1 block. With just 700 of these machines each solving 1 block every 3.6 days, difficulty will be at Z within a week, where difficulty is then recalculated to even out the time period of solving blocks (if I understand correctly).

The variable I have is about what the implications are of the algorithm for difficulty. Is it intended for there to only be a finite number of blocks solved in a certain timeframe?

Is it intended for there to only be a finite number of blocks solved
  in a certain timeframe?

Yes.  The intended rate is 1 block per 10 minutes, which is 144 blocks per day, which is 2016 blocks every 2 weeks.

To estimate the difficulty, flip around the "time to generate a block at a hash rate" equation

difficulty=((Time for a block to be found in seconds)*(hashes per second))/2^32

Where the time is 600 and the hashrate is whatever you want.


Testnet fallback nodes Is there a list of nodes on Testnet that work like the fallback nodes on the Mainnet? I am trying to test my Bitcoin communication code and I'd like to start with just one IP I can rely to be on and responsive.

Blockexplorer.com runs a testnet node all the time.


How to send bitcoins from selected address on blockchain.info wallet? I have wallet on blockchain.info, with two addresses. I want to send some bitcoins from only one of them using quick send. I don't see where I can select source (input) address.
Where I can see my default (master?) address?
How can i change it?

The Blockchain.info's My Wallet "Quick Send" feature just selects one of your addresses that has a sufficient balance to fulfil your payment. If none has, it will combine multiple to fulfil the payment amount.

How Blockchain.info choses the address is not specified. My best guess is that it will try the oldest output first. Keep in mind that it is not possible to always send from the same address since you will most probably receive your bitcoins on multiple addresses.

If you want to specify from what address to send, you can use the "Custom" option. It will let you configure your transaction from input addresses to change addresses. It also supports multiple output addresses.


How to suggest to our church that they should accept Bitcoin payments? A little bit of context: I send 10% of my profit (the tithe) to a church. Along with the tithe I send money for different projects.

I guess they can be considered donations.
This church is a non-profit organization.

Recently I started to get profit in Bitcoin (weekly, I'm paid in Bitcoins for the work I do). It's not a small amount. Now, obviously, the next idea that came in mind was: how do I send the tithe now?

Since this non-profit does accept other currencies (such as EUR, USD etc) I think it would be a good reason to accept Bitcoin too. Currently it doesn't and I didn't talked to them about this.

I'm beginner in understanding Bitcoin, but I know the basics. Most of them are non-technical people and I believe it will be very hard for them to understand how this works. I have to admit I had a lot of questions I had to find answers for as well.

What would be the reasons I should present them to support my plan: sending Bitcoins to this non-profit?

Some things I have in mind:

There are quite a few shops that do accept Bitcoins in our country.
It's not controlled by the state or any organization (personally I find this pretty huge, for obvious reasons)
Some other people send to this non-profit even things that are not money (e.g. they work with bees and they get a lot of honey, they can choose to send 10% to the church). I think this is a thing that will help them realize a little bit that Bitcoin is a value as well.
Since they accept other currencies, why won't they accept Bitcoins too?
Related to the previous one: if I'd convert my Bitcoins in other currencies (e.g. EUR), since the Bitcoin value is still changing quickly it won't be a stable thing for both parts

Are these good enough to start with? What others points should I present? Given the context, how can I explain them in simple words how this would help?

From my understanding, they will simply have to create a wallet and share an address with the world.

My best approach would be to show them coinbase.com or xcoins.io or gemini.com and show them how its similar to a bank account. They can log in and check their balance or withdraw to a bank account directly from their wallet.

Tell them that Bitcoin + Coinbase is less costly compared to PayPal: With Coinbase the church can create its own donation button for its website and accept up to $1 million in transactions with no fees (and only 1% after that, compared to PayPal's 2.9% + 30¢/transact. fees). Of course if they accept Bitcoin without any intermediary like Coinbase, there wouldn't even be a 1% fee, either.

Really they're probably not going to know what your talking about unless you visualize it for them. For example in my xcoins.io account it shows my Bitcoin in a dollar amount too so they could see that and not get confused if you know what I mean.


If Bitcoin addresses are a single-use token, how several transactions belong to a single address? (Edited) While in Bitcoin wiki (Link to the page) is explicitly mentioned:

  "A Bitcoin address is a single-use token."

We therefore expect that every address would be belonged to only a single transaction since addresses are one-time use token.

However, in any Bitcoin transaction explorer website such as e.g. following example, we can see that several transactions belong to a single address, meaning that several transactions have been performed using a single address.

example:

https://live.blockcypher.com/btc/address/3Gfuha9cM3sH3D6Ae2t6f81SEiMNLhmQvN/

In above example, the address: 3Gfuha9cM3sH3D6Ae2t6f81SEiMNLhmQvN has performed 2,005 transactions (at the time of writing this question). I chose the address randomly.

How can we interpret the statement of "A Bitcoin address is a single-use token" ?

Edit: In a first view, it seems that unlike mentioning explicitly (in both Bitcoin original paper and Bitcoin wiki) the statement that a Bitcoin address should be used one time for every transaction; however, in practice, it is NOT obliged that a Bitcoin address is used unlimitedly for infinite transactions. It is maybe because of difficulties to hold too many key pairs securely. Assuming for example for above selected address, the owner has to keep 2,005 key pairs in a safe location. Or is there other reason to allow an address to be used unlimitedly?

A Bitcoin address is not necessarily a single-use token. Addresses can absolutely be reused. However, it's good practice to use a new address for each transaction, for reasons of privacy and security.

The privacy element was outlined in the Bitcoin whitepaper (section 10):

  As an additional firewall, a new key pair should be used for each transaction to keep them from   being   linked   to   a   common   owner.

The security benefit is that a Bitcoin address is a hash of a public key or a script, which means that if the elliptic curve cryptography used in Bitcoin is broken (allowing signatures to be generated for known public keys), we still have the hashing algorithms (SHA-256 and RIPEMD-160) helping to obscure the script or public key until a transaction is published. To spend the coins associated with an address, one must publish the original public key or script, but if you use a new address each time, the new address will have a corresponding public key or script that has not been pulished. Thus it would not be vulnerable to such attacks until you go to spend.

I would interpret the statement "A Bitcoin address is a single-use token." to say that a Bitcoin address may be used as a single-use token, and you should not assume that if someone once gave you an address, that will always be the address to pay to them. You should expect that there might be a different address each time.

Edit: Yes, reusing the same address provides a lot of convenience because you don't have to keep track of many different keypairs, and it makes things easier/cleaner if you can send your change back to the same address instead of a new one. (Edit: Note, as chytrik points out, good wallet software will handle key generation and storage for you, so this should not be an actual concern unless you are making your own transactions by hand, writing your own software, etc.) When you use a new address each time, you may accumulate lots of small amounts of bitcoin at different addresses that you can't recombine without associating those addresses. (Edit: I feel that this comment is worth reading and thinking about, BUT as chytrik pointed out, the privacy risk of reusing addresses is much worse than the risk from recombining UTXOs. I sort of intended this to say something like, "You're probably going to be losing some anonymity either way, so take that into consideration along with convenience when threat modeling and choosing a method." But I wasn't very clear about the level of risk in either situation.) It's definitely a convenience factor.

There are also obvious advantages to having a persistent address. It's much easier to use if you aren't specifically requesting payment from someone. For example, if you want to list an address on your website for people to donate to you, it wouldn't be very useful to have that address constantly changing. Some people also generate "vanity addresses" (see e.g., Vanitygen) which may have taken a lot of work to create, and they may not want that work to go to waste by switching to a new address.


What is causing "Network not available" error in rippled RPC call and how to fix it? I am running rippled (standard configuration, I only changed node_db to Sqlite) and communicating with it through JSON RPC. On a few calls I get a response:

'error_message': 'Network not available.', 'error_code': 12, 'error': 'noNetwork'

The example commands that are doing this are:

account_info{"account":"rhPT87PasaG27VqKjEsp5j2AWNSHUWJd9Y"}
wallet_accounts{"regular_seed":"seed"}

What is causing this error to appear and how can I fix it?

This error indicates that your server is not synchronized to the Ripple network and thus doesn't have current information. It's perfectly normal when your server first starts up -- it can take ten or fifteen minutes to sync up, depending on your bandwidth and hardware.

You should make sure you're actually connected to a few servers and have your validators correctly configured. The server_info RPC command can help.

The following config entries should help:

[ips]
23.23.201.55 51235
184.73.226.101 51235
54.225.112.220 51235
54.225.123.13 51235

[validators]
n9KPnVLn7ewVzHvn218DcEYsnWLzKerTDwhpofhk4Ym1RUq4TeGw
n9LFzWuhKNvXStHAuemfRKFVECLApowncMAM5chSCL9R5ECHGN4V
n94rSdgTyBNGvYg8pZXGuNt59Y5bGAZGxbxyvjDaqD9ceRAgD85P
n9LeQeDcLDMZKjx1TZtrXoLBLo5q1bR1sUQrWG7tEADFU6R27UBp
n9KF6RpvktjNs2MDBkmxpJbup4BKrKeMKDXPhaXkq7cKTwLmWkFr

[validation_quorum]
3

You can resolve r.ripple.com for a list of server IP addresses recommended by Ripple Labs. Currently the list is 54.225.123.13, 54.227.239.106, 107.21.251.218, 184.73.226.101, 23.23.201.55, and 54.225.112.220.


generating random pair key has standard? If a crypto wallet generates all pair key between small range for example between 1-100, the risk and possibility of creating the same key is an increase. Generating random pair keys for cryptocurrency has standard? If the answer is No what the solution cryptocurrency for it?

Developers of reputable wallets use a suitable source of randomness and will generate a key in the whole range available, not restricted to some arbitrary small range.
So far as I know there is no standard (e.g. BIP) that specifies this. It is assumed knowledge.
For example see https://www.freecodecamp.org/news/how-to-generate-your-very-own-bitcoin-private-key-7ad0f4936e6c/


How to send money to set of recipients using bitcoinj I am creating a wallet app using the bitcoinj library. I have a use-case where I need to send bitcoins to multiple recipients in one transaction. Currently, I am creating multiple send requests for each address but only first send request is successful and rest of the requests failed and give me following error:

Exception in thread "AWT-EventQueue-0" org.bitcoinj.core.Wallet$DustySendRequested
   at org.bitcoinj.core.Wallet.completeTx(Wallet.java:3646)
   at org.bitcoinj.core.Wallet.sendCoinsOffline(Wallet.java:3471)
   at org.bitcoinj.core.Wallet.sendCoins(Wallet.java:3536)
   at org.bitcoinj.core.Wallet.sendCoins(Wallet.java:3506)....

Please help me to sort this out. I would be very thankful.

Try this. You can add several outputs to a transaction

 SendRequest req;
 Transaction transaction = null;

transaction = new Transaction(this.activity.getNetWorkParameters());
        transaction.addOutput(coin1,address1);
        transaction.addOutput(coin2,address2);
        req = SendRequest.forTx(transaction);


What would happen if a portion of the Bitcoin network was separated from the rest of the network? Yesterday I asked a question over at SuperUser, so that I could have my facts straight before asking this question.  The scenario sets the basis for this question.

Regarding bitcoin, what would happen to the Bitcoin system if a portion of the world had it's internet connection severed with the rest of the world.  In other words if, say, all outside communication was lost in the region of Armenia, would the Armenian Bitcoin users, who continue to use Bitcoin, ultimately create a forked block chain?

If so, what would happen to the blockchain when connection to the severed region of the world is restored, and the segregated network is resolved to the primary network?

I imagine the outcome would be similar to a 51% attack.  Is that correct?

When bitcoin client downloads two conflicting blockchains, in other words when fork happened, it chooses the longer blockchain as valid, and the shorter becomes invalid and called "orphan blocks". "Length" is calculated as total combined difficulty of that chain, not number of blocks. Wiki: Block Chain

So in your scenario, Armenia most likely has less hashing power then the rest of world and it would produce shorter fork of blockchain, therefore it would be overrided after connection is restored.

51% attack implies coordinated effort from a small group of people with malicious intent, which is not the case according to your scenarion, therefore I wouldn't call 51% attack.

It would be easy to counter any negative outcome because users of isolated network would know instantly about the problem from sudden drop of total network hash power, and would just need to avoid spending bitcoins until connection is restored.


Comparing Bip 38 to AES256 Can anyone explain what are the advantages of using BIP 38 Bitcoin wallet encryption to simply encrypting the private key with AES256?

See the following links for an overview and for details.

Note: In short, if you do not have a strong understanding of the BIP38 encryption and decryption workflow, do not BIP38-encrypt your paper wallet. Just print your paper wallet out without encryption, and keep it safe the same way you would jewels or cash.

Just encrypting with AES provides excellent security but the weakness is the key which is unwieldily since it needs to be random binary data and the encrypted output which is also binary data. In order to use a passphrase as the encryption key a function such as PBKDF2 is generally used and the output can be base64 encoded to make it ASCII so it can be printed/written. Finally, unless you are a crypto domain expert do not roll-your-own security schemes, they generally will contain flaws rendering the security null.

Note: Scrypt is a form of Password-Based Key Derivation Function (PBKDF2) that has increased memory requirements.

BIP38 encryption provides the above and some inter ability with the crypto currency eco-system.


Bitcoin private key, location on ECC curve In the ECDSA algorithm, the Bitcoin private key is supposedly a point on the graph (or is it?).  But the private key is a single integer, and not x,y coordinates.  Is the integer, by itself, the x value or the y value?  If it is x, then what is y? If it is y, then what is x?

The basic elliptic curve operation is addition of points.
The operation of applying this addition repeatedly is called the scalar multiplication of a point by an integer.

The private key is the 'scalar', the point being multiplied is the 'Generator' point, the result is the public key.

Scalar multiplication is basically repeated addition. Multiplying the Generator point by 5 means: calculating G+G+G+G+G.

You calculate this by first calculating  G2= G+G,  then G4=G2+G2, then G5=G4+G.

The curve formula

The formula for the curve used by bitcoin calculations is as follows:

y^2 == x^3 + 7   ( mod p )

where p = 2^256 - 2^32 - 977

Points on the curve

a point (x,y) is on the curve if it matches the above equation

Curve Addition

Curve addition is best visualized geometrically

image from certicom

Elliptic curve cryptography does not use floating point values for it's coordinates, all calculations are done in integers modulo a large prime ( mentioned above, named p ). But the method of calculating the sum of 2 points remains the same.

adding points

Add points P1=(x1,y1) and P2=(x2,y2),  resulting in Psum= (xsum, ysum)

slope = (y1-y2)/(x1-x2)
xsum = slope^2 - (x1+x2)
ysum = slope*(x1-xsum)-y1

point doubling

if P1 and P2 are the same point, the above adding formula would
involve a division by zero, so a different formula is needed to
calculate P+P

slope = 3 * x^2 / (2*y)
xdbl = slope^2 - 2*x
ydbl = slope *(x-xdbl)-y

ecdsa keys

For ECDSA a generator point G was chosen.

The private key is just an integer, lets name it k.
The public key is the generator point added to itself k number of times. In other words, multiplied by k.

If you choose your privatekey unwisely, say 1, your public key would equal the generator point, this address: 1EHNa6Q4Jz2uvNExL497mE43ikXhwF6kZm

As you can see, it was even used recently.

What makes ECDSA a useful crypto system, is that it is easy to calculate a public key from a privatekey, but not the other way around.
Another way of putting this is that multiplication is easy, but there is no (easy) division algorithm on an elliptic curve.

Example code

See this gist for an example in python


Has anyone tried transfering 0.00000001 BTC (the currently minimum amount) successfully? I did an experiment of withdrawing 0.00000001 BTC from MtGox. And this transaction still cannot be seen on http://blockexplorer.com/ after about an hour.

Concern solved, thank you everybody!

http://blockexplorer.com/address/1Mm1YSodmgoDEHEQtQaZLjBW8Nemje3kFw

Yes, I have successfully transferred 0.00000001 BTC (commonly referred to as a Satoshi) before.

What is possible within the scope of a MtGox withdrawal is another question entirely. MtGox uses a custom client and has a fee structure and other assorted math to contend with that may not allow for such a transfer at present. If your withdrawal has not appeared in Block Explorer you should contact MtGox support as it may reflect more on their modified system than the default behavior of Bitcoin.


Is there a signature format, or cryptography has *only one* possible S value? EDIT: This question is not specific to Bitcoin.  It's applicable to any other crypto currency that is interested in using a different signature scheme than Bitcoin or the QT reference client.  One reason for this is to reduce complexity (and bugs) in the protocol.

My understanding of malleable transactions in Bitcoin is that two different values are supported for "S" when a signature is validated.

The solution for this is to ensure that S is less than the following

  X9ECParameters ecParams = Org.BouncyCastle.Asn1.Sec.SecNamedCurves.GetByName("secp256k1");

  HALF_CURVE_ORDER = ecParams.N.ShiftRight(1);

Given the plethora of signature mechanisms available to crypto-currency, what algorithms or signature approaches are not vulnerable to Malleable Transactions?

e.g.  What if...

A different curve was selected instead of secp256k1?
A different signature mechanism was chosen?
A different approach entirely, such as a blind HMAC was used to sign transactions?

I'm interested in answers that describe both solutions that are broken, and those that would prevent malleable transactions from ever occurring.

My goal is to flush out an algorithm that produces consistent results with minimal complexity for implementors.  (in other words, even Mt Gox would get it right)

The solution is the same regardless of curve or signature algorithm -- reject non-canonical signatures. This is precisely what Bitcoin has decided to do.


How to enable mining on daemon? I forked bitocin and created a altcoin.

Now I am running a node of it. There are currently 0 blocks because there are no miners. How can I enable mining on bitcoind?

I tried adding gen=1 with config, but it's not mining.

I believe there was a setgenerate true command, but I am not sure how to use it. How can I make my node mine coins?

I believe you can still use the generate and generatetoaddress commands to mine a certain number of blocks. setgenerate was removed in version 0.13 because mining with bitcoin core on mainnet is useless and has been for a number of years:
https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.13.0.md#removal-of-internal-miner


CDiskBlockIndex: NFile and NDataPos not defined This is the source code snippet that is used for the serialization of block indexes (found in leveldb).

Block 478573 index is (as of my node's leveldb) 89af109c996d020000000020774f568005a00bf4ffed76b52e3a7e5e5140a5371834a00000000000000000009f5db27969fecc0ef71503279069b2df981ba545592a7b425f353b5060e77f3e7e13825935470118da70378e

Isn't NFile undefined (i.e. 0) in this case? (and NDataPos and NUndoPos too).

Whereas for block 478574 it is :

89af109c996e1d801886399fbf8017828daf5502000020dcc139c241e6315463dd82c89fc288de35f004c87816430000000000000000000f7f9503fc2daab46c4103516c386b1c5b2390e082af76ba8c49fb522d5e5b148b96805935470118ae6ba061

Which yields NFile = 953 and is correct.

Why block 478573 is not defined? And how to retrieve NFile and NDataPos in that case? I understand that the index is different for every node because it depends on the order the blocks were downloaded.

This is likely the case because you don't have the block.

Blocks are downloaded out of order, and the block index contains entries for blocks that are not in the main chain ("orphan blocks"). Many of those are clearly not in the best chain before they're even downloaded, in which case Bitcoin Core will not download them at all.


Curious about lost bitcoin The Merkle reported a user lost 17BTC in a fire that destroyed his private keys and backups. Are those BTC (out of the fixed 21x10^6) lost forever? I assume they are and assume there are many lost bitcoin over time that actually decreases the total amount that will circulate or be accessible. Interesting in that bitcoin scarcity also becomes a function of inadvertent or accidental attrition over time.

As the answer by @MeshCollider states, those BTC are lost forever, altough there is one more thing I believe is worth of consideration.

Cryptanalysis never get worse, it always get better with time. One day, the current algorithms used to secure bitcoin could get old and weak enough. It will probably be, as it typically is with cryptanalysis, a gradual process. First there will be some unpractical, but theoretically possible attacks, then some practical, if not too hard or improbable, then with a good equipment and enough money it will be possible to spend those coins and finally everyone will be able to do that with their PC. This whole process will probably take years of slowly advancing cryptanalysis.

The bitcoin community will probably adapt a new algorithms which will require a new generation of addresses when the current algorights will be close to be broken, but the old coins will remain insecure as long as they are on old addresses. That will probably require users to transfer their coins to the new-generation addresses to secure their BTC. If that will be the case, the lost BTC will remain on the old addresses, where they will be vulnerable to retrieval. It will result with a new enterprise of retrieving those coins, which will therefore return into circulation.

Note that it this answer is highly speculative. It relies on two assumptions:

That the algorithms will be broken one day, which is a highly reasonable assumption, as it has been the case with many algorithms before.
That the problem will be solved by the community in a way I described, which is reasonable in my eyes, as I haven't seen any better proposal to date, but noone can be sure if that will be the case.

Bottom line: lost bitcoins might be like gold sunken in the oceans: it may be unretrievable now, but one day it might return to circulation.


Blockchain gap limit I was trying to figure out how exactly the Blockchain gap limit works. I've read the following question on Bitcoin Beta: How to solve Blockchain 20 address gap-limit problem? and started thinking. Maybe I am not getting this right, but in the answer to that question, it says, that the Blockchain will always look ahead 2-22 addresses, to see if any payment came inside, starting from the index of the address, that received payment last.

Am I correct in stating, that, if for example, 2 users try to send me a payment of XBT.

User 1, asks to deposit some XBT to me, gets an address from my site, with index 1. Then, a minute later, user 2 does the same, and gets an address with index 2. If in this case, user 2 makes the payment faster then user 1, the Blockchain won't see the payment from user 1, because from this onward, only addresses with index 2-24 will be checked?

If this is the case, this seems like a serious issue to me, maybe I am understanding something incorrectly, can anyone clear this up to me?

No, that's not how it works. Blockchain (and most other HD wallets by default, as set in BIP 44) look forward 20 addresses before deciding that no more are being used, it doesn't ignore the ones before that. Its purely a way of telling which ones you're using, because you can generate effectively as many as you want using incremental indices, and you wallet shouldnt have to check them all every time you update your balance. So it checks index 1, then 2, and so on, until it finds a stretch of 20 unused addresses in a row before assuming it's reached the end of the addresses you are using currently. If at some point in the future, you received a payment on one of those 20 in the gap, the wallet would begin looking 20 indices higher from that one.

So the only way you could miss payments is if they were too far in the higher indices not lower, e.g. no payments on indices above 10 but one on 30 would go unseen, because the wallet would give up looking after 20 unused. That's why blockchain usually warns you if you're approaching the gap limit rather than silently letting you.


Can my transactions be traced back to me even if I do this? I installed the wallet from Bitcoin's official website on 4 computers each running Microsoft Windows 7.

Moreover on each of the 4 PCs, I installed OpenVPN client, meaning each of the computers access the internet via VPN.

Suppose I do not use an online Bitcoin mixer to further anonymize my transactions.

Instead I transfer my Bitcoins from one computer to another, all the while making sure that the VPN gateway/exit node is located in a different country.

Question: can my transactions be traced back to me?

Well, that depends. First, never reuse addresses if you are doing this.

Second, if you are not mixing, the transactions will, with no exception, be traceable. Would there be someone focused on you, he would see the bitcoins move around, and so most probably think they are spent. But if he is really interested in you, he will probably keep track of the coins and whenever you really spend one of them, he will probably notice and try to track the owner of that address to see what you did with them.

He will probably only stop keeping track of those coins if he sees them being spent by someone that cannot be you, or if he cannot track them anymore as they are split up and combined with many other coins.

You must be quite paranoid considering your few questions here. I can maybe advise you to buy bitcoins for cash like via localbitcoins.com. Apart from the guy you trade with, no one will know you bought coins.


How can I fix corrupted encrypted wallet.dat? My only one backup of encrypted wallet is corrupted (last time when backed it up i probably didn't shutdown bitcoin-qt), with hex editor i found in it:

mkey
ckey (117 that looks fine)

Does this enough for recovering my private keys? at least 117 of them?

How can i do this?

PS
Already tried pywallet without success:
ERROR:root:Couldn't open wallet.dat/main
Bitcoin-qt: wallet.dat corrupt, salvage failed

Found out that pywallet has recovery feature, and it worked:

Created 1GB FAT32 partition on flash drive(/dev/sdb1 in my case), copied corrupted wallet.dat on it and run:

nyaa@ubuntu:~/github/pywallet$ sudo ./pywallet.py --recover --recov_device /dev/sdb1 --recov_size 1Gio --recov_outputdir /home/nyaa/
...
All the found encrypted private keys have been decrypted.
The wallet is encrypted and the passphrase is correct

One of change addresses with all bitcoins on it was there!


Bitcoin Cash "Cash Address" format What is "Cash Address" or "CashAddr"? Is that a new Bitcoin Cash address format?

"CashAddr" is the name of the new Bitcoin Cash address format, which is heavily influenced by SegWit Bech32 format.

It looks like this:

bitcoincash:qpm2qsznhks23z7629mms6s4cwef74vcwvy22gdx6a

The format is consisting of a prefix (bitcoincash, bchtest or bchreg), a seperator (always :), and a 42 character payload.

TIP: P2PKH starts with q while P2SH starts with p

Currently it's compatible with all Bitcoin Cash wallets and services except a few.

The address format can be converted to the old format using cashaddr.bitcoincash.org if your wallet is not compatible.


Why is my pruned node downloading old blocks? I set up my first bitcoin node and I'm a little confused with it.

So, I am trying to setup a pruned node - which from my understanding is very useful if you just need your application to verify transaction/read blocks/lookup TXIDs.

I added:

prune=550

to my bitcoin.conf, and started up daemon again.

However, I am now confused. I ran bitcoin-cli getinfo and got this:

It seems like it is still downloading the entire blockchain, and its downloading oldest blocks to newest.

Did I do something wrong? Isn't the point of pruning just to download recent blocks to verify transactions? Please someone fill me in...

Pruning just means it doesn't store the blocks forever, but it still must download them all at least once to verify the chain and track the unspent outputs which form the UTXO set. Once the blocks are downloaded and verified then they can be automatically deleted


Non-bidirection payment channels for lightning network I am trying to understand the technology behind LN and similar concepts.

As I understand it, LN is a network of bidirectional channels, which are created with some limited capacity, within which the channel can operate. So, we can have Alice putting 3 coins to the channel and Bob putting 20 coins to the channel and this 3:20 ratio can then change in time with each off-chain payment, until it eventually reach the point where Alice and Bob want to close the channel at some final balance ratio - say 13:10.

This bidirectional concept has some features (or disadvantages) of e.g. requirement to balance the channel (or create a new one) if payments in one direction are more common. Also each such channel connecting two parties needs two on-chain transactions.

Questions:
Why do we use channels only between 2 parties? Would it not be possible to have a channel that is formed e.g. by 4 parties, e.g. Alice with 3 coins, Bob with 4 coins, Cecil with 5 coins and Daniel with 6 coins? It should allow Alice to send e.g. 2 coins to Bob, thus modifying the state of the channel from "A3:B4:C5:D6" to "A1:B6:C5:D6" etc.

If this was possible, we could have 2 on-chain transactions to interconnect 4 (or more) entities, so it seems it would be more effective than bidirectional approach. It also seems to me that keeping the channel balanced would be little bit easier than in case of bidirectional case.

Obviously there would be more communication needed for each off-chain transaction within the channel (all parties would probably have to be involved).

So, is there any fundamental problem with having more than 2 entities in one channel? Or is it just that the benefits of having them would not outweigh the additional complexity?

There's no fundamental reason why you couldn't use a non-bidirectional link. The onion routing protocol of lightning is ignorant of the channel between two nodes. Hypothetically, if two lightning nodes were right next to one another, you could have robotic arms pass pennies back and forth in lieu of a lightning channel.

That said, would a non-two-party lightning channel work, or would it let one channel participant defraud another?

Normal lightning works like this: before Alice and Bob create a channel, Alice signs Bob's refund transaction, and Bob signs Alice's refund transaction. Alice's refund transaction says:

Output 0: 1 BTC can be claimed by Alice, only after 48 hours, OR
                can be claimed by Bob, if Bob knows P, where hash(P) = x
Output 1: 1 BTC can be claimed by Bob

If Alice decides that she wants out of the channel, she publishes the above transaction, waits 48 hours, and claims her money. Now that we have a way to end the channel, Alice and Bob jointly pay into a transaction that can be spent by the refund transactions, or any transaction that Alice and Bob jointly sign.

That's great, but how do you move money? First, Alice and Bob create new refund transactions to reflect the new state of the channel. Then, Alice tells Bob P, the value above that hashes to x. If Alice tried to submit that transaction to the Bitcoin network now, Bob would reply by taking all of the money in the channel.

This is where we hit our first roadblock. If there are three parties with money in the channel, and Alice cheats, it's obviously unfair to Charlie for Bob to take all of the remaining money. How do we fix this?

If Alice uses her refund transaction, we drop into a two party version of the lightning protocol. We do this whether or not Alice cheats by using an old refund transaction. Alice's refund now looks like this:

Output 0: 0.33 BTC can be claimed by Alice, only after 48 hours, OR
                   can be claimed by Bob and Charlie, if they know P, where hash(P) = x
Output 1: 0.67 BTC can be claimed by Bob and Charlie

We're not done, though. When Alice uses her refund transaction, Charlie might be offline. (In fact, that might be why Alice is leaving the lightning channel.) Therefore, Bob and Charlie each need to create a sub-refund transaction before they fund the channel. Bob signs Charlie's transaction, and vice versa. Bob's transaction looks like this:

Output 0: 0.33 BTC can be claimed by Bob, only after 48 hours, OR
                   can be claimed by Charlie, if they know P, where hash(P) = x
Output 1: 0.34 BTC can be claimed by Charlie

The result is that if you have n people participating, you need n refund transactions, and n-1 sub-refund transactions, and n-2 sub-sub-refund transactions. This grows factorially, so if you have 10 participants, I estimate that you must sign and revoke about 3.6 million transactions for every channel update. This will cover every possible ordering of nodes leaving the channel.

If you're willing to trade off some security, you could have 5 lightning nodes create a 3-of-5 multisignature account, and only allow withdrawals from that account if 3 nodes agreed that the withdrawal was done by a node with enough balance. If you're interested in this, I suggest looking at federated peg.


Is it possible to copy transactions between Bitcoin's forks blockchain? Do Bitcoin forks share the same transaction protocol after the fork? If so, is it possible to copy/ duplicate a transaction that uses common input transactions in the other blockchain?

Let me explain what I mean:

Let's say, I have 1 BTC in an unspent transaction which happened before a fork (Bitcoin Cash for example).
So after the fork, I own 1 BTC in Bitcoin blockchain and 1 BCH in Bitcoin Cash blockchain.
Then, I send that 1 BTC to another person.
At this point, can that person copy my transaction code and re-send it in Bitcoin Cash network so that he gets 1 BTC and 1 BCH?

Yes, some people call this a 'Replay Attack'. But it's not literally an attack, but the desired outcome. If a fork don't want this to happen it can change the rules to prevent it.

You can also avoid it but using inputs mined in BTC after the fork, if your wallet app allows this kind of selection.


API for getting the Hash-of-thing-to-sign Does anyone have, or have access to a simple API that can calculate the hashofthingtosign for old transactions along the blockchain?  I'm just looking for something simple to see what the "Hashofthingtosign" is or was for transactions along the blockchain.  One might even say this is a question of "how" do I do this, but it is well beyond me and is effectively a question of does anyone have one or know of one?

A simple API such as what is here; http://2coin.org/tx.asmx would be awesome (though I'm having a hard time accessing the website at this time).  It was just a simple thing; you paste the transaction ID and it can spit out the R value, the S value, and the hashofthingtosign by reading probably the info from blockchain.info or something like that.

I'm trying to better understand the algorithm that's used, but it seems like block explorers don't keep track of that variable nor have implemented a simple detail of just showing what it was.  I'm not asking for a huge program or something that would take someone weeks to do.  The complexities of creating even a python script to look up this variable for old transactions and calculate it are well beyond my capabilities.  Not to mention, without examples of the hashofthingtosign, how would I even be able to confirm whether I had done it correctly or not?

Try the page at https://2xoin.com/getRSZfromRawTX/
Paste a raw transaction into it, it will return the z values of each tx input.
The z value is the hash of the message that was signed.
It only works for bitcoin at the moment.


Hypothetical Scenario - How long does a network correction take? Hypothetical scenario:

If China decided to stop bitcoin and forced all electrical companies to stop generating electricity (unlikely I know, but work with me for a minute), that I assume would force miners to switch to solar power, meaning there will be a huge drop in mining power, meaning, transactions would take longer etc, until the network corrects itself.

If mining power instantly dropped by 90% tomorrow, how long would this correction take? and how long would transactions take in such a scenario, until the network corrects itself?

Details about difficulty adjustment can be found at https://en.bitcoin.it/wiki/Difficulty and https://en.bitcoin.it/wiki/Target.  Difficulty adjusts every 2016 blocks, with the goal of keeping the average block time at 10 minutes (so that 2016 blocks takes 2 weeks).  At each adjustment, the difficulty can change by at most a factor of 4 (up or down).

Let's assume the worst case: that this disruption happens immediately after a difficulty adjustment.  With a 90% drop in mining power, each block now takes an average of 100 minutes to mine, instead of the usual 10.  So the next 2016 blocks take 20 weeks instead of 2.

After 20 weeks, there is an adjustment, and presumably difficulty will drop by the maximum factor of 4.  Now the average block time is 25 minutes and the next 2016 blocks will thus take 5 weeks.

At this point the difficulty can drop by a factor of 2.5 and we are back on track, with an average block time of 10 minutes.

So it takes 25 weeks to get back to normal.

Of course, in your situation, a more likely outcome is that Chinese miners will quickly sell their mining hardware to people outside the country, where electricity is still plentiful, and the total mining power will recover.  (Or they'll set up their own offshore mining facilities, and just ship the hardware there.)  If not, then mining hardware producers would try to quickly ramp up production so as to fill the void.  After all, everyone can see that difficulty will drop by a factor of 4 in 20 weeks, which will increase mining revenue by a factor of 4 and make it far more profitable (assuming the price of Bitcoin remains constant).


How to import data from Blockchain.info to Excel can anyone explain how to transfer data from Blockchain.info to Excel. I am not familiar with the CSV format.  Thank you in advance!

Blockchain.info has a list of API endpoints to make it easy to collect data.

blockchain.info/api

Depending on which data set you want, you can typically add ?format=csv to the end of the query to get results in csv format, or ?format=json if you'd prefer JSON. Once you have the data in a .csv file, you can simply open the file in Excel, which has native support for .csv files.


The actual target (and thus difficulty) is determined by its compact 32-bit encoding.

After the computation you did above, you should round it to the nearest compactly-representable target (24-bit accuracy, multiple of 256). That is the target encoded inside blocks, and the one that matters.


Can inputs to a transaction have different values for sequence? I noticed that the sequence field is used to signal opt-in RBF. I would think that signaling RBF applies to the full transaction rather than particular inputs.

If my transaction has two inputs, and I signal opt-in RBF on one of these inputs, am I still signaling that my transaction might be replaced? Or do I need to signal it for both inputs? Is it valid to signal RBF on one input but not another? Does the sequence field need to match for all inputs in the transaction?

According to BIP 125:

  A transaction is considered to have opted in to allowing replacement of itself if any of its inputs have an nSequence number less than (0xffffffff - 1).


How to confirm how many peers a node has? When a node requests one of it's neighbours for a list of it's peers, that node responds with a list of all of it's neighbours. I'm just wondering is there a way to confirm that those nodes are actually his neighbours and not random/bad nodes?

Or is there an easier way to determine which of your neighbours is the most connected i.e has the most connections to it?

When a node requests one of it's neighbours for a list of it's peers, that node responds with a list of all of it's neighbours.

No it doesn't. It responds with list of nodes that its aware of being claimed exist.  It likely isn't connected to any of the nodes it returns and probably has never connected to many of them. Many of them may not even be real. (though some of them will be, because it does make an effort to include at least some that it has previously connected to)

There is no direct way to get information about a node's peers, and ways to do so are considered a security compromise (if not the most cosmically critical one).


Recover Multibit Wallet on Mac I had Multibit installed on my last mac computer around April 2013, that computer broke and I have had the hard drive recovered. I now have the files from that past Multibit on my new mac, including files named multi bit.wallet and multi bit-xxxxxxxxxx.wallet.

How do I go about recovering my bitcoin on my new computer?

This should be the location of wallet.dat on MAC

~/Library/Application Support/MultiBit/

You will be able to copy this file to USB and paste it into the same location on your new MAC.


How do you enable ASICBOOST on an s9 How do you enable ASICBOOST on an Antminer s9?

Both Bitmain and Braiins have now released S9 firmware that enables overt AsicBoost.


Is the alert system still in the main client's code? Will it be removed? It is said that Satoshi removed the alert system from the client ... still, there are at least some leftovers in.

Is the alert system functioning in 0.3.24? Are there plans to remove all traces of it?

See also this answer.

Satoshi didn't remove the alert system; it still exists in the client. However, it cannot trigger RPC safe mode as it could before.

There are no plans to remove all traces of it, as all it does in its current state is display a warning message.


Recover Electron wallet with bad seed phrase I once created a bitcoin wallet with Electron using a hand crafted seed phrase (using the words of the valid word list that time).

I now figured it was a bad idea, while it is possible to create wallets for abitrary seeds, a version number is encoded inside the seed, and thus it has some kind of format.

Now I just recovered the wallet from my seed phrase just to found it empty, no transactions inside.

I guess changes to the Electron code base broke the decoding of this hand crafted invalid seed so it now points to some other private key not matching my old wallet.

Is there any condensed documentation, how the usage of the seed phrase changed over time? How can I convert the old seed phrase to a working wallet?

Electrum used BIP 39 seeds for some time. So your seed may be a BIP 39 seed, in which case you will need to tell Electrum that you are importing a BIP 39 seed. When you are importing the seed, click the Options button and then check the checkbox for BIP 39 seed.


How to use -txindex to enable blockchain transaction queries? I am trying getting the raw of transaction. But I am getting the following error with following command and  RPC call as well.

  bitcoin-cli getrawtransaction ad844933ceb9cf990fd75ebd2f6731527885e31d1a4c9ea292db235bcd64bdbe

Error
No such mempool transaction. Use -txindex to enable blockchain transaction queries. Use gettransaction for wallet transactions.

use

txindex = 1

in you bitcoin.conf file and restart daemon with -reindex flag if you are building it for the first time, it might take a while but after txindex is defined you can get data for any transaction in blockchain no matter if its related to your wallet or not.

Alternetivly you can start your daemon with

 bitcoind -daemon -txindex=1 -reindex=1

Either way it functions the same


Forks to be aware of other than Bitcoin Cash and Bitcoin Gold? I have now taken care of the Bitcoin Cash and Bitcoin Gold that I was given "for free" when the hard forks took place, and sent them to other wallets.

Before getting rid of [*] my old Electrum wallet containing all the relevant keys and wallet seed, I wanted to ask the question:

  Are there forks other than Bitcoin Cash and Bitcoin Gold I should be aware of that might carry some value?

I guess I can safely assume that SegWit2x will never happen, at least not at the block that was originally planned?

[*] Not exactly getting rid of it, but just take comfort in the fact that I can calmly forget the password, erase that wallet file by mistake etc etc.

Current forks that I successfully sold on exchanges and got free BTC:

Bitcoin Cash
Bitcoin Gold
Super Bitcoin
Bitcore
Bitcoin Diamond

A few more forks that I wasn't able to sell yet:

Segwit2x
Lightning Bitcoin
United Bitcoin
Bitcoin God


rawtx & rawblock ZMQ at the same time? I need your opinion, do you mind ? :)

I'm bulding a javascript layer on top of bitcoind.
I have bitcoind running on my server with rpc & zmq enabled.

daemon=1
rpcallowip=0.0.0.0/0
rpcuser=xxxxxxxx
rpcpassword=xxxxxxxxx
server=1
rest=1
zmqpubhashblock=tcp://*:28332
zmqpubhashtx=tcp://*:28332
zmqpubrawblock=tcp://*:28332
zmqpubrawtx=tcp://*:28332
rpcworkqueue=100

My program goal is to listen for rawblock and rawtx ZMQ channels. This is my zmq client:

const socket = ZMQ.socket('sub')
socket.connect('tcp://myserverip:28332')

socket.on('message', (channel, data) => {
  console.log(channel.toString())
})

So here is what happens :

subscribing to rawtx alone works, I receive the tx flow (approx 2.5tx per second)

socket.subscribe('rawtx')

subscribing to rawblock alone also works, I receive blocks (approx 1block per 10minutes)

socket.subscribe('rawblock')

But here is my problem, when subscribing to both, i do receive rawtx but no rawblock !

socket.subscribe('rawblock')
socket.subscribe('rawtx')

I'm assuming the ZMQ socket is flooded with rawtx, which result in missing rawblock event.

My question is: how would you debug this ? Have you guys faced this situation already ?

I know I could use the blocknotify option in bitcoind to forward the blockhash back to my client, and then load the rawblock via an rpc call back to bitcoind, but then I would use 2 different mechanisms (one for rawtx and blocknotify for rawblock) for something that was supposed to work in the first place :)

Thanks for your feedback !!

Try to subscribe by using prefix raw as topic . After this you will get both message on the one listener.

socket.subscribe('raw');

socket.on('message', (topicRaw: Buffer, bodyRaw: Buffer, ...tailRaw: Buffer[]) => {

    const sequenceRaw = tailRaw[tailRaw.length - 1];
    const sequence = sequenceRaw.readInt32LE(0);
    const topic = topicRaw.toString();

    if (topic == 'rawtx') {
        const rawTX = bodyRaw.toString('hex');
        console.log(topic, sequence, rawTX);

    } else if (topic == 'rawblock') {

        const rawBlock = bodyRaw.toString('hex', 0, 80);
        console.log(topic, sequence, rawBlock);
    }
});


Bitcoin purchased but not received into my wallet I paid over 12k for bitcoins and it was sent and I have a copy of the bitcoin transaction.  I have not received the amount into my wallet. Is there any way that I can still retrieve my bitcoins?  It has been 3 days now and they provider is one that I have used before and I trust that the bitcoins are there but I need to find a way to access them.

If your wallet is a custodial wallet where the private keys are managed by the provider, your only recourse is to contact the provider.

If your wallet is a non-custodial wallet where you manage the private-keys yourself, there are several possibilities

check that your wallet is fully synchronised.  How you do this depends on which wallet you use.
check the transaction by entering the transaction-id at several blockchain explorers. The business or person you bought the bitcoins from will be able to tell you the transaction-id and receiving address (it might have been printed on a receipt, mentioned in an e-mail or in a text-message etc)
check that the output of the transaction was sent to the correct Bitcoin-address. You can see the actual recipient addresses of the transaction in a blockchain explorer. Your wallet should be able to show you a list of the receive-addresses it has generated. Wallets nowadays generate a new receive-address for every transaction.


How do bitcoin vanity generator work? How do Bitcoin vanity generator work and why is there a limit to nine "specific" chars?
I tried looking up the usage, but couldn't find good articles explaining the methodology behind it.

They work by brute force.
As a private key is essentially a very large random number, and the encoding process from a public key to an address goes through a couple of hashing steps, the relation between the characters an address starts with and the underlying key is basically random.
Vanity key generators work by simply generating many, many private keys until one leads to an address that just happens to start with the desired characters. It is very similar to the block mining process in this sense.
Difficulty is estimated by the amount of effort it would take to produce an address starting with a desired pattern.
Bitcoin addresses (non-bech32) are encoded in base58, which has 58 possible characters. As the first character of an address is fixed to a 1 or a 3, we can ignore that.
To create an address starting with 1A, you effectively have a 1 in 58 chance, as the address distribution is random, and A could be any one of 58 possible values.
For one starting with 1AA, you are looking at a 1 in 58^2, or a 1 in 3364 chance. This exponential growth is why there is a limit (although the limit varies by how much computing power you can throw at a single address).
For the nine characters indicated in your question, the odds of a random address matching the desired pattern are 1 in 58^9, or 1 in 7,427,658,739,644,928. While this is a big number, it is an achievable one given a large enough cluster working on that one address, especially if you're using GPUs - even a 2-3 year old (high end) laptop CPU can hit several 10 million attempts per second, so this is still an achievable number if you have the resources.
Commercial vanity gen services further optimize this by simultaneously working on multiple independent addresses. The odds of finding an address go up proportionally with the number of addresses you are looking for.

As mentioned by Murch, the second character does not allow all 58 characters with even probability - details on why and how can be found in this question.


How do I create a shopping cart that accepts Bitcoin? I need to start a website to sell and buy goods with Bitcoin. Then I need to know how to add an shopping cart system for it. Are there any CMS plugins or modules for Joomla, Drupal, or another? Or can you tell me how to add a shopping cart system for a PHP based website without any modules?

I have same needs, and i found Stripe that accepts bitcoins payment similar like paypal do, then i planned too to use CMSs and i found a solid plugin for opencart on GitHub.
Simply googling i found alot of results, the bitcoin shopping cart plugins are around .. :D
I Also Found interesting bitcoinpay.com,
I can use Api to accept Bitcoin and send to a bitcoin address
...
 even if i not understood if i can operate as Anonymous or i have to link a bank account.
(Obviously i wannot)

The most for all is to find a way to collect bitcoins without to be forced to link a  Bank account.
Tms


If only one Bitcoin miner gets the block reward, is it worth mining only for the transaction fees as a (not-so-competitive) solo miner? I have heard (but not that knowledgeable) about mining-pools. If a weak system joins the pool, it has a chance to get a portion of the block reward, but I assume that not all of the miners are joined to a mining pool.
If I use my average PC for Bitcoin mining, it is a very low probability that I will be the first to solve the hash problem, thus, I won't earn the block reward most probably. I will only be rewarded with the fees with respect to the calculations I have made. So my question has two parts;

I assume that the numbers showing the average revenue generated from mining includes both the transaction fees and block rewards, is that correct?
If that is the case, then shouldn't the weak miners consider a lower average revenue, until they earn the block reward with such low probabilities?

Please correct any points that I might have been wrong about. Thanks in advance.

I will only be rewarded with the fees with respect to the calculations I have made.

That's not correct. If you don't mine a complete block, you get nothing at all.
Joining a pool will let you get a proportional share of the income (from both the block subsidy and the fees), changing the game from a lottery to a more predictable payout based on your contributed hashing power.


How are transactions invalidated by nodes when both parties are offline in a Lightning Network? Let's imagine Alice wants to send multiple transactions to Bob. Both Alice and Bob have open channels with Carol, not with each other:

Alice <-> Carol <-> Bob

So Alice first sends 0.01 BTC to Bob. She sets up the multi-sig tx and sends it off to Carol, which then also Bob sees. Then Alice makes another transaction to Bob of 0.02 BTC, and sets an earlier time-lock in order to invalidate the earlier 0.01 tx.

Now both Alice and Bob have seen these 2 transactions and they both go offline. They are sure that Alice has given Bob 0.02 BTC.

My question is: how do they know that Carol will commit to the blockchain (when the moment comes) the second transaction rather than the first? Couldn't Carol simply send the 0.01 tx to the blockchain rather than the 0.02 one?

I understand that Bob could come online and post it himself, and because of the timelock, he could do it before the other one, thus invalidating it.

But in the scenario where both Alice and Bob are offline do they have to trust Carol to behave honestly?

AFAIU, if you have open lightning channels, you cannot go offline. You must be online in order to monitor the blockchain for old commitments. If you see an old commitment transaction, you immediately broadcast the punishment transaction, but you cannot do this if you go offline. So if you have open lightning channels, you must be online and if you go offline, you are trusting that the other person in the channel will not attempt to defraud you.


How to recover Bitcoin files from 2011 that were erased using the Gutmann method Всем доброго времени суток. С 2011 года на жестком диске хранился файл блок биткойн с наградой в 50 btc. Супруга по не знанию о криптовалюте удалила несколько папок включая и папку с файлом биткойн. При этом сказала что вроде была надпись о принадлежности данного продукта корпорации и будет удалено методом Гутмана. Есть ли возможность восстановить удаленный файл? Делал откат системы windows7.Папка появилась ,но файла нету(
Google translates this as

Good day. Since 2011, a bitcoin block file with a reward of 50 btc has been stored on the hard drive. A spouse who does not know about cryptocurrency deleted several folders including the folder with the bitcoin file. At the same time, she said that there seemed to be an inscription about the belonging of this product to the corporation and will be removed by the Gutman method. Is it possible to recover a deleted file? Did a rollback of the windows7 system. The folder appeared, but there is no file (

Any files erased using the Gutmann method cannot be recovered. The Gutmann method is actually overkill on modern disk drives.
At best, if empty space on the drive has not also been overwritten, you might recover fragments of data from previous versions of files or temporary files. If the files have not been used since 2011 this is extremely unlikely. The more use you make of the computer since the deletion, the less likely any recovery.
The best (and probably only) way to recover control over the money is to simply recreate the wallet using backups of the files or from the written copy of the private keys which you presumably made.


How to implement cold storage payments using bitcoind I wonder what APIs of bitcoind I can use to sign a transaction without actually publishing it. I read that createrawtransaction (in conjunction with signrawtransaction) is a bit risky and for sure poorly documented. Are there any alternatives?

Using bitcoind, sendrawtransaction is one of the steps normally performed.  So to not broadcast, simply omit that command.

For an alternative, you might want to look at SX>

SX is a set of modular Bitcoin commandline utilities that admin types can engage with Bitcoin functionality without having to write code.

http://sx.dyne.org
http://bitcoinmagazine.com/6234/what-libbitcoin-and-sx-are-and-why-they-matter/

Using the Mycelium mobile app has to be the easiest method to spend funds from a paper wallet. From the app, select Cold Storage. Then scan the private key from the wallet. Then scan the QR code for the Bitcoin address to send the funds to.


BitFinex API call returns 400 bad request Trying to get authentication with BitFinex to work. Docs here: https://www.bitfinex.com/pages/api

  Say the client wants to make a request to POST

  https://api.bitfinex.com/v1/order/new

  With a payload of { "request":"/v1/order/new", "nonce": "1234", "option1": ... }

  The nonce provided must be strictly increasing.

  To authenticate a request, use the following:

payload = parameters-dictionary -> JSON encode -> base64
signature = HMAC-SHA384(payload, api-secret) as hexadecimal
send (api-key, payload, signature)

  These are encoded as HTTP headers named:
  X-BFX-APIKEY X-BFX-PAYLOAD X-BFX-SIGNATURE

Here is the c# code, which follows the above example, but generates a HTTP 400 Bad Request. Any ideas how to fix?

        long nonce = DateTime.Now.ToUnixTimestampMS(); //returns a strictly increasing timestamp based number e.g. 1402207693893

        string path = "https://api.bitfinex.com/v1/balances";
        string paramDict = "{\"request\": \"/v1/balances\",\"nonce\": \"" + nonce + "\"}"; //ie. {"request": "/v1/balances","nonce": "1402207693893"}
        string payload = Convert.ToBase64String(Encoding.UTF8.GetBytes(paramDict));

        //API Sign
        HMACSHA384 hmac = new HMACSHA384(Encoding.UTF8.GetBytes(APISECRET));           //My API SECRET
        byte[] hash = hmac.ComputeHash(Encoding.UTF8.GetBytes(payload));
        string hexHash = BitConverter.ToString(hash).Replace("-", "");

        NameValueCollection headers = new NameValueCollection();
        headers.Add("X-BFX-APIKEY", APIKEY);                                            //My API KEY
        headers.Add("X-BFX-PAYLOAD", payload);
        headers.Add("X-BFX-SIGNATURE", hexHash);

        //POST data
        try
        {
            //create post request
            HttpWebRequest request = (HttpWebRequest) HttpWebRequest.Create(path);
            request.KeepAlive = true;
            request.Method = "POST";

            //add headers
            request.Headers.Add(headers);

            //write out payload
            byte[] byteArray = System.Text.Encoding.UTF8.GetBytes(paramDict);
            request.ContentLength = byteArray.Length;
            using (var writer = request.GetRequestStream()){writer.Write(byteArray, 0, byteArray.Length);}

            //read reply
            using (var response = request.GetResponse() as System.Net.HttpWebResponse)
            {
                using (var reader = new System.IO.StreamReader(response.GetResponseStream()))
                {
                    //get reply (JSON)
                    string responseContent = reader.ReadToEnd();
                }
            }
        }
        catch (Exception e)
        {
            //always throws an exception here
            Debug.WriteLine(e.Message);
        }

Finally discovered the fix: hexhash has to be lower case:

string hexHash = BitConverter.ToString(hash).Replace("-", "").ToLower();


Interested to find a good resource with all active bitcoins exchanges I am looking for recommendations for good bitcoin exchanges resource that would include info on:
- live/approximate daily trading volumes
- spreads
- and most importantly traded currencies

I found this one: https://bitcoincharts.com/markets/
But it is not up to date (no KRW for example) and I couldn't find a way to sort it by an exchange and it is a bit hard to compare traded volumes by exchange because the info is in different currencies.

Thanks,
Tagir

Cryptonator looks like a good start.
Find all exchanges for a particular trading pair.
https://api.cryptonator.com/api/full/eth-btc

Then swap out the eth with whatever currency you're looking for.

Cryptonator says this is all their supported currency pairs (https://www.cryptonator.com/api/currencies) but looks like it includes some dead coins. You could loop through that URL and for each record, input the symbol into the original https://api.cryptonator.com/api/full/eth-btc end-point.

https://api.cryptonator.com/api/full/ltc-btc
https://api.cryptonator.com/api/full/dash-btc
...and so on.

Once the loop is through you should have all pairs and all currencies, or at least all the ones cryptonator has.


Is there a limit to how long a wallet can be offline? I have a wallet file I backed up June 2011, and has been offline for over a year now. When I copied it back into where the files are stored with the official client, it says my balance is 0, with no transactions.

Does it take a long time for my balance & transactions to get updated correctly, or is my wallet considered corrupted, and the coins lost forever?

Any unspent bitcoins against addresses in your old wallet should be retrievable.

The client won't show transactions that haven't been downloaded to your copy of the blockchain yet. There should be an icon in the lower right corner of the Bitcoin-QT client that indicates progress on downloading the blockchain. It can take a few hours (there's around 2.5GB to download, and it downloads them slower than you'd expect because the client verifies the blocks as it goes).


Are blocks stored in blkxxxxx.dat files per line? Simple question. Is each line in a blkxxxxx.dat file a block?

Simple answer: no.
The files are not text files and therefore don't have lines.


Why do bigger blocks make it more expensive to run a full node? Does it cost more storage?
For the transaction verification, to which extent bigger blocks make it more computational intensive?
In terms of computational complexity, is the verification process a O(n) computation or anything else?

Short answer: For big players the cost is mostly negligible.

Longer answer (independent of the current block size debate):

Hard Drive Cost:
A bigger block will take up more disk space. Right now the block size is limited to 1 MB. If the block size is increased to 2 MB and assuming all blocks are always being filled to the max size then you will need about twice the hard drive space to store the same amount of 2 MB blocks as you needed for 1MB blocks.

Network Bandwidth Cost:
If block size is increased, a full node has to relay a bigger size block. Sending and receiving more data will have an impact on cost as well.

Real Time Computational Cost:
A full node has to hash a block and verify that the hash has n amount of leading zeros. Increasing the block size will result in hashing a larger amount of data which increases verification time.

Big O Complexity:
Big O would depend on whatever the Big O is for sha256.


Is it important to have an unencrypted backup of the private key? Am I correct that in not having our private keys written in paper or otherwise backed up we are implicitly trusting the wallet developers to keep publishing wallet versions that are capable of reading and deciphering our password-phrase? Nobody else can decypher that phrase and give us access to the bitcoins, correct?

I recently had a bad experience with Mycellium wallet: i lost my Android mobile and the backup of my wallet was in a 1-year-old format (encrypted private key in paper, QR format) that the new desktop app, amazingly, would not recognise. In the meanwhile, I had moved to iPhone, where no Mycelium was available. Eventually i solved the issue by installing Mycelium in a friend's Android. Fortunately, the Android version did recognize the old encryption after scanning the QR with the camera, so I could send the money to another wallet. But this made me realise that we absolutely rely on the developers if we do not keep the private keys written somewhere, unencrypted.

In other words: What happens if a wallet app is discontinued and we find ourselves in 2020 with no way to install that old wallet in the 2020 standard devices?

Or am i missing something here?

Thanks in advance

It is important to be able to recover your private keys using only tools you fully control. That protects you against failure of infrastructure you would otherwise need to transfer your funds. There are lots of stories of corrupted backups, unreadable backups, and backups that didn't actually include the private keys.

Storing your private keys unencrypted on paper is one way of doing this. They can also be stored electronically in encrypted form, so long as you have reliable access to the encryption key and decryption tool.


How to fix "Failed to resolve (?wrong URL) cgminer.exe --bmsc-options" I downloaded CGMiner and have my pool with slushs pool. So below I believe is the correct setup for CGMiner.

cgminer.exe --bmsc-options 115200:20 -o stratum.bitcoin.cz:3333 -u Starfleet.worker3 -p ***** --bmsc-freq 0781

However, every time I try and connect, it says exactly this:....

Failed to resolve (?wrong URL) cgminer.exe --bmsc-options
Pool 0 slow/down or URL or credentials invalid
Pool setup failed

Can anyone please help me, I am not sure what I am doing wrong. And I do not really know how to write script.

Had you read the page on Slush's Pool on how to set up CGMiner, you would have gotten it right the first time. Use this:

cgminer.exe --bmsc-options 115200:20 -o stratum+tcp://stratum.bitcoin.cz:3333 -u Starfleet.worker3 -p * --bmsc-freq 0781


How to send bitcoin with a message attached Is it possible to send bitcoins with an attached message with the transaction? If yes how to do it?

The payment protocol (see BIP 70-72) will support attaching messages to transactions.

Note that these messages do not end up in the blockchain, which is the right way to do it, as they are private information between sender and receiver - no need to make the entire world replicate it.


Is the difficulty in mining a function of how much total mining power there are in the ecosystem? I'm trying to understand how difficulty works in bitcoin mining. I understand that as there are less and less bitcoins left to be mined, the amount you get for each new block is lowered.

The bit I don't get is how a block is mined every 10 minutes. The miners aren't connected to a single network and talking about how much mining power they have so how would the system itself be able to regulate itself to only spit out a new block every 10 minutes?

Also, does this mean that difficulty is really not only a function of how many bitcoins are left, but also how many miners are there in total? So say, if 90% of the miners decided to not mine bitcoins anymore, then would bitcoins be 90% easier to mine for the 10% of miners left? Likewise if bitcoin miners doubled, it would be 100% more difficult to mine? Simply due to the fact they would need to sustain the quota of a block per 10 minutes?

Difficulty is a function of the number of blocks and the time it took to produce them. In Bitcoin, the difficulty is calculated every 2016 blocks. At each recalculation, it calculates how long it took to mine the 2016 blocks using the block timestamps and then compares that to how long it should have taken to mine 2016 blocks (the target is 2016 blocks in 2 weeks). Then using simple proportions, it scales the difficulty accordingly.

Because the difficulty is based on the time it took to mine blocks, the difficulty is directly related to the amount of hash rate there is in the entire system. More hash rate means that blocks will be found more quickly, so the difficulty will increase. Less hash rate means blocks will be found more slowly, so the difficulty decreases.


Is there a ripple whitepaper? I'm interested in doing some research on the ripple system. Is there a whitepaper which explains the underlying fundamentals and how they are realised? I know about the Wiki, but that is not citeable in research publications.

Not that I know of. Opencoin is still playing around with the protocol, so there probably won't be a white paper until they open source it.


Understanding Transactions, Mining, and the 10 minutes block solved I'm not entirely sure if the questions I have regard to Bitcoin all relate to each other?
How do miners decide how many transactions they should have in a block in order to mine 1 bitcoin? When miners compete to find the "nonce" that has the smallest possible hash number, would it be faster/easier to find the "nonce" if there are fewer transactions? Or do miners try to pack as many transactions (up to 1 mb of data) into a block so they can get the most fees?
Do all miners try to solve a solution where all the transactions should be the same in a single block and everyone's trying to compete to finding the nonce and hash? Or is it random, and its just whoever finds a hash the quickest, saves those transactions and adds it to the blockchain?
Also, I noticed looking at btc.com, there are blocks being mined less than 10 minutes back to back, I thought it needs to be 10 minutes to be mined?

How do miners decide how many transactions they should have in a block in order to mine 1 bitcoin?

The amount of work miners do has no impact on the amount of Bitcoin they make. The block subsidy is a fixed amount, and transaction fees are determined from transactions. Mining 1 Bitcoin does not require some specific amount of work.
Miners determine how many transaction they should have by determining how much in transaction fees they stand to gain from including those transactions. This is typically done by ordering all known unconfirmed transactions by their fee rate. Then the miner just includes as many transactions that is allowed by the consensus rules, starting from the transaction with the highest transaction fees.

When miners compete to find the "nonce" that has the smallest possible hash number, would it be faster/easier to find the "nonce" if there are fewer transactions?

No. The number of transactions has no significant effect on the difficulty of a block or the amount of work required to mine a block. While including more transaction nominally requires computing more hashes, this is negligible in the grand scheme of things, especially since this calculation is only done once for a set of nonces and extraNonces.

Do all miners try to solve a solution where all the transactions should be the same in a single block and everyone's trying to compete to finding the nonce and hash?

Everyone chooses their own set of transactions to include. Everyone is making their own block, just each block points to the same parent block.

Or is it random, and its just whoever finds a hash the quickest, saves those transactions and adds it to the blockchain?

It is entirely random. It's however finds a block first and broadcasts it.

Also, I noticed looking at btc.com, there are blocks being mined less than 10 minutes back to back, I thought it needs to be 10 minutes to be mined?

The average time between blocks is 10 minutes, but that is an average, not a requirement. Blocks can be found in less than 10 minutes, or more than 10 minutes. The average block is ~10 minutes.


How to convert from Ardor time to Unix time? What is the best approach to convert from Ardor time to Unix time?

Ardor time is measured in seconds since the Genesis block, represented as Java int. Currently there is no API which performs conversion to Unix time so you have to code it yourself.

If you are coding a server side contract in Java use the following code:

long EPOCH_BEGINNING = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss Z").parse(isTestnet ? "2017-12-26 14:00:00 +0000" : "2018-01-01 00:00:00 +0000").getTime();

public static long fromEpochTime(int epochTime) {
    return epochTime * 1000L + EPOCH_BEGINNING - 500L;
}

public static int toEpochTime(long currentTime) {
    return (int)((currentTime - EPOCH_BEGINNING + 500) / 1000);
}

If you are coding a client side app in Javascript use:

function fromEpochTime(epochTime) {
    return epochTime * 1000 + EPOCH_BEGINNING - 500;
};

function toEpochTime(currentTime) {
    return Math.floor((currentTime - EPOCH_BEGINNING) / 1000);
};


What is the current state of BIP 38 (encrypted paper wallet) integration with cell phone wallets? Given current implementations, is there a wallet that I can use to scan a private key, then enter in the password as a PIN, and the wallet will send from the key and sweep the rest onto a key generated from the phone?

Android, obviously.

Also, what's the state of BIP-38 integration with wallets in general?

Blockchain.info works well, exactly as you describe for BIP38 encrypted keys.

I switched to Mycelium in late 2014 and have had good experiences since then.

  what's the state of BIP-38 integration with wallets in general?

It is actually quite good now.
Only obviously missing wallet is Armory: https://github.com/etotheipi/BitcoinArmory/issues/131

(Armory pioneered many of these ideas with its own implementations, but it is not yet using standards like BIP32 and BIP38 which came later)

One can also use Bippy to work with BIP38 encrypted keys offline.

PS: I just added recommendations here for creating a paper wallet:
How to download bitaddress.org to use offline?


Why was the bip32 fingerprint used for bip174 psbt? The fingerprint is widely used across the bip174 psbt specification. This is done to speedup parsing for a signer such that he

  can observe whether the master fingerprint for the public key for that output belongs to itself (as quoted from BIP174).

BIP32 defined the fingerprint as the first 4 bytes of the hash160 of a public key. It also says that

  Note that the fingerprint of the parent only serves as a fast way to
  detect parent and child nodes in software, and software must be
  willing to deal with collisions. Internally, the full 160-bit
  identifier could be used.

Why was the fingerprint chosen for psbt instead of the full hash? Collisions aren't that rare for just 4 bytes of data and adding mitigations in the psbt transaction parsing for such a case seems unnecessarily complicated.

There is also the issue that if the chain code changes without the public keys changing, the fingerprint will remain the same. If this would be the case, the fingerprint would be identical between two identical public keys, but each would lead to differently derived child keys. This leaves even more work for collision detection and potentially even destroys the benefits of using the fingerprint for fast account ownership checks.

Why was the fingerprint chosen for psbt instead of the full hash? Collisions aren't that rare for just 4 bytes of data and adding mitigations in the psbt transaction parsing for such a case seems unnecessarily complicated.

Fingerprint collisions would still require thousands of signers in a single PSBT to actually be a problem. Collisions aren't all that probable when you consider the circumstances.

There is also a practical issue. You can't get the full pubkey hash160 from hardware wallets. There is no existing standard that includes this data and no existing APIs that export it. In some devices, you could get the master public key and hash it yourself, but not all devices supported getting that. The fingerprint is far easier to get, just get the xpub for the key at m/0h and pull the parent fingerprint from that.

  There is also the issue that if the chain code changes without the public keys changing, the fingerprint will remain the same. If this would be the case, the fingerprint would be identical between two identical public keys, but each would lead to differently derived child keys. This leaves even more work for collision detection and potentially even destroys the benefits of using the fingerprint for fast account ownership checks.

I don't see how this would even be possible unless you are intentionally messing around with the chaincode, and I don't see why you would be.

The chaincode is derived by hashing the BIP 32 seed with HMAC-SHA512 and taking the last 256 bits. The first 256 bits becomes the master private key. So you would have to somehow collide the first 256 bits (and thus have the private component of the master private key). But that is highly improbable and is akin to a normal private key collision. The only situation where you could possible have the same public keys but different chaincodes is if you were directly modifying the chaincode itself, but I see no reason for anyone to do this, and if they were, they would really only be inconveniencing themselves.


Are bitcoins “stored” on phones? Or we only see data on the blockchain? I'm confused. BTC or other crypto currencies are not stored on phones/computers right? On Wallets we ONLY see the amount of BTC or currency that belongs to us, but there is nothing being "stored” right?

You're right, your wallet is only holding your private keys and tracking the unspent transaction outputs that you're able to sign for. The UTXOs are also tracked by every full node on the network, which have digested the complete transactional history of the network to learn exactly which pieces of the currency are currently available for spending.
As long as you maintain control of the private keys, you can regenerate the information of the spendable balance from the publicly available ledger.


What does the poclbm output mean? I have 3 graphics cards mining with poclbm (no external pool) and they all have pretty much the same output:

MYSERVER:MYPORT [141.642 MH/s (~0 MH/s)] [Rej: 0/0 (0.00%)]

what does the "~0 MH/s" mean?

From the poclbm source code, Switch.py line 219:

say_quiet('%s[%.03f MH/s (~%d MH/s)] [Rej: %d/%d (%.02f%%)]', (if_else(verbose, miner.id()+' ', '') , rate, round(estimated_rate), rejected_shares, total_shares, float(rejected_shares) * 100 / total_shares_estimator))

It's estimated_rate.

And how estimated_rate that found, you ask?
I tried looking at the source, but that didn't really clear things up.

self.estimated_rate = Decimal(new_accept) * (targetQ) / min(int(now - self.start_time), self.options.estimate) / 1000
self.estimated_rate = Decimal(self.estimated_rate) / 1000

I eventually found this discussion on bitcointalk. It states that the estimated rate is based on how many shares are submitted to the pool. I don't know what it's supposed to display if you're not using a pool.


How do you track the participants of a multisignature transaction? How to glean which wallets were involved in a multisignature transaction?

a multisig tx (e.g. 2of3) has a redeem script, which is basically the hash of three bitcoin addresses. This hash is included in the bitcoin transaction. As per today's knowledge, this hash can only be reproduced, if you have the three initial adresses. If you don't have them, then you can't know, which adresses were initially involved. A hash is a one way. Easy to generate a hash, but extremly difficult (or even impossible) for today's computers, to revert back.


why using `blockIndex` in bitcoin's code `unconfTxs` I am reading the code of rpc's estimateSmartFee method , and I can't understand why using blockIndex in unconfTxs ?

estimateSmartFee loop unconfTxs to get feeRate(code: https://github.com/bitcoin/bitcoin/blob/0.18/src/policy/fees.cpp#L291)

But the value unconfTxs[blockIndex][bucketindex] will be reseted in TxConfirmStats::ClearCurrent or reduced in TxConfirmStats::removeTx.
Why not just define like this unconfTxs[bucketindex]?

source file fees.cpp

unsigned int TxConfirmStats::NewTx(unsigned int nBlockHeight, double val)
{
    unsigned int bucketindex = bucketMap.lower_bound(val)->second;
    unsigned int blockIndex = nBlockHeight % unconfTxs.size();
    unconfTxs[blockIndex][bucketindex]++;
    return bucketindex;
}

the unconfTxs

    // Mempool counts of outstanding transactions
    // For each bucket X, track the number of transactions in the mempool
    // that are unconfirmed for each possible confirmation value Y
    std::vector<std::vector<int> > unconfTxs;  //unconfTxs[Y][X]

That whole vector is to keep track of how many blocks have passed since a transaction entered the mempool and what feerate it is. So it allows the estimator to look up how many transactions have been in the mempool for Y blocks at a feerate of X. This allows it to see what feerate is probably needed in order for a transaction to be confirmed in Y blocks.

If you just had the number of transactions at each feerate, that only tells you the feerate distribution of unconfirmed transactions. This is not helpful for estimating how many blocks will pass before a transaction becomes included in a block.


Is there a BSD Bitcoin client? I have a few BSD-based systems sitting around serving away, but for the most part they're idle CPU-wise. Does anyone knew of a bitcoin client that I could run on these machines to make them more productive while they wait for requests?

The standard Bitcoin client should run on BSD machines. If you encounter any difficulties getting it to compile or run, ask more specific questions.