Does bitcoin have the potential to be subject to a hard fork where miners are forced to choose which fork they will accept, like Etherum? Some background (Taken from Quartz):

  Ethereum is similar to bitcoin, but it also supports smart contracts,
  agreements written in computer code that execute automatically when
  conditions are met.

  Distributed Autonomous Organization (DAO) sought to build a humanless
  venture capital firm that would allow the investors to make all the
  decisions through smart contracts. It was one of the biggest
  crowdfunding effort in history. For Ethereum, the backbone of the
  project, it was a major vote of confidence in its nascent technology.

  Then it got hacked, when someone started siphoning money out of the
  DAO. By the end, the hacker, who has said that he was simply taking
  advantage of a technical loophole in the DAO, had amassed $50 million
  in ether, based on current exchange rates at the time. While the core
  developers who designed and run Ethereum didn’t really have anything
  to do with the DAO, they were left to deal with the mess, so they
  decided to hack the hacker.

  They managed to stop the theft and move the funds into another smart
  contract where they currently sit: a temporary fix. The way the code
  of DAO was written, there is a question of whether the original hacker
  can still lay claim to the funds. Fixing this would require more
  intervention from the core developers.

  Whether to do so has created an existential question for Ethereum. One
  of its underlying tenets is that it’s a decentralized platform,
  meaning the power lies almost exclusively with all of its users. By
  stepping in to fix this problem, it would completely undermine that
  objective. This has led to a heated debate between those who want to
  return the funds and others who say that the the power of smart
  contracts lies in their immutability.

  Doing so would basically eliminate the DAO, and move all the money
  into a smart contract that can only reimburse investors. The initial
  proposal was a soft fork where a majority of the Ethereum miners could
  voting on the roll back. Unfortunately, a security flaw was found in
  the voting process, which eliminated this option.

  That leaves a hard fork, where the core developers of Ethereum
  unilaterally make the decision to essentially create a new version of
  the network with different rules than the original. Then, miners,
  exchanges, and other major apps that are built on it need to decide if
  they want to a part of the new version of Ethereum or the original.

Yes, Bitcoin could also be subjected to a hardfork. In fact, there are members of the Bitcoin community that feel so strongly that the blocksize should be increased that they are proposing to do just that:
They are working on a version of Bitcoin that is incompatible in regard to the current consensus rules of Bitcoin forcing a permanent split of the blockchain into two. They surmise that their vision for Bitcoin will have greater support than the road map followed by the Bitcoin Core developers and expect to oust the original chain completely.

As they (IMHO) appear to overestimate the support for their project, I don't expect the latter to come to pass.

As Mindwin has pointed out in the comment rightly so, the Bitcoin blockchain has actually forked before by accident: See march-2013-fork, or Bitcoin Magazine's report.
There have also been previous forking attempts, such as the ones pushed for by Bitcoin-XT and Bitcoin Classic.


How to convert Stellar Lumens into USD I have created Stellar account. I have to transfer lumens to other account in USD.
How can I convert lumens to USD?

On stellar site, it is mentioned that we have create trust line with provided Anchors. But while creating thrust line it is always saying "changeTrustLowReserve".

Please suggest any inputs if you have.

What I'd suggest is to convert it to USDT on Bittrex or Bitfinex and then proceed to withdraw USDT to your bank account.

Another alternative is to convert it to BTC and withdraw it in cash using Localbitcoins.


Where can the Coinbase referral link be found? I got the coinbase bonus signing up in an Italian site. I'm wondering if I can do the same promoting Coinbase to someone I know. I heard I can receive the bonus and they can get the bonus too. It sounds pretty good. But how can I have my link to give to my friends?

In your profile settings you can get your referral link to invite your friends.
I think both of you will get $10 when your friend spends $100 in buys.


How to get confirmations for incoming transactions? I'm currently working on accepting Bitcoins on my website. To do this I create a new address for every sale. I know I can get the amount of bitcoins that were paid into this address by using ./btcoind getreceivedbyaddress <the-address> 0 or conn.getreceivedbyaddress(localAddress, 0) when using the python binding for bitcoin. So far so good.

I now also want to get and display the amount of confirmations to the customer. So I made this:

highestConfirmCount = None
for i in count():
    received = btcConn.getreceivedbyaddress(localAddress, i)
    if received >= amountExpected:
        highestConfirmCount = i
    else:
        break
print highestConfirmCount

This works fine, but it's pretty slow for incoming payments which have been a while ago. Also, I would presume there would be a better and more efficient built in function for this, but I can't find anything like it.

Does anybody know what the best way is for getting confirmations for incoming payments to a specific address?

Calling bitcoin-cli listunspent 0 9999999 "[\"someLocalAddress\",\"someOtherLocalAddress\"]" will provide you with the exact number of confirmations for every transaction to these addresses so you will not need to perform all these iterations.

Replacing 9999999 with what you consider in your application to be a confirmed transaction will only return the unconfirmed transactions, which is more effective if you already keep track of the confirmed transactions in your database.


How to activate the mining process in the standard bitcoin client? I have done the whole synchronization and now it should be mining bitcoins from what I understand but I don't see anything showing that it is actually mining for bitcoins nor any activity from my cpu… Is this normal ?

Do I need to enter a command to start the mining process or is the process done automatically without having to do anything ?

Warning: doing what is described below will not gain you any coins at all with exceedingly high probability, and just burn electricity (see other answer).

Bitcoin Core still has a built-in miner. It is not efficient, not optimized, does not use any special hardware (like special CPU instructions, GPUs, FPGAs, or ASICs), and is only useful for testing on test chains.

You can enable it by issuing the RPC command setgenerate true, and disable it with setgenerate false. These commands can be issued in the debug console in Bitcoin-Qt, or using an RPC client (like bitcoin-cli) to send it to a running bitcoind instance.


How can I buy bitcoins using Western Union (October 2012)? I would like to use Western Union to buy some Bitcoins. I have carefully read Bitcoin's wiki page about buying Bitcoins now I'm after users' input about which service they would recommend.
There's a lot of services and I am just after the quickest and safest (like everyone I guess). Could, you guys, recommend a service you find to be the best please?

Western Union is a hassle and is expensive.   Bitcoins Direct was accepting WU payments until just a couple days ago.  In the U.S., about the last exchange to accept WU (USD) for bitcoins is:

http://www.QuickBitcoins.net

In the EU there is an exchange that accepts WU (EUR):

http://bitcoinsinberlin.com

There are also some others.  For instance:

http://www.ecurrencyzone.net/buy.php
http://www.coinmama.com

As far as other options, the factors relevant to providing the right advice include:

Where are you located (country)?
How much are you looking to buy?
What payment methods do you have available?
How soon do you need access to the proceeds?
Is privacy important?

Quite simply, depositing cash at a bank or 7-11, Walmart, CVS is going to be the fastest and easiest way.

Options:

http://www.BitInstant.com (Deposit at major banks, 7-11, Walmart, CVS, Moneygram, etc.,)
http://www.BitMe.com (Deposit cash at Chase)
http://www.BitFloor.com (Deposit cash at Chase or Wells Fargo)
http://www.bitinnovate.com (Deposit cash at a bank in Australia & New Zealand)
http://www.CAVirtEx.com (Deposit cash at several banks)
http://www.Spendbitcoins.com (Deposit cash at a bank in Australia)
http://BitcoinNordic.com (Purchase CashU or UKash in dozens of countries)
http://www.BTC-E.com (Deposit cash (USD) at bank locations in Russia)
http://www.BitNZ.om (Deposit cash (NZD) at back locations in New Zealand)
http://www.BitInstant.com (In Brazil using Boleto or Banco Recomendito, or in Russia, using Qiwi or Cyberplat.)

Also, Bitcoins Direct will accept cash, but they have a $500 minimum order size:

http://bitcointalk.org/index.php?topic=87094.0 (Deposit cash at Bank of America, Wells Fargo or PNC, minimum $500)

Or you might find a local trade (paying cash):

http://www.localbitcoins.com

The fees aren't trivial but you can use a credit card to purchase by using VirWoX where you can buy SLL using your credit card, then trade SLL for BTC:

http://www.VirWoX.com

Or if you are considering a bank transfer, there all kinds of options are available:

http://en.bitcoin.it/wiki/Buying_bitcoins

There is also #bitcoin-otc where you can connect with sellers via IRC:

http://bitcoin-otc.com/

Buying  bitcoin with western union westernuniontobitcoins.com  is very easy, being one of the few that allows you to transfer money online directly to  bank account or to a person authorized to raise money from an office W.U

http://westernuniontobitcoins.com


Public Keys Prefixes and Derivation Paths When importing an zpub, for example, to a wallet, does the wallet understand it should recreate a set of addresses using the derivation path "m/84'/0'/0'" and the script type "p2wpkh" ?
So if I generate an zpub with correct script type but choose an arbitrary path like  "m/77'/0'/0'", would it be conceptually wrong and can cause problems when exporting to other wallets ?
I am just trying to understanding if the concept of version bytes / prefixes in extended public keys are also path-dependent or can change just according script type.
The SLIP 0132 mentions the path for some prefixes.
But the Electrum Docs don't.

It all depends on the wallet. There is no rule saying they should even accept these strings or know what they correspond to and there is no consensus among wallets.
Wallet A could accept zpub and know the desired path and script type while wallet B may accept the same zpub, ignore its version byte and use the default derivation path and a completely different script type while wallet C could simply reject the string because of "unexpected" starting character (z).
With that said most of the times wallets perform similarly as long as there is a BIP somewhere defining the algorithms.


Where can I access a NXT public testnet node? Was wondering where can I access a public NXT testnet node?

Start up Nxt on your local system in Testnet mode and display peers (on the Settings Menu (gear graphic) in the header bar). The peers with a domain name are likely to be public nodes. Here are a few:

nxt.noip.me, raspnxt.hopto.org, node1.forgenxt.com

For example, put node1.forgenxt.com:6876 in your browser to open the Nxt Wallet.

Some of the non-domain name (IP address only) will work too.


How to make a vanity throwaway address? Similar to 1BitcoinEaterAddressDontSendf59kuE I want to write data to the Blockchain, and write to specific addresses.

I want to send small amounts of Bitcoin to addresses like this:

1MikesReallyCoolApp<game_id_here>59kuE

How can I do this while still maintaining a valid address to send BTC to?

Is there someone who can breakdown the parts of a Bitcoin address that can be altered? I know each address needs a "1" in the beginning, but not sure about the other rules.

Simple website to create burn address http://gobittest.appspot.com/ProofOfBurn
If you want a script try this https://gist.github.com/CoinWhisperer/6d673f1f3d13da1611cd


How does transaction confirmation work through mining process? Hi i am just a newbie in this thing but there is something i can not understand if blockchain keeps every transaction in it and creating a new block to blockchain takes so much time then doesn't it supposed take long time to confirm a transaction that is sent from A to B?

Yes, the system is designed in a way that you should expect a new block to be mined every 10 minutes, which is what is needed for a new transaction to confirm. As more blocks are mined on the top if it, the transaction gets more and more "confirmations". Each user decides how many confirmations are required for the transaction to be considered "safely completed".

Although it should take roughly 10 minutes to create one confirmation, due the nature of the process, it can be much faster (think tens of seconds) or much slower (think more than 1 hour). So definitely, in some cases, you may need to wait a long time before you get the number of confirmations you want. Another factor here is the number of transactions that are currently waiting to be confirmed. If there are many such transactions, your transaction may not make it into the very next block, thus prolonging the delay even more.

This is the reason for many different technologies to emerge. You can see many altcoins that change the parameters to lower the time needed for the successful "completion" of the transaction. But even on Bitcoin, you can see technologies like Lightning Network to emerge that promise very fast completion times.


Can the fees in a coinbase be used to launder Bitcoins? Generally Bitcoins coming from a coinbase are considered clean as they are newly generated. However while answering this question I realized that mining pools could offer to launder Bitcoins in the following (in its edge case even extrem) way:

Let's say I want to launder 1 Btc

I create a chain of btc transactions with a relatively high fee (1000 Satoshi per byte). In the extreme case  I could even make an extremely large transaction by including a couple of outputs with large scripts producing 1 tx which has basically the entire amount as a fee.
I send this (those) tx only to the mining pool that helps me to launder the Bitcoin.
The mining pool then sends me an output from the coinbase to a new Address of a value less then the 1 btc (taking their share of the laundering operation) also since I wanted to launder I could receive several smaller payouts to various addresses.

Let's say this is impossible due to KYC requirements of miners. Such an endeavor could also be achieved by solomining such a block by renting out hash power.

Of course such an extreme tx would already look suspecious but I could create a similar situation by spammimg tx during a high fee market (or even producing such a fee market by spamming.)

Somehow this picture makes me worry as it seems to me that criminals would not only be incentivised to do so it would also interfere with the entire ecosystem.

Am I missing some point here? Why has that not been done yet? In case of stolen coins (for example quadrica exchange, it seems to me that it would even be worthwhile to just create a mining operation for such an endeavor)

While nothing stops you from paying a high fee to a miner and claiming it out of band, trying to launder any significant amounts through this would likely be discovered and linked fairly quickly.

A pattern of disproportionately high fee transactions appearing in blocks that are mined by a subset of miners would be noticeable, as would linking the money - If you are laundering 10 BTC and put it through via these fees, I simply need to track the spends of the coinbase output instead of spends from the original 10 BTC utxo.

Of course, you could do this piecemeal by laundering smaller, less noticeable amounts like 0.01 BTC per tx, up to 0.2 BTC per block, but that doesn't really scale to a significant amount, especially not once you take out the miner's fee. Moreover, unless you are able to bring all miners on board, you could only do this a handful of times a day (assuming you manage to convince a single large pool), which again does not scale up to any significant amount of BTC, especially if you stick to doing small amounts.

It's likely simply not worth the effort for miners or launderers. Sending coins to a KYC free exchange, or exchanging them P2P for other coins, especially ZCash and Monero, likely has much higher throughput.


What are the top sites to purchase bitcoin from? As a newcomer to bitcoin, what would be the top websites for purchasing bitcoin?

I recommend CoinBase.
Coinbase is a Bitcoin company based in San Francisco, and backed by trusted investors. Coinbase is the world’s largest Bitcoin broker, and also offers an exchange, wallet, and developer API.

Coinbase offers its brokerage services in the United States, United Kingdom, Canada, Singapore, and the following European countries: Austria, Belgium, Bulgaria, Croatia, Cyprus, Czech Republic, Denmark, Finland, France, Greece, Hungary, Ireland, Italy, Latvia, Liechtenstein, Malta, Monaco, Netherlands, Norway, Poland, Portugal, Romania, San Marino, Slovakia, Slovenia, Spain, Sweden, Switzerland.

Coinbase plans to enter the Latin American market in 2016.

Coinbase has a knowledge base and email support. Coinbase “Community” can be used to ask questions and get support help.


Why there are miner fees now? I understand the mining fee will be the major incentive when the Bitcoin supply hit its limit of 21m. But right now, new coins are still being minted and are much higher than any fee can compansate. Shouldn't the fee calculation be a WIP improvement protocol that needs to be worked on in the Testnet rather than causing huge innefficeny in the Main Bitcoin network?

I am very sorry if it is naive to think that, but I see that many debates on Bitcoin's future are based on the high amount of miner fees or the long waiting time for confirmations.

Why shouldn't miners just add the transactions randomly and just incentivized by the reward?

I believe the mainstream usage adoption will be provided by the people who can't afford the current miner fees, but still wish there could be a way to actually use the network at least in a fair way where the highest fee couldn't win the confirmation race.

To sum up, I am wondering, why the fee structure shouldn't be tested and worked on on the Tesnet until a good protocol for fee calculation has been developed, and in the main network miners just incentivized by the reward and add the transactions in blocks randomly or by First In First Out method or by some other criteria rather than fee?

Fees are there because of penny-flooding attack, which is a praticular kind of denial-of-service.

Without fees you would have a situation in which an attacker can fill the memory pool with 0-costs pending transactions, which would cause a sensible service degradation.

An attacker could move its funds between addresses of its own, spamming thousands of transactions on the network without losing anything. The memory pool would grow until filled, and since miners are not able to discriminate between honest transactions and malicious transactions, this will result in no (or few) honest transactions being processed and included in the chain.

By adding a fee you are adding a cost to such attack. An attacker is no longer able to generate thousands (or more) of fake transactions at no costs.


How bittrex and other bitcoin trading websites send bitcoin to their one user to another instantly and without any fees? When user-1 post an order of selling btc, user-2 comes and fulfill that order, we noticed that instantly user-2 receive btc in his/her wallet.
My question is how is it possible to send btc instantly with out any charges.

They are not transferring coins. They are issuing IOUs that are only valid on their platform.

The coins are not transferred until a user makes a withdrawal to their own wallet, which usually does involve a withdrawal fee. Similarly, your initial deposit to the exchange is much slower, and involves a transaction fee, which is paid by you.


As mining without a pool? Bitcoin 0.14

Friends, tell me how you can mining without a pool at home on your computer?
I have bfgminer and cgminer
I'm trying to connect so

D:\bfgminer\bfgminer.exe -o stratum+tcp://localhost:18444 -u login-p password

D:\cgminer-4.10.0-windows\cgminer.exe -o stratum+tcp://127.0.0.1:18352 -u login -p password

but it does not work:(

bitcoin.conf

regtest=1
server=1
daemon=1
rpcuser=login

# Alice connects to Cory
connect=localhost:18444

rpcpassword=password
rpcallowip=127.0.0.1

So Regtest as it says here on official bitcoin Developer notes. https://bitcoin.org/en/developer-examples#regtest-mode

  Bitcoin Core’s regression test mode (regtest mode) lets you instantly
  create a brand-new private block chain with the same basic rules as
  testnet—but one major difference: you choose when to create new
  blocks, so you have complete control over the environment.

Start bitcoind in regtest mode to create a private block chain.

## Bitcoin Core 0.10.1 and earlier
bitcoin-cli -regtest setgenerate true 101

## Bitcoin Core master (as of commit 48265f3)
bitcoin-cli -regtest generate 101

So on Regtest mode you do NOT need to mine with an ASIC.  It is like testnet but you decide when to and how many blocks to generate for your testing.

Hope this helps.

EDIT: Old Post below, as missed the regtest part of the config file

Yes u can solo mine, but you will need to run the bitcoin client so it knows what the latest work is.  I should mention that u should not be solo mining btc without at least 250TH or so hashing power from last calculation I saw with current difficulty, so u would need many ASICs for this.

Otherwise your conf file and connection string look ok.


How to properly combine PSBTs for CoinJoin? I am trying to learn the workflow for manual Coinjoins using PSBTs. I was following Andy Chow's suggestions in another thread here Where he suggests:

1. Createpsbt (he suggests using walletcreatefundedpsbt)
2. Have individual users send their PSBTs to coordinator
3. Coordinator uses joinpsbts to join the separate PSBTs into one
4. Coordinator sends joined PSBT back to users to sign with walletprocesspsbt
5. Once all users have signed/processed the joined PSBT, coordinator uses combinepsbt.
6. Coordinator uses finalizepsbt and then transmits to the network using sendrawtransaction.

I am on testnet using Bitcoin Core version v0.19.0.1 (64-bit)
I'm using the console in QT
I am using multiple wallet.dat files to simulate different CoinJoin participants.
I've created 2 PSBTs from two separate wallet.dat files, and am able to join them together using joinpsbts

Once I have my joined PSBTs, I was able to sign my PSBT in each wallet, and then combine them into one PSBT using combinepsbt.

When I try to finalizepsbt, I get a return of  "complete": false
I am able to decode the PSBT and view all the correct inputs/outputs, but I must be missing a step to finalize the transaction after combining.

I believe I need to get finalizepsbt to return a value of true.

As a sidenote, if I use a single wallet.dat file, I can create multiple PSBTs, join, process, finalize, and send exactly as Andy describes. However when I try to do this in a  more-real-world-situation than "just one user combining his own PSBTs" and then try to combine the PSBTs from different wallet.dat files, then I run into problems (to me, each wallet.dat file = one separate user/Coinjoin participant).

I am very embarrassed, just circling back to share, the above workflow works perfectly. My problem was I had an incorrect vout value in one of my inputs. Basically I was trying to spend money I don't have (/facepalm). As soon as I corrected that, everything worked flawlessly.

Here's my multi-wallet.dat file Coinjoin :)
https://live.blockcypher.com/btc-testnet/tx/537d4f9c49e06916c8f74ad53e52c3389f1654f4dec1014e2335c7ad49e268ab/


Bitcoin Transaction Unconfirmed I made a transaction on March 13th, transferring .88 BTC from my desktop wallet to another account. I have a Mac and am using Bitcoin-Qt version v0.8.1-beta. The transaction did not go through, my wallet is "out of sync", and I do not have the .88 BTC in my wallet anymore. I have scoured the internet trying to solve this problem and have not found anything yet. Any help is MUCH appreciated!

You can see when is your transaction with : https://blockchain.info

If your wallet is out of sync don't worry, it's normal that you don't see the transaction.
If you sent BTC from A to B, B will see the transaction when he's synced.


How to connect to litecoin testnet3? Running litecoin-0.13.2 with testnet=1 I get "No block source available."

Do I need to add some nodes to litecoin.conf ? I tried adding some that I found from http://litecointools.com/ . Is there a more official list?

testnet3 is deprecated.  The development version is now on testnet4 and it appears this will be in the v0.14 release.

https://github.com/litecoin-project/litecoin/pull/285


Transfer BTC from online wallet to paper wallet I just wanted to post this here to make sure I am doing this exactly right.

I created an online wallet with block chain dot info (cant post links with my rep)
I am going to buy BTC's from bit bargain dot co dot uk and transfer the bitcoins to my online wallet created in step 1.
I used this tutorial (http://fieryspinningsword.com/2013/12/01/how-to-create-a-reasonably-secure-bitcoin-paper-wallet/) to create a 'reasonably secure' paper wallet (I even wrote down my keys instead of printing them off as noted in the 'extra security' bit at the end)
I shall then send all the BTC's from my Online wallet (step 1) to my paper wallet (step 3).

My question(s) are:

My paper wallet will still be secure? because I've only used the public key online — correct?
How can I confirm that the BTC's are in my paper wallet? I don't want to hold on to these suckers for 10 years, for them to be worth billions, to realise that I lost them in the ether when I come to sell/use them.

I used the tutorial to the letter, and took no further steps to create my paper wallet, if I missed something and it's not created properly, please let me know.

My paper wallet will still be secure? because i've only used the public key online - correct?

Sure, if the wallet was created securely in the first place then sending to it's public key (address really) poses no threat to it.

  How can I confirm that the BTC's are in my paper wallet?

You can use a block explorer like blockchain.info or blockexplorer.com to check the balance of your paper wallet address.

Might not hurt to do a trial run with a small amount first.


How can I track bitcoin transaction(I am receiving) programatically? Building something where I will be getting bitcoins in my bitcoin address, so is there a way I can keep track and know who sent me bitcoin?

You can run Bitcoin Core with the walletnotify feature, which will execute a script of your choice every time you receive a payment.

See How do I use walletnotify?

There are also lots of third-party service providers which have APIs to notify you of incoming payments.


How to get the derived public key from xpub? Here I'd like to generate the other address use xpub.

Is there any library (python) could help to derive the new address from extended key?

such as:

gen_new_pub(xpub, new_path) to get the derived public key.

Of course, the library supposes could support

gen_new_prv(xprv, new_path) to generate the corresponding private key according to the xprv and path.

the btclib library (https://github.com/dginst/btclib) is a python3 type annotated library for bitcoin cryptography; it provides BIP32 functions, tested to successfully reproduce the BIP32 test vectors (https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki).

Among the btclib functions you can find:

bip32.ckd(xparentkey, index) [child key derivation]
bip32.xpub_from_xprv(xparentkey) [neutered derivation]
bip32.derive(xkey, path) [child key path derivation]
bip32.address_from_xpub(xpub) [address derivation]
bip32.mprv_from_seed(seed) [master private key from seed]


How to do "sendmany" without accounts? As the account system is deprecated, I am not using it. But when I try use json-rpc call sendmany, I get the error:

"Account has insufficient funds (code -6)"

But when I call getbalance I have more than enough funds

It is possible to use without an account.
Just use "" as from-account.

Example:

sendmany "" '{"mzjqvrPTipexdXzJbCjZExs8keg7nMf4M3":0.01,"mqQ69fPZEeJomEzG85FHfrKQ66x3w6oXwp":0.02}'

Watch out: It will tell you Account has insufficient funds (code -6) when you not have enough funds even if you don't use accounts.

Help:

sendmany "fromaccount" {"address":amount,...} ( minconf "comment" ["address",...] )

Send multiple times. Amounts are double-precision floating point numbers.

Arguments:
1. "fromaccount"         (string, required) DEPRECATED. The account to send the funds from. Should be "" for the default account
2. "amounts"             (string, required) A json object with addresses and amounts
    {
      "address":amount   (numeric or string) The bitcoin address is the key, the numeric amount (can be string) in BTC is the value
      ,...
    }
3. minconf                 (numeric, optional, default=1) Only use the balance confirmed at least this many times.
4. "comment"             (string, optional) A comment
5. subtractfeefrom         (array, optional) A json array with addresses.
                           The fee will be equally deducted from the amount of each selected address.
                           Those recipients will receive less bitcoins than you enter in their corresponding amount field.
                           If no addresses are specified here, the sender pays the fee.
    [
      "address"          (string) Subtract fee from this address
      ,...
    ]

Result:
"txid"                   (string) The transaction id for the send. Only 1 transaction is created regardless of
                                    the number of addresses.

Examples:

Send two amounts to two different addresses:
> bitcoin-cli sendmany "" "{\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.02}"

Send two amounts to two different addresses setting the confirmation and comment:
> bitcoin-cli sendmany "" "{\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.02}" 6 "testing"

Send two amounts to two different addresses, subtract fee from amount:
> bitcoin-cli sendmany "" "{\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.02}" 1 "" "[\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\",\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\"]"

As a json rpc call
> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "sendmany", "params": ["", "{\"1D1ZrZNe3JUo7ZycKEYQQiQAWd9y54F4XZ\":0.01,\"1353tsE8YMTA4EuV7dgUXGjNFf9KpVvKHz\":0.02}", 6, "testing"] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
 (code -1)


What would be the Internet Usage For 100 Antminer S7? I am planing to set up a mini farm with 100 S7 Miners, but am little concerned about the internet usage and speed.  What speed do I need and how much bandwidth it will consume per month?

Mining in a pool setting actually doesn't require all that much bandwidth. This is because you get block templates sent to you and that single template can be used by all 100 miners. A block template isn't very big, it's less than 1k and looks something like this:

{
 "error": null,
 "result": {
   "coinbasetxn": {
     "data": "0100000001000000000000000000000000000000000000000000000000000000
0000000000ffffffff1302955d0f00456c6967697573005047dc66085fffffffff02fff1052a01
0000001976a9144ebeb1cd26d6227635828d60d3e0ed7d0da248fb88ac01000000000000001976
a9147c866aee1fa2f3b3d5effad576df3dbf1f07475588ac00000000"
   },
   "previousblockhash": "000000004d424dec1c660a68456b8271d09628a80cc62583e5904f5894a2483c",
   "transactions": [],
   "expires": 120,
   "target": "00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
   "longpollid": "some gibberish",
   "height": 23957,
   "version": 2,
   "curtime": 1346886758,
   "mutable": ["coinbase/append"],
   "bits": "ffff001d"
 },
 "id": 0
}

You'll get that maybe once every few seconds, so from a downloading perspective, you only need about 20k/min download and that's sufficient to keep all your miners busy.

For upload, you'll need to submit shares to the pool. Depending on the pool, each share has to be below a certain target and the share targets are adjusted normally so that it doesn't take up much upload bandwidth. The actual upload for each share is on par with a get-block-template call. In addition, if you're using stratum, there's very little overhead in terms of requests since the same connection is used for both uploading and downloading (unlike http which incurs a large overhead).

Depending on the pool and the policies they have, though I'd guess that they normalize to reduce the number of shares submitted to be less than 100k/min. Again, depends on the pool and what shares they accept. But basically, the network bandwidth should not be the limiting factor even with a normal home internet connection.


Will Bitcoin scaling affect the amount of hashing power required to keep the network secure? In Mastering Bitcoin Andreas Antonopulous asserts that

  "Bitcoin can scale up, achieve broader adoption, and remain secure without any increase in hashing power from today’s level."

Is this really the case?

This is a comment from page 199 of Mastering Bitcoin. I think its meaning is to be interpreted taking into account the two preceding sentences:

  Note that the target difficulty is independent of the number of transactions or the value of transactions. This means that the amount of hashing power and therefore electricity expended to secure bitcoin is also entirely independent of the number of transactions.

This means that the number of transactions and their value could increase (this is the broader adoption of the currency) while the target difficulty could  remain the same (as long as the total computing power of the mining nodes remains the same), thus the total hashing power (required to solve the mathematical problem) would also remain constant.

What really increases the total hashing  power of the network, is the entrance of new miners (market forces) seeking for the reward (thus the increase of the total computational power available to the network). This is then compensated by the regulation of the degree of difficulty (target difficulty) of the mathematical problem.

P.S.: To be more specific, the regulation is done by periodically adjusting the hash target value for blocks: Every 2,016 blocks

  ( on the mean this is every two weeks, given that each block is taking approximately 10 min to confirm:
  6 (10 min intervals per hour) x 24 (hours per day)x 14 (days per week) =2,016 )

Bitcoin nodes calculate a new difficulty accordingly, based on the time it took to mine the last 2,016 blocks. This is implemented by the following formula:

  New Difficulty = Old Difficulty x (20160 min) / (Actual time of last 2,016 blocks)

And the new degree of difficulty determines the total hashing required for the solution. This is the reason that, no matter the (computational not only physical) size of the network, the mean time for block-validation remains approximately constant (about 10 min on average). See also here for the relative graph.


multisig without tying up funds Is it possible to enable a 2 of 3 transaction without the escrow component defined as "nobody can run off with the funds but the funds have to exist"

In a scenario where A wants to pay C and requires intermediary B for multisig.

Is it possible for A to authorize a transaction with B and C with one partially signed signature, and then B and C can combine that signature to create a transaction? B and C will have several ways to determine if funds are available from A, but for sake of brevity lets assume A has funds

This certainly is possible---but unless you define the "several ways" to verify that A has the funds, the solution must exclude this key component. Here is one possible solution:

Special Multisignature Bitcoin-Address

Create a 3-of-5 multisignature Bitcoin address to which A transfers the Bitcoin in question. A owns 3 of the 5 participating addresses, whilst B and C contribute one each. Next A prepares a partially signed transaction that is signed with only one of his keys.

To eventually access the funds, B and C must both sign this transaction (or ask A for further signing). But it does not tie up the funds in that A can still access the Bitcoin using only his own keys.

Note that this only protects A from either B or C unilaterally taking possession of the bitcoins involved, but it does not offer any reassurance to B or C that the bitcoins will remain available to them in the future. That may create a particularly perverse incentive for intermediary B and recipient C to conspire into splitting the pot among them rather than adhering to whatever B's responsibilities in this matter were supposed to be.


Why prices are different in different fiat currencies on the same market? What I noticed is that prices in different fiat currencies on the same market for the same crypto currency are different. But what are the reasons behind that? Does it has anything to do with market volume for the fiat currencies? What variables I need to know to predict the difference in prices?

Few examples:

1) Cexio.

BTC/USD: 6286 USD (~4749 GBP)

BTC/GBP: 4787 GBP (~6336 USD)

Price in GBP tends to be higher (currently it's +0.8%).

2) Kraken.

BTC/USD: 6263 USD (~4732 GBP)

BTC/GBP: 4743 GBP (~6277 USD)

Price in GBP tends to be highter (currently it's +0.2%).

BTC/USD: 6263 USD (703.5k JPY)

BTC/JPY: 697.2k JPY (6206 USD)

Price in JPY tends to be lower (currently it's -0.9%).

BTC/USD: 6269 USD (~5363 EUR)

BTC/EUR: 5373 EUR (~6280 USD)

Currently price is higher in EUR (+0.2%). But it changes from time to time. Sometimes price is higher in USD. Why?

Because they are different markets. Each trading pair is its own market with its own supply and demand. Each has its own set of orders and traders. It is the same reason that different exchanges have Bitcoin at different rates: they are independent of each other.


Can one rig run multiple different graphics cards? I have some 7950 and some R280, can I connect them both on one rig? Will it work normally? Or does system require all GPUs to be same?

Nope, you're good to go. You don't even have to connect them all through PCI-e. With cgminer, you can set the settings uniquely for each card. You can use any kind of adapter that would normally bottleneck GPU performance.


How long would it take for a transaction with 0 fees to be confirmed six times? I thought my wallet would ask me for a tx fee, as it always does, it just sent the amount without any tx fee at all. Now it seems to be stuck in some sort of bitcoin limbo. It's been two hours now, and not a single confirmation has happened.

Dont worry about that. If you check blockchain.info at your transaction you will see it has medium-priority, which is the reason why it was send without transaction fees:

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

I normaly send transactions without fees, it can take some time. For me it was no longer than 6-12 hour until it got included into a block. If it got inlcuded (1 confirmation) it will get confirmed again every block. So after it was included in the chain you only need to wait 60 minutes for you 6 confirmations.

If your transactions need to be send quickly you should add some optional fees on them, which can be set in the options of bitcoin-qt (if that is your wallet).


Representation of coordinates in signature. OpenSSL I want to calculate the v-value from the signature obtained using the OpenSSL ECDSA_do_sign function. I found that this value is calculated using the parity of y-coordinate of r. Here I also found that the parity of y is equal to the parity of r. I want to understand whether it depends on the implementation. Can anyone tell exactly how the coordinates x and y are stored inside r in OpenSSL. I can't find it in the code.

edited:
  I understand how v is calculated. My question is how to get the y-coordinate of r in the specific implementation of ECDSA in the OpenSSL library.

The value r is just a number and doesn't explicitly store or encode any point coordinates.  In a signature, r is set to the X coordinate of the point R, which is really k*G, where k is the secret nonce used during signing, then reduced mod the curve order.
In secp256k1, this usually means that r is in fact the X coordinate (because r itself is usually very big), but it is not always so.

During verification, the verifier attempts to reconstruct the original R point by from the signature values (s, r), the message z and the signer's public key P by solving the equation s*R' = z*G + r*P, then reduce the X coordinate of R' mod the curve order and check that it is equal to r given in the signature.

I've never used openssl, but the process seems to be in ossl_ecdsa_verify_sig().  So you can see R' being computed here :
https://github.com/openssl/openssl/blob/master/crypto/ec/ecdsa_ossl.c#L396-L404

After these lines, the reduction mod the order is done and finally the equality test.  In simple signature verification, the Y coordinate of R' is not used, but it is available from the value point (which is R') in openssl's implementation.

edit:
Also, I just realized I should add a something about pubkey recovery since you mention the v or recid value in your question.
When doing pubkey recovery from message and signature (as in the case when the signer's pukey is not given), to get the Y coordinate from a possible R' point, you would try a few values based on r as the candidate X coordinates.

The possible X coordinates of R' will be r itself, or r + curve_order (and both can be valid X's).  You can then solve the curve's equation y^2 = x^3 + 7 to get the possible Y values for each.


pycoin command line transaction Is there a quick way to do transactions knowing only the private key(secret exponent) and the destination address, preferably from a command line utility such as pycoin?

I am using Debian/Ubuntu and python 2.7.

In order to create a transaction, you need the blockchain, or at least the transactions in the blockchain that belong to a particular address (technical term would be unspent transaction outputs or UTXOs for a particular script). There are three ways this can happen:

You have a local bitcoind or btcd installed which would let you query for transactions, at the expense of downloading the entire blockchain.
You use an electrum or some other SPV server to query for transactions, at the expense of connecting to these nodes.
You use a centralized service such as blockchain.info to gather all transactions at the expense of having to trust the centralized service to be up all the time and to not be corrupt.

Any way you slice it, you cannot get the transaction data from a python library that doesn't connect to some other service. Hence tools like pybitcointools or pycoin will not get you what you need. sx has some tools to look up utxos using method #3.

You can install Armory or bitcoind and import the private key and use method #1 above or use something like pi-wallet and use method #2.


If you confirm others' transactions, what do you do to earn 25 bitcoins per block? I was a bit surprised to learn that you can earn 25 bitcoins, just by confirming a block worth of transactions. If I've done the math right, at $493 per bitcoin, that's $12,325.

Does one do a lot of work (beyond a few mouse clicks) to earn those 25 bitcoins? Does that constitute "rent" for the use of the resources of your computer (which probably cost a lot less than $12,325)?

Or is it just the case that 25 bitcoins are issued per block, and by confirming  a block of transactions, you get those those 25 bitcoins.

Just to give some specifics in addition to David Grayson's answer:

At current difficulty levels, mining a block requires computing an average of

  29,973,900,941,385,007,104

hash operations.  An ordinary computer can perform perhaps 10,000,000 such operations per second.  At that rate, such a computer would take about 95,046 years to mine one block, on average.  If the computer draws 100 watts of electricity, it would use 3,469,201 kilowatt-hours of electricity over that time.  Electrity prices are somewhere around US $0.10 per kWh, so that would cost US $346,920 in electricity alone - much more than the $12,325 of the block reward.

For obvious reasons, most miners today don't use ordinary computers, but rather specialized ASIC hardware that is considerably more efficient (and more expensive) than an ordinary computer.


Why were OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 originally reserved? Since the earliest public release of Bitcoin, OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 have been defined at 0x50 (80), 0x89 (137), and 0x8a (138), respectively.
Why?
The intended purpose of all the other now-disabled opcodes seem to be well documented, but do we have any record or explanation for why the OP_RESERVED{1,2} opcodes were assigned at their current locations?
OP_RESERVED seems pretty clearly placed to allow OP_1 (0x51, 81) through OP_16 (0x60, 96) to match each pushed number 1-to-1 with the second half of the byte (such that 0x515253 is easily read as OP_1 OP_2 OP_3). It may also be reserved to ensure users writing raw contracts don't accidentally assume 0x50 is either OP_0 (0x00) or OP_1NEGATE (0x4f, 79), which might be easily confused because 0x80 is basically a negative sign in the Script Number encoding. (Any other ideas as to why Satoshi didn't fill in OP_RESERVED?)
For OP_RESERVED1 and OP_RESERVED2, the reasoning seems less obvious.
In the oldest commit they are listed under // bit logic, a set of 8 opcodes which begins at 0x83 (131) and continue through OP_RESERVED2 (0x8a, 138).
These don't seem to fall on any particularly special codepoints, and neither of the preceding or following opcode "groups" begin or end at any obviously special codepoints.
Is there something unusual about 0x89/137 and 0x8a/138 for which Satoshi might have reserved these codepoints?
Is there some other instruction set which reserves them (or where reserving them makes the "Bitcoin instruction set" consistent with that instruction set)?

Since the earliest public release of Bitcoin, OP_RESERVED, OP_RESERVED1, and OP_RESERVED2 have been defined at 0x50 (80), 0x89 (137), and 0x8a (138), respectively.

I doubt there's any known reason for them to exist. The script engine in Bitcoin obviously underwent a lot of changes during development and in the year following; a good portion of all the opcodes were completely rewritten, the behaviour of OP_FALSE was inverted, OP_CODESEPERATOR was effectively removed by execution changes, and so forth. There's many remnants of those changes and removals, and many of the opcodes have non-obvious quirks about how they are handled as a result.
It's worth remembering that the original releases of Bitcoin had > 8 bit opcodes at least partially implemented, and they were removed in the following year, so some of the space was reserved for the byte indicating their extension.

Is there some other instruction set which reserves them (or where reserving them makes the "Bitcoin instruction set" consistent with that instruction set)?

Bitcoin script's instruction set seems to be influenced by a research paper from the early 2000s that describes "security forth", but the copies of this online seem to be well and truly rotted. Notably, the order of the operators is the same and it has matching oddities such as OP_2OVER and OP_3DUP, but these is shared by a number of other similar languages from the time as well.


What bitcoin is really easy to purchase and sale to the any person in cash? If I purchase bitcoin and after a year I want to sale it with cash what I can sale it to any person? And for the same what I get cash or check?

There are millions of users of Bitcoin, who are interested in Bitcoin. If you want to sell your Bitcoin a year later, you will find a good buyer. When you want to sale it, maybe localbitcoins.com is a good choice. Millions of transactions are listed on this website. Buy some bitcoins, and then enjoy it. But first you need some knowledge about how to save your bitcoin by bitcoin-wallet. you can get started from here.

If you don't want use your own bitcoin-wallet, you can buy some bitcoin on a web exchange, like Poloniex or Bittrex, or you can choose a exchange by yourself, list of bitcoin-exchange.


BTC sent to Coinbase BCH wallet I have sent my BTC to a BCH wallet on Coinbase, it is for a sizable amount of money and I read that if greater than $5K, they will help you.  What is the proper channel to ask for help as the cases I have opened are not getting any results.  Both accounts are mine one on Electrum (BTC) and one on Coinbase (BCH)

Coinbase has the private key for the BTC transaction (because it should be the same as the BCH address), but it might require manual intervention on their part to recover the deposit and refund it. Unfortunately, their support is swamped with many other issues this month. If you submitted a support ticket to https://support.coinbase.com/, you might just have to wait a while before they get to it.


Original default bitcoin script Where can I read the original Bitcoin script for verifying the transactions?
Also, who controls the GitHub profile of bitcoin?
Thanks.

Where can I read the original Bitcoin script for verifying the transactions?

You should be able to find the source code on GitHub
e.g. https://github.com/trottier/original-bitcoin but I'd verify that before relying on it for anything important.

who controls the GitHub profile of bitcoin?

Some subset of
https://bitcoin.org/en/development#bitcoin-core-contributors
See https://github.com/bitcoin/bitcoin/blob/master/contrib/verify-commits/trusted-keys

See also:

Is there a list of core Bitcoin committers? (hat tip to Pieter Wuille for pointing this out)


Why bitcoin is not inflationary? I understand that a lot of people today stack Bitcoin instead of spending them and that makes sense because there is a limited number of bitcoins.

However, I think that for bitcoin to be a real currency that people use everyday there should not be a limited number of bitcoin so people could freely spend them without to care.

Why bitcoin was made this way with a limited number of bitcoin ?

If one could simply "print more" Bitcoins, then it would quickly lose its value (this is the definition of inflation btw) because of increased supply. This is the main reason why, for instance, the USD has lost so much value in the last 50 years.

People invest in Bitcoin because they think it will increase in value, not because there is a limited supply. Lots of stuff is limited, but have no value.

Throughout history, inflationary currencies (ie currencies without a cap) have all lost their value and collapsed. This includes thousands of fiat currencies and will most likely include the ones we're using today.

You say that money must be inflationary for it to work?

Well, gold is not inflationary but has been used as currency for thousands and thousands of years. In fact, it was used as world currency up until 1971. Apparently gold worked, right?

Consider this... Two villages. One produce fish and the other coconuts. They buy from each other. They each have 10 Bitcoins each. Let's print more Bitcoins -- let's double the number of coins and give them out to each village! They still produce the same amount of fish and coconuts. What's going to happen now? Yes, the price of fish and coconuts will double! In effect, the value of each coin just got cut in half. That is the effect of (uniform) inflation. (*)

Or, simply put: If every person's bank account is doubled, then all prices will double as well. So changing the amount of currency uniformly like that is pointless. Nothing really happens.

But wouldn't a non-inflationary currency cause prices to drop (and, thus the currency value to raise)?

You're correct! But there are forces which work to counter that effect. Let's look at gold again:

On a fixed gold standard, prices would indeed fall slightly year by year. (By the way, this is fundamentally a good thing).

The reason prices fall is because the amount of goods increases due to increased productivity while the amount of gold stays the same. In other words, prices go down while the price of gold goes up. But (and this is important!) higher gold prices also gives gold miners strong incentives to mine more gold! So more gold is produced which enters the economy. More gold in circulation will eventually lower the gold price (and raise prices again) until miners don't earn enough and they stop mining. Which leads to higher gold prices (ie lower prices of goods) AND... the cycle repeats again.

And that is why prices on a "fixed" money base stays stable.

But what about Bitcoin?

The stuff you just read (above!) about applies to Bitcoin a well, but there is a huge problem:

The Bitcoin price is not even remotely predictable.

I agree that it wouldn't be wise to buy one pizza with Bitcoins today, when you can buy 10 pizzas tomorrow. You see, for us to call something money, it has to to be stable. Otherwise, it's impossible to make economic calculations. So until (if) Bitcoin becomes stable, no-one is going to use it as money for practical reasons.

So for the time being, you should consider Bitcoin an asset for investment, not money.

(*) This is extremely simplified, particularly as I ignore the harmful Cantillon effect. Inflation (money supply increase) in the real world, causes enormous amounts of problems, one of which is that it acts taxes the most unfortunate of us.


How did Extranonce2_size change? From stratum,I know that the coinbase is composed of "Coinb1 +Extranonce1 + Extranonce2 + Coinb2".

How did Extranonce2_size change ?

Will the Extranonce2_size change when I connect to a pool?

Miner sent message mining.subscribe to pool

mining.subscribe("user agent/version", "extranonce1")

Pool reply with

[[["mining.set_difficulty", "subscription id 1"],
["mining.notify", "subscription id 2"]],
"extranonce1",
extranonce2_size]

Pool set size of extranonce2


Wouldn't bitcoin benefit from distributing partial blockchains over each node? Why doesn't each node store only a portion of the blockchain?

For example, if you had 100 nodes, each node would store 10% of the blockchain. This would amount to significant overlap of each aspect of the blockchain, and as nodes came and left there would be increased or decreased sharing of the blockchain.

Is it infeasible? If so, why? I am interested in pursuing this as a project because I think it could solve a lot of bitcoin's scalability/decentralization issues.

From my understanding of the blockchain, let's assume a particular node starts at the genesis block. Let's assume another node stores 1% of the blockchain past the genesis block. Couldn't multiple node verify block hashes for their shared 9% at a rate of once every 10 minutes? It wouldn't really use that much data -- you could hash the 9% of the blockchain to a particular value, produce a public key, and see if the other nodes can match a private key to said public key.

A related question: Is this what Electrum does? Or, does Electrum simply store the entire blockchain on multiple servers that you can connect to?

Why doesn't each node store only a portion of the blockchain?

This has been proposed before and is possible with Bitcoin, but it's not clear how it would be executed. The blocks aren't an important part of a running node, for most people you can throw them out as soon as you have processed them into your UTXO database.

The problem comes when deciding which parts to store, and signalling to other people in the network that you have a certain subset of blocks. You can't advertise a list of hashes as that would be massive and inefficient (many megabytes for each peer), and making a deterministic random selection is extremely problematic. Choosing ranges of blocks is not ideal because the sizes are not consistent, 1,000 blocks at the beginning of the chain is servers orders of magnitude smaller than ones at the tip. In a naive implementation of random selections peers attempting to sync with the network may need to make thousands of connections to find a single peer that has a specific block, which is obviously not feasible.

  From my understanding of the blockchain, let's assume a particular node starts at the genesis block. Let's assume another node stores 1% of the blockchain past the genesis block. Couldn't multiple node verify block hashes for their shared 9% at a rate of once every 10 minutes? It wouldn't really use that much data -- you could hash the 9% of the blockchain to a particular value, produce a public key, and see if the other nodes can match a private key to said public key.

This is not necessary and highly vulnerable to Sybil attacks, you don't need to verify blocks once you have seen them. Pruned nodes work like this today, only they throw away every block and store absolutely nothing more than they are specified to sore. They don't advertise which blocks they have because there is no mechanism for that.

You might want to read up on how the autoprune patch works and get a better grasp on the threat models that need to be tackled here. You've missed some of the operation slightly, note that pruning for nodes nodes does not operate in the way described in the white paper, the UTXO is a newish concept added in 0.8.0 era Bitcoin Core.

  A related question: Is this what Electrum does?

Not at all, Electrum servers are a full node and an extremely heavy address based index, almost doubling the storage size. The client is light weight but the sever most definitely is not. There's no sensible way of maintaining these indexes in a sharded way, though you could break addresses into multiple pools and hope that people maintained enough of each shard for clients to be able to request subscriptions for all of their addresses. Ideally systems would be designed that don't require full indexes as they are getting increasingly unwieldy to work with.


What causes the 'uncertainty' when a block is still relatively new I am currently looking into bitcoin and the underlying blockchain technology for an internship. More specifically, I am trying to grasp the confirmation process. Many sources I have used for my research state that after 6 blocks, a transaction is 99.9% valid.

My question is: where does the 0.01% uncertainty about a transaction stem from?

Many thanks in advance.

An attacker could try to mine a chain of 7 blocks that would not include that transaction. That chain would replace the one where the transaction happened and "undo" it.

However, doing this is very hard, it requires the attacker to control a significant amount of hashpower and isn't guaranteed to work 100% of the time since while the attacker is mining, the other honest miners are also mining. Satoshi ran some numbers (albeit his calculations were off) in the whitepaper, section 11.

The more blocks your transaction is buried under, the higher the certainty is. It exponentially increases with every block that confirms your transaction.


in PHP how to calculate full uncompressed public key from a short 02/03 pubkey? in PHP how do i create the full public key from a compressed one?

my test key is
026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3

and the uncompressed one is
6a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3
36b6fbcb60b5b3d4f1551ac45e5ffc4936466e7d98f6c7c0ec736539f74691a6

can this be done via openssl?

thanks for any helpful answer!!

using MDANTER's great library i managed it to work.
if anyone needs it in the future.
use Elliptic\EC;
$ec = new EC('secp256k1');
$pub="026a04ab98d9e4774ad806e302dddeb63bea16b5cb5f223ee77478e861bb583eb3";
$key = $ec->keyFromPublic($pub, 'hex');
print_r($key);


Bitcoin system with payins and payouts using bip32 I want to build an automated system, that can accept payments from users in bitcoin and can make payouts to addresses, specified by users, as well.

BIP32 says, that the best way to accept payments is to use HD wallets. But what about payouts? How can I make payouts using funds from account's external chain addresses with received funds and not introduce security leaks?

For some code examples, take a look at Synala -- http://synala.com/

Or on Github:  https://github.com/peterscott78/synala/

Supports watch-only BIP32 wallets, user registration, etc.  Will also gather the unspent inputs and format them into an outgoing tx, allows for offline signing, etc.

However, doesn't allow for users to automatically send funds from their account.  Due to security reasons, no private keys are stored online, and sends must be manually processed by admin.

Nonetheless, will give you some good example code to build on.  Hope that helps.


Storing an encrypted private key on a server I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.

I want to learn how to make a website where the database does not hold anyone's private data.

What client-side encryption and hashing algorithm should I use? What algorithm or process should I use to ensure that the users encrypted and hashed data is secure on the server?

Using brainwallet, the process for account creation is this:

The client creates a private key.
The user enters a username/password
The client encrypts the private key with a password. The client hashes the password and username. The client sends data to the server.
The server stores the hashed username/password and encrypted private key to the database.

Now, whenever a user wishes to spend a transaction on my site, I am attempting to use brainwallet to send transactions. The process for this will be:

The user types in a username and password.
The client sends a hashed username/password to the server.
The server responds with an encrypted private key for that user.
The client decrypts the private key with a password.

As a side note: is this a sound process for storing and transmitting data to the server?

I am planning on building a small e-wallet website to learn the basics of encryption and handling accounts, transactions, and balances in Bitcoin.

This is really not the place to learn. Even the most hardened Bitcoin services get attacked on a regular basis.

  Using brainwallet, the process for account creation is this:

"Brain wallets" are an incredibly easy way for users to lose all of their funds. It happens every day. Think your 8 word sentence is strong enough? Chances are that it's not, and there's at least three bots that will empty the wallet in seconds of it receiving funds.

  Now, whenever a user wishes to spend a transaction on my site I am attempting to use brainwallet to send transactions.

The code you're referencing is just a frontend for blockchain.info and the bitcoinjs library.

  As a side note: is this a sound process for storing and transmitting data to the server?

Blockchain.info uses this method for it's web wallet, but no, it's very unsafe and offers very little in the way of security. If your server is compromised, the keys still are. If you are malicious, you can just backdoor the client scripting and nobody would ever know. It is not secure, and a service using this type of system shouldn't be advertising itself as such.


Creating a multisigaddress using public key from 2 different wallets or using public key from 1 wallet only? Which one is correct? Given 2 scenarios,

I used the command [addmultisigaddress] to create a multisigaddress using public keys from walletA only. When I run this command [listaddressgroupings], I'm able to see that this address is one of the account in walletA. Running the [validateaddress] command will show that this multisigaddress belongs to walletA.
I used the command [addmultisigaddress] to create a multisigaddress using public keys from walletA and walletB. Let's say 2 public keys from walletA and 1 public key from walletB. When I run this command [listaddressgroupings] for both walletA or walletB, this address is not listed in either of the wallets. Running the [validateaddress] command for both walletA or walletB show that this multisigaddress doesn't belong to either one of them.

This is (unfortunately) the correct behavior in Bitcoin Core. This is due to how the wallet is structured and what it determines to be part of the wallet.

In order to be able to have the multisig address be "part" of your wallet, you need to import it using importmulti or importaddres. That way it will be added as a watch only address so the wallet will track transactions to and from it.


I have wrongly transferred 0.00184426 BTC, request please help to return it back to my wallet I have wrongly transferred 0.00184426 BTC to address (TN3W4H6rK2ce4vX9YnFQHwKENnHjoxb3m9) request you to pls help me to return it back to my account.

Did you possibly convert your BTC to something called BTCTRON?  I don't know what this is (apparently some type of wrapped Bitcoin token on the TRON blockchain), but you can supposedly convert it back to BTC again with no fees.  See  https://support.poloniex.com/hc/en-us/articles/360054846854-Using-Bitcoin-on-TRON-FAQ
The  reason I think this is what happened is that the receiving address you gave looks like it's the one that you would have used to swap your BTC for BTCTRON.


Bitcoin transaction fee calculator I'm new to bitcoin. Is there a website where I can type amount of BTC I want to send and type of transaction - Urgent, Normal, Economic and they give me the price in USD how much the transaction fee will be ?
For now I just found this https://bitinfocharts.com/comparison/bitcoin-transactionfees.html
There I can see that transaction fee is 0.4$. But I don't think it could be so low.

This calculator and this chart are fairy useful for estimating fees. When creating a transaction with X amount of Bitcoin being spent and Y Bitcoin received, the difference (X-Y) will be the fees sent to miners. The far left column of the chart will display the amount of satoshis/byte per transaction in the mempool and the far right column will display an estimate of processing time. (Higher Satoshi/byte = more appealing to miners)

For example, this transaction is 257 bytes and was charged $3.25 in TX fees or roughly ~194 Satoshi/byte. Looking at the chart, this transaction had a much higher priority than a transaction with 10 Satoshi/byte.

A quick reminder: Fees are not dependent on how much Bitcoin you send, but rather how much space the transaction takes in bytes. A simple transaction between you (1 input) and another person (2 outputs, 1 change address, and 1 recipient) will have less fees than for example, a transaction with 20 outputs.


How do i get info from Bitcoin QT 0.7 to Bitcoin QT 0.11? I'm having trouble with Bitcoin QT 0.11 not automatically extracting address info from my Bitcoin QT 0.7. When I try to open my Bitcoin QT wallet it comes up with an error code saying it is to unsafe to continue. How can I get hold of my info from my Bitcoin QT wallet.

A blkindex.dat error means that the block index has been corrupted or can't be opened. However, the block index is not part of the wallet, and can be deleted without removing the funds in your wallet.

With that in mind, try this:

Open %APPDATA% in file explorer. Do this by pressing Windows + R, then typing %APPDATA%.
Open Roaming\Bitcoin.
Make a new folder in there called 'old block files,' or something similar.
Move every file in that folder except wallet.dat into the old block files folder.
Optionally, delete the 'old block files' folder.
Start Bitcoin 0.11, and your computer will redownload the block chain. This will take a few hours.


Can I download only a coinbase transaction at a specified block height? I want to implement a client similar to SPV client.
The client will download block headers and coinbase transactions.
There is an api of downloading block headers such as getheaders.
However, it seemed that there is no api of downloading only a coinbase transaction.

Can I download only a coinbase transaction at a specified height without downloading all transactions at the same block height?

The Bitcoin p2p network doesn't provide any methods for downloading transactions at a specific index (in this question, zero) within a block. SPV clients aren't able to perform any sort of validation of transactions that aren't their own, and only basic validation of ones paying to them, so this sort of method isn't provided. Bitcoin Core additionally doesn't maintain indexes of transactions on disk so this would require an additional one to be built for the purpose, or have the node load entire blocks and re-parse them to find transaction positions.


How do I compile Bitcoin Core to be more portable? Background: I compile bitcoind on one system but run it on another. When I compiled bitcoind 0.19.1 some time back using the following method, I was able to run bitcoind and bitcoin-cli on the target system without issue

./autogen.sh
./configure --disable-wallet --disable-tests --disable-bench --disable-gui --enable-util-tx=no --prefix=$HOME/bitcoind/x64 --exec-prefix=$HOME/bitcoind/x64
make && make install

Today I compiled v0.20.0 using the same method. If I run ./bitcoind -version on the system I compiled the binary it runs fine, but if I take the binary to my target system I get the following error:

./bitcoind: error while loading shared libraries: libboost_filesystem.so.1.67.0: cannot open shared object file: No such file or directory

The binary seemed to be portable last time, and the pre-compiled binary I download from the Bitcoin Core team runs fine.

Note that on the target system libboost-filesystem-dev and libboost-filesystem1.67-dev are not installed, this is likely the source of my error. That said, running the pre-compiled binary from the Core team runs, so why doesn't mine?

Can someone help me understand if I did something wrong or if I need to add ./configure flags to make the binary more portable? Specifically what I likely did differently than the core developers that made my binary fail where theirs worked?

EDIT 1: Running ./configure --enable-static or ./configure LDFLAGS=-static does not result in a portable binary either.

Also note that installing libboost-filesystem library with apt does fix the error.

By default, the binaries that you build are dynamically linked. This means that they use libraries installed in standard search paths on your computer. What you want is a statically linked binary where those libraries are packaged together with the binary.

Bitcoin Core achieves this by using the "depends" system. Documentation for this can be found here and in the windows cross compilation docs.

Basically, you cd into the depends directory, run make in there, then back in the root directory, you configure and point to the configuration stuff produced by the depends system, and when you compile with make, it will use the libraries build in the depends system and be statically linked.

For example, you might do these commands:

cd depends
make HOST=x86_64-pc-linux-gnu
cd ..
./autogen.sh
CONFIG_SITE=$PWD/depends/x86_64-pc-linux-gnu/share/config.site ./configure --prefix=/
make

x86_64-pc-linux-gnu is the platform that you want to build binaries for. The depends system will create a directory in depends/ with that name. That directory contains the depend system's build results.

The resulting binaries should be portable.


How can a lightweight client make sure output has not been spent yet? It's simple to prove the creation of a UTXO: You just need to provide the transaction data, the Merkle branch, and block of the creating transaction.

Then, as a full-node, it is simple to check whether the output hasn't been spent yet: You're keeping track of the UTXO yourself, and if it hasn't been removed from your UTXO set, it's still unspent.

As a lightweight client doesn't have the full UTXO set at hand, how could it make sure that an output is still unspent? I see that BIP0064 introduced a getutxo message, but can't seem to find more about it. Is such an interface still in effect? Is there an option beyond polling a number of different nodes for a particular UTXO, or running a full-node?

Clarification of what I'm interested in: I've recently read the paper Sybil-Resistant Pseudonymization and Pseudonym Change without Trusted Third Parties. The proposed system BitNym manages pseudonyms by storing them in transaction outputs. A pseudonym stays valid until the anchoring output is spent. It is therefore of interest to check whether an output is still in the UTXO set.

There are currently 115 or so nodes which will answer the getutxos message.  This is as good a source of this information as calling a 3rd party API.  The problem with both of these sources is that they do not provide cryptographic proof.

It's not actually possible to prove an output unspent, for the simple reason that it may have been spent in a block found an instant after the proof was produced.

The idea of UTXO commitments would have miners publish a digest of the entire UTXO set in every block, which could be referenced to prove that a specific UTXO was unspent as of the lastest one, but you're probably also interested in any unconfirmed spends that are floating around out there.

It may be a better idea to ask your peers to try to prove that an output is already spent.  Only confirmation should build your confidence in an incoming payment, but a spend proof in the form of a conflicting transaction (+ merkle branch, if found in the chain) can instantly lower your confidence to zero.


Do bitcoin clients automatically add more fee than specified? Sometimes when I'm sending a transaction using json-rpc calls to bitcoind, the client adds more than 0.0001 fee. 0.0001 is the TX fee I specified in the settings.

My understanding is that when the TX size is larger than a certain KB, client automatically adds more  fee. Is this true?

If so, how can I calculate how much fee a transaction will require before I send it?

Yes, an additional fee is added for each 1000 bytes in the transaction.  You can get a rough estimate of the transaction size using this formula:

148*IN + 34*OUT + 10

where IN is the number of inputs and OUT is the number of outputs.  The result can vary by IN bytes since a leading zero is prefixed to keys where the first byte is 0x80-0xFF.  This assumes the transaction is using compressed public keys (bitcoin addresses).

So, for the minimal fee, you need to keep the transaction size under 1000 bytes.  Assuming two outputs (the recipient and change), you can have up to 6 inputs without incurring an additional fee.


What triggers safe-mode? While reading through the bitcoin wiki I found this following segment describing a bitcoin RPC safe-mode

  Until version 0.3.20, Bitcoin went into safe mode when a valid alert
  was received. In safe mode, all RPC commands that send BTC or get info
  about received BTC return an error. Current Bitcoin versions no longer
  go into safe mode in response to alerts, though Bitcoin will still go
  into safe mode when it detects on its own that something is seriously
  wrong with the network.

  Even though Bitcoin no longer automatically disables RPC when an alert
  is live, it is wise for Bitcoin sites to shut down when an alert has
  been issued. To detect an active alert, poll the "errors" field of
  getinfo.

  To test safe mode, run Bitcoin with the -testsafemode switch. To
  override a real safe mode event, run Bitcoin with the -disablesafemode
  switch.

  https://en.bitcoin.it/wiki/Alerts#Safe_mode

It says "Bitcoin will still go into safe mode when it detects on its own that something is seriously wrong with the network." I am interested in learning which events would make bitcoin go in to safe mode on it's own.

It looks like the relevant code is in CheckForWarningConditions().  This sets the flags fLargeWorkForkFound and fLargeWorkInvalidChainFound, which are checked by GetWarnings(), which is called in CRPCTable::execute() to check if safe mode should be enforced.

It appears that the code looks for large forks in the block chain, suggesting that miners disagree on which blocks are valid.  The two flags seem to correspond to which camp our client falls in.


Is this an ok "poor man's 2 out of 3" key solution? In the situation that you want no individual to have the complete private key, but you do want  to share the complete key between 3 individuals, of which any 2 can construct the complete key, what is the downside from doing something like this:

Orig key = 1 2 3 4 5 6 7 8 9 (abbreviated for demo)

key 1 = 1 2 _ 4 5 _ 7 8 _

key 2 = 1 _ 3 4 _ 6 7 _ 9

key 3 = _ 2 3 _ 5 6 _ 8 9

obviously any 2 keys would construct the entire key again.

Apart from the decrease of key strength to 1/3 of the original, are there any other potential issues ?

This would be used for "short term" escrow accounts where, in the case of a "winner takes all", the escrow would just communicate their key to whichever counterpart won. If the escrow failed to send, then the counterparties could choose another (trusted) escrow and transfer the funds to them.

There are two problems with your approach. The second one's more difficult to solve than the other.

Problem 1

While it would take me a 100 million years to brute force the key 1 2 3 4 5 6 7 8 9, if I know two thirds of the key, it doesn't take just 1/3 the time, but a cube root of the time, meaning that I might actually be able to guess it.

Giving everyone a part of the key without making bruteforce faster

Instead, you generate 3 totally random strings of bytes as long as the key. We'll call these R1, R2, and R3.
We'll call the private key K, and the clients, C1, C2, and C3.
To C1, you give R1, and R2 ^ K. (^ is shorthand for XOR)
To C2: R2, R3 ^ K
To C3: R3, R1 ^ K

Example: If C1 and C2 put their heads together, they could combine R2 and R2 ^ K. This is important, because R2 ^ R2 ^ K = K
Space requirement: Given that n = number of people, and m = maximum number of people  abstain, you need n!/m!/(n-m)! ciphertexts. Okay for 3 people, starts to get unwieldy for 10.

Problem 2

When generating the key in the first place, somebody needs to know the full private key before they split it up. In other words, you need a trusted third party. To get around this, you need to do something called Distributed Key Generation. I'm not sure if this can be done for ECDSA. This paper looks encouraging based on the abstract, but I can't see the whole article.

Multi-signature transactions

This is a much more scalable and secure system. Unfortunately, it's not really ready for real-world use yet.


Understand double spending through an example Let’s suppose you have 1 BTC which you try to spend twice.

You made the 1 BTC transaction to a merchant (Transaction T1). Now, you again sign and send the same 1 BTC on another Bitcoin address to try and trick the merchant (Transaction T2).

1) Will every mining node that read from the pool both these 2 transactions discard the second one ? So as to put in a block only the first transaction (the correct one)

2) Suppose that for some reasons a mining node A mines the first transaction  in a block and propagate its blockchain to the network. At the same time a mining node B mines the second transaction in another block and propagates its blockchain to the network. This creates a fork in the blockchain. Will the other nodes of the network simply reject the B's blockchain because they know that transaction T1 is the correct one ?

3) To me it seems impossible that double spending can happen, every node will almost immediately read transactions T1 and T2 from the pool and discard T2, or discard a block if it contains T2. So i don't understand the need for waiting for 6 confirmations to be sure a transaction is correct.

First, a quick overview of what happens when you submit a transaction to the network:

Each node that hears about your transaction will check to see if it is valid according to their view of the network. If it is valid, the node may broadcast the transaction to its peers, and may add the transaction to its local mempool. If it is invalid, the transaction will be discarded (not broadcast further, not stored in the mempool).
At some point, a miner's node will hear about your transaction. If it is valid and the fee-rate is sufficient, then the miner will add it to the block template that they are mining on.
If the miner finds a block that includes your transaction, then we say the transaction is 'confirmed'. As this block propogates across the network, individual nodes will check to ensure it is valid, and then update their local copy of the blockchain (and their mempool) appropriately.

With that in mind, lets look at your questions:

  1) Will every mining node that read from the pool both these 2 transactions discard the second one ? So as to put in a block only the first transaction (the correct one)

No, because the mining node will have no way to determine which transaction was truly 'first'. Many nodes follow a 'first seen' policy to determine which transaction they will broadcast and store, but given the choice between the two transactions, a miner could include either one.

  2) Suppose that for some reasons a mining node A mines the first transaction in a block and propagate its blockchain to the network. At the same time a mining node B mines the second transaction in another block and propagates its blockchain to the network. This creates a fork in the blockchain. Will the other nodes of the network simply reject the B's blockchain because they know that transaction T1 is the correct one ?

This situation leads to what is referred to as a stale block (or sometimes, and orphan block). Nodes will store both blocks, and it will not be clear which block will be the 'winner' until a miner finds another block, that builds off one of the two blocks in question.

The other block will be discarded, and so if there are conflicting transactions (that spend the same input) in each block, it is only when one chain is extended that it will become clear which transaction will be included in the blockchain history.

Blockchain reorganizations like this are the reason for the often-cited '6 block confirmation' recommendation when receiving a transaction.

  3) To me it seems impossible that double spending can happen, every node will almost immediately read transactions T1 and T2 from the pool and discard T2, or discard a block if it contains T2. So i don't understand the need for waiting for 6 confirmations to be sure a transaction is correct.

A certain output can only be spent once in the blockchain record, this is guaranteed by the network's consensus rules. So a 'double-spend' usually involves some trickery to defraud a transaction's recipient, by convincing them to accept a transaction that will not ultimately end up in the blockchain record. For example:

Attacker sends txA to victim, while also creating txB that spends the same coins back to the attacker. Victim accepts the unconfirmed transaction, and releases payment/goods to the attacker. Later, txB is confirmed in a block, so the victim doesn't receive payment (txA is now invalid).
Attacker sends txA to an exchange, while mining a block with txB (spending coins back to attacker, as above). txA confirms in a block, so the exchange credits the attackers account balance, and the attacker quickly withdraws coins (receiving a new UTXO on chain). At the same time, the attacker hopes to mine more blocks than the rest of the network, so that they can publish their longer chain (that includes txB instead of txA), and thus have txA erased from the blockchain history. This would leave the exchange without their deposit, but the attacker would still receive the withdrawal (since it would likely come from an unrelated UTXO that the exchange owned).

Thus, the 6 confirmation recommendation (see the link above for more info). Also worth noting: the 6 block confirmation rule is important even in cases where someone is not actively trying to defraud you: stale blocks happen naturally, so by waiting for multiple confirmations you help ensure you don't accept a transaction that is included in a block that doesn't end up in the eventual longest chain.


671d52454812a73517aac8b8d0aeff82a81dc1a493f84fdcfa6273e930fa6288 is the txid while 0c47b3981a84eed8032fe87f7909da1c95fb35adcb8ba533c24712589487ca49 is the wtxid. wtxid was introduced with segwit. For more info check BIP141


How to debug a failed restore of a Namecoin wallet? I bought some Namecoins a while back. With the upcoming Merged Mining patch, I reinstalled Namecoin 0.3.24.63 on my newly formatted computer, copied my wallet.dat from my backup to the right folder, and ... can't seem to figure out how to view my funds.

I ran namecoind -rescan, and then:

> namecoind listaccounts

{
    "" : 0.00000000
}

> namecoind listreceivedbyaddress
[
]

Am I using the right commands here? Is my wallet corrupt/empty? Should I just wait for the blockchain to download? In Bitcoin, if I remember correctly transactions I made using a backup wallet were visible immediately (grayed out) even before the blockchain was downloaded. Any more suggestions?

Update - I have all the blocks.

  namecoind.exe getblockcount
  19062

The best thing to do is wait for the blockchain to download.  With most wallet backups/new installations of bitcoin or namecoin blockchain downloading is usually the issue.  Many people seem to get a little impatient and think the program is broken when it's really just the download taking a while.


What is the point of a permissioned blockchain? As far as I understand, the whole point of a blockchain is to prevent failures of the kind where a node produces arbitrary data with malice - i.e., to guard against the case you don't trust some nodes of the network. If your nodes are trusted, though, a blockchain isn't necessary at all, you know the code isn't malicious. So what is the point of a permissioned blockchain?

If your nodes are trusted, though, a blockchain isn't necessary at all, you know the code isn't malicious. So what is the point of a permissioned blockchain?

Knowing someone's identity is not necessarily equivalent to trusting them, and not all trust is equivalent.

Consider the typical example of a permissioned blockchain. Two (or more) banks want to batch hundreds of payments a day into a single daily settlement payment. Each bank trusts the other banks to be solvent, and to pay whatever they owe. However, none of the banks trust the other banks to calculate the payments correctly. Instead, they all do the calculation separately, and only make payments if they agree about the result.

You could trust your business partners to do the calculation themselves, but they could give you the wrong number, either by accident, because of a rogue employee, or intentionally. Trusting someone's honesty is not the same thing as trusting their competence.

Let's also consider the opposite of the first example, where you don't know the identities of everyone involved. Imagine you have a Bitcoin sidechain, where instead of mining, a permissioned set of nodes creates blocks. In addition, instead of transaction fees, you give out API keys, which are permitted to create a certain number of transactions per hour. Some of the people who are creating transactions are people who you don't know.

In this example, you trust other nodes to not spam the network with useless transactions, but you don't allow them to spend other people's money, or create money out of thin air.


How does OP_CHECKSIG work Hi I am learning bitcoin and learning how scripting works and how to use P2PKH. I was wondering how does OP_CHECKSIG work. I want to understand what is the data that the private key signs to create the digital signature itself?

Is there a simple explanation which illustrates how the digital signature is constructed for verification in OP_CHECKSIG? I understand that the Opcode uses the ECDSA algorithm for verifying the signature but I want to understand how the signature is generated for verification?

Pardon me if this is a basic question. Thanks

What is signed is a simplified version of the transaction (replacing the scriptSig, since that is what we are creating). There is a lot here so hopefully I covered it all:

 * `version` (4 Bytes) - Transaction format version
 * `flag` (2 Byte Array) - Optional flag, if present, must be 0001, which indicates there is witness data in this transaction
 * `input counter` (Variable Length) - Number of inputs in the transaction represented by a Variable Length Integer.
 * `inputs` (based on Input Counter) - List of all transaction inputs which will be spent and which reference unspent transaction outputs from previous transactions.
 * `output counter` (Variable Length) - Number of outputs in the transaction represented by a Variable Length Integer.
 * `outputs` (based on Output Counter) - List of all transaction outputs where the coins will be sent and which will become unspent transaction outputs to be spent in future transactions.
 * `scriptsig` (variable) - First, a one-byte varint which denotes the length of the scriptSig, then it is temporarily filled with the scriptPubKey of the output we want to redeem.
 * sequence number (4 Bytes) - Used as a relative lock time if transaction version is >= 2. See BIP68.
 * one-byte varint containing the number of outputs in our new transaction
 * 8-byte field (64 bit integer) containing the amount we want to redeem from the specified output (in satoshis)
 * one-byte varint denoting the length of the output script
 * output script
 * `locktime` (4 Bytes) - If non-zero and sequence numbers are < `ffffffff`: it represents either the block height or timestamp when transaction is final.
 * four-byte "hash code type" (1 in our case): 01000000 see [Sighash types][1]

Then, double-SHA256 hash this entire structure and the hash is what is signed. For an example, see https://bitcoin.stackexchange.com/a/5241/60443


How to uncompress a public key? Simple question but I couldn’t find the answer anywhere.

What’s the 65 bytes version of those public keys ?

0229b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898
02f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f27

which for reference yields according to Bitcoin core getrawtransaction 5ed3694e8a4fa8d3ec5c75eb6789492c69e65511522b220e94ab51da2b6dd53f 1 "00000000000000001e76250b3725547b5887329cfe3a8bb930a70e66747384d3" :

18p4JBHP3EAKCc4jqN8XzuEJtvq8G9NAot
1Dh8oSChJWZQx5sr7ePsBNtw7uKMsNnYNC

with transaction output being :

1 04ad90e5b6bc86b3ec7fac2c5fbda7423fc8ef0d58df594c773fa05e2c281b2bfe877677c668bd13603944e34f4818ee03cadd81a88542b8b4d5431264180e2c28 0229b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898 02f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f27 3 OP_CHECKMULTISIG

So that while the first Public key is uncompressed, they are no version uncompressed version of the 2 others keys on the Blockchain which means Bitcoin core is recovering the 2 addresses above from the compressed public keys (the first one being not included because the Public key is uncompressed).

Points are decompressed by solving for y in the equation used for secp256k1's elliptic curve where x is the last 32 bytes of your public key. The equation is y^2 = x^3 + 7. You will get 2 possible y values, one even and one odd. The correct one is indicated by the prefix byte of your public key which indicates whether y is even or odd.

Note that all operations must be modulo p which is defined by secp256k1's spec as being 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F.

This python script will decompress the two public keys that you have posted:

#! /usr/bin/env python3

import binascii

p = 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F

def decompress_pubkey(pk):
    x = int.from_bytes(pk[1:33], byteorder='big')
    y_sq = (pow(x, 3, p) + 7) % p
    y = pow(y_sq, (p + 1) // 4, p)
    if y % 2 != pk[0] % 2:
        y = p - y
    y = y.to_bytes(32, byteorder='big')
    return b'\x04' + pk[1:33] + y

print(binascii.hexlify(decompress_pubkey(binascii.unhexlify('0229b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898'))).decode())
print(binascii.hexlify(decompress_pubkey(binascii.unhexlify('02f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f27'))).decode())

The uncompressed public keys are:

0429b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898d6881e81d2e0163348ff07b3a9a3968401572aa79c79e7edb522f41addc8e6ce
04f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f274d335b71c85e064f80191e1f7e2437afa676a3e2a5a5fafcf0d27940cd33e4b4

Pubkey decompression is completely different and unrelated to address generation. Addresses are generated by taking a public key as is (either compressed or uncompressed) hashing it, and then encoding it. The compression matters because the resulting serialized public will produce one hash (and thus one address) when it is compressed, and a different hash (and thus different address) when uncompressed.

Addresses are encoded by hashing the serialized public key with SHA256 and then with RIPEMD160. The resulting hash is encoded using Base58 Check encoding.

In the transaction you provided, the three public keys:

04ad90e5b6bc86b3ec7fac2c5fbda7423fc8ef0d58df594c773fa05e2c281b2bfe877677c668bd13603944e34f4818ee03cadd81a88542b8b4d5431264180e2c28
0229b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898
02f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f27

have the following hashes respectively:

946cb2e08075bcbaf157e47bcb67eb2b2339d242
55af2ea3c45819c6c5ae710d29fcaaced5b00cc7
8b38a8d40e08362046dee55c1c94e7991d7dec75

Encoding those as version 0 addresses with Base 58 Check encoding results in the addresses you are expecting:

1EXoDusjGwvnjZUyKkxZ4UHEf77z6A5S4P
18p4JBHP3EAKCc4jqN8XzuEJtvq8G9NAot
1Dh8oSChJWZQx5sr7ePsBNtw7uKMsNnYNC

The code I used for this is:

#! /usr/bin/env python3

import binascii
import hashlib

b58_digits = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'

def sha256(s):
    return hashlib.new('sha256', s).digest()

def ripemd160(s):
    return hashlib.new('ripemd160', s).digest()

def hash256(s):
    return sha256(sha256(s))

def hash160(s):
    return ripemd160(sha256(s))

def encode(b):
    # Convert big-endian bytes to integer
    n = int('0x0' + binascii.hexlify(b).decode('utf8'), 16)

    # Divide that integer into bas58
    res = []
    while n > 0:
        n, r = divmod (n, 58)
        res.append(b58_digits[r])
    res = ''.join(res[::-1])

    # Encode leading zeros as base58 zeros
    import sys
    czero = b'\x00'
    if sys.version > '3':
        # In Python3 indexing a bytes returns numbers, not characters.
        czero = 0
    pad = 0
    for c in b:
        if c == czero: pad += 1
        else: break
    return b58_digits[0] * pad + res

def to_address(b, version):
    data = version + b
    checksum = hash256(data)[0:4]
    data += checksum
    return encode(data)

pk1 = binascii.unhexlify("0229b3e0919adc41a316aad4f41444d9bf3a9b639550f2aa735676ffff25ba3898")
pk2 = binascii.unhexlify("02f15446771c5c585dd25d8d62df5195b77799aa8eac2f2196c54b73ca05f72f27")
pk3 = binascii.unhexlify("04ad90e5b6bc86b3ec7fac2c5fbda7423fc8ef0d58df594c773fa05e2c281b2bfe877677c668bd13603944e34f4818ee03cadd81a88542b8b4d5431264180e2c28")

h1 = hash160(pk1)
h2 = hash160(pk2)
h3 = hash160(pk3)

print(to_address(h3, b'\x00'))
print(to_address(h1, b'\x00'))
print(to_address(h2, b'\x00'))

(Base58 encoding function from https://github.com/bitcoin-core/HWI/blob/master/hwilib/base58.py)

As you can see, this does not do any point compression or decompression. Rather it takes the public key as it is and encodes it.


Unconfirmed BTC after 48H, 0.000119 Fee! My BTC has been unconfirmed for 48 hours now.
I deliberately made a relative big fee of 0.0001119 and still no confirms.
Could anyone here PLEASE help me I'm getting kind of desperate.
Any miner that could push it, I will send him an extra fee.

This is the transaction: https://blockchain.info/nl/tx/f40f229b36f94bfbaa97a9998107c0014a6ad079370566698ec1cb58f2c94cb8

I would REALLY appreciate any help, thanks in advance!!

Microtransactions can take pretty long, even with a relative big fee.

The confidence of your transaction is: 17.39% and miner preference is low:
https://live.blockcypher.com/btc/tx/f40f229b36f94bfbaa97a9998107c0014a6ad079370566698ec1cb58f2c94cb8/

At the moment there are a huge number of unconfirmed transactions:
https://blockchain.info/nl/unconfirmed-transactions

See also this site, it will show you the estimated confirmation time in minutes:
https://bitcoinfees.earn.com/#delay

But don't worry, you wont lose any BTC. If it takes too long you will get your balance back.


Can I buy or sell with bitcoins offline? Is it possible to buy or sell something using Bitcoin, in an offline mode?

In other words, if I had my wallet on my mobile phone and I wanted to send or receive money from another Bitcoin user who also has their wallet on a mobile phone, can we send/receive bitcoins offline to each other and then later re-sync the transaction to the network?

I find offline mode critical for this currency to progress beyond a simple crypto-currency experiment because relying on the network means that if network access is unavailable, your wallet is useless.

Take a look at Bitcoin apps available for your mobile phone. Several are recommended in answers to question Can I send bitcoins with my mobile phone?. Look for apps that offer some kind of offline mode.

For instance, the highly recommended Bitcoin Wallet app for Android mentions in its feature list, "Enter transactions while offline, will be executed when online".