Attaching additional data / text message to a Bitcoin transaction? I'm building an single page web app, where I need to send the users inputted string (email address) along with their bitcoin payment. Say for example I have a single page web app that issues gift certificate barcodes and accept Bitcoin or altcoins. The problem I'm having is that if the user pays to my static bitcoin address, how do I know where to send the barcode information to? I need some form of contact, in my case it's an email address that the user inputs on to the page. What ways can the user send me their email address?

Some problems I ran into was the static bitcoin address. If multiple people paid to the same bitcoin address, I won't know who to send the barcode to. But if I have 100 pre-generated addresses. And one of them was chosen at random then combined with the email address. It would less likely have a collision of someone paying at the same time to the same btc address.

Now the issues is getting that email+btc address to me to verify the transaction has been completed.

One of the other solutions I came up with was requiring another altcoin that had messaging ability built in. The only 2 I know of is Florincoin and NXT where you can include a message with each transaction. The only issue with this is that it requires the app owner to hold florincoin or nxt (i don't believe you can attach a message in ethereum?). Using shapeshift to convert BTC to one of these coins works, but you cannot attach a message during this shapeshift swap. If shapeshift enabled the ability to also attach a message during their conversion this would technically solve the issue by getting the email address to the app owner.

What are some other solutions that might not require a centralized server to collect this data? Centralized server solutions are okay too if you have a solution.

The obvious solution would be to require payments to have an OP_RETURN output with an email address encrypted to you. This isn't simple and there isn't a wallet out there that supports something like that, but it's technically feasible.

For the 1 address problem, you can use a deterministic wallet, which can generate as many addresses as you need. You can use BIP47 if you want to get fancy and be able to offer refunds.

I built a web shop example app for Armory a while back that you might want to look at that generates a new address for any transaction. You may want to take a look:

https://github.com/etotheipi/BitcoinArmory/tree/master/webshop


Is there a fixed order for all transactions in the block chain? Every block in the block chain contains a list of transactions. This list has a certain order which is basically set by the miner introducing the block. The merkle root in the block header requires that this order is fixed.

Therefore there is a fixed order for all transactions in the blockchain which cannot be modified at a later time (except for the usual temporary forking).

Is that correct?

Yes, you are correct. There is a fixed order, as ensured by the merkle root and the proof of work. Both the blocks and the transactions within each block are strictly ordered.

This order is actually necessary for validation of the transactions within. For example, you could have a transaction Y that depends on the output of transaction X in the same block. If Y came before X in the list of transactions in the block, then the block would be an invalid block.

With that said, although the order of transactions within a particular chain snapshot cannot change, the chain itself can change from time time. This happens when there is a fork in the network. Look at this image below:

Let's say you knew about block A and you thought it was the tip of the best chain. Then all of the sudden the other chain comes out, and block A is replaced by block B. The order of transactions in A might not be the same as the order in B.

It may also interest you to know that to enable Gavin's O(1) block propagation proposal, there is a canonical ordering for transactions in a block.


How to spend the change in a BIP32 super account? I am developing my own wallet in python for which I have already implemented BIP32 and BIP39. According to BIP32 documentation, change should be stored in different addresses as well as payments received. This is fine. However, how can I spend my bitcoins when they are stored in different addresses? Let's suppose I have 1000000 satoshis in 10000 different addresses that are derived from m/0'/1'/ path, and each address has 100 satoshis. If I need to send my 1000000 satoshis to XYZ address, can I build a single raw transaction to achieve this, or do I have to create a raw transaction for every single address that is storing my change? Isn't this very expensive?

You can do this with 1 transaction, it will get more expensive, but it has nothing to do with whether you use separate addresses or not (or with whether or not you're using BIP32 in any way or form, for that matter).

Bitcoin uses a UTXO model: every transaction has 1 or more inputs, and one or more outputs. Every output creates a UTXO (which you can think of as "a coin", with a certain address and a certain amount). Every input consumes an entire UTXO. Change is simply an output that goes back to yourself, because the sum of the input values exceeds the amount you want to send. Change always requires a separate output, whether it reuses an address or not.

So, what matters to the complexity (and thus cost) of your transaction is how many inputs you need. If that's outputs created in 10000 outputs, you will need 10000 inputs, regardless of whether they're all in the same address or not.


Is it possible to forward bitcoins without the private keys? According to this question, there isn't an easy way to automatically send bitcoins from one address to another and I think that it might be useful.
So I thought about creating a website were people could upload their wallets and choose a destination address where the coins would be sent to. A bitcoin daemon would be constantly checking the balance and forwarding any received transactions. But then I was confronted with the problem of securing a collection of online wallets.

When a transaction occurs, what part of the message is signed by the owner? Since the destination address is always the same, is it possible to send the bitcoins without storing the private keys on the server?

Probably the whole transaction is signed (which means that I need the key because the input is unpredictable), but I don't know much about this so I might be missing something here.

Short answer: no.

Longer answer: to 'forward' coins one needs to spend them out of the first receiving address, and to the next one. in order to spend them, one needs to sign a transaction using the private key associated with the first receiving address.


Double spending race attack first transaction In tackling double spending, does the protocol enforces that only the first transaction (and by first i mean the first transaction to be send to the network) is considered as valid ?

No, not really.

First of all, there is no clear way for everyone to agree on which was the first transaction to be sent to the network.  If the attacker was to send two conflicting transactions (call them A and B) to different nodes almost simultaneously, then depending on how the propagate, some nodes might see A first, and others B.

For the Bitcoin Core reference client, if it receives A first and later receives B, it will ignore B and will not relay B to its peers.  This hampers a double-spend attack somewhat.  But if a client later receives a mined block that contains the transaction B, it will accept it in place of A.  And a miner has total freedom which of the two transactions to include in a block.


Complete definition of 'tx_witness' data structure used in 'tx' data structure I'm reading the Protocol Documentation page for the 'tx' data structure and cannot find a completely clear definition of the 'tx_witness' data structure.

After the 'tx_out' table, there is short comment stating that "The TxWitness structure consists of a var_int count of witness data components, followed by (for each witness data component) a var_int length of the component and the raw component data itself."

Could someone post a table, similar to others on the Protocol Documentation page, defining clearly how a 'tx_witness' data structure should be formed?

In Bitcoin Core, the scriptWitness property (for the CTxIn class) is serialized from a CTransaction as a std::vector<std::vector<unsigned char> >, so I would imagine the serialized version would look something like:

TxWitness:

+------------+-------------------------+------------------------+
| Field Size |        Description      |       Data Type        |
+------------+-------------------------+------------------------+
| 0+         | witness_component count | var_int                |
| ?          | witness_components      | witness_component[]    |
+------------+-------------------------+------------------------+

WitnessComponent:

+------------+------------------+-----------+
| Field Size |   Description    | Data Type |
+------------+------------------+-----------+
| 0+         | component length | var_int   |
| ?          | component        | uchar[]   |
+------------+------------------+-----------+

References:

https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L67
https://github.com/bitcoin/bitcoin/blob/master/src/primitives/transaction.h#L254
https://github.com/bitcoin/bitcoin/blob/master/src/script/script.h#L676


How to get unique rpcpassword for bitcoind I am on Linux Debian 8.4 and have one server running 24/7.
I would like to help the Bitcoin network.

On https://bitcoin.org/en/full-node#other-linux-distributions I got to the point where I should run bitcoind and it should give me unique password:

  Then you can run the command bitcoind. It will print output similar to this:

But it does not print out anything. Ideas?

Since Bitcoin Core 0.12, an RPC password is no longer required for normal operation. Instead, a random password is automatically generated by bitcoind and stored in a temporary file on disk. When an RPC client (like bitcoin-cli) wants to connect, it automatically uses the password from this file.


How difficult is it to invent a new cryptocurrency? (In regards to time, money, technical knowledge, etc.) Although I initially believed there were only a couple cryptocurrencies available on the market, after some research, I've discovered that there are well over a thousand different cryptocurrencies!...even if a large percentage of these have extremely small market capitalizations. So my question is: What does it take to "create" a new cryptocurrency? More specifically, what degree of time, money, technical knowledge (and any other pertinent resources) is required?

*I apologize but I should have also mentioned: Since I have limited technical experience, I would appreciate a non-technical "theoretical" answer.

quick approach:-

Not that difficult , Just fork a github repo of a smart contract supporting ERC20 token starndard and deploy the contract on main net.

developer approach:-

If you want to make your own crypto currency the easiest way is to learn ethereum smart contract development , most crypto currencies present in market today are build over the top of etherum smart contract. If you have programming experience in javascript or similar languages it will be very easy to start with solidity language used to develop smart contracts.

Also learn about ERC20 token standard which is followed by crypto currencies build over top of ethereum
The ERC20 token standard describes the functions and events that an Ethereum token contract has to implement.


Blockchain Parser not working on blockchain generated in regtest mode using bitcoind. Any help? Has anyone used this blockchain parser for Bitcoin https://code.google.com/p/blockchain/ ?

http://codesuppository.blogspot.in/2014/01/a-command-line-interface-for-blockchain.html

I tried to parse blockchain generated by Bitcoin (bitcoind -regtest -daemon) in regtest mode but it is not reading(parsing) it correctly.

I copied the file blk00000.dat (this is the only file generated in regtest mode) to /home/somesh/Desktop/blockchain-read-only/ folder.  I executed the command:   ./blockchain.out /home/somesh/Desktop/blockchain-read-only

output:

Successfully opened block-chain input file '/home/somesh/Desktop/blockchain-read-only/blk00000.dat'
Welcome ...
Commands available: ... (then prints all the available commands)

then I selected scanning option

scan

The following is the message I get on scanning

Scanning block-chain re-started from block 0 up to a maximum of 500000 blocks..

Warning: Missing block-header; scanning for next one.
Failed to open block-chain input file '/home/somesh/Desktop/blockchain-read-only/blk00001.dat'

Finished scanning block headers. Built block-chain with 0 blocks found..

It is working fine for Bitcoin's real blockchain but not for the blockchain generated in regtest mode.

I think the parser is not able to find the block header in blk00000.dat and is skipping to next file.

Warning: Missing block-header; scanning for next one.

what changes do I have to make ?

When working in regTest (or testNet) mode the 'magic number' identifying the start of each block is different to what it is for the live network.  The parser you mention may well use the magic number to identify the start of blocks. This may be the cause of your problem and why it is not finding any blocks in the regTest blockchain file.

RegTest (and testNet): 0xdab5bffa
 Live: 0xd9b4bef9

Hence it is likely that the parser code needs to be modified to work with regTest/testNet magic numbers.


How does the satoshi client handle endianness? I'm looking through the source code of the satoshi client, particularly into how transactions are serialized and sent through the network or stored to the disk.

The CTransaction class has this block:

IMPLEMENT_SERIALIZE
(
    READWRITE(this->nVersion);
    nVersion = this->nVersion;
    READWRITE(vin);
    READWRITE(vout);
    READWRITE(nLockTime);
)

If I'm not mistaken, the serialize part of IMPLEMENT_SERIALIZE expands to:

template<typename Stream>
void Serialize(Stream& s, int nType, int nVersion) const
{
    CSerActionSerialize ser_action;
    const bool fGetSize = false;
    const bool fWrite = true;
    const bool fRead = false;
    unsigned int nSerSize = 0;
    assert(fGetSize||fWrite||fRead); /* suppress warning */
    {
        (nSerSize += ::SerReadWrite(s, (this->nVersion), nType, nVersion, ser_action))
        nVersion = this->nVersion;
        (nSerSize += ::SerReadWrite(s, (vin), nType, nVersion, ser_action))
        (nSerSize += ::SerReadWrite(s, (vout), nType, nVersion, ser_action))
        (nSerSize += ::SerReadWrite(s, (nLockTime), nType, nVersion, ser_action))
    }
}

Let's focus on nLockTime for now, which is an unsigned int. SerReadWrite is defined as:

template<typename Stream, typename T>
inline unsigned int SerReadWrite(Stream& s, const T& obj, int nType, int nVersion, CSerActionSerialize ser_action)
{
    ::Serialize(s, obj, nType, nVersion);
    return 0;
}

The Serialize function, for unsigned ints is defined as:

template<typename Stream>
inline void Serialize(Stream& s, unsigned int a, int, int=0) {
    WRITEDATA(s, a);
}

Which expands to:

template<typename Stream>
inline void Serialize(Stream& s, unsigned int a, int, int=0) {
    s.write((char*)&(a), sizeof(a))
}

So, this converts the 4-byte unsigned int to a char* and then writes it to the stream.

However, won't this have a different result on big-endian vs. little-endian machines? How does the client handle this? Or is the protocol defined in terms of little-endian, and on the machines the satoshi client is built on, it ends up just working out?

The answer is simple: big-endian architectures are not supported.


Is there a "Total Bitcoin Days" metric? Recently people have been talking about Bitcoin Days Destroyed. I am curious, is there a place I can find out something like Total Bitcoin Days: the number of days since each bitcoin has moved, all added together?

EDIT:

I am aware of Bitcoin Days Destroyed, and what they are (at least, I am pretty sure I am), I am looking for a metric that shows the opposite of Bitcoin Days Destroyed; maybe better wording would be "Bitcoin Days Not Destroyed". Perhaps my wording is off. Please suggest how I can clairify if so.

I think you are viewing the metric incorrectly. The notion of Bitcoin Days Destroyed is not relative to any other standard of measure. Rather, it is the standard of measure.

To clarify, there is no "gold standard" for Bitcoin Days Destroyed saying "if all Bitcoins had been spent within X weeks the total would be Y". That just doesn't make any sense. Think about it like this: how would one calculate what the DOW would be at today, had it not fallen 200 points? One wouldn't! It cannot be done; the points are there only to show the relationship of the market from day-to-day, month-to-month, or n-to-n. They have no standard to which they are measured.


Can LN clog main chain BTC? Main chain BTC can handle something about 300k tx per day without increasing fees, open and closing channels need to be done using standard tx on main chain. So the question is if we will have large world adoption, can LN can produce 300k tx per day (sum of opening and closing txs)?

The answer is yes, but not anytime soon.  Also, it's a function of how frequently channels are opened and closed, which can be estimated, but is not "really" predictable.

If you read the LN whitepaper [link], it mentions in the conclusion that "to enable 7 billion people to make two channels per year with unlimited transactions inside the channel, it would require 133 MB blocks"


Why does the script contain the hash of the public key The ScriptPubKey contains the hash of the public key, and this is compared to the public key in the ScriptSig. It is not possible to derive the public key from the hash (address). But when the output is spent, the public key is visible to the world. This isn't a problem though, and the same public key (address/private key) can be used multiple times. So why have the hash step? Why not just have the public key in the ScriptPubKey as well, without the OP_HASH160 step? The hash doesn't add any security (afaict), since an address can be reused multiple times without loss of security (only privacy).

A major pro other than shorter addresses is that breaking into your private key takes one more step (hash -> public key -> private key). Plus, if ECDSA gets cracked someday and you follow the one-address-per-transaction best practice, transactions with P2PKH scripts will only unveil public keys when the amount they "hold" is going to be spent, so anyone attempting to hack your private keys from public keys would end up with empty addresses.


What prevents real-life robberies in the hypothetical future where Bitcoin is widely used? What prevents the following real-life robberies from happening in the future where Bitcoin or similar cryptocurrency is widely used?

Robber A goes to an infrequently-visited street vendor and buys a pack of gum with Bitcoin.  Robber A now knows the address of the vendor.  Robber A can sit and wait until someone (Victim A) purchases something from this address and has a very large Bitcoin balance.  Robber A can follow and rob Victim A for their entire Bitcoin wallet.
More generally, Robber B goes to random persons house with a gun and demands a Bitcoin transfer equal to Victim B's full wallet.

Am I missing something because it seems incredible easy for people to do?  Today cash, credit, and debit robberies have preventions/limitations in place to thwart very large robberies.  I'm not seeing the same preventions for Bitcoin.

Robber A now knows the address of the vendor. Robber A can sit and wait until someone (Victim A) purchases something from this address and has a very large Bitcoin balance.

Most vendors would generate a new receiving address for each customer, as is recommended, which would stop this from happening. It is likely Victim A would also have generated multiple addresses rather than owning all his BTC on one address.

  Robber B goes to random persons house with a gun and demands a Bitcoin transfer equal to Victim B's full wallet.
  Am I missing something because it seems incredible easy for people to do? Today cash, credit, and debit robberies have preventions/limitations in place to thwart very large robberies.

How can a cash robbery of exactly the same type be prevented? Although as above, it is unlikely the robber would know their entire amount of BTC owned, so they could not know if the victim had sent everything or not. In general you could keep large amounts of BTC stored on encrypted cold wallets off-site which any robber should not know anything about.


Can I use root used to create multiple BIP32 addresses, to spend transactions belonging to these multiple BIP32 addresses? I want to accept BTC from different clients during an ICO, for this, I'm planning to use a combination of BIP32 and BIP39.

var bip39 = require("bip39");
var bitcoin = require("bitcoinjs-lib");

var mnemonic = 'praise you muffin lion enable neck grocery crumble super myself license ghost';
var seed = bip39.mnemonicToSeed(mnemonic);
var root = bitcoin.HDNode.fromSeedBuffer(seed);

console.log(root.derivePath("m/0'/0/0").getAddress());
//'1AVQHbGuES57wD68AJi7Gcobc3RZrfYWTC'
console.log(root.derivePath("m/0'/0/1").getAddress());
//'1Ad6nsmqDzbQo5a822C9bkvAfrYv9mc1JL'

Can I use this mnemonic to login into some pre-existing wallet and transfer the funds sent to the addresses generated using the root to transfer funds to any other BTC wallet? Or can someone suggest a better strategy?

A BIP32 master extended private key can be used to derive child addresses, but to spend coins sent to those child addresses, you will need the private key of each individual address. The master xpriv key cannot spend the coins located in one of its child addresses.

Remember that an address derived via BIP32 is otherwise indistinguishable from any other address. In order for a transaction spending any address' balance to be valid, it must be signed by the private key of that address.

That said, good wallet software will take care of key management in the background for you, so as long as the derivation scheme is correct you should be able to spend the funds sent to your master xpriv key's derived addresses using a BIP32 & 39 compatible wallet. Again, this will be done by deriving the child addresses and using their private keys to sign transactions.


Funds still showing in old Armory wallet/address after being sent+confirmed to new Electrum one? I'm having a bit of an issue that I'm sure someone more knowledgeable will be able to clarify.   I've had an old wallet using the full node client "Armory" for a few years, with 0.2 BTC within that I'd like to send to my new Electrum wallet.

After trying to send without a fee a few times and having it rejected by the network  (Armory has a pop-up window with a link to the transaction, saying something like "if it doesn't show up on this blockchain.info transaction link in a minute, nobody picked it up so try again and this time send a fee"), I decided to have it send with a fee of 0.0001 BTC.  Armory still told me that by its calculation this wasn't enough (it suggested something like .00015555 or different amounts close to that range), but this time once I waited a moment I saw the transaction post to the blockchain.info link!    My Electrum wallet also registered the arrival of the 0.1999 BTC and started to add confirmations - as of this writing it has 68 confirmations  and the new Electrum wallet  shows that amount as a balance.   On the surface all would be well except...

My Armory wallet doesn't seem to show the money has left the wallet, still suggesting a spendable balance of 0.2 BTC!  It doesn't show in the transaction log either.  I figured this may be because it just hasn't "seen" the block as of yet, so I decided to  restart Armory even though it was currently connected to the network.  Having restarted and waited for it to go through its whole process, it still doesn't seem to notice the money is gone. I thought that Armory, because it is a full node client (and takes all that huge HDD space) would "have" to know that it happened.   The pop-up I got when I sent the funds telling me to wait and see on Blockchain if the transaction was accepted or not mentioned that Armory would "learn" about it from the network if it was..so I'm surprised it hasn't thus far.

The most likely issue I can think of is that Armory hasn't caught up yet.  According to Armory, it is "Connected" and received its last block 1.5 hours ago and has 348324 blocks currently.  However, I noticed that according to blockchain.info linked from my Electrum wallet's transaction, it takes place on block 393144 (the transaction was made probably close to 15+ hours ago) so assuming blocks are added sequentially, it would seem Armory doesn't see it yet, right?  Why would this be? After all the time it takes for Armory to connect to the network, catch up, deal with its data bases etc.. I would expect it to be up to date, not approximately 5000 blocks behind if Armory shows it is "connected"?

Is it likely the hypothesis that the transaction just hasn't been understood yet by Armory is accurate?  If so, why it so far from current?   Any other ideas  or possible issues?  Thansks

It's not Armory that hasn't caught up, but your bitcoind that hasn't caught up. Armory works on top of bitcoind and gets all the block information from the local bitcoind node. It looks like the bitcoind node has about 50,000 blocks to catch up before Armory will notice that the bitcoin is gone. Just let bitcoind catch up (how long will depend on your network bandwidth and your computer's RAM/CPU) and you'll see it once the blocks catch up.


scrypt mining rig suggestions i went to configmyrig.com and selected the options to hit something close to 5mh.
here is a screenshot:

http://s28.postimg.org/uayj19exp/Screen_Shot_2014_01_09_at_11_21_58_PM.png

i'll be scrypt mining at a multipool and the total that came up for the complete setup is about $5,000 seems like alot but let me know if you have any suggestions. What i'm wondering is how many PSU's would I will need and what kind is recommended? I'm thinking it would be a gold or platinum for the PSUs but i'm not sure how many and what kind would suit 6 Radeon R9 290x's. Also is the motherboard & cpu selected good enough? I'll be using a milk carton for the rig instead of a case so i'll need to get a hold of a good one.

What i'm wondering is how many PSU's would I will need and what kind is recommended?

I would recommend much higher PSU, at least 1000 Watt PSU for each two Radeon's R9 290x. This is based on some recommendations I found (here and here). I am 99.99% confident a single 750 Watt PSU will NOT be able to cover 6 GPUs of that power.

I also think the motherboard you selected can only take 3 cards, you need to double check. Even with 3 slots the cards may not have enough room between the slots, so you will need to use extension cables. The CPU is actually overpowered, I would select a low-power one. CPU will not be used for mining. Memory is not used as well. You will be covered with a 2-4GB stick to run the OS processes.

No one seem to be bothered with a case. For that much price of a hardware you don't want much dust to come in. Or any morning coffee spilt on your expensive hardware... I would advice to buy a large, solid, enclosure with good ventilation. This would cost you around $200. But it will protect the hardware much better then a milk or vegi plastic case.

Just thoughts, I am NOT a professional electrical engineer.


History of cold boot attacks on Proof-of-Stake miners Have instances of theft due to cold boot attacks been recorded?  If so, is this a common problem?

If so, are miners installing memory encryption software like Trezor?

It's not an appreciable issue. If somebody has physical access to a a miners server rack, it's game over no matter what "memory encryption" is used. As for the attack specifically, I doubt it's ever been used outside of security demonstrations and high level infiltration rather than something as completely insignificant as Bitcoin mining.


Mining on Nvidia(i know it's bad, but it's a start) So, I have this nvidia geforce fx5200 d256m gpu in an old box, I want to start it out as a no-cost minig rig(laugh all you want, I'm starting base and hoping to spend zero out of the pocket). I wanted to know what the expected hashrate would be, and what kind of settings I should set it up to use with in cgminer.
Remember people, the question is about the card, not my ideas of what I'm doing. Also this is planing to be done in my basement, which is always cold. So airflow/temp isn't an issue either. It's mining litecoins NOT bitcoins.

Here is a comparison chart.  Your card is not even on there. So I assume its going to be about 5khs if you lucky.

I would suggest you sell that card even for five bucks and invest in AMD card with loads of cuda cores. Its obvious you don't want to spend lots of money but for 50 bucks you can find a decent card on eBay or something. That will give you allot more kh/s.

The problem with GFX mining is that electricity is really expensive. If you dont have to pay for it or you are within a green area (Hydro plants, Solar Power) and its "dirt" cheap then it is still worth it.

Good luck with your experiment.

FYI - I would suggest looking into ASIC Erupter for ultra low power BITCOIN miners.

Or you sell everything and stack the pennies up order one of these 5GHs "Jalapeno" miners  from Butterfly LABS. They can be "jail borken" and even go to 9ghs if you add extra fans.

I am in no way affiliated with any of these companies. I just use their stuff and I know it works and brings me money in. No BS!


Where in ~/.bitcoin are mempool and UTXO pools written? Where in ~/.bitcoin are the two pools in question stored when their size grows above the size set by dbcache and maxmempool in bitcoin.conf.
Is UTXO pool written to such location at Bitcoin Core's shutdown?

mempool.dat stores the obvious, but it it only written there when the node is shut down
chainstate/ stores the entire UTXO, all the time


Dog identifier in blockchain I would like to print qr-code with transaction that contains my home address to print it for my dog's necklace. If dog will get lost everyone can scan it and get the address.
How can I prepare the transaction?

Janina Lowisz of Bitnation's BlockchainID project became the first "World Citizen on the Blockchain" by making a sort of blockchain passport:

Something similar could be done for identifying pets.

For instructions on how she did it, see:
https://github.com/MrChrisJ/World-Citizenship


Are minimal bitcoin fees nowadays enforced in bitcoin-core? I read some resources like http://bitcoinfees.com/ and Are Bitcoin fees optional?, and I still don't get this:

Does bitcoin-core nowadays enforce (regulates) minimal bitcoin fee or is it completely left to the market?

For example if I put a fee of 10 satoshi and there are not much unconfirmed transactions will bitcoin-core always confirm this transaction (no matter of how old new inputs are, or anything else).

Bitcoin core does not anymore use the notion of priority, where a part of the block was reserved for transactions spending old UTXOs.

Further there is something called a "relayfee", which is simply a policy and default setting that you can check in your node when calling "getinfo". Any transaction with a fee/kb under that one is not propagated by the node. The default value currently 1000 satoshis per kilobyte.

But a miner can still choose to add any (valid) transaction to a block, irregardless of the fees it pays or amount it spends. But rational miners will always try to create blocks that maximize their profits, hence pays them the most in transaction fees.


Unconfirmed txes disappeared in my own bitcoind's mempool I had a unconfirmed tx which have not been confirmed for few days. Today, it was disappeared in my bitcoind's mempool (bitcoin core v0.12.1).

The following is the tx. blockchain.info shows the unconfirmed tx.

https://blockchain.info/ja/tx/60821723b93e2ae5ed729e93c22ca824e7e91fe5a16cba3468139657dc953abc

However search_raw_transaction command does not show the tx.

curl -X POST http://localhost:xxxx/api/ --user xxxxx -H 'Content-Type: application/json; charset=UTF-8' -H 'Accept: application/json, text/javascript' --data-binary '{"method": "search_raw_transactions", "params": {"address": "178gnsM1R5gXQgo13wJDMdQTYNJqfB5LJf", "unconfirmed": true}, "jsonrpc": "2.0", "id": 0}' | grep 60821723b93e2ae5ed729e93c22ca824e7e91fe5a16cba3468139657dc953abc

I'm sure search_raw_transactions showed it yesterday.

It seems that mempool size is very big. Is it affected?

https://blockchain.info/ja/charts/mempool-count?timespan=all

And is it possible to get back the tx into my own bitciond?

Updated 1

Does the mempool size equal roughly the unconfirmed transactions?

Murch say

  Every node owner can set their own policy for the mempool. The mempool is limited two-fold:
  With -maxmempool= you can set an explicit limit of MB that it will not exceed. The default is 300MB.

I don't set maxmempool so it might over 300MB.

Updated 2

I confirmed the usage size reached 300MB. I checked it by "bitcoin-cli getmempoolinfo".

I will set maxmempool option then restart bitcoind.

Update 3

I want to make sure about the maxmempool mechanism. I believe that old txes are deleted when the usage size exceed. Is my understanding correct? Or will not new txes add mempool after the limit? If the next one is correct, it does not make sence on my case.

Problem solved. I changed to maxmempool from 300MB to 1GB.

And Murch's comment is what I wanted to know how to transactions leave the memory pool. Thank you!

  Transactions that you're sending yourself should never leave your mempool unless manually evicted or becoming invalid when a doublespend is confirmed. Foreign transactions get evicted after 14 days (previously 3 days), or when mempool is full by lowest fee rate first. You might also be interested in How do transactions leave the memory pool?

Especially, I wanted to know the delete order.

  when mempool is full by lowest fee rate first.


The address and amount of the sender can be gotten from the 'txid' and 'vout' by using getrawtransaction command. Let's see the example, the vin part of the block is as follows:

"vin": [
    {
      "txid": "0d6cbc21a1b1a3e5df1eae4fc37aa849174b6b727e53f9f505a605f066b7f000",
      "vout": 0,
      "scriptSig": {
        "asm": "304402203f198d9695a293c41d2124e790d473e68f4b35a09ece5517c7adfffc797f91760220304feb1cc2829d3c937665bcb4b7f9735acbcac50e9169bc53c9e689ce20b3bc[ALL] 025743bce4e775bb754e784dd2cfdc8dabc2023154eee539bb155612101a583e7e",
        "hex": "47304402203f198d9695a293c41d2124e790d473e68f4b35a09ece5517c7adfffc797f91760220304feb1cc2829d3c937665bcb4b7f9735acbcac50e9169bc53c9e689ce20b3bc0121025743bce4e775bb754e784dd2cfdc8dabc2023154eee539bb155612101a583e7e"
      },
      "sequence": 4294967294
    },
    {
      "txid": "aac498279d50ee81237d704cb495b243b50def5ecdcb36d9d78f596f73b1d3e9",
      "vout": 1,
      "scriptSig": {
        "asm": "3045022100b763b986b17beddac1ac96c3656fa7af188a28cfacfc87390e1e796b7fdbc0d102201e76f77db6093306028e681e2fe6354ae12649afb5c27c549243b67d505a1bb6[ALL] 0349ebb9d180938ab3a571d8c2e9771fb4fecb9f4484c337bb35d8fd8b48283ca9",
        "hex": "483045022100b763b986b17beddac1ac96c3656fa7af188a28cfacfc87390e1e796b7fdbc0d102201e76f77db6093306028e681e2fe6354ae12649afb5c27c549243b67d505a1bb601210349ebb9d180938ab3a571d8c2e9771fb4fecb9f4484c337bb35d8fd8b48283ca9"
      },
      "sequence": 4294967294
    }
  ]

It means that there are two inputs, the first input is from the "vout" 0 of the transaction "txid" "0d6cbc21a1b1a3e5df1eae4fc37aa849174b6b727e53f9f505a605f066b7f000", the second input is from the "vout" 1 fo the transaction "txid": "aac498279d50ee81237d704cb495b243b50def5ecdcb36d9d78f596f73b1d3e9". Since the vout part of one transaction has address and amount, we can get the input address and corresponding amount.

For instance, let's look the first input:

      "txid": "0d6cbc21a1b1a3e5df1eae4fc37aa849174b6b727e53f9f505a605f066b7f000",
      "vout": 0,

run following core rpc command (note that we need let the server index each transaction to support getrawtransaction, it can be done by add "txindex=1" in the bitcoin.conf)

bitcoin-cli -rpcuser=jun -rpcpassword=123 getrawtransaction "0d6cbc21a1b1a3e5df1eae4fc37aa849174b6b727e53f9f505a605f066b7f000" true

We get following vouts part as follows:

 "vout": [
    {
      "value": 0.01040000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 af9e84db382823b9c36c40d70090ff81890c5ef5 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914af9e84db382823b9c36c40d70090ff81890c5ef588ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "1H1b9fN7wYYwTSweyPjE7wCGSHuduCcE2o"
        ]
      }
    },
    {
      "value": 147.75014395,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 35f72ce8b9123a055e27be9a0bb723b6cb502419 OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91435f72ce8b9123a055e27be9a0bb723b6cb50241988ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "15vLvDZyAjWCrfWyazMtvHRe8hDJBxXJEC"
        ]
      }
    }
  ],

Then we have the address and amount which are the first part of the vout. It is the first input of our transaction.

"addresses": ["1H1b9fN7wYYwTSweyPjE7wCGSHuduCcE2o"]
"value": 147.75014395

There is a very nice blog about the vin and vout explanation
http://www.michaelnielsen.org/ddi/how-the-bitcoin-protocol-actually-works/


Besides transaction validation, are there any other uses of the Script language in Bitcoin Script's stack operations are used to validate signatures and scripts of transaction inputs and outputs. Is Script also used to validate block, network, or any other data?

Seem like there are a lot of OP codes not in use or deprecated. Why were they added in the first place? Am I missing something?

Is Script also used to validate block, network, or any other data?

No. Scripts are only included in transactions and can only read some data from the transaction and the block the transaction is included in. Scripts are only used for transaction validation as they specify the conditions required to spend an output.

  Seem like there are a lot of OP codes not in use or deprecated. Why were they added in the first place? Am I missing something?

To allow for scripts that can have a lot of different conditions. Those opcodes can be used to create smart contracts on Bitcoin.

There are some opcodes that are disabled (nothing is "deprecated") because they can be abused to perform various attacks on nodes verifying transactions containing them.


What if you wanted to decrease anonymity? My idea is to be able to build "credit" for an individual. Lenders of BTC could just use a service to check the "credit score" of a certain address of a borrower. The borrower would have to spend a year(s) using one address like a checking account, and by meeting certain criteria over time, they'd earn a higher credit rating. But this doesn't limit them to one address, only to one public address.

You'd have to data mine transactions to and from known/published public addresses of public companies or employers/employees, etc. All of this data about an address could be pulled off of the blockchain and calculated with certain weights, which means no reliance on a P2P rating system. An applicant for a loan could even provide their daily use address (like a checking account) and their offline address (like a savings account). Lenders would rely on the ADDRESS's credit rating, not the individuals.

Is it possible? Am I oversimplifying?

Trying to build a centralized credit system would require a mint, which is why this protocol was build in the first place. We don't want mints and on top of that we don't actually need mints for most functions. I would suggest you take a look at those whole new possibilities that come along with this protocol, such as coloring, escrow services, etc and forget all about the old-fashioned and in many cases incapable credit scoring system. Or, if you insist, try to make use of the all-public transaction log after you have associated an entity with a public address, maybe with a micro-payment or the such.


How do we distinguish between BTC and BCH in an address? Bitcoin.com has recently published an article about the DOJ seizure of Silk Road-related funds. The article states:

From 1HQ3, 101 BTC were sent to BTC-e, the defunct Russian exchange.
About 69,370 BTC remained in 1HQ3 and were subsequently seized by the
government. The address also contains approximately 69,370 BCH, BTG,
and BSV prior to the government’s seizure.

What does this "the address also contains" really mean?
This sounds like the address contains 69,370 BTC + 69,370 BCH + 69,370 BTG + 69,370 BSV, and I don't think that is what they've meant. Do they only mean that the transactions are committed before BCH, BTG, and BSV forks happened?

How do we distinguish between BTC and BCH in an address?

By looking at the post-fork BTC and BCH blockchain transaction-journals independently.

What does this "the address also contains" really mean?

They are saying that in both the BTC and BCH blockchain transaction-journals there were unspent transaction outputs associated with an address that existed in both.

Do they only mean that the transactions are committed before BCH, BTG, and BSV forks happened?

That seems most likely.
Incidentally, since many addresses are created deterministically, I suspect it is possible that re-use of the same keys in both BTC and BCH wallets would cause either to generate the same sequence of addresses post-fork. I am not familiar with BCH and don't know if they continued to use the same HD algorithm, it seems possible.


Why did Litecoin choose the scrypt factors that they did? Litecoin uses the scrypt factors (N=1024, r=1, p=1) This means that each hashing thread takes 128kB of memory. The scrypt paper recommends r=8.
Colin Percival, the creator of scrypt, has said:

Q: are you into #litecoin at all?
A: I'm aware of it, and I'm aware that they used scrypt poorly (not enough RAM usage).  That's the limit of my knowledge.
Q: I'm considering enhancing #litecoin. How is scrypt being used poorly? Maybe I can help improve it
A: I'd suggest talking to @solardiz about this -- my knowledge of how litecoin misuses scrypt comes mostly from him. The 1-tweet summary is that scrypt is designed to achieve security by using lots of RAM, and litecoin doesn't use lots of RAM.

Is there a technical justification for such a low N and r?

Litecoin basically copied the parameters from a coin called tenebrix. The parameters were chosen partially because using more memory intensive parameters caused the GUI to be noticeably slow.
Listen to Charlie Lee talk about this at the Hashers United conference in Las Vegas.

https://www.youtube.com/watch?v=aHX34MbXuOk#t=469m00s
https://www.youtube.com/watch?v=qbj7aXu7FTw

[transcript starts at approximately 9:45 in the second video.]
Q: [...] But in hindsight, do you regret selecting the N, r, and p, parameters for scrypt?
A: So, the parameters I chose were copied straight from Tenebrix. The reason why they were chosen that way is because if you make the parameters harsher, more memory harsh, it actually slows down the client. Every time a block comes in, the client would actually freeze, for a minute, to verify the block, because it was so hard. At that time, it was decided, that it was a tradeoff. They decided to go with a better experience of the user using the client, and not as memory harsh, because at that time there wasn't any GPU that was capable of doing it, and it was CPU-only.
It would be great if the parameters were more memory harsh, but I think it was a tradeoff, and it was decided early on, to err on the side faster client speed instead of harsher memory requirements.


Why use Merkle Root (and not just concatonation of all hashes?) I am studying the bitcoin protocol and do not exactly understand why a Merkle root is used to register all the transactions. What is the point of using a tree-wise structure when you can also just take a hash over the concatenation of all transactions hashes? As far as I see, that would be less operations and therefore only more efficient?

The Merkle tree structure is essential for section 7 (Reclaiming Disk Space) and section 8 (Simplified Payment Verification) in the whitepaper.

With simple concatenation, the only way to be convinced that a transaction exists in a block is to have access to the hashes of all transactions, which requires a lot of storage space.

With a Merkle tree you can:

Prune large parts of the history, and still know that the data left intact is a legitimate part of the block.
Convince a specific node that a transaction exists in a block, by showing the Merkle branch.

Merkle trees are also used in pooled mining, allowing the miner to construct the generation transaction independently while the pool or another node builds the bulk of the block.

Some more details are in this answer.


How and where to pay in bitcoins into online wallet if I have address and ID I just found my "old" wallet.dat.
Is it possible to "send" it to an online-wallet in order to avoid downloading the whole blockchain again?
Or can I do it directly because I have the Address and ID of the coins?

I just found my "old" wallet.dat. Is it possible to "send" it to an online-wallet in order to avoid downloading the whole blockchain again?

NO. In fact, any service that asks you to transmit your wallet.dat file is most certainly a scam.

A wallet.dat file contains a collection of private keys, which are what is required to spend your bitcoins. So if you would like to use a different wallet without syncing the blockchain again, then you will need to dump the private keys out of your current wallet, and find a wallet that lets you import (sweep) private keys into it.

You can use a light-wallet to do this, rather than trust an online-wallet. You may be interested to check out the list of wallets on bitcoin.org, but remember to do your own research to ensure that you are downloading reputable software from a reliable source.


Ideal prompt to show to the customer I am selling SASS solution on my website.

How do I ideally educate customer to use bitcoin, which convince them
to use bitcoin instead of paypal or other methods.

Do you offer both Bitcoin and PayPal/other on your website? If so, offer them some discount, say 10% off, if they use Bitcoin. Tell them that it is due to lower processing fees. With some monetary incentive, you will convert some of your customers over.

If you offer only Bitcoin, put some link in a visible page stating something like "why only Bitcoin?", then bring them to a page in your FAQ where you explain your reasoning to use Bitcoin - lower development cost, lower processing cost, no charge-backs, freedom from third party companies, etc. etc.

Be sure to link to some accessable material for newcomers - for example, We Use Coins, or some materials from Bitcoin Wiki on Introduction.


Can not find or remember exchange About 4 years ago i gave my son some BTC for his Birthday....
Trying to teach him a bit of financial responsibility.....
he created a wallet, on an exchange i believe, i wasnt part of that, as i insisted he take charge and responsibilty for his own, and, keep passwords, seed etc safe.
Fast forward till now..... He can not remember which exchange he created the wallet on, i do have the original wallet numbers however...... dont have seed.
it there anyway to tell which exchange it went to , he " thought he saved all the info on his computer..... kids huh.

[is] there anyway to tell which exchange it went to

In general it isn't possible.

i do have the original wallet numbers

Wallet numbers aren't really a thing, there are wallet-IDs for some custodial wallets and there are Bitcoin-addresses for normal wallets.
If the number has hyphens in it, that might be a Wallet ID for an account at blockchain.com. In which case their support might be able to help.
If the number looks like a Bitcoin address, it isn't generally possible to trace those anywhere useful and you can't recover control from an address alone.
There are specialist businesses that perform blockchain analysis to try to infer relationships between addresses and to infer ownership of addresses. They are probably expensive to use and probably do not find anything useful in most cases.
It may be better to look for email or other text messages relating to a possible custodial account.


Wallet recovery history My Blockchain Wallet Has Been Hacked By Recovery Words.and my wallet id changed
How Can I Get Access To My Wallet Recovery History?

You can't. Most if not all wallet software don't keep logs as to who accesses recovery seeds or mnemonic phrases. (as would be stupid if not impossible)
(I'm assuming you're talking about Electrum here?)
The most you can do is see where your funds went using a third-party tool such as Walletexplorer
If you're lucky and he sent them to a regulated exchange, (coinbase et al), you can file a police report and they'll probably someday hand over the KYC data + IP adresses.
Don't get your hopes up though, your funds are gone.


Implementing NiPoPoW algorithm Hello,

We, a small team, have implemented about 95% of a breakthrough scientific proposal that is describing the NiPoPoW Non-Interactive Proofs of Proof-of-Work. You can find our source code implementation of the NiPoPoW algorithm on our GitHub

During the implementation, we have got a few questions that we were not able to figure out from your breakthrough paper:

I. The WebDollar uses the Mini-Blockchain scheme ( Ethereum alike ) by using Patrica Merkle Trees to store the Balances of every non-zero addresses and Smart contracts. So, in order to validate a balance, we need only SPV hashes from the Patrica Merkle Tree and proofs based NiPoPoW of the last block (which is the last block from the blockchain)… so we believe we don’t require the infix proofs. Am I right? Or do we need the infix or velvet NiPoPoW algorithm?

II.  Algorithm 2 Verify

a)  We guess that the function validChain will validate π and χ in order to check the interlinks that they point to the genesis block and the hashes are correctly calculated.

b) My first technical question is that we were not able to understand what is the Q predicate used in the Verify Algorithm 2. Is it a “function” that checks and validates the χ (validating a PoW blocks based Target (T), interlinks. I am right? ) or how Q predicate will look like ? What else will the Q predicate do differently than validChain (π, χ)

III. MultiLevel Property

We are not very sure we got the order correctly.

We iterate u' from [0 to all u] and we will check that every u' must hold the property that for any C* included in C that has the property   |C∗↑µ'| ≥ k1, C* must have also the last equation. in case C* fails the last equation we return false;

IV. Badness

We were not able to understand the marked C* from the badness function

a. What is the correct order to calculate the expression C↓↑µ−1… first we calculate C↓ and then we calculate based the previous result ↑µ−1?
b. How do we calculate C↓? We couldn’t find any idea of how to calculate  C↓ only C’↓ which is downchain definition C’↓ C is defined as C[C’[0] : C’[−1]].
c. Isn’t it C’↓ and not C↓ ?

Thank you!

I. This is almost correct. The only difference is that you still need the χ suffix mentioned in the paper, which includes the most recent |χ| = k blocks of the blockchain. This is because the “last block” is not stable and may be withdrawn (in case another block of the same height happened to be mined at a similar time). You can only deduce the “current” balances as of k blocks ago.

II.
 a) This is correct.
     b) The predicate “Q” is application-specific. In your case, it could be, for example, a statement that the balance of a specific account holds a certain amount of money at a certain point in time. i.e. Q would be that “Alice holds 5 Ether at block #4,000,091”.

III. This is correct. Generally, unless there is a serious attack against the whole blockchain, this property will not fail to hold (for appropriate δ).

IV.
a) Yes.
b) c) You are correct. The C↓↑µ−1 should in fact be C’↓↑µ−1 instead. I have corrected the error and we will update the paper in the newest version. Many thanks for pointing this out!

Answer credits: Dionysis Zindros


Coinbase IPN test page not posting data? On Coinbase under Merchant Profile I'm entering the URL:
https://www.scirra.com/handlers/coinbasecallback.ashx

For the IPN tester.  This ashx page has the code:

var r = "";
foreach(string name in context.Request.Form)
{
    r +=(name + " = " + context.Request.Form[name] + "

");
}
r += "

" + context.Request.QueryString;
Amazon.Emailer.SendEmail("xxx@domain.com","xxx@domain.com","Callback Dat", r);

The email I receive contains absolutely no data, although the logs page on Coinbase implies it's posting JSON data and returning HTTP 200 (success).

Am I doing something wrong?  Or is this a broken feature?  Can I (semi) safely assume that it posts the JSON in live mode?  And if so, do I simply Request.Form[0] to retrieve it or does it have a string index?

Thanks for any help!

Instant Payment Notification callbacks are POSTed in the form of JSON data.  The issue may be that you're attempting to iterate over regular http params that aren't there, instead of parsing the response body as JSON.  I've never used ASP.net before but this topic looks like it may help:

https://stackoverflow.com/questions/3398926/how-to-retrieve-json-via-asp-net-context-request/3411775


How long does it take to find a UTXO in UTXOs set? to validate a TX, the miner or full node should first find the UTXO. How long does it take to find a specific UTXO in a list of UTXOs set?

Right now, there are around 100 million of UTXOs. Then, how long does it take to find a specific UTXO among 100 million UTXOs? I need to know the accurate time.

It is impossible to answer this accurately without knowing details such as the hardware the miner is using, their utxo storage method, and their validation process.

However, in general, the utxo set can be stored as a list keyed by the utxo identifier (txid:vout). This provides O(1), or constant, look up complexity for a single utxo.

However, the utxo set may not fit entirely in memory on many systems, and the actual retrieval time may be longer than you'd expect in an ideal scenario after accounting for disk access time, and other implementation specific details.

In a miner's case, they validate incoming transactions and prepare a block template by feerate asynchronously from the actual mining operation - this allows them to have a reasonably good chance of maximising their earnings per block without having the mining process blocked by tx and block validation systems.


Is bitcoin the only entrance to buying other coins? I am totally newbie and looking into buying some other coins such as Megacoin and Quark with my bank account. After some research, I found that the only way to buy those coins seems to be buying them with Bitcoin.

Are there ways for me to directly buy other coins?

You can find coin exchange who sell those alt coins, see at MtGox or BTC-e
other ways to get alt coin such as Megacoin and Quark is by mining that coin


Who are creating all the alternate cryptocurrencies? Everyone knows Bitcoin and Litecoins goes hand in hand and they are the most popular cryptocurrencies out there. But who is creating all these alternative cryptocurrencies such as Feathercoin, Peercoin, Quarkcoin, Craftcoin, etc. And why are they created?

I see no potential why they would be something people would want to pay with in the future. I can not think that a café (for example) wants to add any other payments besides BTC and LTC and some FIAT money.

Why would they ever struggle with adding Peercoin, Quarkcoin, Craftcoin etc etc etc?

Once again, who are creating these coins and why? Do they have potential to grow high? If so, why?

Many people have an interest in cryptocurrencies - some of them are interested enough that they would investigate and work on creating a new cryptocurrency.  Some people are in it for a quick profit, i.e. the scam coins, but others are genuinely interested.  Sometimes it is good to be associated with a currency, but often they prefer to be anonymous (to some extent) and watch and help from the sidelines.

A cryptocurrency is not just a once-off effort.  There is work needed to maintain it, especially when a problem occurs, or a security issue affects it.  It is necessary to update clients, maybe even fix a blockchain.

Another reason for the increase in alternate cryptocurrencies is due to the hardware investment in the coin mining community.  For most miners like myself, it is now almost infeasible to mine BTC unless you have or are prepared to buy into the latest ASIC miners, but even then, the timeframe for making a reasonable profit is very short.  What do we do with this hardware - we use it to mine alternate coins that suit the hardware.  USB ASIC miners for SHA-256 based coins.  GPU mining for Scrypt based coins.  Hence the alternate coins are actually filling a need by the mining community to have something to mine and have the chance to make a profit or get a return on their investment.


I am looking for a list of all the public repositories for as many different cryptocurrencies as possible I am interested in reviewing github repositories of many different cryptocurrencies to enhance my understanding and know the differences between them. Does anyone know of an online list of the links to all of the different repos?

https://www.coingecko.com compiles the developer activities of almost all or most public traded cryptocurrencies.

They have the repo data stored on their site. Site may be hard to navigate, click Coin then choose Developer tab and look for Code Repository link. Enjoy.


How do I prevent Bitcoin from synchronizing? I have a script that uses Bitcoin's RPC interface and takes a lot of CPU to run, and I don't want Bitcoin to be verifying blocks while I do it. Is there a config setting or an RPC call I can use to stop it from syncing?

bitcoin-cli invalidateblock `bitcoin-cli getbestblockhash`

or

bitcoind -maxconnections=0


Is there such a thing as an "ERC20 compatible Ethereum address"? I believe the answer to be no, but just asking here to confirm.

I think the answer is that it is just the software interacting with the address that is ERC20 compatible or not, not the actual address. It doesn't matter what software generated the address, and it is fine to generate the address using any software for doing so. As long as I have the private key for the address, I can import that address into an ERC20 compatible wallet software, such as myetherwallet.com, and interact with the address in an ERC20 compatible way.

It means that the title for the e.g. the article How to generate your Ethereum ERC-20 compatible wallet address is slightly misleading, because it sounds like there is something special with the actual address generated. But how could there be, since an address is just a key pair?

Have I understood or not?

This is correct.

Any Ethereum address is compatible with ERC20 tokens (even a contract address).

There is also the ERC223 standard, which isn't finalized, and if approved would allow contracts to accept or reject specific tokens. In such a case, contract address validity would be a valid concern.

However, for ERC20 tokens, there is no such issue, and every address works (although some tokens include safeguards against sending to 0x0000000000000000000000000000000000000000)


How to query rewards data from a block I am trying to find out how much BTC has been mined over time hence I would like to query the rewards associated with a block. However, I cant seem to find the API endpoint from the BTC databases I searched.

Ideally, it will be something like www.blockchain.com, where we can see all the block data, including the rewards data.

Can anyone help me with this?

If you have a fully downloaded blockchain in your local machine, you can parse the raw database with this script.

Then you can find in output text files transactions with TX from hash equal to 64 zeros, there is the coinbase transactions.

Each of this TX has outputs with Value fields. The sum of this Values is the mining reward that you trying to find.


TxHash to BlockHash using API Can anyone plz point out a way to derive the BlockHash from TxHash using API ?

Lets assume I am studying the following...

https://blockchain.info/rawtx/5602487e624ee14193f646e29a9ac203335bc962b30155b66d142ab15f79018c

{"block_height":277586,"time":1388338452,"inputs":[{"prev_out":{"n":0,"value":1683888660,"addr":"14RfKeVn9PrG4CLuyzJYUXiFdqyd7Amjp5","tx_index":102576735,"type":0}}],"vout_sz":2,"relayed_by":"178.194.214.181","hash":"5602487e624ee14193f646e29a9ac203335bc962b30155b66d142ab15f79018c","vin_sz":1,"tx_index":105080382,"ver":1,"out":[{"n":0,"value":1483888660,"addr":"1FxmczX5yUXn6GAZBCJy2Uc25NgzpQNEtM","tx_index":105080382,"spent":false,"type":0},{"n":1,"value":200000000,"addr":"1NbX8RDmNJ2J36LBTBgTU6bwcqdX7Udv2M","tx_index":105080382,"spent":true,"type":0}],"size":225}

I have "block_height":277586

Now, how do I find out the block_hash of this ?

Although I don't fully understand your question, I can tell you that you can get the hash of a block at height Happy using the getblockhash api call:

getblockhash 277586

Will result in the block hash for the block on the main chain at height 277586.

Block Explorer.com provides an online api for this api call: http://blockexplorer.com/q/getblockhash


What happens if your transaction is never confirmed? If I have a low amount and don't include a fee, the transaction takes forever to get confirmed. What happens if it never gets confirmed? Can the wallet that I sent it to still spend the money?

If a transaction goes unconfirmed for too long, it will eventually disappear from the network.

Most clients will remove it from their pool of unconfirmed transactions at some point. When most clients have removed it, you can go ahead and send the transaction again, this time with a higher fee. There's not a precise time when the transaction will disappear from the network, it could be days or up to a week. This is why it's always recommended to set a transaction fee.

The wallet that you sent it to cannot spend it because it's not confirmed. So you have to wait until it disappears from the network and send an entirely new transaction.


What is the difference between "time" and "timereceived"? https://bitcoincore.org/en/doc/0.20.0/rpc/wallet/listsinceblock/ :

"time" : xxx,                        (numeric) The transaction time expressed in UNIX epoch time.
"timereceived" : xxx,                (numeric) The time received expressed in UNIX epoch time.

What?
In the output, every single "transaction" appears to have the exact same time and timereceived timestamps, killing my theory that time meant when the transaction was sent and timereceived referring to when the local Bitcoin Core first "saw" it.
It feels like I've asked about every single little part of Bitcoin Core online by now. I cannot fathom how anyone can get anything related to Bitcoin done when the documentation is this nonsensical/nonexistent.

time is the best guess for the actual time a transaction took place. timereceived is the time at which the wallet received the transaction.
For the most part, both of these fields will be the same. Generally when you use a wallet, you will receive transactions when they are unconfirmed which is then both the time that the transaction is received, and the best guess for the time the transaction was made.
However there are a few cases where the time and timereceived will be different. This is particularly noticeable when creating a new wallet with imported data and rescanning the blockchain.
Suppose you import an address which has a transaction from 2 years ago. When your wallet scans the blockchain for existing transactions, it will learn of that transaction at the current time, so it sets timereceived to now. But that is not reasonable for a transaction that existed in the blockchain 2 years ago. So it will try to guess what time that transaction was actually made by looking at the timestamp for the block it is included in. That block's time becomes the time for that transaction. In this case, time and timereceived are not the same and more clearly represent what those times are.


Armory - Change Amounts Not Showing So I imported a watch-only copy of my wallet on the online version of Armory but my balance in the wallet is missing all the amounts I previously received as change. The transaction history clearly shows that a certain amount of BTC were sent back to the same wallet as change but the transaction is grayed out and the amount given as change is not part of my total balance. The change addresses are also not associated with the wallet.

Anyone have any ideas?

You may just need to wait for the transactions to confirm. Be sure that your bitcoind is caught up.


Wallet.dat corrupted I ran Bitcoin during 2009 and 2010.
I found an old file I had renamed to xxxx.dat. I recently downloaded the Bitcoin.org wallet and let it run.
I get the "wallet.dat corrupted, salvage failed" message after I put in the file I believe to be my old wallet.dat. I have deleted the installation and restarted my computer. I hope to be able to start over. Any suggestions?

I ran the blockchain during 2009 and 2010

By "ran the blockchain" I guess you mean you ran Bitcoin-core wallet software sometimes known as Bitcoin-qt.

I downloaded the Bitcoin.org wallet

Bitcoin.org lists many wallets, I guess you mean Bitcoin-core wallet.

I found an old file I had renamed to xxxx.dat.

There are many different data formats and software applications that use ".dat" as a filename extension. So your xxxx.dat might not be a wallet.

Any suggestions?

Check the format of your xxxx.dat file. See if it matches the expected format.
There are tools that might assist with this - such as pywallet.
Otherwise maybe you have to download an ancient version of Bitcoin-core


Old Bitcoin QT Core (V0.7) - Sent BTC - Lost? I performed a 'Send Bitcoin' transaction from my really old Bitcoin QT Core client (V0.7 2-beta) a few days ago as a Test.
The client is YEARS out of date regarding the Blockchain.

I can see the Transaction Status on the client about an hour after sending it was given as -->

"Status: 0/unconfirmed, broadcast through 28 nodes".

I sent the nominal BTC transaction to an address beginning with "1B.." a legacy BTC address. There was a Transaction fee added natively by the Client (0.0005 BTC).

I’ve got a BTC Transaction ID for the Send BTC - but it is not showing up on blockchain.info, after 2 or 3 days now.. ?

Anyone know what might be the problem ?

ps - If this is a hopeless scenario - is there anywhere I could reverse that transaction ?

Understand a Core Client Upgrade would be the way to go - but I was just checking if I could so a Send (as a Tester), to save me all the time to get my setup up to date, download 145gig etc..

Thanks!

Anyone know what might be the problem ?

Your client thinks that funds were sent. All other nodes know nothing about your transaction. So, the truth is that your bitcoins are still yours, but you should remove the unconfirmed transaction from your wallet and/or use updated software.


How to safely spend from a compressed key offline? Armory supports offline transactions nicely, but doesn't support compressed keys.

A number of other ways exist for creating offline transactions, but all of them - every single one I've seen - requires one to manually create a raw transaction. This has previously resulted in accidentally sending a huge fee, and I've seen people say "do NOT create a raw transaction unless you're a bitcoin expert".

I'm no bitcoin expert, that's for sure. How do I make sure I create a "safe" transaction offline? I've seen Brainwallet's and Coinbase's services, are these foolproof? They show some JSON but I'm not exactly sure I would spot if something was amiss in that JSON...

Creating a manual offline transaction isn't super difficult, you just need to be careful and think about what you're doing.

Make sure you have the public bitcoin address and the private key before continuing.

Here's what I do (This assumes you are sending some BTC to one address, some back to yourself as change and some as a transaction fee)

Create a bootable Live linux CD
Download https://github.com/brainwallet/brainwallet.github.com/archive/master.zip and save it to a USB memory stick.
Open https://blockchain.info/unspent?address=1publicbitcoinaddress and pasted it into a text editor
This (from 3) is a list of all the unspent transactions for the bitcoin address, I like to manually pick the transactions I want to use as inputs.  eg. if I want to send 1 bitcoin, I might reference a 0.5 and an 0.6 BTC transaction rather than a 5BTC transaction.
Remember that the transactions are in 1/100,000,000ths of a bitcoin.
Remove the transactions you don't want to use as inputs, to do this, delete the transaction from the text editor including the "{" and the "},"
If you removed the last transaction in the list, check that there isn't a comma after the last transaction.
Save the contents of this text file to the USB stick with the brainwallet code.
Shut Down, disconnect your computer from the network, disconnect the hard drive(s) and boot into the live linux CD.
Open the brainwallet code in an internet browser
If your private key starts with a 5 (uncompressed) or an L (compressed), skip onto step 15.
You need to convert your private key to a format which starts with a 5 or an L.
If it's a 64 character hex code, type it into the "secret exponent" section of the generator tab and copy the private key.
If it's a brainwallet (passphrase), type your passphrase into the "passphrase" section of the generator tab and copy the private key
Go to the transactions tab
Type in the private key, click Cancel when asked to download the transaction history (it won't work as you're air gapped anyway).
Verify that the "Source address" is your bitcoin address
Click "Edit Inputs" and paste in the test of the unspent transactions.
The BTC box next to source address will update to show the value of the transactions you've selected - This is the number of bitcoins you will loose if you mess up transaction fees, so be careful.
Take the number of bitcoins from 19 and subtract your transaction fee (eg: 0.0003) - The result is the number of BTC you need to spend (including change).
Edit the Destination address to be the address you want to pay and set the amount.
Click the [+] button to add another destination address and enter your bitcoin address (for change) and set the amount to be the result from 20 minus the payment to your destination.
Now, on a calculator, add up the two payment amounts and add in your transaction fee.  This should perfectly match the amount in the reference transactions from step 19.
Scroll to the bottom and click Re-sign.  This signs the transaction.
Copy the contents of "Raw Transaction" to a text editor and save it to a USB stick
Shut down, reconnect hard drives, networks and boot up.

You now have a signed transaction which is not yet on the bitcoin network.  You now need to push it onto the bitcoin network.

We will do a final test of the transaction.

Visit https://blockchain.info/decode-tx (title should be Decode Raw Transaction)
Paste in the raw transaction and click "Submit Transaction"
Scroll to the bottom of the result and check the following:
vout_sz is the number of destination addresses (it does not include transaction fees)
hash is the transaction hash which will be searchable on blockchain.info, etc (once submitted)
vin_sz is the number of input transactions you referenced
out contains sections (per destination address), so check the "address" values are what you expected to pay coins to.
Also add up the "value" sections and divide them by 100,000,000 to get the total bitcoins to be sent (the difference between this and all the referenced inputs will be paid as mining fees)

If you are completely happy with the above checks, you can now broadcast the transaction.

Go to https://blockchain.info/pushtx (Title is Broadcast Transaction)
Paste in the raw transaction and click Submit.
It should say "Transaction accepted" if all was good.


How to get asm and hex from vout I've got this weird string for a utx message (not my code)

CTransaction(nVersion=1 vin=[CTxIn(prevout=COutPoint(hash=41caa5bf2b814135257b26e44b111f55c067f783e3cdf9bdf914e1ef7e403d05 n=0) scriptSig=47304402200910d62908c2f386008d024c3622cae2440338ea2f65ff970c6c4140704dadc20220636e346e716b93348aab1d01893379f21e7798870dd75d566d217784ea9e0925012103e7670f57af2bd9f601f32ea5b701140e478f0f3e06a1d23e47fc4af9d1965ae2 nSequence=4294967295), CTxIn(prevout=COutPoint(hash=e87b3bb5fd83baad8cfd621ab715b21daf44bbc6165b645f9fa1730d457623b0 n=1) scriptSig=483045022100e6429685c5a935c69659af47d2487f9252724b730eee087f75c81083ca3390860220653e3f0b53c9750c3c22d46ba0d7822e0a9661d717279ccddbfb94dfad10f330012102689f559da51e353cc1d34bd1436560b92a179646e5c5e2ae7dddf116a56656a0 nSequence=4294967295)] vout=[CTxOut(nValue=0.00061000 scriptPubKey=76a91497176e06ed3ebb9fc46d983f7e976046246b8eb388ac), CTxOut(nValue=0.03000000 scriptPubKey=76a9145414feb353a36043f5257366479389263b0cba5988ac)] nLockTime=0)

In each vout there is scriptPubKey that looks like a hex.

How to I use this information to get each vouts scriptPubKey.asm and scriptPubKey.hex

The code that produced this string is python but I could also manipulate this data in javascript! I'm stuck on first why does the scriptPubKey(s) look like this in the first place and second what do I do to get the asm and hex information

I found https://github.com/bitcoin/bitcoin/blob/master/src/rpc/rawtransaction.cpp

void ScriptPubKeyToJSON(const CScript& scriptPubKey, UniValue& out, bool fIncludeHex)
{
    txnouttype type;
    vector<CTxDestination> addresses;
    int nRequired;

out.push_back(Pair("asm", ScriptToAsmStr(scriptPubKey)));
if (fIncludeHex)
    out.push_back(Pair("hex", HexStr(scriptPubKey.begin(), scriptPubKey.end())));

if (!ExtractDestinations(scriptPubKey, type, addresses, nRequired)) {
    out.push_back(Pair("type", GetTxnOutputType(type)));
    return;
}

out.push_back(Pair("reqSigs", nRequired));
out.push_back(Pair("type", GetTxnOutputType(type)));

UniValue a(UniValue::VARR);
BOOST_FOREACH(const CTxDestination& addr, addresses)
    a.push_back(CBitcoinAddress(addr).ToString());
out.push_back(Pair("addresses", a));

}

Which looks like its doing the action I require (but I don't understand the code / what's happening)

Sounds like this is what you are looking for

Example usage:

cout << "Script being executed: " << ScriptToAsmStr(script) << std::endl;


Why increasing block size increases centralisation? I understand this is a contentious question. Help me understand Why increasing block size increases the risk of centralization?
I don't understand what Antonopoulos meant when he said few people can validate the blockchain when block-size is increased.

  "If my block takes 11 minutes to validate, then i’m off the blockchain, which means fewer people can validate independently, which means the system becomes centralized. With which one of these increases, fewer people can participate in the validation process, fewer people can participate in storing the data, and fewer people can participate in being independent actors. We go from a system that is decentralized to a system that gradually gets more and more centralized,”

He seems to be saying that if the block is too big, he might need more time to validate it than the time the network takes to solve a new block. This would mean he loses time with every block, and therefore can't validate at all.

Bitcoin blocks are solved every 10 minutes on average. He suggests that if blocks take him 11 minutes on average to validate he would lose a minute every block, therefore he would be unable to validate every block, which defeats the purpose.

With the assumption block sizes will increase, I'm unconvinced this problem is even on the horizon. In answer to the question "how long does it take", this excellent answer refers only to seconds, not minutes. For validation to snowball into an 11 minutes long process, we'd have to willfully neglect it's long predicted coming. I doubt that would ever happen.

But that's an extreme example. In reality, going from 5 seconds to 15 seconds really seems insignificant at first, but it does have advantages for larger miners over smaller miners.

A significant portion of blocks are found within seconds of the previous block. If you found the previous block you can skip validation and begin working on the next block immediately. This means you will get lucky every now and then and shove the next block within a few seconds, allowing you to claim the reward and fees. Comparatively, if a different miner solves the next block within a few seconds, he will submit it without any transactions because he was still validating the previous one. Naturally, large miners find more blocks, so they are more likely to benefit from this.


Is there a way to launch bitcoin-core and have it shut down when synchronized? I use bitcoin core infrequently.  I don't want to have it running all the time, but I'm willing to (for now) devote disk space to having it stay current.  I'd like to be relatively current whenever I do start it up, without being weeks behind.

What I'd like to do is:

Once a week or so, start bitcoin-core up.
Have it shut down once it's caught up (I guess defined as "when the latest transaction is less than an hour old).

I know how to handle step one (via cron/launchd/etc).  What I don't know how to do is step 2: either having it terminate automatically, or using some kind of CLI-command to check the sync status every so often.

If the answer to this is "put in a feature request to bitcoin core", then I'd be looking for workarounds/alternate methods to use until that worked.

For the record, I'm on OSX, but in theory this question applies to all variants of the client.

Any ideas?

You could sleep for e.g. 10 minutes after you started bitcoind, and then  do the following:

bitcoin-cli getblockcount, which is the current height of the node
call getpeerinfo, parse the JSON, take the median of startingheight (how far these nodes are)
If difference < 10, stop bitcoind with bitcoin-cli stop and exit
Sleep 1 minute, repeat

Or use something like this to determine if the last known block is less than an hour old.


Ardor: defining fee & bundler question let's suppose I send this request to the blockchain:

"requestType=transferAsset&secretPhrase=blablabla&chain=ignis&asset=blablabla&recipient=ARDOR-blablablablabla&quantityQNT=1000&feeNQT=1000000&deadline=60"

how does it work with the bundlers? I mean I set there a feeNQT that is 1000000 but not sure if that has to match an existing bundler rate or if that lets me bundle my transaction.
Thanks

Outgoing child chain transactions require a fee denominated in the child chain token. Unlike when using NXT, 0 is a valid fee for sponsored child chain transactions.

For normal transactions, let the server calculate the child transaction fee, a value of feeNQT=-1 should be used, and a new feeRateNQTPerFXT parameter must be supplied, to indicate the exchange rate of child token NQT per whole ARDR to use when calculating the fee (since minimum fees can only be calculated in the parent chain token ARDR).

If feeRateNQTPerFXT is also set to -1, the server will query the currently known bundlers rates for this child chain, also subject to the minBundlerBalanceFXT limit on effective bundler account balance, and use the best one for the fee calculation.

Transaction fee in ARDR varies depending on the status of the recipient account, sendMoney to a new account will charge higher fee than sendMoney to an existing account so don't make any assumption about the ARDR fee the bundler will have to pay to bundle your transactions, unless you check first if the recipient account is new.

One way to do this is to invoke the getAccount API on the recipient account and check for errorCode 5 in the response, then predict the fee according to the current minimum fee specifications.

A more robust approach is to submit the transaction when setting the broadcast parameter to false then read the minimumFeeFQT field from the response which indicates the minimum required fee in ARDR the bundler will pay for this transaction.

Bundlers rates cannot be trusted blindly as they may change based on market conditions, the returned transaction JSON including the fees calculated should be reviewed by the user.

The bundler rate used will be returned in the bundlerRateNQTPerFXT JSON field, -1 if no bundlers are known for the chain.


What permissions should wallet.dat have to be as secure as possible and still work? I would like to restrict the permissions on my wallet.dat file but but I don't want to stop the bitcoind daemon from functioning.

What are the bear minimum permissions that need to be on wallet.dat to make it functional, while making it as secure as possible?

The bare minimum permission would be to have it owned, and only accessible to, a user you specially create for bitcoind. At least for creation, and addition of new addresses for change, it will need to be not only readable but also writable. I am not sure if you can make it non-writable for as long as you have not exhausted the unused addresses in it.


Electrum address syncronization I need to periodically check the balance of a number of bitcoin addresses (a few tens or hundreds addresses).
I noticed that Electrum may syncronize a thousand or more imported addresses in a matter of a few seconds. But I failed to realise how it is done searching through Electrum source code.

Which methods it uses? Does it really import all these addresses into currently connected remote node and then calls listunspent no matter how many addresses I insert into the wallet?

Can you please point me to a code snippet that implements such funtionality

Electrum wallet requires a special Electrum compatible server where it can query the data needed.

There are now several implementations eg:

https://github.com/spesmilo/electrum-server
https://github.com/chris-belcher/electrum-personal-server
https://github.com/kyuupichan/electrumx

  ...code snippet that implements such funtionality

https://github.com/spesmilo/electrum-server/blob/ce1b11d7f5f7a70a3b6cc7ec1d3e552436e54ffe/src/storage.py#L286


getrawtransaction in Bitcoin-Qt (0.8.5) I am getting an error {"code"=>-5, "message"=>"No information available about transaction"} when issuing getrawtransaction.

I am aware that

  since bitcoind/Bitcoin-qt 0.8, no transaction index is kept anymore by
  default, as it is not necessary for validation in the new database
  model.

( Discussed here: getrawtransaction error? [Code -5] )

I have followed the answers and rebuilt my index with --reindex. I also have txindex=1 specified in my Bitcoin.conf file.

I am still getting the same error every time. What could be the issue? How do I make sure the client keeps an updated index along with synchronising for new blocks?

UPDATE: I tried working with a random hash: "d3ad39fa52a89997ac7381c95eeffeaf40b66af7a57e9eba144be0a175a12b11" and it works. Not for all though. Is transaction data specific only to some blocks?

My guess is that getrawtransaction only works on utxo transactions which means outputs of that transactions are not spent and still kept index by the bitcoin client.


What is GLBSE? How does one use it? What is the Bitcoin Global Stock Exchange?

How can one use it effectively?

GLBSE is a website where companies and individuals can issue and sell stocks, bonds, and options via Bitcoin. Anyone can create an account and issue any contracts he wants - a contract is just some text, signed by him (For example I created this bond as a proof of concept where I promised I will pay X amount of Bitcoin in the future for a loan of Y amount of Bitcoin today).

You can use GLBSE as an investor, transferring Bitcoins there and placing BUY and SELL orders on the various assets, or you can use it to sell parts of your company. It is a small scale version of a stock exchange (e.g. Nasdaq), with much lower fees and (almost?) no regulation. To create an IPO at an official stock exchange would probablly cost you at least a few thousand dollars, on GLBSE you can do it for half a bitcoin.

Although GLBSE has a command line client and an API, the easiest way to use it would be the javascript client. You can see a list of assets here, and follow this blog for posts about new assets. An updated list of transactions is available via Twitter, and you can find graphs of the assets prices here.


How does solving reduced difficulty hashes contribute to solving a block? In pool mining, it's my understanding that miners solve a reduced difficulty hash which proves that work is being done and also simultaneously helps solve a block.

How is this computationally possible? and how can the pool difficulty be different from the Bitcoin block?
I guess I don't understand how work on blocks is computationally divided among pool miners.

Contrary to popular belief, mining is not something where there is progress. Each hash has the same probability of being a valid block hash. You could get lucky and find a valid hash with your next hash, or you could not. There is no progress that is made. When you mine on a lower difficulty, the target that your hash must be under is much higher than that of the networks. With enough hashes, someone will eventually find a hash that is lower than the network target, and that hash would also be lower than their pool target. The higher target (thus lower difficulty) is only for tracking who is actually doing work and how much work they are doing so that they can be paid appropriately.


binance on site data and api data doesnt match When I collect say 1 minute historical kline data through the API, I see differente close times to what I see on the site checking the same time's candle. (I am matching data to UTC time that is not a factor here.)
Do you have any tips what might be the cause?

I have realised that the site doesn't refresh correctly, and I only needed to reload the site to match the one that gets returned through the api


How can data be accessed/searched for in a blockchain? I'm currently trying to find practical examples for the usage of a blockchain, instead of a typical database like MySQL.
I understand that the big advantage of a blockchain is the high security of data not being compromised.

But how can I imagine accessing or searching for a specific record in the blockchain?

Let's say, in a company we use a blockchain for saving all employee payrolls? How could one look up all payrolls for a specific employee?

You can access blockchain data like the way you access normal data in any  MVC where you fetch data from database ,manipulate it in backend and display the result in front end. Incase of blockchain,what ayou need to understand is it is  nothing but a decentralized database where transactions occor dynamically and the data is distibuted among all the nodes.
So to explain how the data is actually fetched from blockchain, what I do is ,Crawl each block in the blockchain and store the data in your preferred data base like MySql or Mongo
You can use rpc  getblockhash "n", which will return the hash of the block "n", for example:
eee7f58d111ef0b25f7f6e8703d80ab6b51ca957170daea949e93e6467906889
You can retrieve the block's contents by calling  get block "b", where "b" is the hash. Which can look like this:
{
"hash" : "eee7f58d111ef0b25f7f6e8703d80ab6b51ca957170daea949e93e6467906889",
"confirmations" : 176023,
"size" : 261,
"height" : 0,
"version" : 1,
"merkleroot" : "695191c2e8f8fddc75331a38d658ab07672970b09981ad77c29c4b0b17580941",
"tx" : [
"695191c2e8f8fddc75331a38d658ab07672970b09981ad77c29c4b0b17580941"
],
"time" : 1518520240,
"nonce" : 2084635057,
"bits" : "1e0ffff0",
"difficulty" : 0.00024414,
"nextblockhash" : "1bb4a4c35103a363ad63bf59bf7fa45c06babcfa8d848ceeb7e4958f9a9f660e"
}
Now every key value of above output replicates some important concept which cannot be ignored. But for now lets just focus on "tx",
the array of tx are the list of transaction that have been mined in the "n"th block, and now you can crawl each and evry transaction given in tx array using rpc getrawtransaction to know the detail of each transaction.
Personally, I store the details in MongoDB so I can keep track of my applications' users, their addresses and the transactions they have done.
So this is a simple approach by which you can access data from a blockchain.


Is Bitcoin a decentralized time-stamping authority? Can Bitcoin/blockchain be thought of as a decentralized time-stamping authority (TSA)? Is there true consensus in the Bitcoin network on a mined block's time, or just that the block was mined?

Yes, Bitcoin can act as a time-stamping authority. However, depending on your application the accuracy of the Bitcoin blocks may not be sufficient.

Nodes only reject blocks that are greater than 2 hours into the future, and blocks created earlier than the median time of the past 11 blocks. Therefore, timestamps may be off by several hours.

also see: How accurate is Bitcoin network time?


Does "fail the channel" mean unilateral close in BOLTS? The BOLTs frequently mentioned "fail the channel" when something unexpected is received or happens. For instance, when receiving an update_fulfill_htlc message, you should fail the channel if the received channel ID isn't known.
At this point, you would have money stuck in a channel, so does this mean you should try to close unilaterally, cooperatively, either? Is "fail the channel" defined in the bolts somewhere?


How are 'excessive' numbers of inputs and outputs handled in bitcoin transactions? I wrote a bitcoin transaction parser in python and it flips out when transactions have more than 255 inputs or outputs.  Some transactions have their number of inputs/outputs represented by a 1 byte hex string, others are represented by more.  How do I know (and how do I program my parser to know) whether a tx's representation of inputs/outputs is 1 byte or more?

The number of inputs/outputs is encoded as a "var_int" or "variable length integer".

Start by looking at the first byte. If it's 252 or less, then that's it, that's your number (like you've been using), there are no more bytes to read.

If the first byte is 253, there are 2 more bytes following it, which are a 16 bit little endian integer. 254 means 4 bytes following it (5 in total), which is a 32 bit integer. 255 means 8 bytes follow, i.e. a 64 bit integer.

You can read more here: https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer


Creating empty blocks vs creating full blocks I've already read many different answers to this topic.

Is it correct that the miner decides on his own if he includes any transactions in his block and how many (as long as the block size is <1MB?)?

What is more beneficial for the miner and why: Creating an empty block, or creating either a block that contains all transactions of the pool/or <1MB? Or is there an optimum?

Isn't it faster for a miner to not include any transactions in order to get the reward? Even more, if a large mining pool did that, isn't there the danger of taking over the network?

Yes, you are correct that miners get to decide whether to include transactions in their block that they're mining. The protocol itself doesn't force them to include any transactions. Instead, they have a financial incentive to include transactions because they can collect transaction fees and profit more.

It's an interesting trade-off for them, because their profit has to outweigh their costs of validating those transactions. However, I suspect transaction validation doesn't cost miners anything because they can validate and hash transactions for block i+1 as they are mining for block i with different hardware: validation is done on CPUs, mining is done on ASICs.

But there are interesting cases: For instance, miner A has to recompute their next block i+1 if  another miner B finds block i and it includes transactions from miner A's next i+1 block. In that case miner A would have to remove some TXs from his block i+1 and recompute the Merkle tree. Or miner A can create an empty block i+1 and just mine on that.

Sometimes, when mining on block i+1, miners even skip on validating other miners' block i in the hopes of winning the race by starting earlier [1].

Hope this helps clarify things a little.


What is MaxBTC and what it represents? I am trying to understand what is the phrase "MaxBTC" and for what is it used? I am new to bitcoins.

Thank you very much.

"We can represent any bitcoin account with MaxBTC 251."

It appears that MaxBTC is used here as a strict upper bound to refer to maximum number of bitcoins that will ever exist.

There will always be fewer than 21m bitcoins. All of Bitcoin's protocol logic actually is defined in terms of satoshis. There are 100 million satoshis per bitcoin. Altogether, this means that there will be fewer than 2,100,000,000,000,000 or 2.1×1015 satoshis.

Therefore, 251, which is about 2.25×1015, is larger than the total satoshis that will ever exist in the Bitcoin protocol and thus big enough to express any single amount of bitcoin that will ever need to be referenced.


How can get balance for btc/bch address and block? How can get balance for btc/bch address and block ?

Similar to web3.eth.getBalance for Ethereum

A BTC/BCH node does not supply aggregate information on addresses.
You could consult one of the block explorers out there, most of them do provide balances for addresses.


Average cost of mining per BTC over time Are there any approximations to the average cost of mining of a BTC over time?

The reason I ask is because I think that as this ratio will affect the general availability of  Bitcoins on MtGox, and will be a factor influencing the price.

In other words miners won't sell BTC at a loss, while competition increases and BTCs per block decrease.

This is a chart of blockchain.info's estimated miner operating profit.
The chart makes a number of assumptions which are listed below.

Electricity consumption is estimated based on power consumption of 650 Watts per gigahash and electricity price of 15 cent per kilowatt
hour. In reality some miners will be more or less efficient.
For profit margin hardware costs are estimated to be $1000 per gigahash every
2 years, and bandwidth $1 per gigahash per year.

It is also entirely possible that miners will start only accepting transactions that pay fees, and possibly increase the amount of fees they take to increase the amount of BTC per block. But the amount of fresh bitcoins taken from mining will almost certainly affect the price.


How many change outputs are there in a Bitcoin transaction I have been reading the following article:
https://coinmetrics.io/difficulty-estimating-chain-transaction-volume/

It mainly discusses how unreliable transaction volume on a UTXO blockchain such as Bicoin is due to factors like change outputs, exchanges making transactions and coin mixing.

My question is related to change outputs in particular. If one sends someone a 5 BTC output, from a 20 BTC input they would receive, there would be a 15 BTC change return to the address of the sender.

So what I ask is, for transactions with more than one output, can we assume that one of the outputs is always change? Wallets would not construct transactions where they split the change to multiple addresses of the sender, would they? Is the only concern then, whether the output is indeed change or it is value that is being sent over to another recipient?

So what I ask is, for transactions with more than one output, can we assume that one of the outputs is always change?

I think this is likely a safe assumption most of the time, but not always. For example, a transaction that pays two people, using an input that is exactly the sum of both payment (+ miner fee) would have two outputs, and no change address. Such a thing is probably rare, but possible.

As well, if you move coins around between two wallets you control, then the only real distinction between the ‘payment output’ and the ‘change output’ is in which wallet controls which key (since you own both).

  Wallets would not construct transactions where they split the change to multiple addresses of the sender, would they?

Sure they could, I’ve seen wallets that are focused on user privacy advertise all sorts of unconventional spending habits, with the goal of making it hard to figure out metrics like this. As an example, check out samurai wallet.

Again though, most wallets are designed to be fee-efficient, so in most cases there will not be more than one change output.

  Is the only concern then, whether the output is indeed change or it is value that is being sent over to another recipient?

That is definitely one issue with trying to estimate tx volume, but likely not the only one. Distinguishing payments between parties vs payments to oneself (eg moving you coins to a different wallet) is another. As you mentioned, off chain tx volume and coin mixers will also make it hard to figure out. Lightning network payments will similarly be difficult to quantify, since payments can be communicated off-band, and we will only see the channel opening/closing txs happen on chain.