Armory issues on macOSX I bought BTC a few years ago and stored them in cold storage. I encrypted it and saved it in google drive.

Some time ago I decided to check on it. But I couldn't open Bitcoin Armory at all, so in the end I downloaded it via terminal (with cask and homebrew). And that worked!

I opened it, saw I had money but for some reason I couldn't send it. Whenever I would press send button, nothing happened.

So, I reinstalled it a few times and still nothing.

So, I decided a few days ago to delete entire blockchain, remove Bitcoin Core and Armory and remove all files from application support and start over.

Now, I finally downloaded the blockchain with pruning and Armory is stuck on organizing blockchain for a few days now.

So, today I decided to export the keys into Electrum but Electrum says there no Bitcoins inside of it...

I am worried that in the process I didn't accidentally lose them.

My question is, should it take this long?
And what can I do to speed it up, to get to the funds faster?

Armory does not work if the blockchain is pruned. You must have the full blockchain in order for Armory to work.


Which pools offer payouts via generation? (Eligius-style payouts) As the title says, which pools offer payouts to miners directly in the generation transaction of the block, as in Eligius?

Luke recently posted that:

  Fresh-mined coins for payouts were innovated by pools in the following
  order: puddinpop, Eligius, BitPenny, p2pool.


Why can't I connect to bitcoind on localhost? The initial question asked was as follows, but it turned out to be nothing to do with keypools:

  I had keypool=1000 before. Now I started bitcoind (the daemon version)
  with keypool=10000 option, and it is 2 hours already and bitcoind
  didn't start up yet. I.e. I still get error: couldn't connect to
  server when I try to do bitcoind getbalance.

  Its a quite fast machine AMD 64bit 4000+ CPU with 10 GB RAM, how long
  the start-up time can be? And will it be so long every time I start
  the daemon, or only the first time?

  Will future start-up times increase in any noticeable way if I keep
  keypool=10000 in comparison with 1000? Or any other performance
  degradation, except this first startup?

Edit: In the end it had nothing to do with keypool=10000. For some unknown reason my local interface was down. I fixed it with:

ifconfig lo up

I killed the bitcoin daemon with kill $PID, started it again and within a minute I could do bitcoind getbalance.

My "Intel(R) Core(TM)2 Duo CPU     T6600  @ 2.20GHz" laptop just took 80 seconds to create 1000 new addresses, so I'm surprised you're seeing over 2 hours for 10 times that.

One thing I noticed is that the address creation is noticeable faster now than I remember it - so perhaps upgrading to a recent version of the client will speed things up for you.

Run "tail -f ~/.bitcoin/debug.log" to see a log of which key number it's currently creating.

Either way, the start up should only be noticeably slower the first time, when the pool is initially created.

Edit: (in response to miernik's comment)

The debug.log output will end with lines like the following while it's populating the keypool:

keypool added key 41, size=41
keypool added key 42, size=42
keypool added key 43, size=43
keypool added key 44, size=44
keypool added key 45, size=45
keypool added key 46, size=46
keypool added key 47, size=47
keypool added key 48, size=48
keypool added key 49, size=49
keypool added key 50, size=50

The stuff you're seeing is what happens while bitcoin is running normally.  It's receiving and responding to messages on the P2P network.  I don't know what to suggest as to why it isn't accepting RPC connections.  Could it be a firewall issue, or some other configuration problem unrelated to the keypool argument?


How to debug a long "0/unconfirmed" status in the bitcoin client? When someone gets a status of "0/unconfirmed" on a transaction for a long time - what could he be doing wrong? What should he check to solve this?

Try running bitcoind from the command line with the -rescan option. It may be that your transaction was erroneous or a double-spend attempt and it only exists in your client. You could double-check the receiving address in blockexplorer to see if the transaction ever came through from the rest of the network's perspective. If this is a zero transaction fee transaction (or is just otherwise unlucky) it might still be in-queue to be included in a block. Bitcoin Charts has a list of in-queue transactions you can check as well.

Assuming blockexplorer sees the transaction, your client probably isn't downloading blocks and may not even be connected at all. Check that the block number in your client matches the block number at blockexplorer (or any of a number of other sites), check if your client has 0 connections. If you have no connections, try the troubleshooting steps from this question. Worst case scenario delete everything from the Bitcoin data folder except for wallet.dat and re-launch the client. Several hours later when you've finished downloading a fresh copy of the block chain, your 0/unconfirmed transaction will probably be resolved.


What is the meaning of the Bitcoin address version? Bitcoin address versions are described on the Address wiki page:

  Normal addresses currently always start with 1, though this might change in a future version. Testnet addresses usually start with m or n.

The Protocol specification gives a bit more technical detail:

  Version = 1 byte of 0 (zero); on the test network, this is 1 byte of 111

Aside from distinguishing real and testnet addresses, what is the meaning and purpose of the address version? How and why will it change in future?

Last time I heard of it, the future of version bytes was still unsettled.
Currently, they are used to force incompatibilities between several base58-encoded data structures:

addresses / private keys
testnet / realnet
alternative-chains variants (namecoin etc…)

This way, you cannot misuse one for the other.

Someday, it might also be used as a real version number (the current SHA-256 + RIPEMD-160 + base58-encoding for keys could become obsolete).


What is the "main" difference between consensus mechanism of Bitcoin and Ethereum? Bitcoin and Ethereum both use proof-of-work (PoW) consensus mechanism. One of differences between Bitcoin Pow and Ethereum PoW is difficulty level, meaning that while in bitcoin block generation rate is 10 minutes on average, in Ethereum is around 12 seconds on average.

Is there any other major difference between these two PoW algorithm?
For example, does Ethereum use proof-of-stake (PoS) in parallel?

The base proof of work system only differs on the block time, and the hashing algorithm. Bitcoin uses sha256d, ethereum uses ethash.

Ethereum currently does not make use of Proof of Stake, although it is planned for the future. Some of the testnets use Proof of Authority.

The consensus rules differ by a fair extent, however, since the two chains follow different models. Bitcoin is a utxo based system, and the consensus rules revolve around that. Ethereum is an account based system, and has its own consensus rules to deal with that.

Moreover, ethereum has a much more complete smart contract platform, which requires additional rules, such as ensuring transactions are executed in order.


Getting transactions and time from Block Chain Info Api I want to fetch transactions for an address from the following api:

https://blockchain.info/address/$btc_address?format=json

The thing is understanding the json returned from the api, I don't understand which of them are the transaction and the time when that transaction took place.

Can any one help?

You could use an online JSON viewer like http://jsonviewer.stack.hu (there are many others).

Just paste the return JSON into their text box and click the "viewer" tab. you will then see the JSON data in a formated expandable tree view, making it much easier to identify the transaction ids, times, and blockheights.

The transactions start under the [txs] tab in the tree.


Bitcoinjs-lib how to add multiple utxos in addInput Hi i want to make transactions of bitcoin bech32 addresses using bitcoinjs-lib , here is my code below, it works fine when my address has only one utxos but when it increases to two or more as its array which doesn't pass into addInput method, so it fails. Please help me out to loop through it or what is the solution to handle multiple utxo as input.
Thanks

    // THIS THING I WANT BUT CANT DO IT BECAUSE LITECORE-LIB DOESNOT SUPPORT BECH32.
//---------------------------------------------------------------------------------------
const litecore = require('litecore-lib');

let utxo = [{
        txId: 'a3f2565ab944629bc0ca46990593c8ec49c50b5eaee0789d58b1b4bc97a76eb9',
        outputIndex: 1,
        address: 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30',
        script: '00142f37386a7c332261dc4d77f77b0b92cbb9abf3e4',
        satoshis: 3000000
    },
    {
        txId: '9d1517a2499ce5496ba3c826785b25982c63dc5b59b0c256303bf19128e44747',
        outputIndex: 0,
        address: 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30',
        script: '00142f37386a7c332261dc4d77f77b0b92cbb9abf3e4',
        satoshis: 2000000
    }
]

let to = 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30'
let from = 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30'
let privateKey = ''
let value = 1000

// // 4. Create transaction
var transaction = new litecore.Transaction()
    .from(utxo)
    .to(to, value)
    .fee(1000)
    .change(from)
    .sign(privateKey);

console.log(transaction)

//----------------------------------------------------------------------------------------

// NOW I WANT TO USE THIS LIBRARY AS ABOVE.
const bitcoin = require("bitcoinjs-lib");

let utxo = [{
        txId: 'a3f2565ab944629bc0ca46990593c8ec49c50b5eaee0789d58b1b4bc97a76eb9',
        outputIndex: 1,
        address: 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30',
        script: '00142f37386a7c332261dc4d77f77b0b92cbb9abf3e4',
        satoshis: 20000
    },
    {
        txId: '9d1517a2499ce5496ba3c826785b25982c63dc5b59b0c256303bf19128e44747',
        outputIndex: 0,
        address: 'ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30',
        script: '00142f37386a7c332261dc4d77f77b0b92cbb9abf3e4',
        satoshis: 30000
    }
]

let NETWORK = bitcoin.networks.litecoin;
let txb = new bitcoin.TransactionBuilder(NETWORK);

//get unspent output details
let txid = "9d1517a2499ce5496ba3c826785b25982c63dc5b59b0c256303bf19128e44747"; //transaction id of the output you want to spend
let outn = 0; // n out

//need scriptPubKey for adding input
let WIF = ""; //private key of bech32 output
let keypair = bitcoin.ECPair.fromWIF(WIF, NETWORK);
let scriptPubkey = bitcoin.script.witnessPubKeyHash.output.encode(
    bitcoin.crypto.hash160(
        keypair.getPublicKeyBuffer()
    )
);

//add input
utxo.map(item => {
    txb.addInput(item.txId, item.outputIndex, null, scriptPubkey);
})

//add output - Total UTXO SATOSHIS are: 20000 + 30000 = 50000/ So sending 10000 rest should be in the same address
txb.addOutput("ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30", 10000);

//signing
utxo.map(item => {
    txb.sign(item.outputIndex, keypair, null, null, item.satoshis);
})
let tx = txb.build();
let txhex = tx.toHex();

console.log(txhex);

What's different with spending SegWit outputs is that signatures cover input values. In other words, every SegWit input must be accompanied by its input value.

Mozilla's documentation says don't use map if you aren't constructing a new array. So I'll use for loop. (because order is important, and for-of is too new)

for (let i = 0, k = utxo.length; i < k; i++) {
    txb.addInput(utxo[i].txId, utxo[i].outputIndex, null, scriptPubkey);
}

//add output - Total UTXO SATOSHIS are: 20000 + 30000 = 50000/ So sending 10000 rest should be in the same address
txb.addOutput("ltc1q9umns6nuxv3xrhzdwlmhkzujewu6hulyuwgx30", 10000);

//signing
for (let i = 0, k = utxo.length; i < k; i++) {
    txb.sign(i, keypair, null, null, utxo[i].satoshis);
}


Could an old, unconfirmed transaction fail to be processed because it is no longer deemed to have enough fees I just read Why do small transactions without fees ever get processed? and it made me wonder about the risk that a legitimate, lock_timed transaction might not be processed once the lock_time is past.

I'm aware (from the above question) that in the reference implementation, the increasing age of a transaction (in the mempool once it's been submitted?) should increase its priority regardless of the its fees but not every miner is willing to process low(/no) fee transactions even now never mind what they may (not) do in future.

So if I have a signed transaction with a (very!) distant lock_time and it has fees that were considered reasonable at the time that the transaction was created and then when I submit it after lock_time what is the risk that no miners will process it because its fees are subsequently considered to be too low to bother with it?

If that does happen, all you need to do is spend your unconfirmed transaction's output with a sufficient fee. A "sufficiently greedy miner" will process both transactions just to get the fee of the latter.


How to distinguish addresses currencies apart on php I need depending on the address to assign a value of the transaction.
Both at the level of php distinguish btc ltc from ppc?

A Bitcoin address always start with 1 or 3.
A [Litecoin] address always starts with the letter L.
A Peercoin address starts with the letter P.

Assuming you can figure out how to check the first character in php, you can distinguish between different addresses. Then you can program whatever value you want into the transaction. Good luck!


How to get notification on bitcoin receive with bitcoin core How can I get Bitcoin receive notifications with Bitcoin Core. I have tried the walletnotify and blocknotify options. walletnotify is fired two times when I send or receive bitcoins. And with blocknotify I have to perform below task to detect which account of the wallet has received bitcoin.

Run getBlock command to get all transaction hash
Run a for loop for each transaction hash to run getTransaction command
If transaction hash belong to my wallet account, I save the receive transaction in my database.

Using blocknotify seems to be inefficient as it involves lots of RPC calls per transaction.

walletnofity executes twice for bitcoin send and receive.

I have also tried ZMQ but I got a response which is difficult to convert into desirable format.

So could anybody suggest some efficient way to get a bitcoin receive notification upon first confirmation?

walletnotify executes once per every unconfirmed transaction creation (incoming/outgoing) and once more once the transaction is mined into a block (gets it's first confirmation).

I am not sure what are you developing, but as far as I see it both notifications are essential:
The first one to let the customer know that his transaction had been recorded, and the second to know that the value was indeed remitted, with enough fee, and will not be double spent.

For more info please review the official documentation.
https://en.bitcoin.it/wiki/Running_Bitcoin


Can you buy bitcoins as a Canadian without a bank account? So is it 100% true that one cannot but bitcoins with just a credit card BUT your purchase MUST be connected to a bank account?  If it's supposed go be anonymous then why is the bank account needed? I just want to try owning $10 worth of bitcoins by buying with a credit card...is that possible?

There's a wiki page about buying Bitcoins with a credit card. It seems the ideal options for you would be Brawker or MeetPays. But whatever method you decide to use, don't forget that Bitcoin is not anonymous (by default), that's a common myth.


Are mastercoin transfers transparent on the blockchain? The mastercoin specification (https://github.com/OmniLayer/spec) details an obfuscation process, but doesn't provide the motivation for implementing this obfuscation.

Why does mastercoin use this type of obfuscation, and what data does it inhibit onlookers from determining?

Mastercoin (now called Omni) had an uneasy relationship with the bitcoin core team early on. Some of them objected to our injecting metadata into the bitcoin blockchain to do advanced transactions.

Because of their objections, we were concerned somebody might try to identify and censor our transactions. That didn't actually happen, thankfully.

I haven't heard any talk of censorship for a long time now, so I doubt that will be a concern going forward. Still, we had plans in place in case it became an issue. But it hasn't been used and hopefully won't need to be.


What are cash outlays & expected inflows for an individual miner? I'm a student and a beginner interested in learning about Bitcoin. I am not interested in attempting to mine at this time, but I would like to know more about how it works.

Per my understanding, adding to the blockchain requires brute-force computing. I know some amateurs attempt to mine with relatively simple setups, spending maybe a few thousand dollars to get the necessary equipment. I also know that others spend significantly more to create complex setups that, all else equal, I would assume are much more effective.

Generally speaking, what are some estimates for what people might spend to get set up to mine bitcoins? Given what people might spend, what might they expect to earn in a year if constantly mining? What I'm most interested in knowing, for context, is what type of an "investment yield" does the average miner generate? For example, if I spent $5 on equipment and earned $25 in a year, my return would be 20%.

Thanks for your thoughts!

There are a bunch of mining profitability calculators here. You just need to fill in how much you're going to spend on the equipment, what sort of hash rate you get from the equipment, how much you pay for electricity and what you think bitcoin will be worth and it'll tell you. These are all highly dependent on what you buy, how much of it you buy, where in the world you are and what bitcoin price will be. Investment yields will differ based on those factors.

An ASIC machine manufactured 2 years ago in Paris is going to be much less profitable (or basically lose lots of money) vs. getting a bulk discount on the latest ASICs in Iceland.

Also, this is a question that gets asked quite often.


blockchain.info and blockexplorer.com show different balance for the same address Does blockexplorer.com have a bug or some other reason?

https://blockexplorer.com/q/getreceivedbyaddress/1KWd23GZ4BmTMo9zcsUZXpWP4M8hmxZwRU
1.95331249

https://blockchain.info/q/getreceivedbyaddress/1KWd23GZ4BmTMo9zcsUZXpWP4M8hmxZwRU
1.90576350

Their definitions of 'total received' differ in that blockchain.info does not count change outputs as an amount 'received', whereas most other explorers do (since there is no way in general to determine if an output is really change or not, unless change is sent back to the sending address, which is the case for blockchain.info wallets).

See this related post on reddit.


Security implications of bitcoin.conf location I'm setting up and hardening a dedicated headless bitcoind and lightning daemon and wanted to have a discussion about location of the bitcoin.conf.

Item #1:

Bitcoind defaults to using ~/.bitcoin/bitcoin.conf, presumably because keeping all relevant files in one location makes it easier to copy and/or share the blockchain between different machines. Are there security implications to this? Is it substantively safer to store bitcoin.conf in /etc instead (such as /etc/bitcoind/bitcoin.conf)?

One argument against using ~/home/.bitcoin/bitcoin.conf I thought of is the RPC Password is be stored in the .conf file and could be viewed by anyone with read access. So it is less readable in ~/home or in /etc?

I'd get +1 POSIX-style-points for using /etc...

One argument against using /etc/bitcoind/bitcoin.conf is portability. It is less convenient to have the .conf file in a separate location. Less convenient means greater chance of mistake or error sometime down the road.

Item #2
Similar to #1, besides +1 style points, is there any advantage to moving logs to /var/log? My understanding is bitcoind already rotates logs, but is there an advantage to how systemd does log rotation in /var/log?

Thanks, these are good points. You're right about bitcoin.conf being in /etc and it causing difficulty accessing the daemon on a day-to-day basis. In my case this server is meant to serve a small local workgroup on the same machine and on the LAN and has bitcoind running without a wallet to serve a local lnd and electrumx instance. Both of these access bitcoind through RPC via localhost, so the location of bitcoin.conf is irrelevant to them.

Even if bitcoind was run as a system-level service to be used as a wallet, users wouldn't necessarily need to access bitcoin.conf if they used RPC. Local users could each have their own bitcoin.conf in their home folders with RPC credentials. This would eliminate their need to specify bitcoin.conf at the command line.

  You may then secure the file with "chmod 600", so only the owner can read/write >the bitcoind.conf file (and root and/or the admins after tweaking the >permissions).

^^This would do more for security than just moving to /etc.

So there is no one right answer, but that if running bitcoind as a system-level service it might make more sense (if not actually increase security) and get +1 POSIX style points to put bitcoin.conf in /etc, but if running bitcoind in the user space for a single local user it makes more sense just to keep everything in ~/home to save RPC credentialing hassles.

I do not see the "necessary" relevance to bitcoin here. File access security is better discussed in unix relevant stackexchange. Still I'd like to share my view with the little bit of bitcoind relevance.

  One argument against using ~/home/.bitcoin/bitcoin.conf I thought of
  is the RPC Password is be stored in the .conf file and could be viewed
  by anyone with read access.

depends how you setup your bitcoin system. If bitcoind is setup as a user related process, it makes absolutely sense to have bitcoind.conf in home directory. You may then secure the file with "chmod 600", so only the owner can read/write the bitcoind.conf file (and root and/or the admins after tweaking the permissions).

When storing in /etc, the "chmod 660" makes more sense, then owner and group can read/write the file. In this case I'd be having bitcoind running as a systemwide daemon. But to be honest, I haven't seen such a setup discussed anywhere. This would be ok for a static setup (using shell scripts to startup), but imagine you use it every day for tx generation or status checks. Every call to the bitcoind executable would require the correct path to the config file, and if not, bitcoind creates one (in your home dir), and then it might give RPC access problems...

  Item #2 Similar to #1, besides +1 style points, is there any advantage
  to moving logs to /var/log?

This again depends on the distribution used. My OpenBSD uses syslog (to /var/log), whereas the OpenSuSE systems have introduced last recently the journal system, where all logging is in a database. I must admit, I am more comfortable with /var/log, but when my beloved OpenBSD would also go away from /var/log, then what to do with bitcoin system logs?
So generally I'd say, /var/log should remain for the unix system related logging, and each application (I consider bitcoind as an application) should have it's own log (and related directory). This makes separation of duties on a larger unixoide system more easy, and the sysadmins wouldn't find irrelevant data in their well known /var/log directory.


How do mining pools connect to the Bitcoin network and miners connect to pool? I couldn't find the answer anywhere so I start a thread.

How do mining pools connect to the Bitcoin network to propagate transactions and blocks? Do they run their own full node? If yes, how many of full nodes?
I presume it's hard to run a mining pool with only one full node because it's IP will be exposed to some network attack like DDoS.
How do miners connect to a pool? Is there any server running by mining pools so miners can connect to?

How do mining pools connect to the Bitcoin network to propagate transactions and blocks?

They connect in the same way that everyone else connecting to the Bitcoin network does. Miners are still nodes, they do everything that a full node does.

  Do they run their own full node?

Yes.

  If yes, how many of full nodes?

At least one. It doesn't matter how many nodes a miner is running, so long as they are running a node. At least one node is needed in order for them to see transactions and blocks and for them to broadcast their own blocks. Large mining operations may have multiple full nodes. Small ones may only have one. It is difficult to know how many and what nodes belong to miners as they look like any other node on the network.

  How do miners connect to a pool? Is there any server running by mining pools so miners can connect to?

Mining pools operate servers which give out work to miners with that pool. The miners have to connect to those servers in order to get work to do. They can connect using a variety of protocols. The two protocols in use today are stratum and getblocktemplate.


Is bitcoin really anonymous? Let’s suppose i buy some bitcoin on an exchange platform (kraken for example).
This platform Ask me some informations (id card).
Now, if i transfer all my bitcoins to a physical wallet, then to another one wallet: is there a way for the platform owner to say: i Know The identity of this wallet owner.
Please note i do not want to do something nasty. It is just for understanding.
Thanks

Is Bitcoin really anonymous?

No, most people describe it as pseudonymous.
When people say that, what they mean by Bitcoin is the tools, technology and network described by Satoshi Nakamoto in the original whitepaper where he described a system of electronic cash that did not rely on trusting third parties.
They usually don't mean the parasitic third-party businesses like Kraken that some people trust with their money.
Bitcoin itself can be relatively anonymous even when parasitic businesses choose not to be (or are forced by governments not to be).
If you feel these parasitic third-parties are exposing your identity more than you are comfortable with, don't use them.
Since the beginning of time, security and convenience work against one another. If you value something - privacy say - you have to invest hard work and money in achieving that and you have to sacrifice some or all convenience.

Note that although I characterise third party exchanges as parasitic, this is mainly for rhetorical effect. They are parasitic but many of them do offer valuable services and provide the convenience that many of us seek. I don't think it right to use a more sympathetic adjective like symbiotic because I think the vision offered by Nakamoto was of a system of cash that could thrive without any dependency on trusted third parties.


Can I run a miner on the same computer as a P2Pool node? I have a P2Pool node running as a VM on my computer.  When I tried to mine on the locally hosted node, the console for the miner was spammed with accepted shares.  When I connect to a remote node, everything seems normal, and not so spammy.

Is it possible to set my miner to mine on the locally hosted node, or will I have to point my miner to a different node?

You can use a local node with no issue.  The p2pool instance will eventually increase the difficulty of the shares it asks of the miner if it is getting too many of them. 99% of those "accepted" shares are simply faked to keep the mining client happy anyway, the current share difficulty of the p2pool network is over 500k.


What are some essential features of Bitcoin classic? I already know about the 2MB block size increase. I would like to know more about who controls the code base, what the other proposed changes are, and those kinds of things.

According to https://bitcoinclassic.com/ there are no additional patches except the blocksize increase yet.

  It starts as a one-feature patch to bitcoin-core that increases the blocksize limit to 2 MB. We will have ports for master and 0.11.2, so that miners and businesses can upgrade to 2 MB blocks from any recent bitcoin software version they run.

In the times of git, nobody really controls a code base, it is just out there. The essential question is: What version is run/accepted by the majority of nodes (miners, merchants, users, ...).  You should read about hardforks if you haven't.


I am trying to get cgminer on Ubuntu 14.04 and the Guide is troubling me Okay, I am trying to follow this instruction guide:

http://www.distrogeeks.com/install-cgminer-3-7-2-ubuntu/

and the 20th step did not work because it could not find the server. I downloaded it from AMD themselves except not version 5.0, but version 6.0.

I go up to the 24th step and when I typed that in it said, "cp: target 'ADL_SDK/' is not a directory"

I then installed it and ran it, but then it gave me this message every few seconds or so:

"KnC spi: Can not open SPI device /dev/spidev1.0: No such file or directory.

Please help, I really want to mine some bitcoins and also the similar questions did not help.

It sounds like you were not in the right directory. Modify this if needed and see if it helps

cp /home/USER/include/* /home/USER/cgminer-3.7.2/ADL_SDK

Just replace USER with your username. If you are running as root (not recommended) then change /home/USER/ to /root/

If that still says directory not found then I don't think you extracted the package from AMD to the right directoy


how do you sign and verify a message that you own a bitcoin address using javascript? Is there a bitcoin library or even just pure javascript way of signing and verifying you own a btc address?

bitcoinjs-lib and bitcore-lib are both javascript libraries that allow for key signing.

For example with bitcore-lib:

var Message = require('bitcore-message');

var privateKey = new bitcore.PrivateKey('L23PpjkBQqpAF4vbMHNfTZAb3KFPBSawQ7KinFTzz7dxq6TZX8UA');
var message = new Message('This is an example of a signed message.');

var signature = message.sign(privateKey);

EDIT: To also include the verification example from bitcore's github.

var Message = require('bitcore-message');

var address = '13Js7D3q4KvfSqgKN8LpNq57gcahrVc5JZ';
var signature = 'IBOvIfsAs/da1e36W8kw1cQOPqPVXCW5zJgNQ5kI8m57FycZXdeFmeyoIqJSREzE4W7vfDmdmPk0HokuJPvgPPE=';

var verified = new Message('This is an example of a signed message.').verify(address, signature);


how to capture only one part of the getrawtransaction I want to capture just one part of what Getrawtransaction returns, but it returns an array within an array that i can't seem to process.
I.e when

$txid =
'4f52e7769fe23059a4f0fa2b66ca0ba9595812654b90cc0526ddb9703a3e1b33';
$txidarray = ($rpc->getrawtransaction($txid,1));

then I can grab the whole "vout" array element(s) with  :

print_r($txidarray[vout])

;
i.e that returns :
> Array (
>     [0] => Array
>         (
>             [value] => 0.077
>             [n] => 0
>             [scriptPubKey] => Array
>                 (
>                     [asm] => OP_DUP OP_HASH160 efe11230ccff2380c3115e2826098931bb76ccef OP_EQUALVERIFY OP_CHECKSIG
>                     [hex] => 76a914efe11230ccff2380c3115e2826098931bb76ccef88ac
>                     [reqSigs] => 1
>                     [type] => pubkeyhash
>                     [addresses] => Array
>                         (
>                             [0] => 1NsN84QPXSXEdojiC482PnJUGNfx9XduQ6
>                         )
>
>                 )
>
>         )
>
>     [1] => Array
>         (
>             [value] => 0.02636684
>             [n] => 1
>             [scriptPubKey] => Array
>                 (
>                     [asm] => OP_DUP OP_HASH160 ae57d86c288389e086eadf1bc50998d86ad2828a OP_EQUALVERIFY OP_CHECKSIG
>                     [hex] => 76a914ae57d86c288389e086eadf1bc50998d86ad2828a88ac
>                     [reqSigs] => 1
>                     [type] => pubkeyhash
>                     [addresses] => Array
>                         (
>                             [0] => 1Gtqoz4tNTLYBR13AxypwsXupsevcy5QPq
>                         )
>
>                 )

But how can i grab ONLY  "1Gtqoz4tNTLYBR13AxypwsXupsevcy5QPq"  ???
I just want to get that address from the getrawtransaction for an txid !!
I tried :

print_r($txidarray[vout,0,scriptkey[0]);

but does not work, no clue as to what the correct syntax is !! anyone can help me ? many thanks !

Looks like you're indexing the array incorrectly.

Try:

print_r($txidarray[vout][1][scriptPubKey][addresses][0]);


When and how does bitcoin node sync itself? When does bitcoin node sync itself?

Do different types of sync in bitcoin exist (initial, periodic...)?

Always.

When starting up, Bitcoin Core sends out a request to its peers to inform it about the best chains they know about (using a getheaders message).

After that point, it is automatic: peers will immediately announce new blocks they knew about after they learn about them. This either happens using:

legacy inv mechanism, in which case just block hashes are announced
BIP130 (if negotiated), in which case announcements send full block headers
BIP152 high-bandwidth mode (if negotiated), in which case blocks are immediately transferred in full using compact blocks protocol


How can I simulate ProofOfStake (PoS) for a testnet (clone of Pivx)? After the end of PoW blocks, I am unable to mine using PoS. Here is my setup.

1) Server with the following config file.

server=1
daemon=1
listen=1
rpcuser=user
rpcpassword=password

2) Two clients running from 2 different VPS with individual unique IPs pointed to the server using the following in config file.

staking=1
addnode=<ip of the server>

3) A Mansternode installed on a separate VPS configured to one of the client VPS above.

4) I set the last block for PoW as 200. After that it must use PoS.

5) I start the mining using the server.

6) I send 100,000 coins each both to the client wallets. In one of them I lock 10,000 coins for Masternode, which works fine.

7) The mining continues and all are updating the blocks properly without any issues.

8) However, I see that none of the wallets report that their coins are enabled for staking. when I check the status using "getstakingstatus", this is what I see.

"validtime" : true,
"haveconnections" : true,
"walletunlocked" : true,
"mintablecoins" : true,
"enoughcoins" : true,
"mnsync" : true,
"staking status" : false

Everything is true, but, "staking status" alone is false.

9) PoW stops at 200 blocks. After that, no blocks are produced and none of the clients are active for staking (PoS).

What am I doing wrong? How do I solve this so that I can test PoS and understand it better? Is there any code that I need to look at and chance some setting in the code? Please let me know.

Ok. For some reason, I got this working when I tried it for the second time. This time, I set the Last PoW block number to 350. I mined first 5 blocks using the server. Then, I setup 4 different wallets in 4 different systems. I sent enough coins to all those 4 different wallets and make it available for staking. All these I did by the first 20 blocks. Then, I started to mine again using the server. Once the block number reached 350, I stopped mining on the server and suddenly, PoS took over and started producing blocks one by one using those 4 wallets. From this experience, I feel that just having 1 server and 2 clients are not enough to simulate PoS. We may need many more wallets connected to the network to get this working. Hope this helps some one.


Transaction without fee If i want to make a transaction and sent it without fee how long it will be getting conf ?

And my friend told me it will take more than 1 day. Can anyone here explain to me why it can be happen ?

In addition to what Mikko said, there have been some recent stress tests on the bitcoin network in which a flood of low-fee transactions have been pushed through the system. When the blocksize becomes full (currently 1MB per block, though that is configurable [can be smaller, but not larger] by each miner) it is likely that the miners will take the transactions with the highest fees. Since you are talking about a 0 fee transaction, yours would probably be left behind until the more expensive transactions are processed.

Think of it like a train in which you can pay what you want to ride (and can also pay 0). If there are a bunch of people waving dollar bills around when the train pulls up, the conductor will let them on first. Your cheapness will mean you wait for the next train... unless the same thing happens again (and it might!).

In the recent tests, some transactions took up to 8 hours to get their first confirmation. This may change in the future, assuming the blockchain max size gets adjusted (there is a big debate on what to do next going on right now in the bitcoin circles).


How to accept and detect altcoin payments? Similar to this question, How can a website detect when bitcoins have been deposited?, is there a way to accept altcoin deposits on a website and have the website automatically know when the altcoins have been sent to the website and update the user's balance accordingly?  Is there a procedure common to all altcoins or does each altcoin need a completely different approach?

Most (99%) altcoins are just Bitcoin clones, so the same process applies, you just need to use the appropriate daemon (dogecoind, litecoind, etc). If you need extra help, we'd need to know which altcoin. In addition depending on how popular the altcoin is there may be the equivalent of Blockchain.info (has merchant services for Bitcoin), eg. DogeAPI.


What is a Blob Vault? The Blob Vault is a part of the Ripple project.
What is it?

The project should get a reamdme.

The "blob vault" is a very simple encrypted storage system used to store Ripple wallets. Your Ripple wallet stores your annotations, named accounts, and so on. You can create a new wallet with the same secret and get your funds back, so losing your wallet does not mean losing your funds.

The guts consist entirely of about 100 lines of Javascript.


How exactly do I run the -rescan command for bitcoin-qt from console on a Mac? I downloaded the blockchain from a torrent, but when I imported my old wallet.dat file, the balance is not showing.  I am unfamiliar with console operation, so please be as specific as possible.  Thank You!

Method 1

Open "Finder".

Press Cmd + Shift + G

Paste this:

~/Library/Application Support/Bitcoin

Edit bitcoin.conf with TextEdit

Add this line:

rescan=1

Save it, then run Bitcoin-qt.

After you the rescan ends and you quit don't forget to revert the bitcoin.conf

Method 2

Right click Bitcoin-qt

Choose "Show package contents"

Go to  Contents/MacOS/Bitcoin-Qt

Run Terminal.

Drag the file to terminal

Type -rescan

Press Enter.

Don't quit Terminal before the rescan ends and you quit Bitcoin-qt

It's done.


The reason is not strictly the upgrade from 0.12 to 0.13, but from a version that does not support SegWit to one that does, after SegWit activated on the network.

Bitcoin Core 0.13 comes with the code preparations for SegWit, although they are only enabled for testnet. Several miners have run pre-release code for 0.13 on testnet ahead of time, causing testnet to already switch to SegWit.

The problem is that you don't have the witness data for the blocks since that activates, so 0.13 decided to ignore those blocks on disk, and download them again.


The BIP32 Extended Keys are different? I was using the same random entrophy (d2310508c6c5313795dc80a7408b608ffda7176dbedefac00f8114c5dd89a673) to generate the BIP32 Root ExtendedKey (path: m) in the libbitcoin-explorer and web-based wallet respectively.

But I don't know why i got two different results?

In the libbitcoin-explorer, I typed the command (./bx hd-new d2310508c6c5313795dc80a7408b608ffda7176dbedefac00f8114c5dd89a673) and got:
xprv9s21ZrQH143K4bPcDZFCnACLDrv2ta2XUpPyMU2j98VEpw1XPPTt7oPiQbbXscESmatehXLGGUGLRZ5yYBiN2y2VR1q6pmH69YBuDWkqW1f

In the web based wallet I had:
 xprv9s21ZrQH143K4EQpRE59bbF9QXCW7QxJSW4LF9wWWWJCamtjVqnn5yuQGh9Y3XDAr9NSwyszLGjqXCuVc3gYMgRjy7FrW12MuaBY5jc4jVu

Because they are doing two different things.

libbitcoin is taking the entropy and directly using it as a BIP 32 seed to produce the BIP 32 master private key.

However the web based wallet is taking the entropy, producing a BIP 39 mnemonic, then using the BIP 39 mnemonic to produce the BIP 32 seed and from there the master private key. Since BIP 39 mnemonic to BIP 32 seed involves hashes and does not result in the same value used to create the mnemonic, the resulting BIP 32 seed is different from your initial entropy. Thus you are getting two different private keys.


encode/decode Base-58 C++ I have built a base-58 encoder using this formula: https://www.youtube.com/watch?v=GedV3S9X89c&feature=youtu.be

Is there a smarter way to encode/decode with base-58?

I read somewhere that you need a bignum library which I use Boost for.

My goal is to convert between these two:

008D4D508F5BF2C28B20A3863405F05D3CD374B045E4B316E7
1Dt8ty59tU9LkrXG2ocWeSzKFAY8fu6jga

Which so easily this website do: http://lenschulwitz.com/base58

I know bitcoin source code have a base-58 encoder/decoder, but I do not know how to implement it successfully.

Have added my own implementation, complete with a fuzz tester to ensure that it works properly.  (The CodecMapping parameter is provided so that you can change the alphabet string as I've had to do from time to time)

#include <vector>
#include <random>
#include <string>
#include <algorithm>
#include <iomanip>
#include <iostream>

inline static constexpr const uint8_t Base58Map[] = {
  '1', '2', '3', '4', '5', '6', '7', '8',
  '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G',
  'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q',
  'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y',
  'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g',
  'h', 'i', 'j', 'k', 'm', 'n', 'o', 'p',
  'q', 'r', 's', 't', 'u', 'v', 'w', 'x',
  'y', 'z' };
inline static constexpr const uint8_t AlphaMap[] = {
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0xff, 0x11, 0x12, 0x13, 0x14, 0x15, 0xff,
  0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, 0xff, 0xff, 0xff, 0xff, 0xff,
  0xff, 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0xff, 0x2c, 0x2d, 0x2e,
  0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x39, 0xff, 0xff, 0xff, 0xff, 0xff };

using CodecMapping = struct _codecmapping
{
  _codecmapping(const uint8_t* amap, const uint8_t* bmap) : AlphaMapping(amap), BaseMapping(bmap) {}
  const uint8_t* AlphaMapping;
  const uint8_t* BaseMapping;
};

std::string Base58Encode(const std::vector<uint8_t>& data, CodecMapping mapping)
{
  std::vector<uint8_t> digits((data.size() * 138 / 100) + 1);
  size_t digitslen = 1;
  for (size_t i = 0; i < data.size(); i++)
  {
    uint32_t carry = static_cast<uint32_t>(data[i]);
    for (size_t j = 0; j < digitslen; j++)
    {
      carry = carry + static_cast<uint32_t>(digits[j] << 8);
      digits[j] = static_cast<uint8_t>(carry % 58);
      carry /= 58;
    }
    for (; carry; carry /= 58)
      digits[digitslen++] = static_cast<uint8_t>(carry % 58);
  }
  std::string result;
  for (size_t i = 0; i < (data.size() - 1) && !data[i]; i++)
    result.push_back(mapping.BaseMapping[0]);
  for (size_t i = 0; i < digitslen; i++)
    result.push_back(mapping.BaseMapping[digits[digitslen - 1 - i]]);
  return result;
}

std::vector<uint8_t> Base58Decode(const std::string& data, CodecMapping mapping)
{
  std::vector<uint8_t> result((data.size() * 138 / 100) + 1);
  size_t resultlen = 1;
  for (size_t i = 0; i < data.size(); i++)
  {
    uint32_t carry = static_cast<uint32_t>(mapping.AlphaMapping[data[i] & 0x7f]);
    for (size_t j = 0; j < resultlen; j++, carry >>= 8)
    {
      carry += static_cast<uint32_t>(result[j] * 58);
      result[j] = static_cast<uint8_t>(carry);
    }
    for (; carry; carry >>=8)
      result[resultlen++] = static_cast<uint8_t>(carry);
  }
  result.resize(resultlen);
  for (size_t i = 0; i < (data.size() - 1) && data[i] == mapping.BaseMapping[0]; i++)
    result.push_back(0);
  std::reverse(result.begin(), result.end());
  return result;
}

// Fuzz Testing the Encoder & Decoder
int main(int argc, char** argv)
{
  std::random_device device;
  std::mt19937 generator(device());
  std::uniform_int_distribution d1(1, 100);
  std::uniform_int_distribution d2(0, 255);
  CodecMapping mapping(AlphaMap, Base58Map);

  auto create_data = [&]() -> std::vector<uint8_t> {
    std::vector<uint8_t> data(d1(generator));
    std::cout << "Generating: " << std::dec << static_cast<int>(data.size()) << " points\nPoints:\n";
    for (uint8_t& v : data)
    {
      v = static_cast<uint8_t>(d2(generator));
      std::cout << std::uppercase << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(v);
    }
    std::cout << std::endl;
    return data;
  };

  std::vector<uint8_t> test_data, decoded_data;
  std::string encoded_data;
  size_t passed = 0;

  for (size_t i = 0; i < 1000; i++)    // Number of tests here!
  {
    test_data = create_data();
    encoded_data = Base58Encode(test_data, mapping);
    decoded_data = Base58Decode(encoded_data, mapping);

    std::cout << "Encoded\n" << encoded_data << "\nDecoded:\n";

    for (uint8_t d : decoded_data)
      std::cout << std::uppercase << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(d);

    std::cout << "\nTest Result: ";
    if (test_data.size() == decoded_data.size() && test_data == decoded_data)
    {
      std::cout << "PASSED\n";
      passed++;
    }
    else
    {
      std::cout << "FAILED\n";
      break;
    }
    std::cout << std::endl;
  }
  std::cout << "Passed Tests: " << std::dec << static_cast<int>(passed) << std::endl;
  return 0;
}


Download only first few blocks of blockchain Is there an archive location or a place where I could be able to download only the first few hundred blocks of the block chain?

If you are running the Qt client on your computer you already have them at this physical location

If you want to retrieve them through Qt's RPC facility then for index i = 0 to i = 99 iterate: getblock(getblockhash[i])


Why would a miner mine with a difficulty other than 'the' difficulty? Why would a miner mine with a difficulty other than the network difficulty? Both of these questions describe miners mining in such a way. What's the benefit of this? What even does it mean?

To understand this we should first explain that a block with a high difficulty, let's say D, is also a share of low difficulty d < D, therefore if we find such a block for difficulty D we automatically have a block of difficulty d. This also means that if I as a miner am looking for a share with difficulty d I might by chance find a block of difficulty D (with the probability d/D). This is exactly the reason why mining pools exist: they assign the miners the task to find blocks of difficulty d in the hope that they will eventually find one for D, i.e., the real network difficulty, which pays for the whole pool operation.

Commonly these blocks at a lower difficulty are called a share, and are used to gauge the hashing rate of the individual miner, giving the pool a way to determine who has what probability of finding the next block and distributing the reward accordingly.


Import 256 bit private key Can I import a 256 bit private key in a Wallet (binary format)?
Or do I have to convert it in another format?

dumpprivkey in bitcoin core returns private key in WIF
importprivkey adds a private key (as returned by dumpprivkey) to your wallet.
Private key to WIF: https://bitcoin.stackexchange.com/a/99101/


How to check ownership of wallet with segwit address So .. this seems like a simple question.

If i have a wallet and someone wants to send me BTC. I want to make sure they own the wallet they claim to be sending funds from. Usually people do something like a satoshi test do confirm this.

Before segwit one could sign a message and with address given, you could decrypt the message to confirm they actually own the wallet containing that address.

After segwit that functionality is broken.

Furthermore, i can't take the getrawtransaction <trans> 1 command to find the vin of the transaction and the to extract the txid and vout of the vin. Then using that txid and again run getrawtransaction <trans> 1 and look at the coorepsonding vout and the "n" that matches the previous vout not longer works after segwit. (all of this makes sense as the way transactions are formed is completely different).

Therefore: If someone is supposed to send me 0.00001 BTC, how do i verify what wallet that came from.

In Simpler terms: How can i verify that someone owns a wallet with segwit addresses?

Before segwit one could sign a message and with address given, you could decrypt the message to confirm they actually own the wallet containing that address.

As you discovered, the signmessage and verifymessage RPCs in Bitcoin Core don't currently work with segwit.  There have been discussions about the best way to fix that, but as of this writing, updated code is not yet available.

  Furthermore, i can't take the getrawtransaction  1 command to

The getrawtransaction RPC now takes true instead of 1 for detailed JSON output.  The txid, vout, and vin fields in the JSON output all the same for the way you're using them (they just have a few extra fields now for segwit outputs and inputs).

  How can i verify that someone owns a wallet with segwit addresses?

There is no easy way at the moment using Bitcoin Core or any other software I'm aware of.  If possible, you may want to change your workflow so that you don't need to verify wallet ownership.  For example, if you currently receive all payments to the same address, you can start using separate addresses for each customer, so Alice pays $ADDRESS_1, Bob pays $ADDRESS_2, and you can tell the difference between their payments by which address they paid.

Alternatively, if you need to verify address ownership for refunds, you can have users provide a refund address at checkout.


Bitcoin / Crypto and exchanges! When we buy/ sell bitcoin through some exchange say "Koinex in Indian context", what is the process i.e. actually followed ?
1. Does exchange communicate to node(s) in the bitcoin blockchain thru my public address on my behalf or
2. My browser directly communicates with node in blockchain which then broadcast it across bitcoin blockchain or
3. Exchange itself is a node in the network and to which i am communicating and it is broadcasting my transaction in the network

When we buy/ sell bitcoin through some exchange ... what is the process

The answer to your question is number 3.

  Exchange itself is a node in the network and to which i am communicating and it is broadcasting my transaction in the network

  why my balance gets updates instantly in exchange?

Some currency exchanges (and BTMs) just send your BTC to whatever Bitcoin-address you give them. This is subject to the usual Bitcoin block production timing. If the exchange subsequently goes bust you lose nothing.

Other exchanges act like a bank, rather ironically. They insist you open an account with them and just change a number in your account without actually performing any Bitcoin transactions. The number shown as the balance in your account basically says that is the amount they owe you (not the amount you own as far as the Bitcoin network is concerned). This is arguably the most risky way to hold Bitcoin (other than for someone who trades currencies several times a day). If the exchange subsequently goes bust you lose everything.

As the wise folk say: "No Private Key - No Bitcoin".

  how can be ensure we are not duped by second type of exchange?

There is no infallible way to ensure you are not duped by the second type of exchange (or by criminals hacking that exchange). Such exchanges are inherently absurdly risky. Remember MtGox, MyBitcoin, Bitcoinica, Neo & Bee, Bitinstant, NiceHash, Moolah, Cryptsy etc. Peruse this website

Don't just assume that a unique string they shared with you is a private-key. Verify that it is by importing it into a standalone wallet and checking the balance (then delete the wallet and clean unused space on the hard disk or Flash memory)

The only sensible action, if you plan on keeping Bitcoin for more than a day or so, is to immediately transfer "your" bitcoin into a paper-wallet (which you generated privately, not generated through some online website) or into a hardware-wallet (directly purchased from the manufacturer) that only you control and which no-one else has ever touched or seen.

If you need to constantly see your Bitcoin balance, set up a watch-only wallet. That way your private-keys are never exposed to the thousands of fanatically determined criminal hackers roaming the Internet.

Related:

Do you 'own' Bitcoins purchased via an exchange?
Pros and cons of using Mt. Gox as an e-wallet
Why is the disappearance of Mt Gox a problem?
Am I scamed? FA exchange trading company is fraud? They are requesting taxes
Is Binance a scam exchange/wallet?
etc, ad nauseam.


Open Source Bitcoin Trading Software Does anyone know if someone has created an open source (preferrably LAMP/PHP based) software package so that they can bring up their own BTC to ?currency? trading site?

I would love to be the guy getting 2% to 3% on transactions. And then I'd be responsible for server uptime and availability, fraud checks, APIs running smoothly, etc.

Intersango is on Github.  Here is a thread on a forum on how to set up your own bitcoin exchange - https://bitcointalk.org/index.php?topic=35812.0


If port 8333 is closed, will a node relay transactions to its peers? During a recent discussion, it was asserted that a node running Bitcoin Core behind a firewall with port 8333 closed would still relay blocks/transactions to peers. Unsolicited connections would be blocked due to the closed port, but the node itself would still relay blocks and transactions to any connected peers.

I'm looking for a good resource that settles the issue. Where can I find one?

Yes it will, connection directionality will not affect block and transaction relaying.


What does it mean I have 1.33 bitcoin? Is it a specific id for each bitcoin that refers to my wallet address, is it an id? or we don't have a unique id for each bitcoin, instead, we use transactions like this:

From address 24*** to address 43***, amount 2 bitcoins. It's just a simple number in the transaction (not unique, the sender and receiver's addresses make it unique, not the bitcoin itself)

Could you please shed some light on this ambiguity for me?

Technically, there is no such thing as a bitcoin. There is only a ledger (the blockchain) that contains transactions. A transaction refers to outputs from previous transactions, and specifies new spendable outputs.

A transaction output consists of a Bitcoin address, and an amount. And for practical purposes we pretend as if these amounts represent actual "bitcoins".

So if I send a transaction to your address for the amount of 3, we say "I sent you 3 bitcoins". But all it does is adding a transactions to the ledger that says 3 from my address to your address, signed with the private key that corresponds to my address.

Just like you say, it's just a number in the transaction.

Now regarding if bitcoins have IDs: no. Say I have 10 different addresses with 1 bitcoin each. I can now spend all these 10 together, in one single transasction, to one new address. This will create one new spendable output of 10 bitcoins. At this point it's impossible to distinguish the previous 10 separate coins. The new spendable output for 10 bitcoins is "atomic", I can only spend that 10 in its entirety. If I want to spend only 0.5 of that 10, I would send 0.5 to the recipient and 9.5 back to an address of my own.

Similarly, I can also have 1 bitcoin and divide that into 20 parts of 0.05 BTC each, all on different addresses, in one single transaction. I can then mix up one or more of these 0.05 BTC parts with other fractions of other bitcoins, merge them, et cetera.

So no unless a (fraction of a) bitcoin has moved completely separately from any other bitcoins, you can typically not track bitcoins to their origin, or associate them with some ID.

P.S. this model of a transaction is actually a gross simplification, more complex constructs are possible, but for sake of simplicity and clarity this basic interpretation should do.


Transaction fees when a block chain is discarded I'm a bit new to the bitcoin system, so I apologize if this is a "noob" question.

A user attempts to take all the unverified transactions it knows about and aggregate them in a chain block. The same applies to all the users world wide - they all attempt to aggregate all the unverified transactions into a block chain with a 1 success every 10 minutes on a global scale rate

But - I imagine that when all the devices are trying to do this, all the devices have a slightly different list of unverified transactions, since it takes a while for a transaction to propagate to all the devices world-wide

So let's say device A and device B both create a block at the same time, when some
transactions in A don't appear in B and vise-versa. Then, more block chains are created and  after some time the shorter one is discarded - all the transactions which appeared as verified in the shorter block chain now become unverified again?

If this is the case, what happens to the transaction fees & the 25 bitcoin award given to the guy who created the "bad" block?

I mean, fine - the 25 bitcoin award could theoretically stay with the guy who created the block, since he did do the work, but the transaction fee? It would need to be paid to the next guy who verifies the transaction, shouldn't it?

Or in this case, would the user need to pay 2 transaction fees?

The blocks on the chain that loses are essentially forgotten. (It's better to call them losing blocks, than "bad" blocks, because they were legal and offered in good faith. They just lost a network race.)

Thus on the winning chain, there's no record of the losing-block reward, or the transaction fees. If there's no record of it in the common history, you don't have it. It's as if the reward and fees on the losing branch never happened.

Many transactions likely already existed in both blocks. (Most redundant blocks happen by accident, and can already contain most of the same transactions.) Despite these transactions, with their fees, appearing in two places for a time window of uncertainty, since only one set of consistent blocks will eventually win, those fees are only meaningfully spent, and then re-spendable, in the winning chain.

Any transactions missing from the winning chain are still eligible for inclusion, as long as they're still consistent with the cemented-history. Anyone building on the winning chain, who still knows about the unverified transactions, might add them on a subsequent block. Anyone interested in ensuring they're still widely-known may continue to broadcast them to peers.


Determine which transaction spent a Transaction Output I will explain my question through an example on the bitcoin testnet network.

I am looking at the output at index 0 of this transaction:

2a50bcc2ec49573ef816a95781b802766910f8690968236cf451cfc32defc491

I can tell through the bitcoin testnet block explorer that it was spent in this transaction:

7b1b3788ae4251d164031f899ba4e81f6371f70c24e71d38b03d44292ada9c81

Is there a way to use the bitcoind RPC methods to determine that it was 7b1b3... that was the transaction that spent this transaction output?

Thank you!

Bitcoind does not track this information as it is not necessary for normal validation, so no, this is not easily possible.


What is the supply for Bitcoin Cash (BCH), how is supply being regulated? We know that for BTC there is a max supply of 21 million.
50% reduction of 50 BTC per block for every 210000 block.

However, what is the mining reward per block, how is the supply being regulated? Can't seem to find any materail on it?

Bitcoin Cash has the same hard limit as Bitcoin, almost 21 million. In terms of supply, it is identical to Bitcoin, with the same halving of supply, at the same block heights.

However, there is a difference in the difficulty adjustment algorithm. Difficulty is the variable that ensures that there is one block mined every 10 minutes. It increases as the number of miners/hashpower in the network increases. In Bitcoin, the difficulty is adjusted every 2016 blocks, based on how long it took for those 2016 blocks to get mined. So every 2 weeks (approximately) the difficulty is adjusted based on how much hashpower was added to the network in that time.

Initially, Bitcoin cash had the same difficulty adjustment algorithm with one addition, which was called Emergency Difficulty Adjustement (EDA). If no blocks had been found for 12 hours, then the difficulty would reduce by 20%. This was put in place to prevent the chain from stagnating  and dying due to lack of hashpower as it was unknown as to how much support BCH would receive from miners.

This algorithm, however, was susceptible to being gamed by the miners. Miners would intentionally abandon mining BCH for a period of time. This would trigger EDA multiple times, and then when the difficulty was low enough to be profitable, they would start mining BCH, and mine 2016 blocks in 3-4 days (instead of 2 weeks). After 2016 low-difficulty blocks are mined, the difficulty would be readjusted to a sufficiently high amount, and the miners would abandon the BCH chain again.

If you compare the supply of BTC and BCH, in the 4 months since the fork, there is a difference in approximately 120,000 coins. This was problematic as BCH blocks were no longer predictable. The block times varied from 12+ hours to less than a minute.

On November 13th, Bitcoin Cash underwent a hard fork to change the difficulty adjustment algorithm. Now the difficulty is readjusted every block based on the previous 144 blocks, to try and keep block times as close to 10 minutes as possible.


What is the origin of transaction I have a bitcoin-qt wallet on computer A and some of the private keys are stored on another computer B with the ability to send transaction as well. I have to following questions :

If I generate the transaction on B and send it to bitcoin network
will it show up on the bitcoin-qt transaction history computer A ?
If 1 is true, Just by looking on computer A can I know which computer
generated the tx ?

If I generate the transaction on B and send it to bitcoin network will it show up on the bitcoin-qt transaction history on computer A?

Yes, when you make transactions, your transactions are broadcast to other nodes, and then the entire network. Your node will surely have the transaction in memory pool / blockchain, as long as your Bitcoin Core is fully synced. But it'll only appear on the history tab if at least one of the inputs of the transaction was held in a private key that computer A has.

  If question one is true, just by looking on computer A can I know which computer generated the tx?

There's no way understand if you're using Bitcoin Qt (I don't know if there's a full node client that does that) - it doesn't log if it created the transaction, or it received the transaction from a node.

You can use web clients, for example GreenAddress. They log when you logged in with your IP address and time. Then you can try to find which computer it is by inspecting its IP address and date and time.


How much internet traffic and bandwidth does mining with a pool need? As you know the new Antminer S9 is available and its hash rate per second is 14TH.
Now, my question is if I buy one of these, how much internet traffic and bandwidth do I need for mining by pool and how much for solo mining (and is it different for two machines or so).

1 Meg Internet can connect 150 S9.  1S9 could use upto 300M per month of data


How to setup my own exchange? How does Exchange set Initial price of any cryptocurrency I have read other answers related to how can I setup my own exchange

What is needed to make a bitcoin exchange?

but I still have few doubts.

When an exchange is launched and there are no buyers or sellers initially how is the price of any cryptocurrency set.
In my country there are few exchanges which don't provide any order book functionality, they just list their buy and sell price for each cryptocurrency and we can buy on that prices, so how does that work? To name a few of such exchanges. buyucoin, bitcoin-india. These exchanges don't have order book but still around 30 cryptolisted to buy/sell.

It isn't.  Exchanges don't set prices at all, they merely provide a place for people to trade with one another at whatever price they can agree on.  If there are no customers, the order book is empty; if you like, you can think of the bid being zero and the ask being infinity.  If the first customer is someone who wants to buy, they can enter a limit buy order at whatever price they want, and that will become the bid.  When someone arrives who wants to sell, either their price matches the existing buy and a trade happens, or it doesn't and that price becomes the ask.
These are not really exchanges, just dealers.  You are not trading with the company's other customers, but with the company directly. Just like an ordinary retail store: they have a product, they offer to sell it at a particular price, and their customers either buy at that price or take their business elsewhere.

And as general advice:

  How to setup my own exchange?

If you have to ask the question, then don't.  This is not a do-it-yourself project; the security and legal and financial considerations are daunting and need to be handled by experts.  At best you will waste a lot of time before realizing that it is impractical.  At worst you will discover it is impractical after you have lost a lot of money belong to yourself and your customers.


Mining with BFL at 440 GHS over 24 Hours and no bitcoin? Is this even possible.  I have been mining for about a month now, steadily building up my machines.  When the big daddy from BFL comes (and the 230 is fixed) I will be mining at 1.2 THS.  I have never gone more than 24 hours and gotten NOTHING and was wondering if anyone else has had this happen with this kind of power.  I am in three pools now, no user names.  Have been getting paid regularly all along.  SHould I change to a different pool? consolidate and only use one pool? if so what is the best pool at this point in time for payouts?

Consider consolidating to one pool.  Pools have a payout time "window" for example, shares per 24 hours. So, the more shares per 24 hour windows mean a bigger slice of the BTC block.

Three pools, no usernames?  How are your miners ID'd in the pools' systems?  Pools usually require an account/username to ID your miners' work for payouts, unless you're using P2Pool, then it's just your payout addy.

My first idea is, unless you're using one of the BIG FIVE pools, you only get a payout once a block is found in that pool.  BTCGuild, DiscusFish, Eligius, GHashIO, Slush...those see 5-20 blocks a day.  Other pools see much fewer, so don't expect any constant payout unless you're in one of the BIG FIVE.
My second idea is difficulty.  2.2+ billion difficulty is rough on a mining chap, and luck plays a big part when mining (many don't tell you that).


How and When are lightning channels disabled? On the testnet and some mainnet there are channels which are disabled, so if you try to route a payment through them it failed with this as an error message. Reading through the RPC commands, it seems you cannot disable your channels. In some cases the node that has a disabled channel is still online, since you can still ping and connect to it.

So How does a node disable a channel, or part of a channel?

This is a tricky question as it tackles the difference between what the protocol supports and what implementations provider as an API.

On a protocol level channels are enabled / disabled via an update message on the gossip Protocol. Nodes SHOULD set the disabled flag and send such a message if they are shutting down or turning (shortly) off for maintenance. Similarly they SHOULD enable the channel if the node is going online again. Now gossip messages are rate limited to prevent spam. Thus it could mean that the node is online but the update message is not sent / propagated yet. Your node would refuse to even try to send out a package over a channel which is known to be disabled to the payer node.

You are correct: lightning nodes do not provide a command line api to change the activation state of a channel.


Why is my P2SH sigScript field prepended with 0x00? I created a P2SH transaction and signed it using coinb.in.

The sigScript field for this transaction is:

    da
      00
      47
        3044
          0220
            33fb7d92f07516a788465dc5e4becabd5a7a5279efd008d004516ca575f00d1d
          0220
            3ad7cd3a4e9a0a5fec9db40b7348681705780e3bfd9bb862ca919342018d2dbb
        01
      48
        3045
          0221
            008a71a625891fca3d693c60881a6e5d946663253b47567d7309ade68208b37e3e
          0220
            1d078abd7d3e49d34c25e8181dbdba02356b1a55e97a3f50d8218381a99978ff
        01
      47
        5221025fd4ecaecef546156b694115406b61e03dec7e36917bb81a68b01b13d7eb289c2102b29cd1868e4b7c23e7c4aaecace46b28678e0138e736ea66848e0f28906cc66552ae

Why does this field contain a preprended 0x00 value?

OP_CHECKMULTISIG contains a bug which consumes one extra element from the stack. Due to this, an additional OP_FALSE (0x00) is pushed for multisig scripts to make the script evaluation valid.


Is the realgg.nl exchange legit? I was on a site www.realgg.nl last night, they have some attractive funding options for me because I live in UK it's difficult to get coins. (Well a lot more difficult than US). Just wondering if anyone knows whether it's legit.

Absolutely not - terrible exhange for any type of (crypto) currency.

DO NOT BUY HERE - you will receive your coins late (I received mine after 3 days of placing my order) AND they used the exchange rate of the day and time of the processing of the order - in other words I lost 60% of my purchase because they were 'having problems with their system' and took 3 days to deliver.


Does getaddr.bitnodes.io find all Bitcoin nodes or only one node per mining pool? Any ideas for finding the number of Bitcoin nodes vs the number of Bitcoin pools?

Thank you!

getaddr.bitnodes.io shows only the reachable Bitcoin nodes in the network. These are nodes that make up the core data exchanges within the P2P network.

There is non-trivial distinction between mining and non-mining nodes at the protocol level among the network participants. Although having observed the first announcement of a block from a node may be a good indicator of a mining node.

It is impossible to tell the full size of the network that includes nodes behind firewall, or nodes that only accept connection from certain IP address/netblock, or nodes that have simply hit the set max. connections.


How does the wallet prioritise keypool addresses imported via importmulti? I want to use importmulti to import 100 addresses from an xpub descriptor.

If I set keypool: true as one of the arguments the keys get added to the keypool.

How does the wallet prioritise which keys it generates when calling getnewaddress? Will it prioritise the imported addresses or do I have to request the imported address via the label argument in getnewaddress? What if I don't add a label argument to the importmulti command?

There is no guarantee of the order by the API. But its currently FIFO (first in first out).

If the order/remembering is important to you, consider using fundrawtransaction with a wallet where you have private keys disabled createwallet "name" true.
Just import pubkeys define the change output address in fundrawtransaction.


What coin to mine to maximise volume of return I'm interested in mining some of the newer, more obscure coins. This is mainly for learning purposes.  I'm not too worried about profitability.  But I want to maximise the volume of coin that I can mine in the shortest period of time so that I actually have something to play with.

How can I find out what to mine that will give the shortest time to first payout in a mining pool? I have 1xR9280x.

For example. Looking at ethereum, all of the mining pools I can see don't payout until you have mined 1ETH which could take me months.

Have a look at https://eth.nanopool.org/

Their default payout is 0.2 ETH but you can configure your account to payout as low as as 0.05 ETH

I'm mining at 28 mh/s on an R9 290 and that takes me about 4 days before I see a payout.


What is consensus.BIP34Height? In the bitcoin source code, I am looking at chainparams.cpp. I can see on line 81 something called consensus.BIP34Height? What is that? I can't figure out what this is.

I'm not sure what else to ask other than what is this? I can't see any mention of it in the developer reference.

The specification for BIP34 was created to fix a vulnerability where it was possible to make two transactions with the same TXID. To fix this a nonce was added coinbase transaction, where the height of the block must be encoded in the first bytes of the first transactions input. The definition is for when that soft fork became enforced.


TX nLocktime and mempool Where is a broadcasted TX located at before it's nLocktime reached? in mempool or not? I have tried a lot can't figure out. Help please.

Such transactions are located only with the transaction creator. Nodes generally do not keep in their mempool transactions that cannot be immediately mined.


How can I work out why a transaction isn't being included in any blocks? I've crafted a testnet p2sh address using python-bitcoinlib.

The script contents is 2-of-2 multisig: 2, key1, key2, 2, OP_CHECKMULTISIG

Redeem script:

522102e637c8658a9647e67b3d9961f0e0a6d1af9427396db430bfef9e2e01bb5618d12103e645fe283cc6759cb0b5aae4a767f74195fa3deeee69749345b5e4b5f3aae7d852ae

Address:
2N1TtyXGR2kDpnaGkJNx17fPyURqgLDdEgd

I then generated and signed a transaction spending some funds. I used python-bitcoinlib's VerifyScript to check the transaction and no exceptions were raised.

Transaction:

0100000001604b635009e1c6ba2db554607b08af3a6ea54f852900e9bc3729589f9b8bdee901000000db0048304502210081e35badb1795ce3c5f22430ac01e51eed2d364dc55292bdc9783e64f5cf5e2f02205cf02ec0bad7c9efd1af57c3cd825b2eda819de0aa64639dc3f2cc274ca0fffa01483045022100b360d75cd92fd5482345a9aebfe44714fe85edab75d1d1bd8d0ba169d13b4b50022031175c5c39145acc3c6635d6c9a9bb1b55c31a5b54140899a4f0b6104d68390e0147522102e637c8658a9647e67b3d9961f0e0a6d1af9427396db430bfef9e2e01bb5618d12103e645fe283cc6759cb0b5aae4a767f74195fa3deeee69749345b5e4b5f3aae7d852aeffffffff01a0860100000000001976a91418c72ac74d84b2bc8a5e4db72a518a4a39025b3888ac00000000

It's been over 10 hours and the transaction hasn't been included in any blocks.

Is there some way to work out why that might be, or if there is something wrong with the transaction?

The transaction needs a fee.

I mistakenly thought that testnet transactions didn't require fees, but the requirements are just lower. Given that this is spending a recent output and the amount is very small, it is being ignored.
Do testnet networks require the same main network fee?

A transaction including a fee went through successfully: https://live.blockcypher.com/btc-testnet/tx/0119445bfc577bcd032a079b03d1534be91b01e789874a02f88b9234ab72429d/


Where does the Bitcoin Core code serialize the number of transactions? I've been studying the Bitcoin Core code, and I noticed that it uses a template READWRITE to serialize data structures for storing blocks.  But it never seems to actually call "READWRITE(nTxs)", the VARINT (CompactSize) that encodes the number of transactions.  It reads the transactions to a vector (primitives/block.h), and it almost seems like it just magically knows how many txs there are.  What gives?

The transactions are passed in as a vector. Bitcoin Core's serialization framework understands that all vectors should be serialized with a compact sized unsigned integer preceding the serialization of the data within the vector itself.


Finding input TX for P2SH addresses I am beginning to work with multi-sig transactions, I understand how they work and how to sign raw transactions but how do you go about A) listing the input transactions for this address using bitcoind and B) more importantly, how do you find the redeemScript and scriptPubKey for constructing the transaction.

A) Not sure if there is a way to do this with the core client. You could do list all your transactions and search through them yourself (see listtransactions).

B) To get the scriptPubKey, you could make a dummy transaction to your multisig address, decode it, and the scriptPubKey will be in the resulting JSON.

To get the redeemScript, use validateaddress to get the public keys (or get them any other way). Then do:

./bitcoin-cli createmultisig 2 '["0233201f4bc6df77f61affdc0b9a8e13c286050b8203453af3788bb3db781d8003", "020c13c8562c579fa79d78fd6dde15924b615c5c5c0904241ac311eb3954377ea0"]'

This will return something like this:

{
    "address" : "3N5ntrDQAv7M4xqdjnpvzWfpogHnRvtMBm4",
    "redeemScript" : "52210233201f4bc6df77f61affdc0b9a8e13c286050b8203453af3788bb3db781d800321020c13c8562c579fa79d78fd6dde15924b615c5c5c0904241ac311eb3954377ea052ae"
}


Lightning Network: node image When browsing explorer.acinq.co, I noticed some nodes display an icon image in front of their name.
How can I configure such an icon for my own node with LND?

You can assign an alias to your node. The als is what is being depicted in node explorers. It is a regular utf8 string. Nowerdays there are a lot of icons as characters in utf8 encoded strings. For example ⚡.
So in lnd and in clightning (apparently both have the same Syntax) you could add the following line to your config file:

alias=⚡my node name with icons⚡

After restarting your node and waiting until the gossip protocol has propagated your new alias you will be able to see it on node explorers.


Can an address have negative balance? This address:n1JagbRWBDi6VMvG7HfZmXX74dB9eiHJzU (on testnet) has a negative balance of -0.27388239 according to: https://www.biteasy.com/testnet/addresses/n1JagbRWBDi6VMvG7HfZmXX74dB9eiHJzU, namely, it has sent more coins than it has received. Is that possible? Is it an error on the block explorer?

Short answer: Yes, this is probably a bug in the block explorer.  blockexplorer.com shows a positive balance.

Some of the transactions shown there are "strange" (they presumably have non-standard scripts which someone was experimenting with), and this probably is tripping up the biteasy explorer.

Note that the notion of "balance" of an address only really makes sense when using "standard" transactions, where the output script says: to spend these coins, provide a public key whose hash is the address X, and a signature made by the corresponding private key.  For fancier transactions, "balance" gets more fuzzy.  For instance, I could make a transaction that requires signatures by two private keys, corresponding to addresses X and Y.  Should those coins be "credited" to both addresses, or neither?  Either way the books will not balance.


What is the smallest block ever mined? Has any miner ever earned their 50/25 BTC solving a block with only one or two transactions? Maybe they got lucky before the full ten minutes?

Thousands of early blocks are empty except for the required generation transaction. See block #1, for example.


Claim Bitcoin cash from android bitcoin app I have some bitcoin stored in the bitcoin wallet android app

I want to transfer my inherited Bitcoin Cash (BCC) to an exchange.
The android app doesn't care about BCC.

I tried to decode a backup of my wallet to use the private key in Bitcoin ABC desktop app.

openssl enc -d -aes-256-cbc -a -in wallet_backup_file

But gibberish comes out.
Update looks like the decryption worked because I see the first text as org.bitcoin.production. The problem is that it is encoded in a protobuf format: Problems decrypting my bitcoin-wallet on android

Importing the same backup file on the bitcoin app works , and after some time I can see my funds.

How can I claim my bitcoin cash and transfer them to an exchange ?

The Bitcoin Wallet project recently included detailed instructions on how to extract your key pairs for exactly this purpose. In the section Recovering from protobuf wallet format, skip to the paragraph beginning with

  You can also get a list of the private keys...

(Here is a historic version of that guide*, should it ever disappear)

I have now completed the process myself. Here's a summary. Note this works for backups made after 2014 (newer protobuf format). See the article above if your backup is older than this.

# pre-reqs
sudo apt install openjdk-8-jdk openjfx android-tools-adb openssl git maven

# use known version of bitcoinj - HEAD of branch release-0.14 at time of writing
git clone https://github.com/bitcoinj/bitcoinj.git
(cd bitcoinj && git reset --hard 0e30a3011c42cedfd83f2109d54dd192730dcc45)

# decrypt the wallet backup (substitute for <BACKUP>)
openssl enc -d -aes-256-cbc -md md5 -a -in <BACKUP> > /tmp/dec

# reset & sync wallet (may take some time, but was necessary in my case)
(cd bitcoinj/tools && \
   ./wallet-tool reset --wallet=/tmp/dec && \
   ./wallet-tool sync --wallet=/tmp/dec --debuglog)

# dump keys You will need to add `--password=<PIN>` if your wallet is pin protected.
(cd bitcoinj/tools && ./wallet-tool dump --wallet=/tmp/dec --dump-privkeys)

# delete your decrypted wallet
rm /tmp/dec


Why must some bitcoin clients download the block chain and others not? What does it mean that some Bitcoin clients download the entire block chain (all transactions ever happened) and others not?

Security of Bitcoin as a whole depends on the Block Chain being held in full by many people. Currently, the Standard Client does exactly that. However, given enough copies of the Chain, one can assume the system is secure enough from the data being lost and rely on other nodes to provide the information we require when we need it.

This is where Thin Clients appear - they only store the information that is useful to them and discard all the excess. Thin Clients usually scan and verify the entire Block Chain on the go to look for any information that is of interest to them during the first synchronisation. They get that data from the Standard Clients operating in the Network, while not providing the same services to other Clients themselves.

Next type of Client relies on external servers to store and verify all the data for them and provide it when needed. They only store their Wallet locally and use it to sign transactions created from provided information. The servers supply them with information about their balance, list of unspent transaction and the like.

Last type of Client could be considered an eWallet, where all the information is stored by the server, including one's private keys used to sign transactions. With this you don't need to store any data locally and instead rely fully on third party to secure your money for you.

All in all, the more data a Client stores, the more independent it is from others. Some Clients sacrifice security for convenience, and there are many levels available for both.


Where is the code that sends generated Bitcoins from mining to the wallet? I was just looking through the Bitcoin code but since I am relatively new to C++ I was wondering, if anybody could tell me where the code responsible for sending coins generated through mining to the wallet is located.

Thanks.

Each new block starts with a "coinbase" transaction, which specifies the generated coins for the block.

The code at the top of CreateNewBlock in main.cpp adds the coinbase tx to the new block, and later on calls GetBlockValue to determine the number of generated coins.

The coinbase transaction uses the scriptPubKey parameter of CreateNewBlock to specify the recipient of the generated coins.


How much space does armory and the latest version of Bitcoin-Qt take up, together? It seems like Armory and Bitcoin Core are taking up 78GB so far, and it's not even done downloading.  How much more space will I need?  Is it possible to get rid of some of the data after it is all done?   So far the Building Databases step has taken up the most GB.  I'm using it on Ubuntu.

In total, it's about 61GB for me right now. In general, it should be about twice the size of the blockchain (which is always growing).

There can be some intermediate files (e.g. bootstrap.dat, 21GB currently; or Armory's similar torrent) involved that increase how much space you need during initial setup.

These can be deleted when you're done using them. (In the case of bootstrap.dat, that's when Bitcoin Core finishes loading data from disk; it's not deleted automatically, you'd delete it manually.)


Why Bitcoin does not user bcrypt for hashing? I've read that bcrypt is a hashing library that can adapt to Moore's Law and I thought that would be great for the network to adapt in a flexible manner its security to its respective growing computing power.

As far as I know, bitcoin already adapts its mining difficulty to the frequency of block generation, I wonder if some kind of similar automatic protection would be possible to do regarding the security of the hashing algorithm itself.

So, can someone with more knowledge on cryptography clarify this?

Because Bitcoin didn't start out that way, and there is a lot of economic investment tied up in hardware that can only perform SHA256d hashes.


How to calculate variable length fields? Some parts of bitcoin tx Ex: Script are of variable length var_int. Can someone explain how to calculate its value from that var_int table.

Ex: In the below tx, the bolded part is script-length. its length is supposed to be 349 bytes. When I convert fd5d01 directly to decimal, its value is 16604417. I think I didn't understand var_int table correctly.

01000000013dcd7d87904c9cb7f4b79f36b5a03f96e2e729284c09856238d5353e1182b00200000000fd5d01004730440220762ce7bca626942975bfd5b130ed3470b9f538eb2ac120c2043b445709369628022051d73c80328b543f744aa64b7e9ebefa7ade3e5c716eab4a09b408d2c307ccd701483045022100abf740b58d79cab000f8b0d328c2fff7eb88933971d1b63f8b99e89ca3f2dae602203354770db3cc2623349c87dea7a50cee1f78753141a5052b2d58aeb592bcf50f014cc9524104a882d414e478039cd5b52a92ffb13dd5e6bd4515497439dffd691a0f12af9575fa349b5694ed3155b136f09e63975a1700c9f4d4df849323dac06cf3bd6458cd41046ce31db9bdd543e72fe3039a1f1c047dab87037c36a669ff90e28da1848f640de68c2fe913d363a51154a0c62d7adea1b822d05035077418267b1a1379790187410411ffd36c70776538d079fbae117dc38effafb33304af83ce4894589747aee1ef992f63280567f52f5ba870678b4ab4ff6c8ea600bd217870a8b4f1f09f3a8e8353aeffffffff0130d90000000000001976a914569076ba39fc4ff6a2291d9ea9196d8c08f9c7ab88ac00000000

Can someone explain me the rules from that table?

it's a lot easier, just omit the "fd". Here is the explanation from the bitcoin developers webpages.

Assuming you have the value in an array (tx_array) and a pointer into the array (tx_array_ptr), here is an (unixoide shell script) code example:

# var_int is defined as:
# value         size Format
# < 0xfd        1    uint8_t
# <= 0xffff     3    0xfd + uint16_t
# <= 0xffffffff 5    0xfe + uint32_t
# -             9    0xff + uint64_t
# if value <= 0xfd, Bytes  = 1
# if value =  0xfd, Bytes  = 2
# if value =  0xfe, Bytes  = 4
# if value =  0xff, Bytes  = 8
  var_int=${tx_array[$tx_array_ptr]}
  if [ "$var_int" == "FD" ] ; then
    tx_array_ptr=$(( $tx_array_ptr + 1 ))
    tx_array_bytes=2
    var_int=$( get_TX_section )
  elif [ "$var_int" == "FE" ] ; then
    tx_array_ptr=$(( $tx_array_ptr + 1 ))
    tx_array_bytes=4
    var_int=$( get_TX_section )
  elif [ "$var_int" == "FF" ] ; then
    tx_array_ptr=$(( $tx_array_ptr + 1 ))
    tx_array_bytes=8
  else
    var_int=${tx_array[$tx_array_ptr]}
  fi

When you have your var_int, don't forget reversing the hex values (big endian conversion)! Then you can send the value e.g. to your decimal converter, so for your value (fd5d01) you get:

omit the "fd"
take the next two bytes "5d01"
big endian conversion "015d"
convert to decimal:

use of "bc" to convert value to decimal:

$ echo "ibase=16;015D" | bc
349


Displaying rotating bitcoin address Is there a way to display on a website of mine, a new address for every transaction?

e.g., I have a wallet, and every time it receives a donation, displays a new address on my website that corresponds to the address my wallet will recognize, so that no address ever receives two transactions?

thanks!!

A safe alternative would be to pre-generate a large number of public wallet addresses offline in your client, then loop through those when displaying them on your website.

That way your private keys are completely safe.  This is the best option in my opinion.

You could generate a lot of keys locally.

To enforce the goal of no 2 transactions per key, you could write a script to check the public address for usage before delivering it to the user.  If the address has already been used, remove it from your list of addresses that you deliver.


Is there a way to detect a mining cartel? According to blockchain.info, the largest mining pool holds less than 20% of the mining power, which is far below the dreaded 51%. But, this information is (probably) based on the pools publicly identifying themselves. Is it theoretically possible that some miners (or pools) created a secret cartel that holds together 51% of the mining power? If so, what are some signals that can help us identify such a cartel?

An entity having over 50% of the hashing power can continue operation as it would while having less than 50% of the hashing power. It then can go undetected when carefully choosing how it distributes its newly fonud blocks.

However, given its share of the total hashing power is φ (for φ > .5, obviously), it only makes about φ of the total money made from mining. Once an entity has over half of the total hashing power, there is a very lucrative thing it can do: Make all the money made from mining. This is done by simply ignoring all blocks others mined and only mining on top of its own blocks. Because φ > .5 and the law of large numbers, every time someone else mines a block, it can be sure to at some point have the longest blockchain which then becomes the effective blockchain, redering all the money the entity made on it valid.

The blocks others mined then never are part of the longest blockchain for long, making them orphans.

For the orphan rate σ, this means that σ = 1 - φ if the entity with φ of the total hashing power operates at maximum profitability (never accepts blocks mined by others).

We don't see a high orphan rate.


Is there a difference between relaying a transaction and relaying a block? I was checking the message types of the Bitcoin protocol and got curious whether there is a difference between relayin a transaction and a block, or not?

For example, notfound message say that notfound is a response to a getdata, sent if any requested data items could not be relayed, for example, because the requested transaction was not in the memory pool or relay set. Does it mean that getdata is only used for transactions?

The wiki is terribly outdated, check out the Bitcoin developer guide instead:

  The response to a getdata message can be a tx message, block message, merkleblock message, or notfound message.

Source: https://bitcoin.org/en/developer-reference#getdata


What power cord to use with BITMAIN PSU? As I introduced in my previous question which no one answered I'm having some problems with bitmain's power cord

So the simple main question is what power  cord to use ??

I used a 250v 10-16A 3*0.75mm^2
And had problems

My previous post


Block validation in blockchain if i am saying that node A is having some block (B) and other nodes X,Y,Z are wants to validate the block B than node A has to send the block B to nodes X,Y,Z. This block B contains the hash of previous block, time stamp, nonce and Merkele root where Merkle root are created from list of transactions. So Node A send the entire things included the list of transactions to other nodes X,Y,Z or node A send only block excluding the list of transactions for the validation process.

Yes, in general node A will send the entire block with all transactions in entirety to other nodes for them to validate. The receiving nodes will receive an entire block with everything in the block header and every transaction in the order that is required by the merkle root and they will validate everything in that block.

There is a network optimization where node A would send the block header, the coinbase transaction, and the list of transaction ids of the transactions in the block. This saves network bandwidth. By using a list of transaction ids (and not the transactions entirely), node A assumes that the other nodes already have those transactions because they were in its mempool (i.e. those transactions were unconfirmed and broadcast to the network prior to a miner including them in a block). The receiving nodes would then pull those transactions out of its mempool and reconstruct the block. If they are missing any transactions, those are requested from node A.

The end result is that they have constructed a block that looks exactly the same as the one that node A has, i.e. it is the same block. They can then pass this reconstructed block through the exact same verification functions as they would have with any other block received in entirety.

This optimization is known as Compact Blocks.

Either way, when node A sends a block to another node, that node will end up with a block that has the block header and all of the transactions contained within the block. Node A always sends the list of transactions included in that block.


Where is the UTXO data stored? When a new transaction is received it is added to the memory pool (after checking for conflicts). While mining, only the transactions which are in the pool are considered. What happens to the transactions after they are included in a newly mined block? Are they deleted from the pool? Where is the UTXO stored? Which function handles it?

I assume this question is about Bitcoin Core's internal operations. This description is valid for version 0.8 and later (up to 0.14 at least).

One part of the system deals with the active chain, which is the longest valid chain of blocks (stored in $DATADIR/blocks) that we know of. This active chain gets blocks appended to - and occasionally removed when there is a reorganization.

  Where is the UTXO stored?

For the tip (the last block in the active chain), we maintain a database with the set of unspent transaction outputs (UTXOs), stored in $DATADIR/chainstate, and aggressively cached in memory. When a new block is received, we remove the UTXOs spent by transactions in the block, and add the outputs of those transactions. When a reorganization happens, we use undo data (stored in $DATADIR/blocks/rev*.dat) to roll back the changes to the UTXO set. In a way, you can see blocks as patches to the UTXO set - but the UTXO set is never explicitly committed to or stored in blocks, it is merely implied by them.

  What happens to the transactions after they are included in a newly mined block? Are they deleted from the pool?

The mempool is a set of transactions that are valid but not in a block. We don't treat those as part of the UTXO set. Rather, it's just a group of transactions that are internally consistent and consistent with the active chain. This means that any mempool transaction only spends outputs that are in the UTXO set, or from other mempool transactions. Whenever a new block comes in, we remove its transactions from the mempool (assuming they were there), and we remove any mempool transactions and their dependencies that conflict with the new UTXO set. When a reorganization happens, we try to move the removed block's transactions back to the mempool.

  Which function handles it?

That's too long to answer here. A significant part of src/validation.* (in 0.14) or src/main.* (in older versions) together with src/coins.* deals with maintenance and caching of the mempool and UTXO set.


Is the hash of the coinbase transaction needed for the merkle root? first time posting here.

I was interested on how mining software works down to the bytes. I came across this well written article right here:

http://www.righto.com/2014/02/bitcoin-mining-hard-way-algorithms.html

Under "Notes and References", he provides a python program that generates the merkle root from a list of transaction hashes. What I don't understand however is, why or how the hash of the coinbase transaction is included in that list.

Lets say you are in the process of mining a new block. You make your list of transaction hashes(without the coinbase transaction, as you haven't mined the block), create the merkle root and guess the nonce until you create a block. Now the coinbase transaction takes place and you get your bitcoins, the coinbase transaction hash now has to be included in the list of transaction hashes. But that changes the merkle root and thus the entire block, which would make it unvalid.

How is this solved? Do you know the hash of the coinbase transaction in advance? Or do you not include the coinbase transaction for the new block and the python code is not correct?

Also a side question is, in the python code this part confuses me a bit:

 h = hashlib.sha256(hashlib.sha256(a1+b1).digest()).digest()

Does a1+b1 mean that you perform addition of the hash values or that you just append the two hashes together?

Thanks in advance,

Fihdi

You make your list of transaction hashes(without the coinbase transaction, as you haven't mined the block),

This is where the problem in your understanding lies. The coinbase transaction is generated before the block is mined, not afterwards, because it must be included in the list of transactions just like all the others. It is the first transaction in the block, and its hash is used in exactly the same way as all the others when constructing the merkle root.

Once the coinbase transaction is created and the merkle root calculated, then the nonce is varied and the block is mined.

  Does a1+b1 mean that you perform addition of the hash values or that you just append the two hashes together?

Append the hashes, not add them