text:
Why downloaded Block Size doesn't match with actual block size mentioned on network?
I am trying to download a block(Height:474044) using an API from here in python. Block is obviously downloaded in JSON format. But when I store it in a file on my system it shows very weird size number, not matching with actual blocksize on network. I also tried to download data in hex format using this link. But still, when I try to store it in a file(JSON/Text), It is not showing the size same as shown in block details officially. I have intentionally chosen a block before segwit BIP to avoid any further confusion. Help me to confirm my downloaded blocksize with actually mentioned on network. This question might seem naive to some users as I am new to bitcoin. Thanks for help in advance.

What size do you see?

Actual Block Size=998198, JSON File Size Stored on My System=5866321, Binary File Size Stored on My System=1996396. All sizes are in bytes.

For one, there is no JSON block format - different APIs have different ways of interpreting and displaying a block in a JSON response, and none of them will ever match the block size.
Your mistake appears to be saving the actual hex block as text.
1996396 = 2 * 998198

You must write the data as an actual binary file. i.e., write 12 as the byte 0x12, instead of saving the text "12" directly, which will write the bytes 0x3132 to disk, doubling the size of the file saved. Saving it as text will double the file size, as you've noticed already.

Yeah. Seems about right. Thanks!!


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

I just wanna save my bandwidth

Running a node in pruned mode will not save you bandwidth during the initial block download (sync), you still need to download all blocks and validate them, even if you don't store them longer term (pruning lowers disk space requirements). You can fine-tune your data upload limits in the bitcoin.conf file though.
Most RPC calls will work with a pruned node, some will not though. From a quick search for some examples, see:
https://github.com/bitcoin/bitcoin/blob/v0.11.0/doc/release-notes.md#block-file-pruning
https://github.com/bitcoin/bitcoin/blob/v0.12.0/doc/release-notes.md#wallet-pruning

Links suggests getblock and getrawtransaction won't work in pruned mode. Why would it be like that? Why doesn't it ask its connected peers to share the required block data? It should download the block at the time of getblock command time.

Getblock could work by asking other peers, but simply isn't implemented in Bitcoin Core. Getrawtransaction cannot work, as the P2P protocol has no mechanism for querying a single transaction - it'd need to download all blocks over again just to find the transaction you want.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Get invoice amount from payment request - LND REST API
I'm using the REST API of my LN node to generate and pay invoices. I would like to know how to get the invoice amount/value in sats from the payment request I receive.
I found this : https://api.lightning.community/rest/index.html?javascript#v1-invoice, but I don't know how to get the payment hash.
Thanks in advance

I just found the answer : https://api.lightning.community/rest/index.html?javascript#v1-payreq
Use the endpoint v1/payreq to decode the payment request.
Exemple :
var fs = require('fs');
var request = require('request');
var macaroon = fs.readFileSync('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon').toString('hex');
var options = {
  url: 'https://localhost:8080/v1/payreq/{pay_req}',
  // Work-around for self-signed certificates.
  rejectUnauthorized: false,
  json: true,
  headers: {
    'Grpc-Metadata-macaroon': macaroon,
  },
};
request.get(options, function(error, response, body) {
  console.log(body);
});

And the response :
{
    "route_hints": <array RouteHint>,
    "num_satoshis": <string>,
    "expiry": <string>,
    "description_hash": <string>,
    "timestamp": <string>,
    "features": <object>,
    "destination": <string>,
    "num_msat": <string>,
    "payment_hash": <string>,
    "payment_addr": <byte>,
    "description": <string>,
    "cltv_expiry": <string>,
    "fallback_addr": <string>,
}

Thanks for posting an answer when you found it.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
BITCOIN MINING POOL OPERATION CONCERN
I have contributed Bitcoin into a mining pool that was being promoted on Instagram.  The miner of the pool informed me that the process consists of 5 cycles.  He set an initial amount of Bitcoin to be submitted into the pool, and then decreased the amount for next 4 cycles.  After the 5th cycle was completed, the I received "Non-Spendable" funds in my Blockchain wallet, which I cannot touch and that will not show up on my dashboard.  I informed the miner of the situation and he told me that I have to submit an activation fee of .2 BTC in order for the funds to be released into my wallet.  The miner then informed me again that I will be able to take back the .2 BTC after the funds are released into my wallet and that this function is how the mining machine works.  Is this fraud?

Yes, this is 100% fraud. You can try to find help from local authorities. If you're in the US, this page suggests  https://ftc.gov/complaint

I transferred Bitcoin from my Coinbase platform to the Blockchain platform to complete the transaction with the scammer.  Is my Coinbase account compromised?

Did you give any private keys to the scammer? Otherwise, no.

No.  The only thing that I did was hold my Coinbase barcode up to the computer barcode for Blockchain.

What you have described is absolutely NOT how bitcoin mining works. This is most definitely a scam, sorry for your loss.

Is this fraud?

Yes. Essentially you gave money to a stranger you've never met who told you a story that seemed plausible but was a pack of lies.
Typical indications of scam

unspendable funds
activation fee
false description of how mining works
promoted on social media (private messaging)


text:
Sending coins when the priv/public keys are not in wallet (bitcoind)
I've created the hex for a raw transaction but do not have the wallet priv/keys in the wallet. Can I still send the transaction using sendrawtransaction? I've checked the message using signrawtransaction and this returns complete.

Yes. You should not need the keys to be in the wallet to send a transaction using sendrawtransaction(). All sendrawtransaction() does is broadcast it over the network.

Thanks - although I read somewhere I have to use the -reindex flag. Which I've done.

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
sendrawtransaction creates hash but does not propogate to the network
I'm on testnet, I've created a raw tx and I'm using bitcoind. I've confirmed that the hex is formed correctly and signrawtransaction returns complete:true.
After I've run bitcoind sendrawtransaction raw_tx I get a hash returned, however when I look at http://blockexplorer.com the hash cannot be found.
I'm definitely on testnet.
Can anyone suggest any ideas?

When using sendrawtransaction if the hash is generated but not propagated, then first I would assume that bitcoind retry mechanism will eventually send to the network.
On build 8.99 the transaction will go through, AcceptToMemoryPool. Which will validate the tx. So unless you see error TX rejected 22, which could be anything, as the validation is not yet reported. Then it's safe to assume you just need to wait.

Only if the transaction applies to your own wallet, will it be rebroadcast. Sendrawtransaction behaves exactly as if the transaction was received from the network.

@PieterWuille, Does this mean you should keep sending a transaction through sendrawtransaction until it appears on another node, or even in a block? Or would this be a bad practice and overload the network unnecessarily?

@Mark Sending invalid transactions (e.g., double-, quadruple-, etc. -spending) would increase your node's banscore; see this.

Could it be as simple as not having confirmations? BlockExplorer seems to keep it's own block database, that's only updated when a new block is reported. Your transaction won't immediately appear there.
Perhaps run less ~/.bitcoin/debug.log and do SHIFT + F to track for new logs. Once you submit your transaction, watch for errors which hint at the reason for failure.
If possible, try verifying it's not being broadcast by using a second node. If it's running with the txindex=1 flag, you can do bitcoin-cli getrawtransaction <txid> 1 on arbitrary, non-wallet transactions. It should be possible after just a few seconds.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
Error Code 22 returned from bitcoind sendrawtransaction
I've created a raw transaction on testnet:
http://pastebin.com/v8rBmGkx
however I'm getting error: {"code":-22,"message":"TX rejected"}
I've looked in the debug.log and there is no other clues. Can anyone tell me (pls) what's wrong with my tx?
Additionally signrawtransaction returned correct: true. And as far as I can see the fees and output values add up. I'm a little confused to what the problem is?

The problem, is there is no problem. It looks like there was two issues I had, which contributed to the error. So this is a bit of speculation really.
The first was that I had built bitcoind on the Mac (8.9+) and somehow the blockchain got somehow corrupted or something caused an issue. So I fixed this by running bitcoind -reindex
The second possible issue was that mempool had either already had the transaction and couldn't/hadn't resent it.
Either way, there is a (throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "TX rejected"); // TODO: report validation state in rpcrawtransaction.cpp), when validating the transaction and my c++ is not good enough to help report the validation state.
But if anyone else suggests how I can approach it then I would gladly!


text:
How to open a Taproot channel on c-lightning node?
Will new channels automatically use Taproot now, or is there something to activate in c-lightning to make it use Taproot?

There are major protocol updates necessary before we can use taproot in lightning and decide how exactly to make use of it in lightning and how to integrate it. Thus I don't think any implementation (that includes c-lightning) as of now or even in this year will add support for it

Thanks! As I understood the messages in Muun, they already added Taproot support last year, after it activated.
We had to take some action in the wallet to enable it, if I remember right.
Did i misunderstand that?

"Taproot support" could be split into multiple different things. When Muun say they "added Taproot support" they mean they added the ability to send and receive to a Taproot address. But all the possible upgrades (gossip, MuSig2, PTLCs etc) to the Lightning Network protocol that Taproot offers haven't been implemented yet (as Antoine, Rene say)

Channel opening is about communication between two nodes. Therefore it's not a feature C-lightning can unilaterally support. The protocol needs to be specified in the BOLTs.
As of February the 21st, specifications are still being discussed on the mailing list. A concrete protocol for Taproot channel openings has not been publicly proposed yet.


text:
ONCHAIN channel state in c-lightning
What does "ONCHAIN" mean in c-lightning channel state?
I guess means the channel is closed, but how to move those sats, or make them available to use in another channel, and completely remove that old channel's information?

The meaning of the ONCHAIN status means that the channels it is closed, you are missing 99 more blocks before that your channels if forgetting by c-lightning.
99 Blocks + the first that your transaction is considered on-chain means = 100 blocks that it is the method to say that somethings it is forever in Bitcoin time :)
A test that shows the coverage of this test case can be found here
P.S: When your channel is in ONCHAIN status you can move all the funds around without waiting that this channel will disappear. You can see the transaction or transaction unreserved in your listfunds RPC command.

I think it's something else, because already more than 400 blocks since the channel closed.
If I try to withdraw all, I get
"message": "Could not afford all using all 0 available UTXOs: all short"

Under listpeers can see that peer probably crashed, then restored did some kind of a unilateral channel crash and spent the onchain funds.
My node is doing its own unilateral close now and says it will wait another 200 blocks before that finishes.
Peer that caused it is still connected and can't be disconnected even with disconnect force set to true.
Seeems that might resolve properly, but after about 700 blocks total.

I didn't good all the use case here, but if you make a unilateral close there is different rules that lightning network apply that required more time to wait if the peer will be online again to perform the close.


text:
How to enable IPV6 on c-lightning in docker properly?
Helping to run v0.10.1 node for a client, who wants to enable IPV6.
Now listconfigs say:
"bind-addr": "0.0.0.0:9735"
"autolisten": true
Reading this: https://lightning.readthedocs.io/lightningd-config.5.html?highlight=bind-dir
It's unclear to me. Is the way to enable IPV6 to put another bind-addr for it and have:
"bind-addr": "0.0.0.0:9735"
"bind-addr": "[MYIPV6ADDRESS]:9735"
Or can there only be one bind-addr?
The installation is docker on VPS.
So, the host has many other inet6 addresses from all that, and seems that should not set
"bind-addr": "::9735"

Why do you need to bind two addresses? This type of address is used only internally

The solution is to leave the IP empty, like this:
bind-addr=:9735
will bind on both IPv4 and IPv6.

An empty ‘IPADDRESS’ is a special value meaning bind to IPv4 and/or
IPv6 on all interfaces, ‘0.0.0.0’ means bind to all IPv4 interfaces,
‘::’ means ‘bind to all IPv6 interfaces’.


text:
Invalid -rpcallowip subnet specification: *.Valid are a single IP, a network/netmask or a network/CIDR
I'm new and all this of bitcoin, but I'm trying…
I downloaded BitcoinCore and GUIminer, I made the configuration for solo minning (I created my username and password, I set Bitcoin client path) but when I tried to launch Bitcoin client as a server I got that message. What could I do?

What do you put for the -rpcallowip option? That's literally what the error says there's an issue with but you don't mention it at all!

I don´t know where is that option

Either you or other software (GUIminer maybe?) must have written that config option to bitcoin.conf.

I think that I fixed!, I found the -rpcallowip in "open file configuration".
But now I have "IO errors 1, tolerance 2" when I start to minning.


text:
No JSON object could be decoded; Failed to subscribe; IO errors - 1, tolerance 2
I´m using GUIminer and Bitcoincore.
When I start to mining I got that message, how can I fixed it?


text:
looking for faucet API so i could use it for tests - Automated faucet
i would like to make some tests on test net, the issue is every time i have insufficient fund in my wallet i need to find a faucet and manually add funds.
i would like to create an automatic faucet that will fill the balance in my wallet, I've found an Ether faucet API in GitHub, and i'll really appreciate if anyone could help me with finding bitcoin API.
thanks

Use regtest, the regression testing network, not testnet. Results using it are reliable and repeatable,  most importantly don’t rely on the will of others.


text:
How to create an online Bitcoin account?
I am new to the Bitcoin world. I want to know what are the procedures / steps to do in order to create a Bitcoin online account ? What are the popular Bitcoin online sites for creating an account ? For analogy for example with VISA cards there is www.paypal.com ; so what is for the Bitcoin ?

Note that Bitcoin is a currency, not (primarily) a payment mechanism. As such it compares with things like the USD or EUR; not with Visa.

You might like to review What kinds of wallets are there?


text:
Is it possible to transfer fund from a bitcoin wallet to paypal?
If I have a bitcoin wallet and a paypal account, I want to transfer my money from the wallet to paypal ; is it possible ? If so how to do ?

I find the best way to answer this sort of question is to Google PayPal bitcoin

According to PayPal's cryptocurrency FAQ, you cannot currently transfer bitcoin into or out of PayPal. You can only hold whatever you bought on PayPal.

So where should I transfer my Bitcoin in order to convert it to dollars for example ?


text:
Bitcoin transaction charges
I have a broker with a questionable reputation who is trying to send me a couple of BTC, but maintains there is a transaction charge of c$25k for this to go ahead. I don't believe him and think this is a scam but would appreciate opinions on what is a reasonable transaction fee to receive 3BTC and the drivers that influence the costs.

What does "c$25k" mean? 25000 USD cents?

Maybe Canadian Dollars? Either way, no, he's trying to scam you. I linked your question to a topic that covers this sort of situation.

If they're legitimate, they will take whatever fee they need out of the amount they are sending you. Anybody who asks you to send them money on the promise that they will then send you money is trying to scam you.

Thanks for the responses, confirms what I thought.


text:
Macro HAVE_DECL_FORK
I'm a new learner of bitcoin project. I'm aware that the macros in header file config/bitcoin-config.h and whole file itself were generated by autoconf. Looked into configure.ac, regarding to fork symbol, I only see only one check AC_CHECK_DECLS([fork]), i.e., I cannot find where symbol fork is defined, but in bitcoin-config.h value of macro HAVE_DECL_FORK is 1. This is true for some other symbols.
Could anyone help to explain that?
https://github.com/bitcoin/bitcoin/blob/master/configure.ac

Symbols like fork are system calls with APIs that are part of POSIX. Access to them are provided by the C library implementations via the unistd.h header.
If you look at the AC_CHECK_DECLS documentation, it states that if the includes are not specified, then the default includes are used, and this includes unistd.h.

I got it, thanks @Andrew


text:
Bitcoin Core - create new receiving address with PHP
I have Bitcoin Core on Debian

Need to create new receiving address with PHP.
As you see at screenshot, I've try to create new address from terminal, but that does not added at Bitcoin Core Receiving Address List, address created but, it's address list empty again.
Need that way which can give me new address and also it inserted in "Requested payments history".
Is it possible with PHP? If yes please explain me how it is possible. Please do not send me only links: EasyBitcoin, Bit-Wasp, etc.
Is it possible with this "denpamusic/php-bitcoinrpc" and if yes, please help to to understand how it is possible.


text:
How can I verify my merkle root function is correct?
I've started playing with Bitcoin on a more technical level recently (I'm an experienced software developer but just a user of Bitcoin up until now). I'm trying to implement a function to calculate a merkle root, as described by the protocol documentation here. I think I have implemented a function as described, but I'm not too sure how to go about verifying what I've done. Ideally I'd like to write some unit tests, but I need some input values and an expect output.
Does anyone know where I might find a set of transaction hashes, along with the correct merkle root which should be produced from there? I'm really looking for example inputs & output which I can use to verify the correctness of my function.
I've tried copying & pasting the transaction hashes from Bitcoin block 96001, but the merkle root I'm calculating does not match what is displayed on blockchain.info. The strange thing is, when I feed the same transaction hashes into the merkle root function in BitcoinJS-lib, it produces the same merkle root as my function. Are my function and BitcoinJS-lib both wrong? Is blockchain.info wrong? Or is there something else going on here?
var sha256 = (buffer) => {
  return crypto.createHash('sha256')
    .update(buffer)
    .digest()
}

var doubleSha256 = (buffer) => sha256(sha256(buffer))

var merkleRoot = (hashes) => {
  if (hashes.length == 1)
    return hashes[0]

  return merkleRoot(
    _.chain(hashes)
      .chunk(2)
      .each(tuple => tuple[1] = tuple[1] || tuple[0])
      .map(tuple => Buffer.concat(tuple))
      .map(doubleSha256)
      .value()
  )
}

// Transaction hashes from block 96001:
var tx1 = Buffer.from('dcc95c8740525e27d87333558e5d0a288d0eac9062598c86c77e75dcde7178d2', 'hex')
var tx2 = Buffer.from('043cd1d9166cf16a4cc02d4385667657056cbe23f7058877c7fde09ef7de904a', 'hex')
var tx3 = Buffer.from('88b058d7e3e7b6d174d0f5a76a209a3107de65c01b010cda72ee64b22c980998', 'hex')

console.log(merkleRoot([tx1, tx2, tx3].sort()).toString('hex'));

// expected 'e7ae478c684e965d730e72b9cac644fd1ebeb1517fe69cc458d9d4070b9de8d8'
// output   'b2f52e4efbbab7653489b83d5ad331f1ada1b7e5959ac63b8aa45a786ae90279'

Most likely, you have some endian-ness issues. Remember that the merkle root published is in little-endian and so are the transaction hashes. You'll have to reverse them and then calculate merkle calculations.
You can take a look at the details of a block with the tx hashes here:
https://webbtc.com/block/00000000000000000375c25e5af8f3b2310585ad6a7c264d66398018ce4c6a41.json
There's a very helpful key in that json payload called "mrkl_tree" which tells you all nodes of the merkle tree (so the parent of two adjacent leaf nodes is in that set). It's probably easiest to build tests around that.


text:
Know the words, forgot the order
So have the words for sure but they were scrambled on paper... What are the options to getting back in my wallet? They started it oder I'm sure of but some word(s) are out of order


text:
Does Proof Of Stake have any intrinsic scalability Advantage over Proof Of Work?
Is there any intrinsic scalability advantage to using proof of stake over proof of work?
Ignoring the environmental impact issue, and ignoring sidechains, can proof of stake achieve higher TPS rates than proof of work?  (Presume identical block size and hardware)

No, the concerns limiting the number of transactions are orthogonal to the method of achieving consensus.
Blockspace is limited to prevent the cost of operating a node from ballooning to enable users to perform full validation. Neither the effort for PoS nor PoW scale with the number of transactions in any way.

It's a complex question because you can never just consider scalability on its own. Something to keep in mind when talking about scalability is Vitalik's infamous scalability trilema.
The trilema involves Scalability, decentralization, and security.
It states that increasing one always sacrifices something in regards to one or two of the other components.
You characterize scalability as TPS. Sure it is possible to increase TPS. But to do so you have to sacrifice either

decentralization: for example, blockchains which increase block size, making nodes more resource intensive and decreasing the amount of full nodes in the network. ie BSV, BCH. This also goes for all kinds of Proof of Stake altcoins which have computationally intensive nodes to gain TPS, or which use dPOS consensus.

security: the network can resist a large amount of participants trying to attack it. 51% is usually taken as a secure amount (as for BTC or ETH), if this amount is low, ie 10%, you will usually be a permissioned network where people who run nodes are screened with KYC. A lot of high TPS alt networks hide the fact that they are actually permissioned for full nodes.

With that out of the way, does PoS intrinsically increase scalability? No, but the proponents of PoS say that it is the best way to enable SHARDING.
Sharding does claim to increase scalability without trade-off because for sharding, you get multiple connected chains and yet each node only has to process one shard chain (decided by some random selection process), therefore decentralisation is maintained while TPS of the whole goes up.
There are two problems with this narrative.

PoS is not necessarily a requirement for sharding. For example Kadena is a blockchain that does sharding with PoW.

There is a more important, insidious factor that stops scalability: state bloat. As the state of the chain increases, processing state updates becomes more and more complex. More memory is needed to store the full chain, and better processors are needed to validate state updates against the ever-growing history of the chain.

In fact the second problem, state bloat, is the reason why BTC may turn out to be wise to keep block size to only 1MB and TPS slow. Complexity of the Ethereum chain is rapidly increasing, much faster than BTC. It seems that because of state bloat, decentralisation+scalability may be doomed in the long run on ANY chain. Even with pruning it is inescapable that chain history and complexity will grow much more rapidly than computation abilities if TPS is too high.
Certain chains are focusing specifically on solving this problem, such as Nervos, which relies on a rented L1 chain to keep state small, and uses sidechains to address scalability rather than sharding or anything like that. Nervos L1 is proof of work chain.
So in conclusion, some people may claim staking increases scalability because of sharding, but this is a doubtful argument. The only thing it really does is reduce electricity costs, if it succeeds.

Good answer. Just one nit: I'd think that sharding requires each node to process more data than just one shard since there must be a mechanism to facilitate cross-shard payments.

PoS may reduce the somewhat easily-quantifiable electricity costs of PoW, but only to replace them with larger and less quantifiable social/capital costs.


text:
How does Ed25519 fit in with BIP32/44 HD wallet paths?
From my understanding, BIP39/32/44 all use the secp256k1 elliptic curve standard from Bitcoin. But I noticed that cryptos such as Polkadot and Cardano have their own registered coin type path for BIP44, but those two cryptos use Ed25519 as their public key elliptic curve standard, so how is this possible?
Isn't those BIP39 mnemonic words all stemming from 256 bits originally? And Ed25519 uses a different private key size than 256 bits?

BIPs 32/44 and one option of 39 all generate 256-bit keys suitable for secp256k1, but they don't depend on it in any way; they are equally good for anything else using 256-bit keys, which Ed25519 does. See https://en.wikipedia.org/wiki/EdDSA : "An EdDSA private key is a b-bit string ... chosen uniformly at random." "Ed25519 is the [instance] ... where ... b=256." A b-bit string with b=256 is a 256-bit string.

thanks for that explanation


text:
In bip32-utils for bitcoinjs, node.getAddress is not a function
I am trying to run the example code in the bip32-utils taken here (https://github.com/bitcoinjs/bip32-utils) of:
const bip39 = require('bip39')
const bitcoin = require('bitcoinjs-lib')
const bip32utils = require('bip32-utils')

let mnemonic = bip39.generateMnemonic()
let seed = bip39.mnemonicToSeedSync(mnemonic)

let hdNode = bitcoin.bip32.fromSeed(seed)

let childNode = hdNode.deriveHardened(0)
let external = childNode.derive(0)
let internal = childNode.derive(1)
let account = new bip32utils.Account([
  new bip32utils.Chain(external.neutered()),
  new bip32utils.Chain(internal.neutered())
])

console.log(account.getChainAddress(0))

But i keep getting this typeError of node.getAddress is not a function, any suggestions?

Bitcoinjs-lib no longer contains the BIP-32 functionality you are trying to use:
https://github.com/bitcoinjs/bitcoinjs-lib/commit/84bc2ea6bf62ddb26fa9cb023b765d414f98f982
You need to use https://github.com/bitcoinjs/bip32


text:
testnet output address has no matching Script?
Here is my code to create a PSBT on the testnet:
const bitcoin = require("bitcoinjs-lib")

const privKey1 = "..."
const address1 = "mkVPHMR5euGTcvpFj6tfyVERstDdH4RtQs"

const theKeyPair = bitcoin.ECPair.fromWIF(privKey1, bitcoin.networks.testnet)

const psbt = new bitcoin.Psbt({ network: bitcoin.networks.testnet })

psbt.addInput({
  hash: "c77821e0565d17e857994b1e026d2cf382ef84b53fca76d1d4b63ce9ee645290",
  index: 0,
  nonWitnessUtxo: Buffer.from("02000000000101170e07c2351440cb0938947c3a41dddbbbe8aa80d44cdcaf6ea0f2b385abf9d20000000000feffffff02400d0300000000001976a914368ca7e5ed3e4c362cc89d65ea5377e4500a797988ac0c235b7500000000160014b31af8dfde1e14e2ac989fc8b166d8132e510d1a0247304402200cbcbdc329254f8bb179b994a60adba7b6015902eb88a7ee805db679f9538ee40220755a3ed40edcf94a31f13af9f30e84179eb5e672f0d7b2aeb2c6e0b46578c037012103c4f71eb5e4d36c44e6551d874bae0948cc7c06685c7198b174ce298538232c13f56a2200", "hex")
})

psbt.addInput({
  hash: "194e0a0bdb2d0ff22ede8c4eefe6b84419064c919b08ea5e656582e8d12c1b42",
  index: 1,
  nonWitnessUtxo: Buffer.from("0200000001f690b8dfd90ee3a8cf146b51c1f5d3180f2a58e997c2fd5aa10428f46b0fcd6d000000006b483045022100ae38259cf1643e8092ea2eade8de51bbbe0c48cac958f450619fa109616e85c0022046f57444fa3b6e05cb14499d302f19172f1a9db0af380ff1c8a36a6c0bb67e5e012102bc65de8691ff3a63c032aa3bde43acc4b22302a28d4554035a1e5791affd28bbffffffff0288130000000000001976a9140a27eeaabbb78515d92ac4237de4c75d5a7e047c88ac905f0100000000001976a914368ca7e5ed3e4c362cc89d65ea5377e4500a797988ac00000000", "hex")
})

psbt.addOutput({
  address: "cQqgBiALkRLfbc17BUJWjUSpKJzgumLP1utkZNJE5yiUcrAa6",
  value: 289000
})

psbt.signInput(0, theKeyPair)
psbt.validateSignaturesOfInput(0)
psbt.signInput(1, theKeyPair)
psbt.validateSignaturesOfInput(1)
psbt.finalizeAllInputs()

psbt.extractTransaction().toHex()

When I try to run the code I get the error below:
  throw new Error(address + ' has no matching Script');
  ^

Error: cQqgBiALkRLfbc17BUJWjUSpKJzgumLP1utkZNJE5yiUcrAa6 has no matching Script

Any help? Could it be the way I instantiate my key pair?

Testnet adddresses start with m or n, for public key hashes, and 9 for script hashes.
There are no known scripts for addresses starting with c.
See more at Bitcoin's wiki - List of address prefixes

rookie mistake by me. Thanks.


text:
can you use blockchain.info instead of hosting bitcoind for a website
If I use api calls to blockchain.info instead of hosting my own bitcoind for checking address values, is it safe?

You probably could - blockchain.info has certainly taken steps towards letting you, and provide a reasonably complete API, along with websocket streams for real time data.
That said, you probably shouldn't - Bitcoin, and other cryptocurrencies, are designed to be decentralized and trustless. By using Blockchain.info, or any other API provider, you leave yourself open to a variety of attacks and issues. For example, how do you confirm that the tx data returned by an API provider is really the tx data on the blockchain? Most APIs do not provide any form of SPV support, so you can't request for inclusion proof.
Running a Bitcoin Node is a relatively low cost for a considerably higher security guarantee. I would strongly advise that you pull your data directly from your own node.


text:
When I specify wallet in bitcoin.conf for testnet3, it gets ignored
I have a question about specifying wallet for testnet3. My bitcoin.conf file is located in the root of the Bitcoin folder with the line 'wallet = receiving.dat as well as testnet=1. Whenever I run 'getwalletinfo' tho it still shows no name for the walletname and if I delete the default wallet.dat, it autoregenerates. This is on version 0.18.0.

Update: So it appears it's selecting the wallet in the non-test version according to the bitcoin.conf. Now it seems to be how to specify wallet in testnet.

This is answered by Can't specify rpcport for testnet but it comes from an issue in the 0.17.XX change where options need to be specified by network type.

more details here


text:
I've forgotten the password to my wallet but can still access it, can I get my Bitcoins out?
I have forgotten the password that I created for my wallet. I can, however, open my bitcoin-qt software successfully and see my transactions etc.
I know I can't recover or brute-force my password. Can I move my Bitcoins from this wallet to a new wallet (where I'll take better care of my password)? How?

Update: I hate being senile. I eventually remembered where I securely stored my password and was able to retrieve. Lucky me.

Sorry but there is no way to spend the coins without the password.  However if your password was of poor quality you may be able to use hacking tools to brute-force it.
Importing the coins to another wallet won't help... it would have the same password.

authors: Николай Новик


text:
Not getting enough Hashrate
I have an i3-3220 processor which i am using for mining.
I know that you're supposed to use a GPU and all that. But currently i'm just trying it out before spending money.
I'm using CPUMiner, mining at middlecoin.com, 24 hours a day.
The problem is that i'm recieving very less hashrate.
This https://en.bitcoin.it/wiki/Mining_hardware_comparison points out that an i3 processor (which is actually a lower model than mine) recieves almost 8.5 MH/s and i receive about 5.5 KH/s on each thread that is about 27 KH/s in total.Why such a large difference?
What do i need to tweak? Is my program useless? Are the settings wrong? Is it problem with the pool?

You should provide the exact model of your CPU and what your command line is.

Which program? Which settings? Which pool? You ask questions without even giving the baseline information. EVER asked anyone for help on anything? You should know better. Give us at least some basic infos.

TomTom. Didn't i mention CPUMiner? I did. Pool? Come on. Middlecoin.com has only one pool. Settings? I didn't tweak anything at all. Just using the default settings. The settings or tweaks part is what i wanna know... You should tell me that.

Colin: i3-3220? Is there a more exact CPU version? If yes, then how do i find that?

@ColinDean the i3-3220 is the model number, enough for exact specs of this chip see summary article and Intel's page for the CPU

EDIT (From comments, this was the real issue):
Are you doing Litecoin or Bitcoin mining? Looks like middlecoin.com does Litecoin. The hash rate for Litecoin will be much slower due to the scrypt algorithm, which is slower to process than Bitcoin sha2. The bitcoin.it wiki page is showing hashrates for Bitcoin mining.  That would explain the 1000x factor difference.
EDIT:  (first answer)
When was the chart made?  Those results captured on that page would have been accurate when the cumulative mining strength of the network was at a particular difficulty.  Note that the difficulty is increasing quite rapidly so whatever you're using for mining is less effective than previous.
From comments below, I'm missing the point a bit, thanks for the clarifications.  Specifically, a device's hashrate remains the same no matter what difficulty the network is at.

You're right Chris. The difficulty decreases because everone's hashrate is increasing. But that doesn't change an individual's hashrate. It just decreases his share.

What i want to know here is why i'm not getting enough hashrate?

@HarryKing Do you have a resource monitor app for your OS?  Like Task Manager or Activity Monitor.  Do they show at/near 100% CPU utilization?  Actually maybe just a little over 50% might be the max, you have a dual-core system with hyperthreading, and I'm guessing CPUminer uses SSE instructions (so no benefit from hyperthreaded "cores").

I'm on windows 8. The windows 8 taskmanager shows CPU activity. And yes, it shows near 100% CPU activity. To be precise, it fluctuates between 95% to 98%. Mostly at 98%.

Looks like CPUminer supports two architectures x86 and x86-64, with Win8 you probably want the better one (or at least newer ;-) x86-64.  As an experiment, can you try the other version than what you have installed?  (maybe a bug with detecting your exact CPU capabilities)  Also I can't tell if CPUminer has any diagnostics, would be interesting to know if it is trying to detect support for AVX or SSE2 and failing, thus causing it to run slower for compatibility.

And another experiment, try --threads=2 on your command line, to see if that helps at all (theory is that you only have two "real cores" so no point running 4 threads waiting on two SIMD units).

Its already running four threads actually. Each at a little over 5 KH/s. I have no technical knowledge about avx or sse2. Care to explain?

And i already have the x64 one.

The AVX (newer) and SSE2 are both a set of extensions to the Intel instruction set, for SIMD tasks, single instruction multiple data.  Each real core will have an SIMD unit, 8 larger registers where you can do the same instruction to all 8 in parallel, this gives a nice performance boost for data-parallel applications such as the SHA2 processing used during mining.  Compare this with the traditional floating point unit of the CPU, which can only one such operation at a time, not 8.  But do try the setting the max threads to two instead of the default 4, just a hunch.

OK... and how do i do that?

Waitasecond, are you doing Litecoin or Bitcoin mining?  Looks like middlecoin.com does Litecoin.  The hash rate for Litecoin will be much slower due to the scrypt algorithm, which is slower to process than Bitcoin sha2.  The bitcoin.it wiki page is showing hashrates for Bitcoin mining.

yes, middlecoin.com mines scrypt coins. Confusion cleared.

All this aside do you know how to speed up the hashrate.
Should i try using linux (ubuntu) instead or drivers or some tweaks?
You don't need to explain a lot. If you know any links..I can help myself.


text:
How does Trezor recover all public keys from different blockchains?
I understand that the Trezor is a HD wallet, meaning private-public keys are generated through a deterministic, hierarchical expansion of the root seed. However, when I am in a process of recovering my wallet with a seed, how does it figure out which private-public key pairs map to which accounts on which blockchain? Is it just some sort of brute-force expand and check (see of Bitcoin blockchain has the following address or no) algorithm?

Trezor follows (and helped design) BIP44.
BIP44 details how a single mnemonic may be used to create individual keychains for different blockchains, and how multiple accounts may work within those keychains.
This is not a foolproof system - if you deviate from the expectations of BIP 44 (such as using addresses beyond the 20 address gap limit) automated recovery software will not be able to locate all of the used addresses - This makes it somewhat unfit for commercial uses, since most companies and exchanges need to give out addresses without assuming they will be used sequentially.
For individual wallets, this is a safe assumption, and one that Trezor makes.


text:
How do I get my Bitcoin "Spendable" instead of it being "Non-Spendable" on my Blockchain Account?
I have been fighting this all night and day and haven't made any progress. I used a CoinFlip ATM to buy BitCoin or deposit USD into the machine. I have an account at Blockchain and I used the right QR code to deposit, or buy, the Bitcoin. My transaction is showing in my Blockchain Account but it's showing as non-spendable. I need to make a payment on something and need to know ASAP how to make it spendable to transfer. Something to do with a Private Key, that I have no idea how to get either. HELP Please!

How did you add this unspendable address to your wallet? To spend funds, you need the private key, and you either know that, or not. You can't deduce a private key from a public key/address. If the address is 'unspendable', then it is likely just a 'watch-only' address, meaning your wallet software doesn't have the private key for it.

I don't recall getting a private key. When would that have happened? I had to transfer the transaction into the Blockchain account by copy and pasting the wallet ID (I think that's what it was). I did get a receipt for the transaction when I deposited the cash into the CoinFlip ATM. Would the key be there?

I guess where would I find the private key or when would I have received it??

Generally, your wallet software will create the private key, and then derive the public key and address from the private key. Based on this video (https://www.youtube.com/watch?v=_aL_OPx1MSc) it looks like the CoinFlip ATM pays to an address you provide. So where did that address originate from?

If you want to post the txID it may be helpful to figure out what is going on, but doing so will hurt your privacy. It may also be possible that your transaction just isn't confirmed yet, and the wallet software is not letting you spend it until it is confirmed.

No, it shows confirmed and everything and my wallet software is the Blockchain account, right? Because that is all I have and when I deposited on the CoinFlip machine I got an address from Blockchain mobile when I first opened the app on my phone it generates a QR code that I scanned. Is there another program I need for the wallet? Is it called Electrum or something? Because a friend told me that just now.

And I'd be happy to show you anything on here too because if I can't figure it out I lose my money anyway or if you can figure it out and take it,well then its gone too, so really I only have a 33% chance of getting my money. So, alright what do you need me to show you? The TX ID??

Just so you know: NEVER share your private key, mnemonic seed phrase, or wallet log-in information with someone else online. Having that data could allow someone to steal your coins. Anyone legit offering to help will never ask for those things. However, sharing your txID, public address, or public key is safe from theft, but hurts your privacy (people will know which tx is yours).

Oh that's fine I don't mind it that much I suppose. But thank you for the advice to stay away from people asking for those things I'll definitely keep that in mind......
The TX ID is: RPMDS3
anything else you think you need to help??

I downloaded the software called Electrum and created a wallet and all with that ONLY transaction and address in there but it needs a SEED which I have and know but it isn't letting me click on the button to enter that info

When you first started the blockchain wallet, did you do anything like 'import address' in the app? The first receiving address the wallet shows you should be spendable, I would recommend contacting blockchain's customer service team. You shouldn't need to use Electrum to spend the funds. Either the blockchain wallet has the private key and you can spend from there, or it doesn't because you imported the address from somewhere (and if you don't have the key otherwise (ie, you used some other software to make the key), the funds will be unspendable).

Yes I had to import the address and entered the address not the private key because I never knew the private key. What I think I need to do is make the key like you said but I'm not quite sure I know how to do that. Is it through the Electrum wallet? Blockchain? Don't know

No, it is impossible to find the private key for a given address. No software can do it, you either have the key, or you don't. Where did you find the address that you imported? It must have come from somewhere. Where?

It came from a URL that one of the support guys at Blockchain.com gave me. It's this right here:
: https://www.blockchain.com/btc/address/17ui5GVdwtfa8AjwxnpWyEpDHWmxbXR88o)
Then they're telling me that I need a private key but I don't remember even seeing one

Well, I feel like a jackass!! I have been using my laptop to try all this and I just opened up my phone and the Blockchain app and apparently the Private Key was stored on the phone app and so it released the funds. Thank you for trying and all your help it is appreciated!!

no worries, I’m glad you recovered the funds

Good to see the issue is resolved. Can you either answer your own question, or close it?

OP answered own question:

I have been using my laptop to try all this and I just opened up my phone and the Blockchain app and apparently the Private Key was stored on the phone app and so it released the funds.


text:
Help - transfering bitcoin old bitcoin core 0.12.0 wallet
I have a old bitcoin core wallet 0.12.0 ... I tried to transfer bitcoin from this to a new Coinbase wallet 2 days ago... Nothing has shown up in Coinbase wallet and the status of the transation in bitcoincore shows sent - but with a ! and status 0/unconfirmed.... is this transaction ever going to work or is there a way to cancel? I dont seem to be able to do anything with it now... so am concerned about how I can I get bitcoin from this old wallet?
It also has years worth of syncing to do to catch up

You must wait untill the blockchain to catch up for your old wallet to send the transaction.

Export your private key(s) from 0.12.0 and import into a more recent version of the wallet, send from the newer version.

That won't solve anything, as he'd still need to synchronize the new wallet.

there are types of wallets other than full nodes that allow importing private keys. syncing a new full node is an option, but not the only option.

Of course, but "a more recent version of the wallet" in this case refers to Bitcoin Core, no? You could alternatively suggest importing into different wallet software, but that's a lot more complicated

it's definitely not more complicated. check this out. https://bitcoinelectrum.com/importing-your-private-keys-into-electrum/

That's still a lot more steps than just upgrading your Bitcoin Core version! Anyway, it seems strange that I'm arguing about what your answer means. I clearly misinterpreted it; you didn't mean upgrading Bitcoin Core, but transitioning to software with a different model entirely.


text:
bitcoin.Psbt doesn't auto-display its method/properties in Visual Studio Code
When instantiating a new Psbt in my Visual Studio Code like below:
  const psbt = new bitcoin.Psbt()

The variable psbt doesn't auto display any of its methods/properties after I add the . right after it. Why is this?

Can you also include the line where you import/require bitcoinjs?

import * as bitcoin from "../../../../bitcoinjs-lib"
It's importing to the browser as I am using it in a React app

That's a strange way to be importing a library. Why don't you install it using a package manager (npm/yarn)? It comes with type definitions which you likely haven't included in your way of importing it.


text:
How do I get my bitcoin from exchange and put it on the bitcoin network (blockchain)? and how do i do something similar with ethereum?
Currently my bitcoin is store in Exchange. I wonder if I should simply generate bitcoin address and private key in BitAddress and send to this address and safely store the keys that was generated. But then how i could trade my bitcoin if they aren't on a Exchange?

Currently my bitcoin is store in Exchange.

Storing your coins on an exchange can be risky for a great number of reasons. There is a saying amongst bitcoiners: not your keys, not your coins.

I wonder if I should simply generate bitcoin address and private key in BitAddress and send to this address and safely store the keys that was generated.

It is generally a good idea to store your coins at an address that you alone control the keys for (your keys, your coins!). I wouldn't recommend using bitaddress though, or any other online wallet. This page is generally a good starting point for choosing a trustworthy wallet: https://bitcoin.org/en/choose-your-wallet

But then how i could trade my bitcoin if they aren't on a Exchange?

You send them back to the exchange, or even better, to a person that you are directly trading with. The wallet software you choose will have a 'send' page that you will enter the relevant info into, so that you can submit a transaction to the network. Once the transaction confirms (according to the exchange's policy), you should see your funds listed in your exchange account).


text:
What are the values used for candlesticks
This sounds like an easy question but I googled for hours and could not find any info on this.
What is the value used for the open of a candlestick ? Was that value a market sell or a market buy ?
Vice versa what value is used for the close ? Is it the last market sell or market buy ?
I have a data set with market orders and I am trying to create candlesticks out of that data.

I figured it out. It’s the first (open) or last (close) price traded, which can be buy or sell.


text:
Why doesn't Multisig provide better security for hot wallets?
I've recently read somewhere (can't remember the source) that multisig often doesn't provide more security in hot wallets, but increases the size and thus the fee.
I can't seem to comprehend how this can be valid (multisig not providing better security for hot wallets), what could be the reason behind this statement?

Multisig scriptpubkeys do increase the overall size of the transaction.  This is because when redeeming the output sent to the multisig script, a number (typically larger than one) of signatures have to be provided for validation in the redeeming transaction.
As for security in multisig, it depends on the setup of keys, and the scriptpubkey that ends up being executed.  For example, for a 2-of-2 multisig script (where two signers must cooperate), it might seem that this script is "more secure" against an attacker obtaining one of the keys, but if both keys are kept on the same device, then there is no security to be gained from a multisig.
On the other hand, if the script is a 1-of-2 multisig, then even if one of the keys is highly secured but the second is not, then the security in having a second signer (secured) is subverted.
Bitcoin's scriptpubkeys can be programmed to require not just multiple signers, but also conditions on when these multiple signers should participate or when they shouldn't.  We could set up a 2-of-3 (requires at least 2 of the 3 predetermined signers to participate) multisig scriptpubkey such that :

The first key is a "low" security key controlled by the user
The second key is a "moderate" security controlled by a 3rd party
The 3rd key is a "high" security key, known only to the user but is normally in cold storage and not used

In normal operation, the low security and medium security signers will cooperate to sign the user's transactions.  The user can rest easy knowing that even if their low security key is obtained by an attacker, the funds will remain safe.  The attacker will need to obtain the medium security key (the one that belongs to the 3rd party service) as well to actually move the funds.
If the service itself disappears, the user can still make use of their high security, cold storage key to complete the script with two signers, so they are never "locked out" of their funds.
There are even more ways to upgrade this setup, using ntimelocked transactions, or encoding a lock time in the script itself using op_csv or op_cltv.
I believe Greenaddress is using a setup very close to this.
So to answer your question, multisig is just a tool.  The security (or not) gained by using this tool depends on the way that it is used.

Using a hot wallet multisig can be more secure than a singlesig hot wallet, provided that you do it right. For example, you segregate the keys on separate devices which are kept in separate locations and you require multiple signatures for spending. Hot wallets are inherently less secure but a well-executed hot wallet multisig has benefits just as a well-executed cold storage multisig has benefits over a singlesig hardware setup.
Of course, most individuals looking into multisig are going to be interested in doing it with hardware devices because people typically upgrade their security by moving from an exchange to a hot wallet to a hardware wallet to a multisig setup. In a group setting, however, a company with numerous employees requiring a fairly large quorom for a spend may be interested in hot multisig because of the physical segregation involved in, for example, multiple company executives having keys on their respective cell phones or laptops. Each hot device is a risk but the risk that one attacker will compromise numerous hot devices is much lower.
With regards to the addition fees invovled in multisig, multisig transactions are more expensive because they require additional signatures, which increases the size of the transaction. Nodes have to store the transaction data and you have to pay more for more storage. You pay more fees for more real estate.


text:
Importing an arbitrarily created Master Private key to Bitcoin Core
I've created a Master Private key (xpriv) on an airgapped machine along with an Master Public key (xpub). Now I'm running Bitcoind on my Ubuntu server and I want to use my newly created keys on a new wallet rather than the one that Bitcoind created for me when I started running bitcoind.
Is this possible to do? If so what is the way to go?

It is currently not possible to import a master private key into Bitcoin Core.


text:
How can i accept Bitcoin donations or payments on my website?
I have seen all these other posts on how to do it, but they are all so complicated, what is the quickest, easiesy way to accept Bitcoin payments or donations on my website? Why is it all so difficult?

BitPay is an electronic payment processing system for the bitcoin currency. It enables online merchants to accept bitcoins, as a form of payment, just as they accept payments from Visa, Mastercard, or Paypal.
BitPay is available in every country, and you can set your prices in over 30 different currencies.
Merchants choosing to keep the bitcoins can be anywhere in the world. Merchants in some countries can choose to receive a direct deposit into their bank account.

Well - the easiest way would be to just put your wallet address up on your site so people could send you Bitcoin directly.  You could also use sites like Blockchain.info or follow this tutorial (http://bitcoinmoney.com/post/9678390130/wolfram-alpha-qr-code-generator) to create a QR code from your wallet address as well.
Alternatively, Coinbase (https://coinbase.com/merchants), BitPay (https://bitpay.com), and Mt. Gox (https://www.mtgox.com/merchant/checkout) all offer tools for merchants to offer Bitcoin payments.  Also - Shopify.com recently announced that they would allow merchants to collect payments via Bitcoin.


text:
Long term BTC investing
my question is, what is the safest way of buying and holding bitcoin for the long term?
And I mean 10-20 years, either a lump sum or through dollar cost averaging, is a paper wallet the answer? Or maybe a cold wallet? I am looking for something very safe that will likely still be around in 20 years time

Recommendations for how or where to buy Bitcoin are generally off-topic here, but long-term storage is a fair question.
First, understand what owning Bitcoin really boils down to: having knowledge of the private key that allows you to spend the Bitcoin stored at that key's address. You aren't storing the bitcoins themselves persay, you just need to store the private key (a 256 bit number).
These days, there is an industry standard that is known as 'hierarchical deterministic (HD) wallets' (BIP32) that allows more efficient wallet backups, and there is also a related standard (BIP39) that allows you to create a mnemonic seed phrase that works as a human-readable master backup of your wallet. So rather than storing a single private key, you can opt to store a seed phrase instead. Since it is a standard, most wallet software is compatible.
Whether you are storing a private key, or a seed phrase, it is probably a good idea to make multiple copies, in case something unexpected happens (fire, theft, etc). By storing them in geographically diverse locations, you can avoid having a single point of failure. The medium of storage can be important too: just writing it down on a piece of paper isn't as permanent as stamping it into a piece of titanium. How involved a solution you choose will depend on your personal situation. Generally, I would recommend a physical storage solution for the length of time you've mentioned (10-20 years), as a digital storage solution may experience data degradation within that time.
One issue with the paragraph above is that if you create multiple copies, and one of them is found, then whoever finds it could spend your coins. So (as Raghav mentioned) BIP38 is a standard that will allow you to encrypt the key with a passphrase (note: BIP38 is less commonly implemented than BIP32/39, but it is still available). Keep in mind that now you will need to store the encrypted private key, and also the decryption passphrase, so this adds additional consideration.
There is also the option of using a multisig address, which can only be spent from if m-of-n keys are used. So you could, for example, create 3 keys, but only require 2 of them in order to spend the funds. If you disperse the keys geographically and one of them is found, the finder will not be able to spend your coins (as they'll still need one more key). You can create all sorts of interesting custody setups using multisig addresses, and there are even Bitcoin storage services that offer solutions using such constructions.
It is up to you as an individual to decide which sort of construction you are comfortable with, there really isn't a 'one-size-fits-all' when it comes to long term storage.
So a related question is: what is the best way to generate a private key (and its related address)?
Generally, you will want to use a device that you are certain is clean (not infected with any sort malware). A 'cold wallet' just refers to a wallet whose private keys have never existed on an internet connected device, thus removing many attack vectors by which someone could steal your private key(s). For high-security storage, it is definitely recommended that you generate keys on a machine that does not connect to the internet. This could just be a special-purpose laptop, or a hardware wallet, etc. Again, there is no 'perfect solution', what you choose will depend on your situation.

Assuming you aren't too concerned about someone tracking the total amount of bitcoin you own, a paper wallet (potentially encrypted via BIP38) would be the safest bet. You only need to generate the key once and derived the address from it.
The key can then be stored somewhere very safe (there are a number of vault services, operated by banks and other companies), and simply keep sending Bitcoin to the previously derived address.
You can also look into constructs such as Hash Time Locked Contracts (HTLC) which would allow you to store the coins in an address that is unspendable until X time in the future - although this won't help much if someone is able to steal the key (they can just wait until X has passed and use the key after that), it will prevent people with temporary access (or even yourself in case of a panic sell) from moving the coins.


text:
How to fix corrupted blocks?
I am trying to copy blocks from Debian 10 “buster” virtual machine to external SSD which I will boot from on a Raspberry Pi.
rsync --archive --delete --human-readable --info=progress2 /home/bitcoin-admin/.bitcoin/ /mnt/usb/home/pi/.bitcoin
        135.53M   0%    9.10MB/s    0:00:14 (xfr#2, ir-chk=7777/8259)
rsync: read errors mapping "/home/bitcoin-admin/.bitcoin/blocks/blk00464.dat": Input/output error (5)

Does rsync error mean blk00464.dat is corrupt? If so, how can I recover?
bitcoind runs fine on virtual machine.
Thanks for helping out!

googled the rsync: read errors mapping, found this: https://bobcares.com/blog/rsync-input-output-error_5/
2. Insufficient privileges -> try sudo rsync

Thanks for helping out @Antoni. The error only occurred for certain blocks and I checked permissions… same for all blocks.

maybe some sectors on your drive are corrupt. does dd if=/home/bitcoin-admin/.bitcoin/blocks/blk00464.dat of=/dev/null bs=4K give any errors?


text:
Socialist fee schemes
If in low inflation future network assured contracts become common and in case they rose to a status of most important source of network computing power, wouldn't then make sense to soft fork increased fees for larger and older utxos, as this could be a sort of standardizing reward contribution?
In other words, will Bitcoin need to demand richest's contributions, or will be enough just to ask for them?
If you are answering "it will be enough just to ask for them", isn't that equivalent to say Bitcoin's survival depends crucially on "their enemies" (if there is such a thing) not becoming important participants (and we are not currently avoiding such thing, or are we), as those participants could be lazy about voluntarily paying high fees?

Bitcoin cannot depend on altruism to survive, its success is contingent on network incentives aligning with what is needed to keep the network operational. So I think it is not really worth considering that as an option. You could perhaps argue that NACs are incentive-driven, in that the user is incentivized to see the network that they store their value in maintain an acceptable level of security, but the prudent individual is going to find a financial instrument that gives them the best guarantees for the cheapest price. From my understanding of them, it isn't clear that depending on altruistic NAC payments constitutes a low-cost and incentive-aligned method of maintaining security.
I also doubt that any soft fork that enforces asymmetric fees based on UTXO age/value would ever be widely accepted/adopted (consider: soft fork adoption at least somewhat depends on an 'economic majority' adopting the change, so would you expect large holders to adopt a fee-policy that disproportionately affects them?).
Anyways, it isn't clear that there is a problem in the first place. The Bitcoin network is self-balancing, there is no 'minimum required hashpower' to keep it functioning. Less hashpower perhaps inspires less confidence in the network's security, and thus the network will be seen as less valuable, but it will continue to function nonetheless. Perhaps the chain tip will be less stable than it is now, but as long as the incentives continue to work, the user can have an increasing amount of confidence in the finality of a confirmed payment as each new block comes to pass.

I think I struggle to understand the 'economic majority' concept.

I think economic majority could (not writing they would) consent a soft fork harming them by fees if they perceive the fork balances well their fee rises and centralization prevention. But I may change my mind as side chains keep evolving.


text:
Does current Bitcoin break in 2038?
I've heard about year 2038 problem and I'm worried I've read about Bitcoin measuring time with 32 bits, why aren't developers worried about Y2038P only 15 years away?

Y2038P was about signed integers.
In Bitcoin, block time is an unsigned integer, such case doesn't correspond to a Y2038P, but a Y2107P.
Thus the numbers are loosely these:
2^32 / 60 / 60 / 24 / 365.25 ~= 136;
1970 + 136 = 2106
instead of these:
2^32 / 60 / 60 / 24 / 365.25 / 2 ~= 68;
1970 + 68 = 2038
Because we will be dead by 2106, it's not current developers task to worry about.


text:
Bitcoin Core: estimated time to synced, without GUI
I enjoy how the Qt program reports how much time remains to complete the chain synchronization, but I don't know how to get that without using the GUI.
Can you configure bitcoind to report that? Can you use bitcoin-cli to query that?


text:
P2SH-P2WSH-P2PKH and P2SH-P2WPKH
What are the advantages and disadvantages of using P2WSH-wrapped P2PKH instead of  P2WPKH?
What are the advantages and disadvantages of using P2SH-wrapped P2WSH-wrapped P2PKH instead of P2SH-wrapped P2WPKH?

I’m kinda curious actually, in what context would this question even come up?

@Murch here or here. :D

I would guess that Pieter meant that as an absurd example. No idea why anyone would actually do it.

I can’t think of any advantages for either of those constructions. As far as I can tell they simply use more weight, are more complicated, and highly fingerprintable because they would be extremely uncommon. I can’t think of any reason for anyone to do either, except “because they can”.


text:
Do we pay cheaper fees for less security in P2TR rather than P2PKH?
Answer quote:

P2TR now is a spiritual successor of P2PK: it locks funds directly to a key and only requires a signature to spend the funds.

If P2TR UTXOs are guarded by Schnorr signatures and P2PKH ones are guarded by ECDSA plus a later RIPEMD160 stage, my question is: do we pay cheaper fees for less security in P2TR rather than using P2PKH, even though using P2TR is obviously currently reasonable (specially for short lived UTXOs)?
... abstracting from the rest of advantages of taproot, like improved privacy for everyone...

Related: https://bitcoin.stackexchange.com/q/93047/5406, https://bitcoin.stackexchange.com/q/91049/5406

Does this answer your question? What are the potential attacks against ECDSA that would be possible if we used raw public keys as addresses?

thankyoubothverymurch

No, there isn't less (weaker) cryptographic security in P2TR- than P2PKH-type of UTXO (or locking script). As a matter of fact, there are improvements and (useless) complexity removed (to some extent). There is a lot of information about it in the Bitcoin Explained podcast (e.g. episode 2) by Sjors Provoost and Aaron van Wirdum.

care to link it please?

I believe Greg is referring to this: https://www.youtube.com/watch?v=G3tXgN7oxaY


text:
Why P2SH seems to be never smaller than 34 characters, unlike P2PKH?
Why base58 of P2SH invoice address seems to be never smaller than 34
characters; unlike base58 of P2PKH invoice address, in which 33 characters
is very common?
Bitcoin wiki tells (format and emphasis mine):

Some Bitcoin invoice addresses can be shorter than 34 characters (as few
as 26) and still be valid. A significant percentage of Bitcoin invoice
addresses are only 33 characters, and some invoices may be even shorter.
Technically, every Bitcoin invoice stands for a number. These shorter
invoices are valid simply because they stand for numbers that happen to
start with zeroes, and when the zeroes are omitted, the encoded invoice
address gets shorter.

But in base58 of P2PKH invoice address, length 33 is a lot more frequent
than in base58 of P2SH. Why does that happen?

Because Base58 initial 1s carry 8 bits of data, but P2SH addresses cannot be represented with a string with initial 1s so it starts with 3 which, like all other cases & characters, encodes 5.86 bits of data. Since the same number of digits encodes fewer bytes, more digits is needed for P2SH.
The P2PKH network byte is 0x00 and the rest is the hash and the checksum. If the hash also starts with 0 digits, P2PKH address will exploit initial 1's efficiency, while P2SH starts with 0x05 so following digits, even if 1's, are not initial 1's and they will not be subjected to the efficiency shortcut I described above.
Update:
The Base58Check algorithms is as below:
The serialized data is "network byte" + "20 byte hash" + "4 byte checksum"
The checksum doesn't change the address length at all. Network byte and the hash do.
The serialized data is encoded in the following way:
- Count initial 0x00s and discard them from the serialized data

For example for mainnet P2PKH addresses (these have network byte = 0x00) if the 20-byte hash starts with 0x00000a..., then there are 3 initial zeros. For other addresses, such as mainnet P2SH (network byte: 0x05), the hash doesn't need to be considered and the number of initial zeros is zero.
- Base-convert the rest

the standard mathematical operation which can be calculated by long-division. The naive method to calculate this is to represent the binary byte array as a BigNumber and to consider the sequence of remainders.

An octal digit corresponds to 3 binary digits because log_2 (8) = 3. Likewise, a Base58 digit corresponds to log_2 (58) = 5.86 binary digits (a little less than exactly 6 digits, for Base64). This is a result of base-conversion.
Nevertheless, if there are initial 0s, when we consume them, we're subtracting 8 bits from bytes-to-be-read-and-serialized instead of 5.86. This is a result of Satoshi's decision to allow shorter addresses at the cost of a higher variance of address lengths (25-34 characters)
The first byte is the network byte. When it's nonzero (for P2SH, it always is!) then there are no initial zeros and the result is 100% derived from base conversion without the initial-zeros shortcut. Just like a six-digit binary number always has 2 decimal digits, all P2SH mainnet addresses have 34 characters.
NOTE: 7-digit binary numbers can have 2 or 3 digits in decimal. Variability by one digit is also possible in address encoding depending on the network byte. This is not the case with mainnet P2SH, it always has 34 bytes. I know this, because both 5*256^24 and 6*256^24 - 1 in Base58 have 34 digits. And P2PKH varies by more than one digit because as Pieter Wuille commented, the serialized data of P2SH in binary has a fixed number of digits while that of P2PKH can have many initial zeros (and how those are consumed can be compared to omitting them).

In a way, it is no more surprising than the fact that a random number between 0 and 1 million may have 1 through 7 digits, but a random number between 2 and 3 million will always have 7.


text:
Why is my Bitcoin transaction not confirming today?
Please don't tell me that this also has something to do with this stupid Corona virus. First, it slashes the Bitcoin value in (less than) half. Then I can't order any groceries and have to sit here and starve. And then it somehow affects the Bitcoin network's ability to make transfers?
Hopefully, it has nothing to do with the Corona virus, but if not, how can it be that I still have "0 confirmations" and it says the dreaded words "memory pool" in my Bitcoin Core?
For the last "many months", every Bitcoin transaction has been very fast to confirm fully for me. Why is it suddenly acting up? Is everyone trading tons now even though the price is so low? Isn't it when it goes up that there's network congestion?

That. and the simple answer is there's lots of transactions at the moment for whatever reason.

The way the price gets low is by lots of people selling.  That takes just as much trading as getting it to go up.


text:
Is there any Cryto exchange that supports automatic sale when profit above X % and buy again when price drop to previous price and repeat this cycle?
I am new to bitcoins
I got a new idea in short selling bitcoins
That is , imagine the price of 1 BTC = $1000
I will buy 0.5 BTC for $500
Now I will wait till the price increased by 10% that is , $1100
Now my portfolio becomes $550
.....
Now I will sell the 0.5 BTC for $550 . I got 10 % , $50 profit
Now I will wait till the price again goes below 10% , that is $1000 .
Now I will buy when price again reached to $1000 for the $550 , that is for the total gain.
then the above cycle continues ...

Suppose if the buy price never reach, that is price starts to grow then I will buy for day's or week's low.. and continue the cycle
-
Is there any exchange that support this automatic job flow ?

I think it will be better to divide your deposit into two parts. Half in USD and another half in BTC. First bot tries to maximize your profit in USD. Second - in BTC. Any price moving makes you rich

Sorry . I can't understand since I am new . Please explain in detail


text:
Which is the best Bitcoin Vanity Address Generator?
Can someone please suggest a Bitcoin Vanity Address Generator which can generate at least six characters (ideally case sensitive). It would be even better if the generator could create seven or more characters. I don't mind paying a little but I would prefer the service to be free.
I am looking to create a Vanity Address like 1Bitcoin... but my system isn't powerful enough. I probably need one or more GPU cards.
There is a post on this topic from several years ago; I'd like something more contemporary if possible.
Thank you.

I had seen this site but the issue is that it is very outdated. For example, VanitySearch (https://github.com/JeanLucPons/VanitySearch) is probably the most advanced software but is barely mentioned.

the issue with it being outdated is part of the reason service/product reviews and recommendations are considered to be off topic here. If you know of more up-to-date resources, you should leave an answer on that older question. It is better to update the old question, than to make new questions that ask the same thing.


text:
Sending Bitcoin to a wallet but user has not received
Good Afternoon,
I sent bitcoins to a user's wallet 2 days ago. Below is the transaction id:
9031b7d71ac55d2982b4451d3a0ec9ec1f80575a07afb5fe0d1a29eed5aa7841
And the wallet address:
1DDfbQNfm7UGWM4jp4CxJF631axDCafSD4
However, I was told that the bitcoin had not showed up in his wallet although the transaction has been confirmed.
May I know what may be the issue?

At time of writing, that transaction has 287 confirmations. That means it has been definitely incontrovertably irrevocably received. There can be no doubt about this. For large amounts, 6 confirmations are regarded as conclusive, for small amounts many people accept 1 confirmation. 287 is far far far beyond doubt.
The blockchain is the only truth. All data about location of Bitcoin money is in the blockchain and nowhere else†.
There is no moment in time when Bitcoin is in transit, it is always either considered by any node in the Bitcoin network to be in your wallet or in the recipient's wallet and nowhere else.
The recipient has received the money. If they say they have not, either ...

you sent the money to the wrong address, or
their wallet is not telling them the truth
(perhaps it isn't synchronised with the blockchain) or
they are mistaken or
they are lying to you.

† Use of Lightning network and other off-chain systems should almost certainly not be regarded as actual Bitcoin movements until recorded on the blockchain.


text:
Is the first input in a transaction always the sender's?
I'm trying to figure out what the input address is from a transaction with multiple inputs. Can it safely be said that the first input in the inputs of the transaction is the sender's?

It would help if you clarify what you intend to use the sender's address for.

Can it safely be said that the first input in the inputs of the transaction is the sender's?

No, no such ordering exists.
Transactions consume UTXOs as inputs, and create new UTXOs as outputs. A transaction can have multiple inputs from one person, or inputs from multiple people. In some cases, more than one person can own an input. So there isn't really any useful way to point to a particular input in a random transaction, and say "this is from the sender".
In cases where there are two or more inputs, there is also the potential that the transaction is a 'payjoin' style transaction, which is specifically built to break common heuristics that attempt to determine UTXO ownership/transaction participation.
More generally, it is prudent to craft transactions in ways which do not surrender information needlessly, so that you can maintain privacy while still engaging with the Bitcoin network.

No, that would not necessarily be true.

If multiple users have created the transaction in collaboration (e.g. during a coinjoin, a payjoin, or other type of multiparty transaction), the address that received the first input could be owned by another party than the one paying you or could have shared ownership by more than one party.

If the sender used a custodial service to initiate the transaction, the address may not be associated with the sender at all. Many custodial services use so-called "omnibus wallets" where all funds are co-mingled, and addresses only link to specific users for deposits, not for withdrawals.

So, while often transactions are created by a single entity that owns all addresses the inputs were received to, this is not always the case, and even when it is, the initiator of the transaction and credited party for the address may be two different users. The notion of a "from address" in Bitcoin is dangerously misleading, you should rather think of addresses as "invoice identifiers": not to be reused, especially not, if you don't know what metadata may be associated with the original invoice.
You didn't specify why you were looking for a "sender address". Should you intend to return funds, please ask the sender for a destination address, otherwise the funds may be lost to your intended recipient.


text:
How to identify the sender from crypto payments
I want my users to deposit crypto into the website for credits, but the biggest issue is getting the input address (the user's address). How can I identify the sender from the transaction (since there can be multiple inputs) as well as the amount they sent (since there can be multiple outputs)?
A lot of services offer payment forwarding but they all seem the same but have different fees, some requiring a subscription of over 80$ a month (cryptoapis, blockcypher) or some having service fees (apirone, bitapis, etc). However they all seem to be the same so I don't understand the price differences, in fact some of them are downright identical (cryptoapis & blockcypher). How would I make my own, and would it be worth it for a start up?

Give each user a different deposit address?

As RedGrittyBrick suggested in a comment: Give each user a different deposit address.
Think of your process as the users purchasing credits in exchange for a Bitcoin payment. You respond to each purchase request with an offer. The offer includes an invoice address. Each new offer should have a new address, so you can identify which user took what offer. Since the address is unique, you'll know which user to credit how much when you receive the corresponding payment to an address.


text:
Clarifying descendants/ancestors in error cases for too-long-mempool-chain
In practice I've seen two instances of the too-long-mempool-chain error when trying to send a transaction:
When there are too many unconfirmed transactions chained together:
"too many descendants for tx <txid> [limit: 25]"

When the chain of unconfirmed transactions is too big in size:
"exceeds descendant size limit for tx <txid> [limit: 101000]"

In the code I also see two more error cases that look similar, but I can't grasp what the difference is in these:
"exceeds ancestor size limit [limit: %u]"

and
"too many unconfirmed ancestors [limit: %u]"

The names "ancestor" and "descendant" seem backwards given that we use the reverse terminology in something like "child pays for parent". Am I thinking about this correctly? Also, when would the latter 2 error messages get triggered?

The ancestors of a mempool transaction T are unconfirmed transactions that this transaction T depends on in order to be included in the block chain (i.e. that are referenced by its inputs).
The descendants of a mempool transaction T are (necessarily unconfirmed) transactions that depend on this transaction T in order to be included in the block chain (i.e. that spend one or more of its outputs).
In both cases there can be multiple "generations" of descendants/ancestors (e.g. descendants of descendants):
         Tb
        /
Ta  ---
        \        Td
          Tc ---/
                 \--- Te
                  \___ Tf

(Here, Ta and Tc are ancestors of Te but Tb and Tf are not ancestors of Te. Td is a descendant of Tc but Tb is not.)
As you may picture from the above outstanding piece of art, their management can quickly start to be tedious hence resource intensive.
This resource usage (mostly RAM for storage and CPU to update them) impacts every single node not running with -blocksonly on the network, it is thus a DOS vector that must be limited. But how?
I can point you to the bitcoin-core dev wiki which reports the word of Suhas Daftuar -one of the main architects of the system that is currently in place- regarding the trade-offs of different approaches to usage limitation, but as a TL;DR:
The mempool needs to be in phase with miner incentives (don't drop the highest-paying transactions), while limiting its footprint on network nodes. Therefore, two limits are in place for the two "views" relative to a transaction:

The size limit, accounted for in virtual bytes, of both its descendants and ancestors.
The count limit, accounted for in number of transactions, of both its descendants and ancestors.

Thanks for your explanation and nice image. I understand now. One thing to note that I was originally confused about... when I would attempt to broadcast a transaction (txidA) that had 24 unconfirmed ancestors, I would get the error "too many descendants for tx  [limit: 25]". This confused me, but now I realize it's saying that the oldest ancestor of my new transaction () would now have too many descendants if I added my new transaction . Its also true that txidA would have too many ancestors, but the code just happens to trigger first when checking txidB.

I love the graphic! You could get even more use out of the graphic by adding an example, e.g. "Ta and Tc are ancestors of Te, but Tb and Tf are not ancestors of Te".

+1 to murch's suggestion.
If i understand correctly:

Ta has 0 ancestors, and has descendants Tb, Tc, Td, Te, and Tf ................

The only ancestor for Tc is Ta, and Tc has descendants Td, Te, and Tf ..............

The ancestors for Te are Tc and Ta and has Te no descendants ................
sound right?

Oops, overlooked it. Will address soon :)

@ deezy this is right. I added @Murch's suggestion to comment the graphic.

@deezy would you mind marking this answer as accepted if it answered your question?


text:
Is receiving address description public domain?
Exploring Electrum and see that I can add a description when generating a receiving address.
The description cannot be edited later... would you happen to know why? And is that description public domain?

Could you clarify what you mean with "is … public domain"? Nobody can see the user data of your local Electrum instance. Do you mean whether it gets shared with the receiver when you share the payment request?

I don't know why the description cannot be edited, that sounds like an implementation quirk. You could try looking at the Electrum documentation or inquiring on the Electrum GitHub project, if nobody else here can tell you.
The address description is your reference to identify what invoice the address belongs to. Some wallets include the description when sharing the address as QR-codes, or even have separate fields for your reference and a message to the sender. Generally, wallet addresses are neither registered nor gossiped on the Bitcoin network, they are just transferred out of band from receivers to senders when the receivers indicate how they'd like to get paid.

Thanks for helping out... I did submit an issue on GitHub a while back, but still don't understand the privacy implications of using the description field.  Perhaps you can shed light on this?

[Bitcoin Electrum](https://bitcoinelectrum.com/how-to-use-the-electrum-receive-tab/ states that "the Description is not shared with anyone and is only for your reference". However, screenshots in the Electrum Docs show what appears to be the description in the request to be shown to the sender. — It is my impression that Electrum includes the Description in Payment Requests when presented to the sender. Unfortunately, I have no personal experience using Electrum.


text:
How to confirm integrity of Electrum wallet created using BIP39 mnemonic?
Given paper backup of 24-word BIP39 mnemonic and passphrase, how can one confirm integrity of Electrum wallet given "Wallet" / "Seed" is greyed out?

I logged in as a different user on the same pc and recovered a wallet using the seed.  The seed generates the private key, and, so far as I can tell, is the same private key.  I haven't confirmed that the private key is the same, but that would be the point of the seed.


text:
What are the privacy implications of using Electrum public nodes?
My (perhaps naive) understanding is that Electrum sends first n addresses to a single randomly-chosen public server to check balances.
If all addresses have balances, Electrum then sends next n addresses (and so forth).
Are all above requests sent to same single randomly-chosen public server?
If so, this means server can infer that all addresses are owned by same wallet.

From docs:

One of the servers, arbitrarily, is selected as the “main” server.
The client subscribes to its own addresses (nit: sha256 hashes of scriptPubKeys) so that it would be notified of new transactions touching them. It also synchronizes the existing history of its addresses. This means the client sacrifices some privacy to the server, as the server can now reasonably guess that all these addresses belong to the same entity.


text:
Does my node rebroadcast its mempool transactions on startup?
Say my node has transactions in its mempool and then gets shut down and restarted.

Does it save the mempool to disk and reload this mempool when it starts back up, or does its mempool get lost on shutdown?

If the mempool gets saved and loaded on restart, does my node rebroadcast these transactions out to the network once it starts back up?

When a node shuts down cleanly, it does flush the mempool to disk and reloads it upon startup. It will not rebroadcast the transactions.
A node will only relay transactions once, when it first learns about them. Your wallet will cause its own transactions to be rebroadcast. There is currently no mempool-based mechanism that rebroadcasts any foreign transactions after the initial relay.
Especially due to the privacy implications of this behavior (which makes rebroadcasts an obvious tell that the source is the sender), there is on-going work to change node behavior such that it will generally rebroadcast all transactions that should have been included in the previous block: [p2p] Introduce node rebroadcast module #21061


text:
Is there a flag to allow creating a transaction with multiple outputs to the same address?
Does bitcoin core have a flag to allow creating a transaction with multiple outputs to the same address?

There’s literally no reason to ever do that.

Could you provide a scenario why you would want to do that? You could of course just send to multiple addresses of the same wallet instead.

the raw transaction RPC commands will probably allow you to do this

the reason for doing it is that we run a large retail exchange, and batch tens/hundreds of withdrawals at once. if a some of our customers decide to send to the same address at the same time, we want to have the outputs separate because otherwise the internal tracking would be a lot more complicated

No, and it is unlikely one will ever be added. There is no reason to make multiple outputs to the same address as it is inefficient and wastes money.


text:
Can inputs to a transaction have different values for sequence?
I noticed that the sequence field is used to signal opt-in RBF. I would think that signaling RBF applies to the full transaction rather than particular inputs.
If my transaction has two inputs, and I signal opt-in RBF on one of these inputs, am I still signaling that my transaction might be replaced? Or do I need to signal it for both inputs? Is it valid to signal RBF on one input but not another? Does the sequence field need to match for all inputs in the transaction?

According to BIP 125:

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


text:
Handling "dead" (double-spent) transactions in my mempool
Say I receive transaction A and it is in my node's mempool and unconfirmed.
Then a block gets mined directly, which spends one of transaction A's inputs, rendering transaction A invalid.
What can I expect my node to respond with, when I ask: getrawtransaction <transaction A's txid>?

A will be kicked out of the mempool when that block is received, and getrawtransaction will subsequently fail for it.

Is there a good way to differentiate between getting kicked due to a double spend, vs getting kicked from the mempool due to a low fee for too long in a high volume environment?
I know we could keep track of the transaction's inputs, and check if any of these inputs have been spent, but wondering if there's an easier way that doesn't require keeping track of inputs.


text:
block.io alternative?
Hi is there a alternative service to block.io Unfortunately they are not allowing mainet wallet on developer api and their monthly cost is too high. So looking for an alternative?
I want to use online service to have wallets online, that can send payments using api

You might want to take a look at Blockchain.com api, they are free and fairly good to start sending Cryptos and creating wallets.
But if your business grows you will need either create your own blockchain provider alongside with your own full node or pay for a service like block.io

I believe Coinbase provides all of the functionality you mentioned as far as online wallets with developer APIs. Their documentation can be found here: https://developers.coinbase.com/


text:
Transaction not complete for two days now
I sent bitcoins to a wallet using the QR code in order to be very sure of the address. It shows in my wallet that it has been sent. But the receiver haven't seen it in his wallet. I checked it online and it shows that the money is in the address.  How can i do for him to see his coins or if not get?
I sent it to this address.
Note: the transaction shows confirmed
1N9V3yNuBEbgS3g87qibrnTGARj9SrKFst

Does this answer your question? Why is my transaction not getting confirmed and what can I do about it?

1N9V3yNuBEbgS3g87qibrnTGARj9SrKFst did receive bitcoins. If they ask you to send again, don't, it might be a scam.
You can give them the transaction ids:
170e84bcc871f4cca8d352035c4bbe9e1a44bf2f66c8e9e4ff69547ea1256639
d1b5b5fddfde0aa492f8ef8a58f6740222ceed42d2ee369082ea4e95f7233415

even though they don't need them. You can just tell them "on block explorers it the transactions are shown as confirmed." with a kind "Can you confirm that the output address 1N9V3yNuBEbgS3g87qibrnTGARj9SrKFst shown on the block explorer was the one you had given to me?"


text:
Getting mass addresses current balance
How can i get the current balance of massive addresses?
I'm getting address balances now on blockchain.info but I need to check about 1000 of addresses in one minute.
The issue is that they blocking my requests every once in a while.
I do tried to look for open XML RPC API but I didn't find one.
How can i make this happen and check many addresses as possible?
P.S
I know that I can have my node but for only checking addresses its seems to me way to overkill + holding 200gb server only for node will costs.
thanks.


text:
Is there such thing as paying a "tax" or "task" on non-spendable bitcoin in a blockchain wallet in order to get the private key?
I had bitcoin placed into my account and now am being told it is non spendable and in order to get the private key and make it spendable, we have to pay a fee.

This is a common scam.
If you don't have the private key to begin with, you have no bitcoin whatsoever, and never had any.
Stop talking to whomever is claiming this, and accept your loss.


text:
Bitcoin-QT client shows coins, but cannot find wallet.dat
It's been a couple years, and I opened my bitcoin-qt client.  It says I have coins, but is taking days to "sync with network".
Further, I cannot find a wallet.dat file anywhere on my system.
How can it know I have coins without a wallet?
I'm on the same computer I had two years ago, and didn't delete any files from my ~library/application support/bitcoin or any other bitcoin related files... sooo... befuddled.
Any insights, anyone?

I guess you already looked there, but when I open a terminal and enter
ls -la ~/Library/Application\ Support/Bitcoin/
I see all the files there, including wallet.dat. Please note the backslash before the folder name space.

You can also search using find on the entire hard disk.


text:
How do big sites/markets handle the intrinsic "transaction fees"?
For example, on the late SilkRoad market, or in bitcoin mixing services.
They supposedly have a "pool" account (or escrow acct, etc) where all the coins go in to, and from which withdrawals are made.
Wouldn't such a setup be a nightmare regarding how large the transaction fees would be during a withdrawal, due to the large amount of input addresses? At least, from what I understand from fee calculation (honestly, a lot of bitcoin concepts go over my head, no matter how much I reread related articles).

If I understood the question correctly: a mixer service or any shared web wallet can bundle several outgoing bitcion transfers to one single transaction with a single transaction fee payment. This is because bitcoin transactions do not need to be 1 input address -> 1 output address, but they can combine any number of inputs and outputs.

Although theoretically the more they stuff into a transaction, the larger it gets in bytes and therefore the fee increases.

@mikko why not make that an answer?

My bitcoin-fu is still weak, but let's try and let others fix it if I am wrong.

Take a look at the Bitcoin wiki page on Transaction Fees.
First of all, a transaction fee is not always required. Miners decide whether to accept transactions without a fee and most miners follow the same decision protocol for that.

A transaction may be safely sent without fees if these conditions are met:

It is smaller than 10,000 bytes.
All outputs are 0.01 BTC or larger.
Its priority is large enough (see the Technical Info section below)

The priority basically adds the notion of age. Outputs that are created some time ago can mostly be sent for free. Very young outputs cannot be spent free. This is to prevent someone from spamming the blockchain with consecutive transactions.

Otherwise, the reference implementation will round up the transaction size to the next thousand bytes and add a fee of 0.1 mBTC (0.0001 BTC) per thousand bytes. As an example, a fee of 0.1 mBTC (0.0001 BTC) would be added to a 746 byte transaction, and a fee of 0.2 mBTC (0.0002 BTC) would be added to a 1001 byte transaction. Users may increase the default 0.0001 BTC/kB fee setting, but cannot control transaction fees for each transaction. Bitcoin-Qt does prompt the user to accept the fee before the transaction is sent (they may cancel the transaction if they are not willing to pay the fee).

So this basically means that the fee increases as the transaction size increases. Considering this, it is not a good solution to add thousands of inputs and outputs to a transaction.
I believe the best solution for a service like a market is to try to make as much as possible free transactions. A typical single-input-single-output transaction is 500 bytes. When you always use the oldest outputs available in your hot wallet pool, you can try to always create 10KB transactions that are free.


text:
Where is the safest place to trade? Open account? Wallet?
I know nothing of bitcoin and would really appreciate any help and suggestions.

Please ask one specific question per post and do prior research. Your question is too broad and unclear. Please refer to [ask].

Depending on the country you are in there are various ways to buy bitcoin. My default recommendation for US buyers is to use Coinbase.com or check out localbitcoins.com for a face to face trade.

and how do i get a wallet?

Depends what you want in a wallet, you can use the one built into an exchange or service like coinbase, open a web wallet on a service like blockchain.info, or install some software like multi-bit, electrum, or mycelium (android)
Check out this link for more info on wallets: http://bitcoin.org/en/choose-your-wallet

One last question, I hear often that someone hacked, stole, crushed, or disappeared with certain exchanges etc. Which websites/resources are the ones I can count on for 100% reliable information?


text:
Sent bitcoin but was never recevied
After withdrawing bitcoin from a site I use I sent it straight to another site with a generated address, on my site it said it was completed but was never received on the other site. The three addresses are
1BVLvno6UX8Rn3KtAQgJcpcZca58bcjVc6
8uskrzBQKwbhWHL7LYFMAD5yCNH6vTLnj
37eHZRcG9G3q3ZE7a3x5qYmWnhFeiThnKR

I sent it straight to another site

Evidence suggests not.

At the time of writing, none of those addresses has any history of transactions in the public blockchain for Bitcoin (BTC). The second address 8usk...TLnj does not appear to be a valid Bitcoin P2PKH, P2SH or Bech32 address
Therefore the "site" you "withdrew" Bitcoin from, or your subsequent "sent it" (if a separate transaction), did not actually create a transaction (or at least, not a transaction that was both valid and had a sufficient transaction fee).
Consequently the money is still in its original location.
You can check addresses and transaction-IDs at any public "blockchain explorer". I suggest trying several to be more confident of the information returned.

If I add a 3 to the start of your second address 8uskrzBQKwbhWHL7LYFMAD5yCNH6vTLnj this makes a valid Bitcoin P2SH address which currently has been used in six transactions in recent days. None of those transactions involve the other addresses in your question.

I think your transaction is stuck in between. If this is the case you may use bitcoin transaction accelerators.
here is detailed article on it: https://coinfunda.com/bitcoin-transaction-accelerator-speedup-stuck-tx/