text:
Fee selection for transaction
I have an application where I pay users in bitcoins (microtransactions). I am also starting to use Bitcoin core.
What I want:
Pay the minimum possible as fee of a custom transaction (1 input and x outputs). I need to pay the minimum because this difference is very important to make my app viable.
I saw that here are different costs/byte. And I see that 0 fee transactions can take forever. But my doubt is that if I pay a minimum of 1 to 10 Satoshis/byte, could the transaction be stucked for ever? or it will spent as maximum 240 min (as the page shows right now I know it can vary).
I also "don't care" about the transaction time spends to reach its destination (to be confirmed) as much I would like 5 days more or less to confirm.
Questions:

Can it take forever if I pay the minimum or it will also be but in some days.
What minimum of fee / byte do you recommend me?

Thank you for reading!
If you don't understand something, please make me know and I'll try to explain better.

10 satoshis/byte would have gotten you a confirmation in five days for big parts of the past three months:
 [via https://core.jochen-hoenicke.de/queue/#3m, filter by 10-20 sats/byte]
Yet, I'm afraid that you cannot rely on getting a confirmation within five days at 10 satoshis/byte.
In the past three months, there were e.g. two weeks in August, where only a few blocks had transactions with <10 sats/byte. It's very likely that you would have gone without confirmations for sixteen days. Earlier this year from early May to mid of June, you would not have gotten any confirmation at all for six weeks.
Also, please think about your users' experience. When they end up with a large number of very small unspents, it will be uneconomic for them to spend them: a big portion would get eaten up by fees, at higher fees they would be unable to make any payments at all.
Unfortunately, since the cost of transactions is in relation to the blockchain space transactions require to get confirmed, the relative cost is significantly higher for micropayments than for larger sums. I would highly recommend looking either at off-chain solutions or other blockchains.

Hello, thank you for your answer. So I can pay more proportion for the transaction, what would you recommend (sat/byte) to place? Extra info: the transaction will be bulk transactions with 1 input and 5 (for now, will be bigger with the time) outputs, and each output of a minimum of 30000 Satoshis. in*180 + out*34 + 10 plus or minus 'in' so that will be a 360+-1 bytes. I could pay more if needed but what I really want is to secure that transactions doesn't get stuck. Thank you again!

You definitely shouldn't go below 30,000 satoshis. If a user wants to spend from that, it's 148 for the input alone, which even at 1 sat/byte is already 5% of the value. At 10 sat/byte they pay almost 50% for the input alone.

Oops, sorry, my comment about 30,000 satoshis didn't make a lot of sense, because I was off by a factor of ten. I now had my first cup of coffee, and what I said would be true at 3,000 satoshis. 30,000 seems reasonable to me at current fee rates. I think you might want to go with 1-10 satoshis/Byte but then also use replace by fee to bump the fees if transactions don't confirm within a few days. If fees go back up to the 100+ sat/B range, these inputs will become pretty costly to spend though.

Okay! I think that I'll try with 10 sat/byte. Could you help me to learn what I need to know how exactly works bitcoin core? (Create wallet and make a 1 to much transaction) I think that I know more or less how it works but if you help me by sharing any helpful link I would appreciate it very much :)

Hey, I think that this might help you: https://bitcoin.org/en/developer-documentation, else you might want to just ask another question. :)

Thank you Murch, I'll check your link and if I had another question I'll just make another question :) Have a good day!


text:
I have some amount of bitcoin, how can i convert them to cash?
I also want to know how one can know his bitcoin wallet, i only see the bitcoin slip

You can sell them on Localbitcoins , the idea is to find a local buyer and meet him face-to-face.

source: Stack Exchange

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

sort: votes


text:
Signature verification in python
When trying to implement OP_CHECKSIG, I am unable to figure out how to do the actual signature verification in python (python3)
I obtained the signature, public key, and hashed message digest of a transaction, and now I want to verify the signature.
message = '692678553d1b85ccf87d4d4443095f276cdf600f2bb7dd44f6effbd7458fd4c2'
pubkey = '042e930f39ba62c6534ee98ed20ca98959d34aa9e057cda01cfd422c6bab3667b76426529382c23f42b9b08d7832d4fee1d6b437a8526e59667ce9c4e9dcebcabb'
signature = '30450221009908144ca6539e09512b9295c8a27050d478fbb96f8addbc3d075544dc41328702201aa528be2b907d316d2da068dd9eb1e23243d97e444d59290d2fddf25269ee0e'

Since python-ecdsa requires 64 byte input for creating the verifying key, I removed the first byte myself.
pubkey = pubkey[2:]

I also extracted r and s from the DER encoded signature, and concatenated these to create a 64 byte signature as python-ecdsa requires.
r = '9908144ca6539e09512b9295c8a27050d478fbb96f8addbc3d075544dc413287'
s = '1aa528be2b907d316d2da068dd9eb1e23243d97e444d59290d2fddf25269ee0e'
sig = r + s

However when I try to verify the message, I get a BadSignatureError signifying that the verification failed.
from ecdsa import VerifyingKey, SECP256k1
vk = VerifyingKey.from_string(bytes.fromhex(pubkey), curve=SECP256k1)
vk.verify(bytes.fromhex(sig), bytes.fromhex(message))

I am looking for a way to verify signatures that I have extracted from bitcoin transactions.
Thank you.

The way that VerifyingKey works is that it will actually hash the message before it verifies. The default hashing algorithm is sha1, so you will need to specify it to be sha256 as that is what Bitcoin uses. Furthermore, you are passing it the fully hashed message. What you need to do is pass it the step before hashing the message. Since Bitcoin uses SHA256 double, you need to give it the result of the first SHA256 hash and let it generate the second SHA256 hash by itself.
So your message should actually be
083867478cb0d1d8bb864175bbc49728cffcc114bc2e762c6df64f2c965a9a66

and your verify call should look like
vk.verify(bytes.fromhex(sig), bytes.fromhex(message), hashlib.sha256)

This worked. I always thought my error lay somewhere in the bitcoin part, but turns out it was in the ecdsa part. Thank you.

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


text:
Private Keys in my Bitcoin Wallet?
What are 'Private Keys'? and where do i find them in my wallet? How do I know it is a private key?

Depends on your wallet.
A Bitcoin private key is a 256bit (32bytes) random number (there is a max limit, but lets don't go into the details).
Often, wallets export them as a WIF encoded base58check string which looks like L1esWYsDL8nBeTRmGjUiDru54nXS4wF811n3e7mbvoSjM2zZWJ6w.
Sometimes, wallet use HD (look up BIP32 if you are interested).
Then the root private key starts with "xprv" and look like xprv9s21ZrQH143K4bhMhuUKZnW9DW5Dx9mwGQseMNdoECsaCGdhL9N8jR6KG5c3UTYrKPTkRNEBfeX7LjE2VjScyLZYA3XqRpyYbhnZHnsUepS
Search after "export private key" or "dump wallet", etc.

This is useful. Thank you! How does Bitcoin private key differ from Ethereum?  How do I save a private key to  USB? How do I know the difference between a private key and public key?

Bitcoin and Ethereum private keys are the same (Ethereum uses the same libsecp256k1 curve).

Save a private key to USB? You mean hardwarewallet? The whole idea of a hardware wallet is that you create the key on the device and the key will never leave the device.


text:
How to install minergate-cli in centos 6.6

How to install minergate-cli in centos 6.6.

To solve this, it is necessary install the missing dependencies, in my case I have installed the epel repository too:
~$ sudo yum install -y libXrender mtdev libproxy xcb-util-wm xcb-util-image xcb-util-keysyms mesa-libEGL mesa-libGL compat-libxcb

or
~# yum install -y libXrender mtdev libproxy xcb-util-wm xcb-util-image xcb-util-keysyms mesa-libEGL mesa-libGL compat-libxcb


text:
Blockchain.info wallet terms
Is the wallet ID you use in your blockchain.info wallet the same as your public address where others can send bitcoins?
And the 'Backup Phrase' is the same as your private key?
Maybe if someone could explain all the levels of authentication in the Blockchain.info wallet?

No, your wallet ID is only used for logging in, keep it to yourself. Your backup phrase is used to generate your private keys, but it is not the private key itself. It uses the phrase as a seed to generating a Heirarchical Deterministic wallet as per BIP 32, 39 and 44. So backing it up is equivalent to backing up all private keys in your wallet.
People send BTC to a bitcoin address, which you can generate when you log in.


text:
Is creating a long password for my coinbase account enough to keep my bitcoins secure?
I've made an account with coinbase and purchased some bitcoin. Only after to start reading people talk about getting hacked and how bitcoins are not secure unless you put them in a "wallet".To be frank this wallet stuff confuses me a bit, I rather just keep it simple and keep the coins directly in the place they go when I buy them, which I guess would be on the "exchange"? So I'm wondering If I create an incredibly long password for my coinbase account, Is this enough security to protect my bitcoins? Just "walletless" and in the hands of coinbase.  I realize if coinbase was hacked as a whole , there would be issues since they act as the bank basically. but aside from that is there really any risk leaving my bitcoin on their if I have like lets say a 45 character long password?

The long password will not help that much and is also likely difficult to enter. Much better enable 2 Factor Authentication with Coinbase (https://support.coinbase.com/customer/en/portal/articles/1658338-how-do-i-set-up-2-factor-authentication-) which gives you a second level of control.
If you have the wallet e.g. on the phone you have much more control on your funds and do not depend on the security implementations of Coinbase. Also does Coinbase have limits when moving funds which does not apply to your funds in your local wallet.
Often splitting funds in local and online wallets gives most flexibility and security so your eggs are not all in one basket.

Well the best options are:

Use a password with mixed characters (numbers, letters, uppercase, lowercase, etc)
Do not use the same password anywhere else
Activate 2FA (If you don't have a smartphone, there is a chrome app which facilitates 2FA)
Save the 2FA seed to somewhere safe
Don't share the password with anyone
Lock your phone or use an app which locks the Authenticator app before you give your mobile to anyone else.
Do not click or open links shared by unknown people
Always check the address bar when you are logging in to coinbase (make sure the address is right)

I can understand if using a wallet nowadays is difficult, but I am optimistic that in a few years, we will have great GUI wallets which will allow even a kid to be able to use it.
Follow the above steps and you will be good to go. Unless ofcourse coinbase gets hacked :D

Questions like "is this secure" don't have simple answers.  You can't really ever guarantee security, only reduce risks, and any given security technique usually addresses some risks but not others.
Using a very long and strong password will make it difficult for anyone to guess your password by trying a large number of passwords.  However, this is probably already fairly difficult, because most websites will lock your account after a relatively small number of failed guesses, or at least slow the attacker's ability to keep guessing.  (Note the phrase "strong": a password consisting of the letter a 45 times is long but still not much good.)
It will not help defend against:

Malicious software on your computer that steals your password as you type it
People who know you well enough to guess what password you would choose (a randomly generated password avoids this)
Someone finding where you wrote down or stored your password (which you are more likely to need to do if it is random)
Rogue employees at Coinbase with administrator access who could steal your password, or steal your coins directly
Coinbase itself deciding to steal your coins, or being hacked (as you mention), or going bankrupt due to mismanagement or malfeasance
Phishing attacks that trick you into giving your password to an attacker, thinking they are really Coinbase
Other people tricking you into giving your coins to them

All of these are realistic threats.

authors: Станислав Мордовцев


text:
Blockchain API Bitcoin transaction list to a wallet
I wanted to write a small script to parse all incoming transactions to a wallet. The wallet I'm looking at is from an OpenSource project I'm working for, to get an overview of the amounts given to the project in a certain time-range. I use the Blockchain Data API and try to parse the information from this call (includes the wallet-adress). But I can't seem to get the amount of Bitcoins that were transferred to the wallet. Sometimes there are amounts as big as 266 BTC listed, even though the real transaction was just a couple of Satoshis.
So, the question is: When I have a JSON Transaction Block like this:
   "ver":1,
   "inputs":[
      {
         "sequence":4294967295,
         "prev_out":{
            "spent":true,
            "tx_index":273950706,
            "type":0,
            "addr":"12tPhkHLjmkDfqTfvbagbnkYDU5UTu2pMp",
            "value":461323,
            "n":1,
            "script":"76a91414b04a7b66d06dd399bdb689df209ed688e9bcaa88ac"
         },
         "script":"483045022100f38ffd67d53b4c5a6f6a2543ca6217863be5b4f3a43e885a2520dbb768ba5df702203d9782af024ee9e213fb59cee1c788c70e66d66addb553b74610a1fed3df10390121026b138ff61ffeaf459c4916889d2c53894fc029c9729886714fe23ebd8a15bb32"
      }
   ],
   "block_height":480392,
   "relayed_by":"52.59.6.61",
   "out":[
      {
         "spent":false,
         "tx_index":274914673,
         "type":0,
         "addr":"1M3GipkG2YyHPDMPewqTpup83jitXvBg9N",
         "value":295902,
         "n":0,
         "script":"76a914dbd0788d294dd15704d232053790c555d1cb337888ac"
      },
      {
         "spent":false,
         "tx_index":274914673,
         "type":0,
         "addr":"18h2yt8cJSYwGSWV5nUodTgPZj9Vi5aCJS",
         "value":124987,
         "n":1,
         "script":"76a914545b2c20e7d8ded3853a2336ebedf7752cf823dd88ac"
      }
   ],
   "lock_time":0,
   "result":0,
   "size":226,
   "time":1502650024,
   "tx_index":274914673,
   "vin_sz":1,
   "hash":"02a7bf19417db6d975d48e27199cd65dcc415c5bf81ed447f945b2a4f3dc1d24",
   "vout_sz":2
},

What is the amount of Satoshis that have been added (or redeemed) from that wallet? How should I interpret the values in the json?

https://bitcoin.stackexchange.com/questions/58060/answer/submit

@ZakriaKhan You only posted a link to this thread

Transaction has inputs and outputs. "value" is Satoshi count:
  "inputs":[
  {
...
         "prev_out":{
...
            "value":461323,
...
         },
...
      }
   ],
...
   "out":[
      {
...
         "value":295902,
...
      },
      {
...
         "value":124987,
...
      }
   ],
...

To calculate fee you should calculate the difference between all inputs and outputs.

Unfortunately, this doenst work out.

Take this transaction as an example (here the JSON) . Difference between in and out is 27760 Satoshi. But the real value was 2270804 Satoshi.

To count how many Bitcoins have been gone into your wallet. You have to look at the out Objects only and especially only at those, that have your wallet-hash as adress. Those are the recieved Bitcoins.
Now I just have to figure out how to count what has left the wallet.

Now I don't understand what you want. Difference between in and out is fee. I noticed this. Your number is: inputs minus fee. What does this mean? Why this is real value? I have no idea. You noticed about "your wallet-hash". I don't know which addresses is yours, the question was about satoshi calculations from json. I gave you exhaustive answer, because these are the only satoshi values that are present inside transaction. You cannot figure out by looking only on transaction, which addresses are yours, and which are not.

Also your number is sum of outputs. Does this mean 2 output addresses are yours?


text:
How are fees determined in the Lightning Network?
How are fees determined in the Lightning Network?
For transactions that occur on chain, fees are determined by the availability or demand for space in node's mempools. How are they determined in the Lightning Network?
If there aren't fees in the Lightning Network, what is the economic incentive to operate a node?

Fees are determined by the node operators. It's a free market, you can set whatever fee you want. Of course there's lots of competition, so if you want people to route payments through you, you should set a low or no fee.

If there aren't fees in the Lightning Network, what is the economic incentive to operate a node?

Even without fees, there is still an incentive to operating a node and using LN. In order to use LN, you must be a node. You will want to use LN to avoid paying higher fees with on chain transactions, and thus you will be operating a LN node.

Can the fee for a given node be reactive to other node fees? Is this system akin to the mempool bidding system of onchain? Could fees be more related to how much liquidity a node has? i.e. higher liquidity nodes have higher fees

Certainly. The fee is set by the operator, and they can change it as they want. Once a payment begins routing through them, the fee is fixed for that particular payment so the node operator can't change it for that payment. But they can change it for future payments.

I'd simply like to expand on Andrew's answer and mention that the routing algorithm used to find the various hops towards your final destination payment will also impact your resulting fee.
The idea is that channels sometimes become almost exhausted - where most of the money is pushed towards one direction. This is bad for people because it would mean that their channels cannot be reused; you'd have to open a new channel for new payments, hence on-chain transactions.
If a channel is almost exhausted, the person of the channel with less money (exhausted towards her) will want payments routed towards her to allow her channel to be full again so she can make more payments on that same channel without reopening a new one.
She will actually want to pay if someone chooses her channel to route their payments -- hence sometimes you'll have negative fees.
This means that a routing algorithm will actually look for paths where you actually get paid (negative fees) because you'd be rebalancing some channels along the way.

Addiotionaly you can estimate exactly what fee you are going to pay reading two parameter [fee_base_msat, fee_proportional_millionths] in nodes policy and applying the following formula:
fee_base_msat + ( amount_to_forward * fee_proportional_millionths / 1000000 )
Ref[https://github.com/ElementsProject/lightning/blob/master/lightningd/peer_htlcs.c]

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


text:
What is the typical size for an extended public key?
What is the typical bytesize range for an extended public key?
An extended private key?

An extended public or private key is always 78 bytes of data. When Base58 Check encoded, this results in a string that is up to 112 characters in size.
The format of the data is defined in BIP 32.

is there any lower bound ? or is it arbitrary -> I have tried to generate like few thousands of extended keys and they are all 111 characters in size - Is this the rule or can it be less/more?

It should be a fixed size.

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


text:
Error: Unknown network starting a bcoin node
Getting an error Unknown Network running a bcoin node, but I'm not sure what's causing it since I'm defining the network very quickly.
Error Message:
(node:10579) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: Unknown network.
(node:10579) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Here is the bcoin script
var bcoin = require('bcoin').set('testnet');

(async () => {
  var full = new bcoin.node.FullNode({
    network: bcoin.network.get().toString(),
    httpPort: 18332,
    httpHost: '127.0.0.1',
    bip37: true,
    listen: true,
    passphrase: "secret",
    logLevel: "info",
    loader: require
  });

  if (!full.config.bool('no-wallet') && !full.has('walletdb')) {
    const plugin = require('/Users/<user>/Projects/bcoin/lib/wallet/plugin');
    full.use(plugin);
  }
  await full.open();

  setUpWalletWatcher(full.pool, full.walletdb);
  await full.connect();
  await full.http.open();

  full.startSync();

})();

I fixed it by simply instantiating the fullnode object outside of the async block
var full = new bcoin.node.FullNode({
   network: "testnet",
   httpPort: 18332,
   prefix: '~/.bcoin/testnet',
   httpHost: '127.0.0.1',
   bip37: true,
   listen: true,
   workers: true,
   passphrase: "secret",
   logLevel: "info",
   loader: require
});

(async () => {
   //do stuff
))();

bcoin.network.get().toString()

returns main which is not a valid network string, it should be one of mainnet testnet simnet or regtest.

Even changing the network to testnet didn't work


text:
Historic market data from Bitfinex
I am trying to use the Bitfinex API to get historic OHLC data. I have posted a simmilar question on the main Stack Overflow page: https://stackoverflow.com/questions/47107106/bitfinex-data-api but I figure I might as well try here since there should be more people who are specifically focused on Bitcoin/Crypto here.
I have looked around extensively and can not find a decent API or source for Bitfinex historical data (which is surprising since they are currently the highest volume exchange)
Does any body here have (*successful) experience using the Bitfinex API for pulling historic OHLC data?
Or can someone recommend another reputable 3rd party source for getting this data?

I have posted an answer regarding the code in the stackoverflow question, but if you just want the raw (or sample) data for either BTC/ETH/LTC from Bitfinex or HitBtc, you can head over to my website at www.cryptodatasets.com.
All the data is free, and gets updated every day.


text:
Old (2010) Wallet - Can't figure out best and safest way to extract
The following is based on my very limited understanding of the software involved in Bitcoin (I have a reasonable understanding of the structure of Bitcoin itself at a high level).
I read an article in 2010 (on Slashdot, maybe) about Bitcoin. It sounded interesting from a technical point of view, so for a laugh I decided to see whether I could get some. I found a faucet that someone had set up. Needed an address to send it to, so downloaded the current Bitcoin client (v.0.3.0). While I never got around to requesting coins that way, I did leave the client on in the background mining.
About a week later, I scored 50 coins. Annoyingly, work got busy, I got distracted, and I never got around to starting up mining again after a computer restart.
In any event, I backed up the entire HDD and stored all the files safely for several years.
I'm now at the point where I'd like to see whether the coins actually exist and, if so, to sweep them into a more modern wallet.
First, upon opening the old client and with the original wallet.dat file in the correct folder, I see a balance of 50 BTC with several hundred confirmations. However, there is only a single address shown, and according to blockchain.info, the balance is zero and there's never been a transaction at that address.
Can someone explain what, if anything, this means about the "confirmed" 50 BTC? Is there some sort of obscured address/private key combo within the client at which the mined coins were stored? The answers to the following question don't fill me with optimism: Found my old wallet, is it empty?
Second (and assuming the answer to the first question isn't "you're screwed"!), I've done some reading about getting the keys out of this client. It precedes clients with the "debug" console, so I can't get them out that way.
Apparently I may be able to use pywallet by jackjack, but not being very familiar with software of this type, I've found it a real struggle to install. Are there any other ways of getting at the address/private key at which the coins are stored?
Am I right that the wallet file is so old that it won't correctly be opened by the current Bitcoin Core client?
I've checked other answers to related questions at Stack Exchange, but it seems most people with older wallets are using clients that at least have the debug console.
I'll be trying to do this on a Windows 7 machine, in case that helps.
Many thanks in advance for any help you can offer.

Not a full answer, but Bitcoin Core intends to support wallet files going back to 0.1. That's hard to test of course, and incompatibilities may have been introduced inadvertently along the way.

Thanks Pieter, I wasn't aware of that approach to backwards compatibility. Should I therefore download Bitcoin Core, allow it to fully update, then replace the (new) default wallet.dat it will generate with my old wallet.dat?

... possibly using the -upgradewallet option?  Thanks.

0.3.0 won't synchronize with the network anymore (see BIP50), so I would suggest making a backup of your wallet (and maybe a "database" dir if you have one), and installing Core 0.14.2, and letting that sync with a copy of your wallet.

Thanks Pieter.
Backups of the wallet and directory already made.
I did know about 0.3.0 not synchronizing, but wasn't aware that the current version is (hopefully!) able to open a wallet from v.0.3.0.
I've downloaded the current version of Bitcoin-Qt (which I understand uses Core 0.14.2) and am now downloading the blockchain. Will see how it goes...
Thanks again.

It worked! I now have the address of the mined coins, which wasn't apparent in the old client. So to confirm, a v.0.3.0 Bitcoin client wallet from mid-2010 can successfully be opened by Bitcoin-Qt running Core 0.14.2. Many thanks for your help Pieter!


text:
Default http port for lcoin?
What is the default http port that lcoin listens on? bcoin listens on port 18332 for http by default, however lcoin documentation links only point to bcoin doc links

lcoin listens on port 19336 by default, however you can set another port by using the --http-port=<your port> flag when starting the node


text:
OP_HASH160 vs OP_SHA256
Why would I use OP_HASH160 over OP_SHA256 and vice versa? Why are there two options? In what situations should I use one over the other?
Example unlocking scripts:
From BIP199: ( where HASHOP could be either )
    OP_IF
        [HASHOP] <digest> OP_EQUALVERIFY OP_DUP OP_HASH160 <seller pubkey hash>
    OP_ELSE
        <num> [TIMEOUTOP] OP_DROP OP_DUP OP_HASH160 <buyer pubkey hash>
    OP_ENDIF
    OP_EQUALVERIFY
    OP_CHECKSIG

From miniscript's received HTLC demo:
<key_remote> OP_CHECKSIG OP_NOTIF
  <key_revocation> OP_CHECKSIG
OP_ELSE
  OP_IF
    OP_DUP OP_HASH160 <HASH160(key_local)> OP_EQUALVERIFY OP_CHECKSIGVERIFY
    OP_SIZE <20> OP_EQUALVERIFY OP_HASH160 <h> OP_EQUAL
  OP_ELSE
    <f003> OP_CHECKSEQUENCEVERIFY
  OP_ENDIF
OP_ENDIF

I think HASH160 is the standard/preferable to SHA-256 in locking/unlocking scripts just because its digest is smaller (20-byte digest instead of 32-byte of SHA-256) and, therefore, it takes less space in the blockchain. As it takes less space, you pay less in mining fees with no security cost (160 bits is well above the 128-bit threshold)
Remember that with HASH160 you are already hashing twice (HASH160 = RIPEMD160(SHA-256)) so the little security benefit compared to two rounds of SHA-256 doesn't compensate for the extra fee/blockchain space.

Is the result from HASH160 vs SHA256 the same?

No, the final result is different. Only the intermediary result of HASH160 is the same as the final result of SHA256. With an example: let's hash "test string" with SHA256, you can do this on the command line with echo "test string" | sha256sum, the result is 37d2046a395cbfcb2712ff5c96a727b1966876080047c56717009dbbc235f566. To do the HASH160, you need to further hash this with RIPEMD-160, obtained with echo 37d2046a395cbfcb2712ff5c96a727b1966876080047c56717009dbbc235f566 | openssl rmd160, the result is 79c15f63a1044e02075b42e6df876890392197f0, which is the HASH160 of "test string"

HASH160 is mostly used due to convention and convenience - it has historically been used in p2pkh, p2sh, and p2wpkh addresses, and is usually well supported and understood by any tooling around the bitcoin ecosystem.
For on-chain reasons, HASH160 produces a shorter digest of 20 bytes, vs. 32 bytes for SHA256.
Beyond that, it is simply a choice - you are welcome to use any reasonably secure hashing algorithm. Bitcoin Script supports RIPEMD160, HASH160, SHA1, SHA256, and SHA256d. All of them would work for an HTLC use case (although SHA1 should probably be avoided as it has been proven weaker than the others to an extent, although not currently a catastrophic one).


text:
(RBF) double spend transaction not showing up in searches
On my first ever attempt to send my mined bitcoins from my wallet to a bitcoin exchange site I underestimated the transaction fee that would be required to get the transaction processed. So, following online advice, I posted a RBF double spend by using Bitcoin Core's Abandon Transaction and then attempted to send a duplicate sized amount to the same address as before but with a larger transaction fee. It all looks correct on my Bitcoin Core client but the transaction ID does not show up on any site that I try (blockchain.info, tradeblock.com). The original (low fee)transaction still appears when I search for it however.
Do I just have to keep waiting or is there another issue and if so, how can I solve it?
This is the transaction id: b124aa23debcae71ca41972dbeff9327160ed092bd54a4be616b6613cfa9161b
Thanks

I suspect that the original transaction did not signal replaceability and your replacement transaction was therefore conflicting with the original rather than superseding it. When your node offered the replacement to its peers, they dropped it, because it was conflicting with the first transaction and the replacement did not propagate.
Less likely, but it is also possible that the original transaction got confirmed between the time you tried to submit the replacement and tried looking the replacement up, so that the replacement now conflicted with a confirmed transaction and thus the input was no longer available for spending.


text:
Double spending on testnet or regtest?
I'm currently doing a research on bitcoin and I would like to know if there is anyway to replicate double spending in the testnet or regtest? If isn't possible is there any other type of "attacks" that can be replicated?

If you have some hash power, you can perform Finney attacks on testnet. With regtest, you can perform any attack requiring 51% of the hash power since on regtest you are 100% of the hash power.

For a double spend, on -testnet create a transaction and let it broadcast. Restart bitcoind or bitcoin-qt with -testnet -zapwallettxes=2 and then go ahead and respend your utxo's.
Note: I'll be honest, I haven't actually any BTC on testnet to try this with, you may also have to delete your testnet mempool.dat before restarting the node - try it?


text:
Why is using a simple SHA1 in a scriptPubKey to emulate a "password" a security problem?
I'm independently working my way through an excellent online course on bitcoin, made available from Stanford.  (https://crypto.stanford.edu/cs251).
One of the problems in the homework challenges the student to create a scripSig that redeems an output locked with a simple SHA1 equality check:

Alice is on a backpacking trip and is worried about her devices containing
  private keys getting stolen. So she would like to store her bitcoins in such a way that they can
  be redeemed via knowledge of only a password. Accordingly, she stores them in the following
  ScriptPubKey address:
OP_SHA1
  <0xeb271cbcc2340d0b0e6212903e29f22e578ff69b>
  OP_EQUAL
a. Write a ScriptSig script that will successfully redeem this transaction. [Hint: it should
  only be one line long.]

While I understand why this is a terrible way to go about storing your coins, I can't come up with a 1 line scriptSig to redeem the funds without knowing the pre-image.
Granted any relaying node could just redirect the transaction output to themselves, after you give up the pre-image, but that doesn't seem to be what is being asked.

The title of your question seems unrelated to the actual question (are you asking why it is insecure - something you answer yourself, or how to solve the homework problem)?

I was interested in the 1 line solution to the problem, which I suspected would reveal a blind spot in my understanding of bitcoin's scripting language or the locking mechanism mechanism. Thanks for taking time to provide the answer.

A simple Google search for eb271cbcc2340d0b0e6212903e29f22e578ff69b will reveal the preimage to you.

Thanks. I didn't try that, and you're right, it does give the answer. My interpretation of the question was that there was something wrong in the formation of the script, or the notion of information hiding via hashes. For instance, if Alice chose a pre-image that isn't trivially dictionary attacked.
Perhaps I was over-thinking it.


text:
Why don't exchanges offer all coins?
What is the tech overhead associated with supporting a new coin on an exchange (such as bittrex). Especially when most of the new coins are built on the popular ones (ETH, LTC etc.)
If it's relatively simple, why don't exchanges offer all coins?

Except ETH (even that too have some level of changes) and Waves (and soon NEO and others in future), all the other type of crypto coins require some level of expertise before it can be added in the exchange.
Also, the more crypto coins added, the more possible pairs will be possible or required. Example, let a coin name be ABC, the possible pairs can start with just
ABC/BTC
Then with time and popularity and demand, the following can be required:
ABC/ETH
ABC/USDT
ABC/CNY and so on.
This puts more load on the server than the exchanges get back in fees. Also, some coins may have some technical problem often, which cost the exchange time and expertise to solve.
That is the main reason popular exchanges like Bittrex and others only list a limited ones (mainly due to server load). While less famous exchanges list almost all the crypto coins to get any kind of traffic they can get. If that particular exchange is the only one allowing that coin, then they will get the initial traffic.


text:
How to get the balance of a wallet using only bash interface?
I need to get the balance of specifics wallets only by using bash terminal tools without installing anything new to the OS (An old customized Ubuntu Server)
Any idea how to do it? Thanks in advance.

you can do it by using blockchain.info and common bash tools that you already have in your system like wget, grep and awk, printf for formatting
For example by using (replace ADDRESS with the actual address you want to query):
wget -qO- blockchain.info/rawaddr/ADDRESS 2>&1 | grep -Po '"final_balance":\K[0-9]+'

And if you want to format the output from satoshi to btc you can use:
wget -qO- blockchain.info/rawaddr/ADDRESS 2>&1 | grep -Po '"final_balance":\K[0-9]+' | awk '{s=$1/100000000} END {printf "%0.8f\n", s}'


text:
Set fee in Electrum RPC
I'd like to pay people using the following command:
curl --data-binary '{"id":"curltext","method":"payto","params":{"destination":"mwLmd5xMnKkf4bBUa6MDrg4HYQaazoHtkj", "amount":"0.001"}}'

But I don't know what will be charged as fee. Is it possible to set the fee?

Seems like you are on testnet... INPUTS minus OUTPUTS = TX FEE.
So better to create a return adress. If there is only one UTXO in your wallet, and it has let's say 0.005 in it, by your line it would give 0.004 to the miners. So better to add a return address. You would have to add an address of your wallet.
I haven't worked out the params field, but there should be an option to add a second param for output address?


text:
I sent some Bitcoin to a Bitcoincash adress on Trezor
I sent some Bitcoin to a Bitcoincash adress on Trezor and it doesn't show on my Bitcoin in Trezor, how can I get them back ?

Possible duplicate of What would happen if you send Bitcoin (BTC) to a Bitcoin Cash (BCC) address?

I've voted leave open, because the related question explains the phenomenon in general whereas this question asks how to recover after the phenomenon on a specific device.

You should upgrade your Trezor firmware. Follow the steps here: https://doc.satoshilabs.com/trezor-user/updatingfirmware.html
After it, your problem should be solved. If not, try these steps: https://blog.trezor.io/claim-bcash-bitcoin-cash-bch-bcc-trezor-wallet-f0a810d5864a


text:
Why aren't 3 party (or more) channels realistically possible in lightning today?
Speaking with Ben on twitter it appears that it isn't feasible without eltoo to create more than 2 party channels on the lightning network today. Why exactly is that the case today and how does eltoo solve it?

AJ answered this on Twitter if someone wants to add an answer https://twitter.com/ajtowns/status/1599892685095329792?s=20&t=U4AZm3ZGpz4s6k1sMudimA

Today's lightning channels use the ln-penalty update mechanism. Each time an HTLC is staged or resolved, the channel owners negotiate new commitment transactions for each side. As part of the negotiation, channel owners must renounce the old state: after acquiring the new state, each provides the counterparty a breach remedy keyed to the prior state. This breach remedy allows a channel owner to publish a justice transaction to claim all funds in the channel should the other party broadcast the outdated state. Ln-penalty requires that each party has a distinct commitment transaction for each state since the funds on the publisher's side are locked for some time to give the defender a chance to use the breach remedy.
Each party must keep all prior breach remedies and outdated backups become toxic waste. If a node accidentally publishes an old state, they forfeit all funds in the channel.
I do not see how the penalty mechanism could work with more parties. Let's assume we had a channel opened by Alice, Bob, and Mallory. Mallory opened the channel with 0.6 ₿. At a later stage, Alice has 0.4 ₿, Bob has 0.15 ₿, and Mallory only holds 0.05 ₿. Mallory tries to unilaterally close the channel with the initial state to reclaim all 0.6 ₿. The breach remedies Alice and Bob hold were created when Mallory renounced the initial state. Does whoever broadcast it get all the money? That would mean that Alice or Bob is punished for Mallory's transgression. Is the money split in half? That way two channel owners could steal from a third whenever one party's channel capacity exceeds half the channel balance. Perhaps a justice transaction could pay out into the shared custody of Alice and Bob, but even then, how would Alice and Bob ensure that each get at least the amount that they could lay claim to in the last state?
I posit that designing an ln-penaly-like update mechanism that guarantees fair outcomes in all possible scenarios for three or more parties would be vastly more complicated and probably have significantly more roundtrips and overhead. I suspect that it might require renegotiating all prior breach remedies for each state update. (Happy to be convinced otherwise, if you have a nifty construction in mind, though. ;))
The Decker-Russell-Osuntokun update mechanism (“Eltoo”) manages to ratchet the channel state forward without asymmetry. Instead of having a separate commitment transaction for each party, a symmetric Update Transaction is created for each new channel state shared by all parties. Update Transactions tie only to the scriptPubKey and amount of a prior transaction output instead of a specific outpoint (which requires SIGHASH_ANYPREVOUT). Each Update Transaction spends the output of the Setup Transaction or any Update Transaction older than itself. All Update Transactions share the same input amount and pay the same output amount to the same scriptPubKey. The payout to the channel owners happens only in a later Settlement Transaction which can only be used after the corresponding Update Transaction has a number of confirmations (via OP_CHECKSEQUENCEVERIFY). This gives other channel owners time to submit any newer Update Transactions if an outdated Update Transaction was published.

via eltoo: A Simple Layer2 Protocol for Bitcoin
There is no punishment for the publication of an outdated state. However, the Update Transactions itself do not pay any fees since input amount and output amount are the same. The publisher must add another input to provide fees (and possibly another output to reclaim change). However, while an older Update Transaction is in the mempool or even after it has already been included in a block, newer Update Transactions can be submitted to enforce a more beneficial outcome for other channel owners (or to skip directly to the newest Update transaction). An unsuccessful attacker wastes the transaction cost of broadcasting an outdated state when their transaction confirms but is later superseded.
Since the channel state is symmetric and there is no state specific breach remedy, each (honest) channel owner needs only the latest state which reduces the amount of state channel owners need to keep track off. Old channel backups are no longer toxic waste that immediately trigger loss of all funds. In case of an actual data loss, other channel owner can ratchet forward to any later state (which may still lose the negligent channel owner some or all funds, or may be the latest state in the case of an honest counterparty). Since the channels are symmetric, the overhead of having multiparty channels is linear. It may still be impractical to create channels with numerous channel owners, since each channel owner must sign every Update Transaction, but a handful channel owners should be feasible. The  overhead for updating the channel state may also be somewhat mitigated via Channel Factories which allow subsets of the channel owners to have segregated balances they can update among themselves.

Nice explanation, thx, I was wondering on what prevents generalization of a 2-of-2 lightning channel to 3 (or more) parties.

I wonder if choosing a 'channel master' in the hypothetical 3 (or 3+) party lightning channel generalization, and restricting transactions to/from channel master only (in practice the LSP) would reduce the set of possible combinations to a manageable level?


text:
How can a bitcoin ATM charge less than the average bitcoin transaction fee?
As of this writing, the average bitcoin transaction fee is over $30, according to this chart. However, I just bought $20 worth of bitcoin from an ATM, and they charged me a fee of around $2.00.
My understanding of the fee for a transaction is that it is a function of market forces, the number of bytes in the transaction, and the time you are willing to wait for your transaction to be added to the blockchain. Overall however, I had the impression that at a given time these fees are relatively constant per transaction. So I would expect that the owners of the ATM would have to spend something around $30 in fees to give me my $18.00.
I asked a similar question about coinbase.  In that case the explanation was that coinbase wasn't actually transferring any bitcoin on the blockchain.  However, this ATM printed me a new wallet, which I assume means a new bitcoin address was created and bitcoin was transferred to it on the blockchain.
What don't I understand?

How long did it take before the transaction was confirmed?

Maybe they want to gain trustworthiness and provide maximum value to their customers. Also GDAX(they are Coinbase dedicated exchange) doesn't charge network fee at all, I see it as as strategy to create pleased customers. No one really know what they are up to.

What exchange rate did they give you?  If the Market rate at the time was $15,000 USD : 1BTC, but this ATM charged $16,500 USD : 1BTC, then they charged you a premium in the exchange rate, not the "fees".

@Monstrum it looks like it took about 3 hours to be included on the block chain.  The fees are indeed more than the bitcoin transacted.

@abelenky The order of magnitude you have there is about what they charged me in the exchange rate.  However, the fees that the ATM owners paid the miners - when converted to USD using the exchange rate that google reports - were still more than the amount I put into the ATM.


text:
Why is there a higher fee for re-used receiving addresses?
Say I want to get lots of small bitcoin deposits and sell them off soon thereafter.  Say I get bitcoin in $5 chunks.  If I take the standard advice and never reuse an address, I have to pay a transaction fee every time I sell one of those chunks.  As of this writing, the average fee is over $2.  This puts the overall fee for this endeavor at 40%.  On the other hand, it seems like I could collect all of the deposits in one address and sell when I've reached some acceptable threshold, say $100.  It seems like this would cost me a mere 2%.
On the other hand, I have read the following at https://en.bitcoin.it/wiki/Address_reuse#High_Fees

A single invoice payment using P2PKH can be redeemed and spent with a predictable fee because the transaction should have a predictable size. Software that determines payment and available funds based on "address balance" can cause loss through high fees. If you are paid to an address in many small increments, you will pay a much higher transaction fee when redeeming those payments. It is much more useful for a client to display transaction outputs spendable than address balances for this reason.

My understanding was that transaction fees are per byte, and that my transaction would be a standard sized one of the form "MyAddress is sending x many Satoshi to YourAddress".  Why would I have to pay more?

https://en.bitcoin.it/wiki/Transaction#Input says "An input is a reference to an output from a previous transaction", as opposed to an address.  To quote Al Gore "while I strongly disagree with the court's decision, I accept it".  It feels like if bitcoin paid from addresses rather than outputs, you could significantly reduce the size of blocks in the way I described.  It would be interesting to understand that design decision.

When you have an address with multiple inputs (you have sent bitcoin to the same address multiple times) and you want to send all of those bitcoins to another address, all of those inputs must be included in the transaction, and recording each input takes up space. If you have only sent bitcoin to an address once, it only has one input, therefore the transaction only needs to contain one input, which takes up less space.

I think my original description wasn't clear.
Say 11 different people send me bitcoin and eventually I sell it all.  In scenario A, where I use a different receiving address for each of the 11 incoming transactions, the people giving me the money each pay something like a $2 transaction fee, and I have to pay something like $22 to sell the bitcoin, since it will take 11 transaction to do it.
Scenario B : I give everyone the same public address and when I sell, I generate a normal sized transaction (if not, why not?) and only pay $2.

What matters is that you're sending coins received through multiple independent payments. Whether those payments are all to the same address or not is irrelevant.

@PieterWuille Why?  Presumably that is because I have to list the inputs to the address when I make the payment.  But isn't that information already encoded in the blockchain?  Is there a reference that I could look at?

Yes, Bitcoin transactions spends have to refer to the transaction output that created them. More outputs to refer to = more bytes = more fee.

I believe you.  Can you help me understand WHY the transaction has to refer to the previous transactions that created it?  There is probably some fundamental misunderstanding in the following sentence, what is it : "at a given point in time, a Bitcoin address holds a certain amount of value, and that value can be calculated using the blockchain by adding the total value of transactions into the address and subtracting the total value of transactions out of the address".  If that's right, why list all the inputs to an address when you are paying from it, given that they are on the block chain?


text:
How can trading phisical goods in the blockchain be safe?
Suppose we have two people: a merchant (Bob) and a buyer (Alice).
Alice wants to buy an expensive good from Bob in excange of bitcoins, so she contacts him and sends him the amount of bitcoin needed. When Bob receives the bitcoins, and the transaction is in a block which has enough blocks built on top of it, he ships the good and both live happily ever after.
But
Bob could be a malicious merchant and take alice's bitcoins and never ship the good, and he could get away with that. So Alice requests a signed message from Bob prior to sending her coins, so she has the proof that Bob actually requested her coins and can hold him accountable for it. Now they can both live happily ever after.
But
Alice could be a malicious buyer and claim that the good was never shipped, even tough she has received it, or claim that it is broken whatsoever. She could be rigth or she could be malicious and Bob has no way of knowing it and he obviously doesn't want to send a refund if the good is good. So they "hire" an escrow (another bitcoin user) to act as a third party in as 2 out of 3 multisig contract. In this way if the good was broken and Bob had fled Alice could ask the escrow to sign the contract with her and get her money back. Or if the escrow does not believe Alice he/her could refuse to sign the contract leaving the money to Bob. And they all live happily ever after.
Now the question
How can Bob (an honest merchant) trust the escrow not to pair with Alice in a completely arbitrary way at his damage? He could have shipped an €900 smartphone and get nothing from it because Alice paired with the escrow to get a refund, and once he has signed a 2 out of 3 multisign contract there is nothing he can do to prevent that from happening.
So
How can a merchant ever be willing to trade his phisical assets over the blockchain if it has not the top security in doing so? In addition to that Alice is just an address hash so he can't hold her accountable in a legal way, while a merchant is likely to provide his bitcoin address over the net in his certified website so his identity is known, and he can be held accountable by that. What am I missing?

"So Alice requests a signed message from Bob prior to sending her coins..." Is this a feature already implemented in Bitcoin?

Simple answer is that both parties need to trust the escrow! Their is no smart cryptographic technique you can use to ensure a link between maths and physical goods in the real world!
If you're talking about digital goods, or products with DRM, the issue is different, but when you're shipping a physical product, like a phone, without DRM, then you need good old fashioned trust. Now if you use a 'reputable' escrow agent on a 'reputable' site, then you can reasonably trust them.
Customer reviews also play into this. This is how sites like AlphaBay could exist. You have no idea that your illegal product is going to arrive in the post, after all, you're dealing with a criminal by definition! However, the interests of the buyer, vendors and site align to ensure that everything works most of the time... See:
Jamie Bartlett How the mysterious dark net is going mainstream

I was hoping in some mind blowing concepts but i guess this is how the world goes. At least I got confirmation that I understood the concepts correctly haha

Maybe attatch a rebate, wallet address, to object, Alice the needs to give bob this address so bob can send rebate to Alice. I've seen this kind of thing in eve online, courier contracts. You have to front collateral.

@IvanoDonadi My understanding is that blockchain does not eliminate the need for trust. It minimizes the need for trust. In other words, there will be some occasions that some extent of trust must exist, and I think your question is one such occasion that the escrow must be trustable.

But isn't the escrow the new "third party"? I think blockchain is trying to remove the third party from business activities but it looks like a third party is inevitable, in the form of either a bank or an escrow. Did I misunderstand something?


text:
regtest method not found
I have alredy looked at a lot of other similar questions here but they didn't involve my case or the solutions provided did not work for me. I'm trying to work in regtest mode and I'm using bitcoin core v0.15.0 on a Debian machine. My bitcoin.conf file looks like this:
$HOME/.bitcoin/bitcoin.conf ->
rpcuser=bitcoinrpc
rpcpassword=7bljxv........zabyi

I run the command
bitcoind -regtest -daemon

And then
bitcoin-cli -regtest getblockchaininfo

And it works fine, but if I try to run the following command:
bitcoin-cli -regtest generate 101

I get the following error:
error code: -32601
error message:
Method not found

Do you have wallet enabled? generate is a wallet RPC now since it needs to get an address from the wallet. If wallets are disabled, then generate will not work. If you want to mine without wallets being enabled, use generatetoaddress.

Thanks, I built bitcoin from source and I had misunderstood the consequences of --disable-wallet


text:
How was the dust limit of 546 satoshis was chosen? Why not 550 satoshis?
Is there a reason why 546 satoshis was chosen as dust limit instead of 547 or even 550 satoshis, historically?

The dust limit is not actually fixed, technically - it varies based on the type of output. 546 satoshis is simply the most commonly known one, for a p2pkh output. Being the longest-lived output type, I suspect some wallets/blog posts/literature might treat it as a hard coded dust limit.
As to how to arrive at 546 satoshis, we must first know what "dust" means. A dust output is an output which costs more to spend, than it is worth. In other words, an X BTC output that costs >X to spend, is a dust output. This is directly proportional to the amount of data required to spend an output, since fees in bitcoin are commonly denoted "per-byte". The more bytes you must add to your tx to spend an output, the higher its dust threshold.
A very basic tx consisting of 1 p2pkh input (~148 bytes), and 1 p2pkh output (~34 bytes) comes out to 182 bytes. The dust limit is 3 times this number (assuming a relay fee of 1 satoshi), or 182*3 = 546 sats.
For more complex txs, such as p2sh, this number is larger. For less space-intensive ones such as the newer segwit options, this number would be lower.
The code used in Bitcoin core to determine the dust threshold can be found here.

I think this answer could be clarified a bit.  It seems to boil down to the statement that "the dust limit is fixed at 3 satoshis per byte", which raises the question as to how this figure was selected.  Also, referring to this as a "relay fee" seems misleading because no fees are collected by nodes who merely relay transactions.

@NateEldredge Absolutely - I'm trying to look up some sources I read ages ago on why 3*relay fee was selected. As for the relay fee bit, I believe it comes from the minrelaytxfee flag for bitcoind, which lets you control which transactions your node relays based on fee

Wasn't it the case that dust limit was introduced to prevent creation of UTXOs whose value is lower than the cost of scriptSig to spend it? For a 148 byte input, scriptSig would be 107 bytes. That is ~34*3.

I think Ugam is right according to this.

how to calculate dust for Testnet pubkey hash (with testnet address like mutrAf4usv3HKNdpLwVD4ow2oLArL6Rez8) and  Testnet script hash (with testnet address like 2N1SP7r92ZZJvYKG2oNtzPwYnzw62up7mTo)? Can I still consider 546 sats? Consider that one is about 34 and one is about 35 bits

Bitcoin core sets the dust limit to a value where spending an output would exceed 1/3 of its value. This calculation is based on the node's setting for the minimum relay transaction fee (see option -minrelaytxfee) whose default is 0.00001 BTC/KB. Any transaction with a fee less than that does not get relayed by the node i.e. is dropped from its mempool.
For a node that uses the default -minrelaytxfee of 0.00001 BTC/KB (1000 satoshis/KB) and given that for P2PKH an input is 148 bytes and an output is 34 bytes, it follows that an output less than or equal to 546 satoshis is considered dust according to Bicoin core.
Reference: What is meant by Bitcoin dust?


text:
Why does a node get stuck in "Loading wallet..."
I've deleted wallet related things from .bitcoin folder including:
.bitcoin/wallets and .bitcoin/chainstate and run bitcoin using bitcoind -reindex.
This takes longer than just starting over from scratch and deleting the entire .bitcoin folder. The reindex seems to finish quickly, but for a long time afterwards rpc calls always result in:
error code: -28
error message:
Loading wallet...

I'm not sure what this error means, if it is recoverable, or how it gets in this state, as there is nothing happening in verbose debug output, and the cpu is not being hit at all.


text:
Label and description visibility in transaction history
When I send a bitcoin payment I provide label and description for a transaction.
Is it possible to see these values on blockchain.info (or somewhere else) ? Or this information is available for receiver only?

They're local to your own client.


text:
Given an altcoin, how to find its mining pools?
I wonder if it can be possibile to find all pools for a given altcoin.
For example, if an altcoin X has an official pool P and its official pool crashes or its not working, how we can find all the pools for the given coin?
It is supposed that the other pools aren't indexed on search engines.

It is impossible to identify who a miner or mining pool is based upon the coin's blockchain. If the mining pools are private or have poor search engine optimization, then it will not show up in search engine results. Given that you cannot deanonymize miners from the block data nor can you search for all of them, you cannot get a definitive list of mining pools for any coin.


text:
Power off Antminer D3 (without ssh access)
I want to power off an Antminer D3.
I have read online that the best way to do it is by connecting via ssh and executing poweroff.
However, I cannot login from my Mac to the miner with ssh -p 22 root@192.168.0.xxx or ssh root@192.168.0.xxx.
It does not accept the default password "root":

Permission denied, please try again.

How can I log in and do I really have to shut down the miner this way? It makes sense to not turn off the fans immediately by unplugging the PSU.

Default password admin for user root worked.

They don’t really stop mining if you shut it down.

@eponymous why don’t they stop mining? What is shutting down then?

You can turn off the control CPU but the mining chips are always connected to the power. I was imagining you were trying to schedule it’s usage.

@eponymous I intended to gracefully shut the miner down where the fans would still run some time after it stopped mining, so the chips don’t overheat.

They’re designed for extremely high heat operation, there’s no danger in just unplugging it. It will probably happier with continuous operating rather than heating and cooling cycles.


text:
At the beginning. when nobody owned bitcoins. what was being minned?
what I understood about mining a block is that,
New/pending transactions are to be verified and placed into a block solving the proof of work.
The miners are rewarded for this task.
In the very beginning.. when there were no transactions taking place.. what were they mining? what were in those blocks?
how did bitcoin circulate all over the world?

See also https://bitcoin.stackexchange.com/questions/2021/what-happens-if-there-are-no-transactions-in-a-block?rq=1 https://bitcoin.stackexchange.com/questions/24098/why-there-are-blocks-with-single-transaction-in-blockchain?rq=1 https://bitcoin.stackexchange.com/questions/46053/why-was-block-289791-empty-of-any-transactions?rq=1 https://bitcoin.stackexchange.com/questions/34089/how-often-does-a-block-have-only-one-transaction https://bitcoin.stackexchange.com/questions/18260/does-mining-activity-only-exist-if-there-are-bitcoin-transactions?noredirect=1&lq=1

right.. but im trying to implement bitcoin protocol in python.. and i wanted an answer which takes into account the implementation part..

Can you edit to state your question more specifically, then?  You never said anything about implementation, and the answer you accepted contains exactly the same information as answers to the "duplicate" questions.

The first blocks were completely empty and didn't contain any transactions.
The first transaction was in block 170 from Satoshi to Hal Finney, as seen here.
As newly generated coins from mined blocks are only spendable after 100 blocks, the earliest possible block to spend the first coins would have been at block 101.
It is completely legit to mine empty blocks (even if there are pending unconfirmed transactions). Here is an example of an empty block on April 2017.

so, they are just hashing the block headers?

yes. And with that they are helping securing the network and every transaction of the previous blocks because more work on top of block means the blocks are more secure because it gets more difficult to undo previous blocks.


text:
10$ registration bonus on Coinbase : how to get it?
I found the picture below and I registered on Coinbase with this signup bonus link :
bonus-coinbase.com :

I didn't received the 10$ bonus yet.
When will i get it ?
Is there something I have to do to get it?
Thanks for your answers!

That's obviously not legitimate, it has a troll face smoking in it. Not sure if you're trying to be funny or just...

@MeshCollider I found the picture on a Facebook fanpage about bitcoins. The link is correct but I don't know if i just have to wait or do something to get the bonus

@MeshCollider it's legitimate. If you go to bonus-coinbase.com it redirects you to coinbase.com/join (to where you can't get to if you don't actually visit bonus-coinbase.com). It's just a promotion offer to get people to join Coinbase. Please do your research before coming to conclusions. It took me 30 seconds to figure it out.

Ok, I found it : you get the bonus when you buy or sell 100$ of bitcoins, ethers or litecoins on Coinbase.
:)


text:
Why would apps use Lightning over an on-chain TX?
I'm trying to understand software orientated payment use-cases for Lightning payments.
Given a web app that accepted BTC payments charged in Satoshi for a service - watching videos for example; why might it be advantageous to use LN to continually generate new invoices (per second of viewing time), instead of simply timing the overall viewing time and invoicing once at the end via a standard on-chain TX?
The only advantage I see atm is a hedge against on-chain fee prices, by opening a "long running" channel.

That is the main advantage, and it really depends on the application whether batching invoices fits the user experience.

I think these are two questions.
1.) Why charge with lightning in real time instead of once? I guess the main reason would be the convenience for the consumer. It is much nicer if I don't continue to watch the video that I don't have to pay the full price.
2.) Why using lightning instead of an on chain transaction? I guess the main reason is that on chain transactions are slow and with the higher adoption of bitcoin also more expensive. This means that it will just be cheeper and faster to accept payments via the lightning network which goes in the direction of the guess you made. There is another advantage which is that your lightning channel can be reused over and over again.

Good points although perhaps I wasn't clear enough in my question; that the comparison is between a continually updated LN channel and a one-off on-chain TX for the duration watched, not the whole video. Also on your point 2, an LN channel will always require N confirmations on the main chain just to open the channel. Having said that i suppose as ypu say, this is offset by one long running channel

This rather begs the question: what is the utility of a long running channel in the context of my question? I order to fulfil an LN invoice, the channel would need to be closed anway would it not?

no the point is that the channel does not have to be closed. it can stay open. that is the point of the Lightning Network. We open channels and use them hopefully forever (:

Brilliant. A channel not needing to be closed is a key piece I was missing. Missed because I was blinkered by my own 2-entity scenario.


text:
Can a Lightning channel's initial BTC value be updated?
When an LN channel is created, it is funded with an initial BTC amount by at least one one peer. But given that most of the whole idea of LN is the existence of long running channels, I wonder if this means that it's possible for a channel to be "emptied", thus making "long running" a bit of a misnomer. Is it therefore possible for the channel's creator to "top up" the channel?

There is some work being done here with splicing, where the channel partipants agree to spend the output of the opening TX together with additional inputs to a new multisig output from which to create commitment txs, thereby increasing channel capacity.

Splicing in and splicing out, as funds could also be reduced. However both results in a new tx confirmed on chain, which is the cost of adjusting the channel capacity after it has been opened.

No. The amount of money in a channel cannot be changed once the channel exists. Channels cannot be topped up nor can they be "cashed out". Any change to the channel balance would require using new outputs and funding transactions. If it were the same channel (so the channel state is not committed to the blockchain), then fraud could occur where an old commitment transaction is broadcast that was from before new funds were added to the channel.
However, there is work on splicing, but that's more like closing a channel and jointly opening a new one.

though it is not quite clear which of the splicing proposals will be used so I would say it is only one way to splice a channel to close and jointly open a new one. Technically splicing should run asynchronously in the sense that the channel stays operationally during the splicing operation

Currently the capacity of a channel stays the same. However on the Lightning Developer Summit in Australia in November 2018 it was agreed that Splicing should be added to lightning. With splicing you can increase or decrease the capacity of a channel (and your balance)
If you don't care about capacity but just about the balance and you want to refill the channel of your channel there are four things you can do:

You can receive a lightning payment by selling some good (:
If you just fund to fill up capacity you could use a submarine swap which works by sending bitcoin in order to pay for a lightning invoice.
You can also use exchange services like zigzag.io in order to send money from your channel to a bitcoin address.
You can route a payment to yourself in order to rebalance 2 of your channels.


text:
Setting up Bitcoin Cash testnet
I am new Bitcoin cash wallet development :
--I want to create or sync with existing bitcoin cash testnet for my testing but don't find a way.
--If available testnet insight for bitcoin cash.
Kindly suggest how can i achieve this. Any Help is appreciated

https://bitcoin.stackexchange.com/questions/57785/is-there-an-active-testnet-for-bitcoin-cash

By "insight" do you mean you are looking for a block explorer?  There is one at https://www.blocktrail.com/tBCC.  If not, please clarify your question.


text:
HD wallet implementation
I want to create public addresses in offline browser from master public key so that owner of master private can access the funds available in child address.
but I am not able to understand how to use this bitcoinjs-lib. how to create master private key, master public key and every time i click on button it generate new child bitcoin address.
Help is appreciated

I'm doing something similar but using segwit addresses (BIP49). If you are using BIP32 with a standard derivation of m/0'/0/0 you could do something like this - See: https://github.com/bitcoinjs/bitcoinjs-lib/blob/master/test/integration/bip32.js#L35

//get a mnemonic, then seed, then root.
var mnemonic = bip39.generateMnemonic();
var seed = bip39.mnemonicToSeed(mnemonic);
var root = bitcoin.HDNode.fromSeedBuffer(seed);

//root can be transformed to your xpub and xprv
var xprv = root.toBase58();
var xpub = root.neutered().toBase58();

//You can then create the address with a derivation of m/0'/0/0
var change = 0; //0 for external (receive), 1 for internal (change)
var index = 0; //the index of the address you want to generate
var keypair = root.deriveHardened(0).derive(change).derive(index);
//or keypair = root.derivePath("m/0'/" + change + "/" + index);
var address = keypair.getAddress();

If your derivation for your addresses is m/0' (then external, then the index) Then you have the xpub for the parent m and can store xpub of m/0'/0 on the server. On the server when a user clicks the button it generates the address n/0, where n = your xpub of m/0'/0.

I have one question for you. Scenario : If bitcoin address on x level down offline on web browser using parent hdXpublickey  which i donot know  because of offline then i retrieve bitcoin from child address using extended private key without knowing path on server when sender sends its fund.

If you're building an HD implementation you should have the parent xprv stored on your computer. Using that you can derive the private keys for all child accounts. You shouldn't be generating addresses from a random derivation on the user-side, it would take you forever to iterate over all the possible derviations.

See my edit of the main for a little more explanation

storing private key on server it question of security. One more thing how Tezos work. Its a big question in my mind.Do you have any idea?

Is bitcoinjs lib can br used  for bitcoin cash?

I don't know Tezos, I don't really do ICOs. I'm not entirely sure if it can be used with Bitcoin Cash, I know the address hashing format hasn't changed, but there may be other differences in the bare public/private keys that I'm not aware of.


text:
Transaction I didn't make is unconfirmed
I have an unconfirmed transaction that's come from my ledger wallet that I didn't make.
The transaction doesn't show in the wallet history but the balance is now zero.
Can anyone advise? I'm a bit new to this and have a horrible fear I'm going to lose my bitcoin to a hacker:
https://blockchain.info/address/1JKuZqSPA9zLAP2XS96zGUyuGR1awcB5bP

Are you the sender or the recipient of this transaction?

It came from my wallet but I didn't make it, nor want it to happen.

There's good news and bad news.  The good news is that this transaction was sent without a fee, meaning it is unlikely to be included into a block in a timely manner (if at all).  The bad news is that it was created without opting into replace-by-fee, meaning you could "cancel" this transaction by sending another one with a higher fee.  This would have been your best option.  Likely, this transaction will never be mined and will be purged from the mempool.  When that happens, you should spend it to a safer wallet.

are you saying it will never be mined and returned? Or do I need to kick start that by sending another transaction to 1JKuZqSPA9zLAP2XS96zGUyuGR1awcB5bP  using a higher fee that I don't pay for?

Only send a transaction to an address you want to pay.  If that isn't an address you want to give money to, then don't.  As for sending another transaction with the same inputs, you can try, but until the unconfirmed transaction is cleared from the mempool, other nodes won't relay it.

No I don't want it to go through, guess I'll hold it out for it's hopeful safe return.
And as you say move to a safer wallet, very disappointed my ledger wallet is compromised. A secondary worry is that it gets returned there and the same things happens.


text:
How to find details about very first block mined for any crypto?
Hi is there any resource or site where we can see details of the very first block mined like its time-stamp and other details . I have been asking around in groups for last 3 days no answer .
I did find some details about bitcoin but would like to find for other crypto coins too.

If you have an altcoin's node software and that software is based off of Bitcoin Core, then you can use the following RPC commands to get information about the genesis block:
getblockhash 0

This will get you the hash of the genesis block. Take that hash and do
getblock <hash>

This will give you all of the information about the genesis block.


text:
Is taproot considered nonstandard to older clients?
When asking an older bitcoind node to broadcast a transaction which includes or spends a p2tr output, how will they respond? Will they broadcast the transaction? Will only certain bitcoind versions broadcast them? Which ones if that's the case?
I'm not asking if it's possible to detect if a user's bitcoind node will broadcast the p2tr transaction, which can be accomplished with getblockchaininfo checking the bip9 version bits supported.

P2TR outputs (and higher-version native witness outputs) are standard since Bitcoin Core v0.19: https://github.com/bitcoin/bitcoin/pull/15846
Inputs spending P2TR outputs are non-standard in all Bitcoin Core versions since 2012 or so, except those versions that have BIP341 implemented for which they're standard since Taproot activation. The first version implementing BIP341 was Bitcoin Core v0.21.1.


text:
Where is the default lnddir?
Looking for my macaroon files which should be at this location:
lnddir/data/chain/bitcoin/mainnet
However, I can't figure out where my default lnddir location is. I don't want to set a new lnddir. I'm working on macOS, however information for all major operation systems should be included.

For macOS: /Users/arshbot/Library/Application\ Support/Lnd/


text:
How can there be block mining rewards in Rootstock?
I'm trying to understand Rootstock a little better, and am still not sure about the mining rewards they mention in their white paper:

RSK uses the DECOR+ block reward sharing scheme to reduce competition and allow miners late switch to the
  RSK best block. If miners switch their hardware each time a RSK block is found, they
  compete for a full RSK block reward. If they late switch, and keep mining past block tips,
  they create uncles and and earn a share of the block reward.

But how does this mesh with the pegged 1:1 exchange rate of BTC to RSK? The people behind Rootstock specifically state that new coins aren't generated, only bought with BTC. Is the block reward the transaction rewards?
Thanks!


text:
How often is a block mined on the bitcoin testnet?
I've been watching testnet for a few minutes and I haven't seen a block come in yet. I'm testing some code that works with incoming validated blocks, and I'd like to test it out.

Blocks on testnet3 are intermittent; sometimes there's hundreds of blocks a second, massive reorganisations that strike out tens of thousands of blocks, or no blocks for many hours. This is largely due its zero value and the difficulty adjustment rules that don't deal well with changes in hash rate. Generally no software is tested here other than for public demonstrations as a result.
For more reliable testing the regtest mode exists in Bitcoin Core which allows you to instantly create blocks on demand in your own isolated testnet with as many peers as desirable.

My understanding is that "no blocks for many hours" can't happen because of the 20 minute rule.

Even a difficulty 1 block needs one miner. The way it's implemented in Bitcoin Core is sort of buggy so external miners often don't see the difficulty drop block properly too. There's no point in fixing it at this point.


text:
eloipool fails with module 'select' has no attribute 'EPOLLIN'
attempting to run eloipool by following the tutorial in the issues section. When running eloipool.py, I am greeted with this error:
Traceback (most recent call last):
  File "eloipool.py", line 84, in <module>
    from bitcoin.node import BitcoinLink, BitcoinNode
  File "/Users/harshagoli/Projects/eloipool/bitcoin/node.py", line 22, in <module>
    import networkserver
  File "/Users/harshagoli/Projects/eloipool/networkserver.py", line 28, in <module>
    EPOLL_READ = select.EPOLLIN | select.EPOLLPRI | select.EPOLLERR | select.EPOLLHUP
AttributeError: module 'select' has no attribute 'EPOLLIN'

Running with python3, and in the python3 repl select does have the correct attributes, but in the script itself it doesn't seem to load.

Are you certain the python interpreter you're actually running is version 3?  The tutorial talks about just using the python command, but on many systems that will give you version 2, even if version 3 is also installed.  What is the full command line you are using, and what do you see if you run the same command with --version?

I am sure I'm using python3. I use python3 eloipool.py and get the error I posted above


text:
How do hodl invoices work?
On March 15th, 2019 hodl invoices where added to lnd via this pull request. Hodl invoices allow a recipient to accept or deny a transaction at their discretion, a very useful feature. However, how does this feature actually work? Are funds locked up until the htlc is settled? Are they not reserved, therefore the longer a hodl invoice is left idle the higher likelihood the transaction may ultimately fail?

Generally when paying an invoice a chain of htlcs from the sender via some path on the network to the recipient is set up. The htlcs lock in by exchanging signatures on every local channel. Now there is a min timelock  which is the amount of time the payment can take. Or the time frame in which the htlcs must settle by releasing a preimage to have a successful payment.
The general workflow is that the recipient is supposed to release the preimage once the htlc on their channel is set up and the amount is equal or bigger the one requested in the invoice.
With the HODL invoice as described in the pullrequest the recipient decides not release the preimage automatically. Therfore the settlement of htlcs is deferred into the future (or the timelock cancels the payment process)


text:
What is the most optimal way to parse a raw bitcoin block with python?
Let's say one is connected to a zmq socket and listening for rawblock. How you'd parse the block header is as follows:
block_header = raw[:80]
version = block_header[:4]
prev_merkle_root = block_header[4:36]
merkle_root = block_header[36:68]
timestamp = block_header[68:72]
bits = block_header[72:76]
nonce = blockheader[76:80]

But, what is the best way to parse all the transactions in the block? Converting a rawtx to a tx object is easy, plenty of libraries do it. But what is the best way to parse a variable length block of txs?

We will compare modern libraries with segwit and bech32 support.
First will be pybtc from bitaps.com, second will be btcpy from chainside.net
Our test code:
import time
import pybtc

f = open('raw_block.txt')
fc = f.readline()
qt = time.time()
block_hex = fc[:-1]
bt = pybtc.Block(block_hex, format="decoded")
print("pybtc library parsed block in decoded format", time.time() - qt )

qt = time.time()
bt = pybtc.Block(block_hex, format="raw")
print("pybtc library parsed block in raw format", time.time() - qt )

from btcpy.structs.block import Block as btcpy_block

qt = time.time()
block = btcpy_block.unhexlify(block_hex)
print("btcpy library parsed block", time.time() - qt )

Raw block that used you can download here
Test results:
pybtc library parsed block in decoded format 0.3380300998687744
pybtc library parsed block in raw format 0.0953378677368164
btcpy library parsed block 0.6518878936767578

You can see that pybtc block parse performance is better. Decoded mode means that all bytes converted to hex and addresses to base58 or bech32. Raw mode faster, but all objects in raw bytes, addresses stored as hashes.

Check this library pybtc
Class to decode raw block
https://github.com/bitaps-com/pybtc/blob/master/pybtc/block.py#L5

Link only answers are discouraged. Add some explanation, background, anything to make this not just promotion of your own service and API.

This is not service or API this is open source library

Link-only answers are still discouraged.

Second link is now a 404 - which demonstrates the reason for discouraging link-only answers.


text:
Is the block 'chain' actually a merkle tree?
Forgive the noob question, but I have just started seriously looking into block chain and bitcoin.
I tried to implement a very, very basic version of what I understood the block chain to be to understand it better, and eventually found out that bitcoin does not store account balances. It instead references previous transactions for inputs and outputs.
This then led me to reading about the Merkle tree, and how all transactions are derived from the root of the Merkle tree. Does this mean that block chain technology does not actually represent a chain, but rather a tree structure where a certain number of transactions in a specific sub-tree constitute a block of transactions? Or have I just misunderstood it? The very fact that its called blockchain technology is throwing me off.

Every block contains a merkle tree of transactions. It is indeed a chain of blocks

So, does that mean a new block is created at the root of every subtree, comprising of the root and the children?
But the very root of the tree branches out into two, correct? Wouldn't that imply it is no longer a chain?

I meant like: --[merkle-tree]--[merkle-tree]--[merkle-tree]--- ,where every [] is a block, and it contains the merkle tree of the transactions included in the block.

Okay, so the merkle-tree is not directly interconnected?  They all terminate within the blocks they belong to?

Yes, one indipendent tree for each block

@IvanoDonadi: Please do not answer questions in comments. To answer questions, please post an answer post.

Each block contains a merkle tree of new transactions and the hash of the previous block. New transactions can consume the outputs of previous transactions and create new unspent outputs for future transactions.
Bitcoin currently does not maintain any kind of universal or canonical tree of all unspent outputs. Individual nodes are free to maintain a database of UTXOs (unspent transaction outputs) using any method they prefer.
The blocks do literally form a chain since each block contains the hash of the previous block.
Ripple works in a somewhat simpler way. There are accounts with balances that are arranged in a Merkle tree. Each ledger contains the hash of the previous ledger, a Merkle tree of transactions and the deltas to the state each transaction created, and the hash of the new Merkle tree of system state.


text:
SharedCoin vs JoinMarket, Pros and Cons of each
Can someone please clearly specify the differences between SharedCoin and JoinMarket.
What are the advantages and disadvantages of each?
How is SharedCoin centralized while JoinMarket decentralized?

I'll do my best. SharedCoin is no longer around. It used to have a centralized server which collected inputs and outputs from users then merged them into one big coinjoin transaction. They allowed you to do multiple "rounds" where the outputs from one round would roll over into the next and be coinjoined again, and they charged a small fee. A few years ago it was demonstrated that this obfuscation could be solved using what was called "coinjoin sudoku" which allowed an observer to connect certain inputs to outputs with certainty, although the computational costs of doing so were very high. This was a significant weakness, not to mention that the SharedCoins servers knew a lot about the participants.
JoinMarket is open source software for people to make their own coinjoins. It is decentralized because it uses an IRC channel to announce orders and organize transactions amongst the participants themselves. It uses a system of makers and takers. Makers offer coins to be used in coinjoins and collect a small fee, takers specify the outgoing transaction size and pay a small fee. Unlike SharedCoin, each coinjoin transaction has a handful of identically sized outputs. If I'm a taker and I want to send 1.2345 bitcoins, my transaction will have a bunch of other outputs of exactly 1.2345 bitcoins going to the makers who participated in the transaction. As far as I know, an outside observer examining this coinjoin transaction alone would have no way of connecting the 1.2345 outputs to any of the participants or input addresses.
SharedCoin's advantages would have been simplicity and ease of use (you used to be able to do it straight out of a blockchain.info wallet), plus I believe it had many more users at its peak which increases the anonymity set. JoinMarket requires a decent bit of time and technical expertise to get set up properly, but its advantages are that it gives you stronger privacy, is decentralized, and allows you to earn a modest return on your idle coins. I'm a big fan of JoinMarket and I recommend you check it out, if you're already running a bitcoin node it's not too much more work to get JM set up.


text:
64: too-long-mempool-chain
I am using bitcoind json rpc api to send bitcoin to multiple bitcoin addresses. I am using sendrawtransaction. When i have 24 unconfirmed payments sent from my account, i can't send anymore because i get this error :

64: too-long-mempool-chain

I have increased the maxmempool to 1500 but it still doesn't fix it.
root@B2:~# bitcoin-cli getmempoolinfo

    {
      "size": 3946,
      "bytes": 1789073,
      "usage": 6043088,
      "maxmempool": 1500000000,
      "mempoolminfee": 0.00000000
    }

I use Ubuntu on a 32GB RAM , 4TB HDD server.
Any ideas on how to fix it ? I want to be able to create for example 300 unconfirmed transactions and not to receive that error.

Have you tried -limitancestorcount and/or -limitdescedantcount?

No. Do i have to put that into the bitcoin.conf ? Thanks

Either in bitcoin.conf or on the command line.  These are debug/testing type options so if you want to know more you probably have to read the source code.

You will not be able create unconfirmed chain for 300 transactions. Bitcoin core default limit is 25 transactions. In case you modify this parameter on your local node, network will not accept tx chain longer then 25 tx.  You have to rebroadcast transactions again after your first batch (25) confirmed.

-limitancestorcount

Do not accept transactions if number of in-mempool ancestors is n or more

and
-limitdescendantcount

Do not accept transactions if any ancestor would have n or more in-mempool descendants

This has fixed my problem. Thanks Nate Eldredge


text:
bitcoin paper wallet--multiple addresses
Is it is true that a paper wallet has only one address and can only have one address maximum?
I want to be 100% sure when I check my balance on blockchain.info that the money is there. If someone were to take my private key, could they generate a new address and transfer money without me seeing it (since I only check the address WRITTEN on the paper wallet)?

Yes, from 1 private key you can calculate exactly 1 public key, and from 1 public key you can calculate exactly 1 address.
But suppose the attacker could generate another address, addresses are only for receiving, so they could not send it "from" the address they generate.
To sign a bitcoin transaction, the private key is used directly, so there is no way you would not see it (on blockchain.info for example).
Also, if it were possible to generate a different "sending address", there would be no traceability or value in the bitcoin ledger and keeping track of the unspent outputs would be impossible.

The bitcoin's wallet is made up of two keys, a public key and a private one. The general title of the wallet, where you can receive money from others, is exactly the opposite: it allows you to send your coins to others.
And of course your key, no one should know, so you do not steal easily, do not disclose this number to anyone.
Create a paper bitcoin wallet step-by-step.
here you can find in MY SITE more information regarding How to create paper bitcoin wallet

Please note if you want to promote your own product/blog you must disclose your affiliation in the answer, otherwise, your answer may be flagged as spam. If you are not affiliated with the site, I recommend you say so to prevent this. Please read How to not be a spammer

sorry, i am new in this site... regarding the a above link its connect to my site and i linked it because its answer the question. anyway i will read the rules


text:
What is a stub from the lightning grpc documentation?
For example, very often in the lightning documentation for their grpc api, you will see the following boilerplate python code:
>>> import codecs, grpc, os
>>> import rpc_pb2 as ln, rpc_pb2_grpc as lnrpc
>>> macaroon = codecs.encode(open('LND_DIR/data/chain/bitcoin/simnet/admin.macaroon', 'rb').read(), 'hex')
>>> os.environ['GRPC_SSL_CIPHER_SUITES'] = 'HIGH+ECDSA'
>>> cert = open('LND_DIR/tls.cert', 'rb').read()
>>> ssl_creds = grpc.ssl_channel_credentials(cert)
>>> channel = grpc.secure_channel('localhost:10009', ssl_creds)
>>> stub = lnrpc.LightningStub(channel)

I am curious, what is an LightningStub? Looking a bit deeper into rpc_pb2_grpc, which seems to be a generated file you'll find the following ( lacking ) bit of documentation:
class LightningStub(object):
  # missing associated documentation comment in .proto file
  pass

It turns out, it is grpc nomenclature. According to the documentation at grpc.io:

gRPC users typically call these APIs on the client side and implement
  the corresponding API on the server side.
...
On the client side, the client has a local object known as stub (for
  some languages, the preferred term is client) that implements the same
  methods as the service.

Which pretty much means using grpc on the client side looks like you're interacting with an object that performs the operations locally - when in reality that object ( known as a stub ) is making calls to the server asking it to perform certain actions.


text:
How to uninstall lnd on ubuntu?
lnd has been installed on my digital ocean droplet, but now I need to uninstall it as attempting to update it has corrupted the exec.
How can I uninstall lnd on ubuntu?


text:
How to check version number of lnd?
New lnd version came out recently, but I'm not sure which version I'm running. How can you check?

$ lnd --version did the trick.
Output should contain the version plus commit hash
lnd version 0.5.0-beta commit=f4305097e1638f6f8958dfa9eec941d8bf80246e

Run the command $ lnd version to see info about the version number, and the network you’re connected to.


text:
What is the difference between an SPV wallet and an API wallet?
I understand what an api wallet is, but I'm unfamiliar with what an SPV wallet details. I'd like a technical explanation on what an SPV wallet is, how it differs from traditional thin clients and how I could go about implementing one.

SPV wallet: only download block headers from blockchain network, it's kind of lightweight node, SPV wallet is able to verify the TX with Merkel branch that from full node.
There are lots of SPV wallet implementation at Github with different coding language, you can go and check it.


text:
How to determine where a bitcoin address resides
I sent bitcoins to a different address that I might own. However, I am unable to determine where that bitcoin address resides. How can I determine where it resides and or how to access that bitcoin address?

What do you mean by where it resides? If you mean who can redeem the bitcoins you have sent to the address, it will be, as @BrettDoffing said, the owner of the private key. Which kind of wallet are you using? Does the address to where you send the transaction show up in the wallet?

You cant. You can send BTC to anywhere, including addresses that will never exist.
If you're reasonably sure that the address is in use, i.e. by seeing active transactions on bitcoin.info, you could try sending a small transaction with a message in it, but it will likely be ignored.
In all probability, you lost these coins.


text:
lost wallet PLEASE HELP
Back when the article came out about the Silk Road.  I followed the instructions in the article to get into the Silk Road.  I just wanted to see it. I was prompted to buy bitcoin so I purchased a small amount.  I don't do drugs and felt guilty about it being on my desktop so I put it in the trash.  I have a Mac.  6 years later someone emptied my trash.  I wrote down the username and password.  Can anybody help me find my old wallet?

What do you mean by username and password? Was it the Silk Road username and password? Wallets that are stored locally on your computer are stored with a public key and a private key.
If the username and password that you have is for Silk Road, then your money is not recoverable. This is because they own your private keys on their site and now that they have been shutdown, you won't be able to interact with your wallet.
If you have a username and password not from Silk Road, it is more likely that you had an online wallet which means that it might still be recoverable.
Best of luck!

You need to know your account's private key or the seed that some wallets provide to recover it. Otherwise, unless you have a backup copy of your wallet.dat file, the amount of bitcoins in that account is lost forever. If you deleted only the wallet app and not its files you could try to see if you still have the wallet.dat file in memory, re-download the wallet and importing such file. It should be protected by a password that you have given


text:
How to compile sources on MAC OS in 2017?
I know there are a few questions like this on the stack already, but currently I'm facing issues with a compilation. I've tried an official guide from the github for mac os, but end up with a lot of errors.
First of all, I always get this kind of errors:
aclocal: error: aclocal: file '/usr/local/share/aclocal/introspection.m4' does not exist

and other files from aclocal.
If you have an experience, and know how to setup, or know any guides, please share share. Thanks in advance :)

Did you install all pre-requisites while following the guide? Please provide a link to the guide you're using.

Have you installed all of the dependencies? Have you followed there instructions: https://github.com/bitcoin/bitcoin/blob/master/doc/build-osx.md?

Yes, I've followed this guide step by step, all pre-requisites installed as well. ./autogen.sh was throwing alot of aclocal errors, a lot of files not found

On a Mac Pro with MacOS Sierra 10.12.6 I got a clean compilation by following the instructions in doc/build-osx.md.
The sequence of commands is:
1) First install Xcode and HomeBrew by executing (in Terminal)
xcode-select --install

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" < /dev/null 2> /dev/null

2) Then install required libraries with
brew install automake berkeley-db4 libtool boost --c++11 miniupnpc openssl pkg-config protobuf qt libevent python3

(note: I added python3 otherwise there would be errors during "make check")
3) Download and compile
git clone https://github.com/bitcoin/bitcoin
cd bitcoin
./autogen.sh
./configure
make
make check

--c++11 not necessary anymore on Macos

Searching aclocal: error: aclocal: file on google yields https://github.com/jashkenas/backbone/issues/3335
the last comment yields
https://stackoverflow.com/a/26748352/6557621
brew doctor
brew prune


text:
Can I get the size of a future transaction from Blockchain.info API?
Let's say I want to send 1 XBT to another address, from my own Blockchain.info wallet. When I try to do this transaction from the website of Blockchain.info it states the recomended transaction fee I should provide along the transaction.
But what if I would like to make this transaction happen programmatically, using the Blockchain.info API? I know that transaction fee depends on the size in bytes of the transaction that is happening. I also have a reliable information of the satoshi/byte needed for the transaction to happen in a timely manner. But is there any possible way, to get the size of the transaction, BEFORE I actually send it out using the Blockchain.info API?