Service to send Bitcoins or Altcoins over a specific amount of time? Doing it Decentralized? Is there a service that lets you send Bitcoins or more interestingly Altcoins to an address over a set amount of time. Say for example I wanted to give allowance to my daughter every week for the next year at $10 each time. This might have to be done centralized or how would this be implemented on a decentralized manner?

You can just publish a bunch of transactions with a particular nlocktime. Say you wanted to give your daughter an allowance of 0.1 BTC/week for a whole year. You can create one transaction with a locktime of next monday for 0.1 BTC, another transaction with a locktime of the monday after that for 0.1 BTC and so on for a whole year. The way bitcoin works, she'll receive the amounts every monday.

At any time, you can create a transaction to yourself to nullify some or all of the future transactions. Many altcoins will also have this feature.

Now, if you want a constant dollar amount and not a bitcoin amount, that actually will require a service. Doing that in a decentralized way is going to be really tough since exchange rates by their nature tend to be centralized.

Here's how you can make an nlocktime transaction using the excellent btcd library in go:

package main

import (
    "bytes"
    "encoding/hex"
    "fmt"

    "github.com/btcsuite/btcd/btcec"
    "github.com/btcsuite/btcd/chaincfg"
    "github.com/btcsuite/btcd/txscript"
    "github.com/btcsuite/btcd/wire"
    "github.com/btcsuite/btcutil"
)

func main() {

    // Ordinarily the private key would come from whatever storage mechanism
    // is being used, but for this example just hard code it.
    wif, err := btcutil.DecodeWIF(
        "<testnet private key in WIF format here>")
    )
    if err != nil {
        fmt.Println(err)
        return
    }

    compressed := false

    privKey := wif.PrivKey
    pubKey := privKey.PubKey()
    serializedPubKey := pubKey.SerializeCompressed()
    if !compressed {
        serializedPubKey = pubKey.SerializeUncompressed()
    }
    pubKeyHash := btcutil.Hash160(serializedPubKey)
    addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash,
        &chaincfg.TestNet3Params)
    if err != nil {
        fmt.Println(err)
        return
    }

    txStr, err := hex.DecodeString("<testnet tx that contains the utxo in hex here>")

    if err != nil {
        fmt.Println(err)
        return
    }

    rbuf := bytes.NewReader(txStr)
    var originTx wire.MsgTx
    err = originTx.Deserialize(rbuf)
    if err != nil {
        fmt.Printf("Deserialize error %v\n", err)
        return
    }
    originTxHash := originTx.TxSha()

    // Create the transaction to redeem the fake transaction.
    redeemTx := wire.NewMsgTx()

    // Add the input(s) the redeeming transaction will spend.  There is no
    // signature script at this point since it hasn't been created or signed
    // yet, hence nil is provided for it.
    prevOut := wire.NewOutPoint(&originTxHash, 0)
    txIn := wire.NewTxIn(prevOut, nil)
    txIn.Sequence = 0
    redeemTx.AddTxIn(txIn)

    addr2, err := btcutil.DecodeAddress("<destination testnet addr here>",
        &chaincfg.TestNet3Params)
    if err != nil {
        fmt.Println(err)
        return
    }
    pkScript, err := txscript.PayToAddrScript(addr2)
    if err != nil {
        fmt.Println(err)
        return
    }

    txOut := wire.NewTxOut(93889960000, pkScript)
    redeemTx.AddTxOut(txOut)

    // unix time of when the tx output will be unlocked here
    redeemTx.LockTime = 1442802900

    // Sign the redeeming transaction.
    lookupKey := func(a btcutil.Address) (*btcec.PrivateKey, bool, error) {
        // Ordinarily this function would involve looking up the private
        // key for the provided address, but since the only thing being
        // signed in this example uses the address associated with the
        // private key from above, simply return it with the compressed
        // flag set since the address is using the associated compressed
        // public key.
        //
        // NOTE: If you want to prove the code is actually signing the
        // transaction properly, uncomment the following line which
        // intentionally returns an invalid key to sign with, which in
        // turn will result in a failure during the script execution
        // when verifying the signature.
        //
        // privKey.D.SetInt64(12345)
        return privKey, compressed, nil
    }
    // Notice that the script database parameter is nil here since it isn't
    // used.  It must be specified when pay-to-script-hash transactions are
    // being signed.
    sigScript, err := txscript.SignTxOutput(&chaincfg.TestNet3Params,
        redeemTx, 0, originTx.TxOut[0].PkScript, txscript.SigHashAll,
        txscript.KeyClosure(lookupKey), nil, nil)
    if err != nil {
        fmt.Println(err)
        return
    }
    redeemTx.TxIn[0].SignatureScript = sigScript

    var buf bytes.Buffer
    err = redeemTx.Serialize(&buf)
    if err != nil {
        fmt.Printf("Serialize error %v", err)
        return
    }

    // Prove that the transaction has been validly signed by executing the
    // script pair.
    flags := txscript.ScriptBip16 | txscript.ScriptVerifyDERSignatures |
        txscript.ScriptStrictMultiSig |
        txscript.ScriptDiscourageUpgradableNops
    vm, err := txscript.NewEngine(originTx.TxOut[0].PkScript, redeemTx, 0,
        flags)
    if err != nil {
        fmt.Println(err)
        return
    }
    if err := vm.Execute(); err != nil {
        fmt.Println(err)
        return
    }

    fmt.Printf("Transaction successfully signed %v\n", hex.EncodeToString(buf.Bytes()))

}


What are the possible Version Bits votes? I don't fully understand how version bits voting works, but I'm trying familiarize myself with the current options.

Are these the most popular for voting at the moment?

0x20000000 = Bitcoin Unlimited?
0x20000002 = Segwit?
0x20000007 = XT?
0x30000000 = 2MB Blocks?

Is there a list of them in one place anywhere?

Also, is it correct to say that each vote corresponds to a specific BIP?

Most of what you ask about doesn't have anything to do with Version Bits actually. :)

Let's start from the top:

nVersion is a four byte (32 bit) field in the block header. The version field was first interpreted as an integer with the genesis block introducing version 1. Later the network was softforked to create blocks of version two. From that point on it was required that all blocks have a version number equal or bigger than two. Expressed in binary, two is 0010. Since the version field is little-endian, this meant that going forward it was thus required that the first three bits in the version field had to be 001.

BIP0009: Version Bits introduced the idea of interpreting the remaining 29 bits as flags instead of interpreting the whole field as one integer. It's also less of a vote but rather a signal of readiness for a softfork proposal. The readiness is expressed by setting the respective bit to 1 in the version field. (More rules for using Version Bits are specified in BIP0009.) It is thus possible to signal readiness for up to 29 softfork proposals at the same time. Therefore each Version Bits field corresponds to signaling about all softforks currently in deployment.

Out of the proposals you list, only SegWit uses Version Bits for deployment: List of version bit deployments. None of the other mentioned proposals is a softfork, and they don't make use of Version Bits for deployment. Instead, they communicate support by setting the Coinbase text.


Export keys from MultiBit to Android Bitcoin Wallet? Is there a way to export a wallet from MultiBit to the Android Bitcoin Wallet?

The format used for exporting the keys is the same for Andreas Schildbach's Bitcoin wallet and MultiBit so basically the answer is yes.

I have done it from my phone to MultiBit by emailing the private key backup from my phone and then importing it into a new wallet created in MultiBit.
The encryption used is the same so the password you use to encrypt it on your phone is the one you use in MultiBit when you import it.

(You get an extra address in the newly created wallet in MultiBit by default - I just label it 'do not use' and never use it.)

I expect you could export it from MultiBit, copy onto an SD card and then import it on your phone to go the other way.


Test network completely removed from the real network? I know of the testnet Bitcoin provides, but is there any framework or simulator of the Bitcoin network which I can use to test on my local machine? I would like to edit parts of the code and simulate the responses of the real network without actually interacting with it.

There is a section in the Bitcoin Developer Guide on Testing Applications. The section you are interested in is likely to be Regtest.


Mining Litecoins as User in Debian I followed this tutorial https://litecoin.info/Debian_Linux_cryptocoin_mining_rig_setup_guide and set up a Mining rig (Debian 6.0.10). Sometimes I modified it (downloaded later graphics drivers than in the Tutorial sugestet etc) but it works and I can mine on a pool.

But I can mine only if I log in as root. If I log in as a normal user and type cgminer --verbose -T, I get the following error:

 [2015-02-15 22:36:50] Started cgminer 3.7.2
 [2015-02-15 22:36:50] Loaded configuration file /home/martin/.cgminer/cgminer.conf
No protocol specified
No protocol specified
No protocol specified
 [2015-02-15 22:36:50] CL Platform 0 vendor: Advanced Micro Devices, Inc.
 [2015-02-15 22:36:50] CL Platform 0 name: AMD Accelerated Parallel Processing
 [2015-02-15 22:36:50] CL Platform 0 version: OpenCL 2.0 AMD-APP (1642.5)
 [2015-02-15 22:36:50] Error -1: Getting Device IDs (num)
 [2015-02-15 22:36:50] clDevicesNum returned error, no GPUs usable
 [2015-02-15 22:36:50] All devices disabled, cannot mine!

I tried setting all privileges in the folders in root - which are used for litecoin mining - to 777 and to change the owner to the usual user, but it didn't work. I copied the file /root/.cgminer/cgminer.conf to /home/user/.cgminer/cgminer.conf, set the user and the right to this file, but this didn't solve the problem too.

But why can only root access the OpenCL functions which are used, why can not the normal user do so?

Thank you.

You should be able to add your current user to the plugdev group in Linux to be able to access the GPU as a standard user.  This can be accomplished by the following command:

  sudo usermod -G plugdev -a whoami

There may be some additional bits of information that are relevant in the README on the cgminer website.


What if the execution time for an alt coin script exceeds the block time? I don't know when and how often a script is executed, but it seems to me that there would be a problem if a single script (or a sum of all scripts in a block) exceeds the time it takes to be included in a block.

Given that the trend in alt coins is to decrease the block time duration,  I think this could become an issue or race condition where the TX never gets included in a block.

Considering that as the various alt coin block sizes grow ... Perhaps larger than 1mb, this risk would grow as well, given the higher quantity of transactions.

So my question is:

When are transaction scripts evaluated (or not )?

I heard that certain old TX scripts aren't validated during the initial sync to speed up the process, so perhaps there are other times that a TX isn't executed. (Perhaps it's an unknown script.)

What role does CPU load have on the network and the risk of a fork?

Perhaps only miners are only affected.... I'm unsure.

If the network running full nodes has capacity issues with either CPU or bandwidth could a fork occur?

You shouldn't need to worry about this ever happening.

There are no loop opcodes in scripts. Every script opcode can only be executed once, and the slowest opcode is probably ECDSA signature verification (because it involves EC_point_multiply). Even so, it only takes about 50~100μs on a single core of a modern CPU to process.

Let's assume a 1MB block (max size) contains 100% signature verification opcodes, that's 1 million signature verification and takes at most 100 seconds CPU time of a single core, this is still much lower than the block time. In practice each scriptSig is accompanied by at least 100 bytes of data (pubkey + ECDSA signature) so it probably takes less than 1 second of CPU time.


Working Implementations of BIP85 Can anyone point me to working implementations of BIP85?
The only one I'm aware of is the Coldcard Wallet implementation.

As of today (2020-08-13) there are seem to be none. I've opened some tickets. Hopefully developers find some time to implement.


Will a Litecoin LTC transaction with a low fee of .001 confirm? Will a low fee of less than .001 ltc confirm using the coinomi wallet? And if it doesn't how long do you have to wait for it to return the coins back to you?

I have seen transactions with 0.000224 fee are also getting confirmed.

So we can say 0.001 LTC fee is too good.

You can check current fee here

https://bitinfocharts.com/comparison/litecoin-median_transaction_fee.html#3m


How do we know how many BTC have not been spent since being mined? Any tool to see this information? I would like to know how many BTC have not moved from the block they were mined in - never transferred or spent. (With this information I believe could have an idea of how many BTC have been lost). Is there a tool to see this kind of information?

I don't think your question quite makes sense. Bitcoins aren't "transmitted", they simply sit in the block chain until someone chooses to spend them. There's no way to tell if a particular Bitcoin is lost or not because that depends on whether anyone knows they key needed to claim it. That key could be written on a piece of paper for all we know.

When your client tells you that you have 50 Bitcoins, it is doing that in a purely passive way. Nobody can tell that your wallet contains the keys needed to claim those Bitcoins, and this is by intentional design.

You could fairly easily measure how many coins hadn't been spent since they were mined. But that wouldn't really tell you anything. Some of those coins may have lost keys and some may not. And some coins may have been spent once and then lost.


Send data to bitcoin blockchain Is it possible to send a transaction containing hashed values in the body of it to no one? I explain better. I would like to store data on bitcoin and I would need to send a transaction containing this value but not to any specific address. I could i do it?

It's storing data on bitcoin blockchain is not a good practice but is possible to create a transaction with a special script.

The transaction name is Transaction null data, a little introduction on this type of the transaction is here


How Does Network Difficulty Relate to the Odds of Finding a Block? Right now the network difficulty for mining is 40640955016.576. And, according to blockexplorer.com, the current odds of finding a block for any given hash is 0.0000000000000000000057288784391318092718842084135055792.

My question is, how is the "difficulty" and the odds of finding a block related? Obviously a difficulty of ~4 billion does not mean there's a 1 in 4 billion chance of finding a block (any modern ASIC miner could find a block in a heartbeat). So what does it mean exactly and how does difficulty and odds relate? And how can one calculate the odds based on the difficulty?

The difficulty is calculated in multiples of difficulty 1, which is defined as a probability of a single hash to be valid of 1/(2^32), i.e., in expectation one PoW is found by iterating through all 2^32 possible nonce values.

So given a difficulty of 40640955016.576 we have a probability for a single hash to be a valid PoW of 1/(2^32*40640955016.576). This in turn results in the ~5.72e-21 given by blockexplorer.


Bitcoin Core Re-install- Don't want to Overwrite Chain Previously Downloaded I have a full Bitcoin chain that I downloaded using Bitcoin Core (v.0.18.0.0, from Ubuntu's launchpad bitcoin ppa).  I've moved to another machine and installed the Snap linked from BitcoinCore.Org, pointing it at my .bitcoin directory.  When I run it, I get the following message.  Before I hit "OK", I want to make sure I'm not going to nuke my already downloaded chain.  Can anyone confirm?

As this is the first time the program is launched, ... Bitcoin Core will download and store a copy of the Bitcoin block chain....  The wallet will also be stored in this directory.
[ ] use the default data directory
[x] use a custom data directory
When you click OK, Bitcoin Core will begin to download and process the full Bitcoin block chain (320GB) ....
[ ] Discard blocks after verification, except most recent 2 GB (prune)

Also, it's been a while since I looked, but the Ubuntu PPA stable channel is now saying:

NOT MAINTAINED. The OS-library linking packages here had a series of issues.
PLEASE DOWNLOAD DIRECTLY FROM bitcoincore.org ...

Is there any chance running that Snap might cause any issues with my wallet and already downloaded blockchain?

The Snap (v.0.20.0) is having various issues, some of which are mentioned here.  As mentioned above, the Ubuntu PPA is saying that it shouldn't be used.  There is apparently a second PPA that is at least semi-official.  That works and doesn't overwrite my chain.


API for automatical buying and selling coins in Java I need to create a simple bot for buying and selling coins and the programming language needs to be Java due to some technical specifications.
These are the functions which I need from that API:

buy(args)
sell(args)
getCurrentPrice(args)

If you know any API-s which are reliable and suitable for Java, please let me know.

Pretty much every exchange offers their own APIs for trading.  Take a look at kraken.


Need to access remote bitcoin node for Lightning I am running a full node on a static IP and I can open up whatever ports needed to communicate with that node.

I need to figure out how to communicate with that full node remotely.  I want to run an implementation of lightning but don't know what is best to use, LND, C-lightning, Eclair, etc.

I will be traveling and will have my lightning on a USB stick and then want to communicate with my remote full node.

Is this even possible ?

Instead of completely opening up RPC ports to the whole internet, I would do something quite different. Here, you're relying on the strength of your RPC auth credentials and the implementation being bugs free. Bitcoind itself strongly discourages to do what was suggested in the other answer:
  -rpcbind=<addr>[:port]
   Bind to given address to listen for JSON-RPC connections. Do not expose
   the RPC server to untrusted networks such as the public internet!
   This option is ignored unless -rpcallowip is also passed. Port is
   optional and overrides -rpcport. Use [host]:port notation for
   IPv6. This option can be specified multiple times (default:
   127.0.0.1 and ::1 i.e., localhost)

I solved it on a network level: Since I have SSH port open anyway (though on a non-common port just for that extra little bit of obscurity on top of the obviously non-obscurity-reliant security), I opted for SSH tunneling.
LN Node
Basically I have a systemd service on the LN node that starts after boot and creates an SSH connection to my Bitcoin node. Through that tunnel, it can access the node's RPC port 18332 (testnet). The port is not exposed directly to the internet this way, instead only reachable via SSH.
The service is mostly stolen from https://avizard.blogspot.com/2021/01/aggressive-yet-sane-persistent-ssh-with.html.
$ cat /etc/systemd/system/autossh_systemd_unit.service
[Unit]
Description=AutoSSH service to remotely access RPC of Bitcoin node
#After=network-online.target
# Use this instead if autossh will interact with the local SSH server
After=network-online.target sshd.service

[Service]
User=[NONPRIV_USER]
Environment="AUTOSSH_GATETIME=30"
Environment="AUTOSSH_POLL=30"
Environment="AUTOSSH_FIRST_POLL=30"

ExecStart=/usr/bin/autossh -M 0 -N -q \
-o "ServerAliveInterval 10" \
-o "ServerAliveCountMax 3" \
-o "ExitOnForwardFailure yes" \
-p [SSH_PORT] -l [USER] [HOST] \
-i [SSH_KEY] \
-L 18332:127.0.0.1:18332 #sleep 10
# We set 'sleep 10' to make ssh exit in case no TCP connections are forwarded in 10 seconds.
# Useful to get remote shell exit codes.

ExecStop=/usr/bin/kill $MAINPID
ExecReload=/usr/bin/kill -HUP $MAINPID

Restart=always
# On Linux TCP_TIMEWAIT_LEN is not tunable and set to (60*HZ), about 60 seconds. TCP_FIN_TIMEOUT also defauls to 60 seconds.
RestartSec=60

# See systemd.kill(5)
KillMode=process

[Install]
WantedBy=default.target

Bitcoin Node
Additionally, the ufw firewall on my Bitcoin node only allows SSH access from 2 specific IPs which are the one which my Lightning node runs on and another one from which I manage my stuff.
$ sudo ufw status
Status: active

To                         Action      From
--                         ------      ----
8333                       ALLOW       Anywhere                   # Bitcoin Mainnet
18333                      ALLOW       Anywhere                   # Bitcoin Testnet
[SSH_PORT]/tcp             ALLOW       [LN_NODE_IP]               # SSH
[SSH_PORT]/tcp             ALLOW       [MGMT_IP]                  # SSH
8333 (v6)                  ALLOW       Anywhere (v6)              # Bitcoin Mainnet
18333 (v6)                 ALLOW       Anywhere (v6)              # Bitcoin Testnet

Lastly, all users can only be logged into with autorized SSH keys and the LN node doesn't hold a key to a superuser account, instead the only user that machine (server) can always access is a non-privileged user. This means in case the LN node gets taken control of, my Bitcoin node is still fine.
$ cat /etc/ssh/sshd_config
[...]
Port [SSH_PORT]
[...]
PubkeyAuthentication yes
[...]
PasswordAuthentication no
[...]

Additionally, an IDS would be advisable on both machines, but the setup for that exceeds the scopes of this question.
I would be interested to hear what other options people use!


Litecoinj transaction sent to unknown address I have used litecoinj-core-0.15 to generate a transaction to address MD1AYTZnTtGKQToj2LTD7qLsSzrqcdXr9J.

Litecoinj generated a transaction with two outputs. The first one (to LaPJ9TfBr6E2MSRa4t1MMhFPQAue4osUn8) corresponds to the change address. The second one is an address that I cannot understand the origin: LQKxaEyD3XLZmbXYyVna9aoJBzLxAhNS4S. I have tried to find it in the list of refund, change, receive_fund, and authorisation addresses of the Wallet and could not find it there.

Could someone explain from where is this address coming?

Kind regards, and thank you in advance,
António.

I looked into this by converting the addresses from base 58 to hex. What I got was this:
MD1AYTZnTtGKQToj2LTD7qLsSzrqcdXr9J -> 0x3237fb62589f848d3808f0b9bfe9762edabe150b93f409d315
LaPJ9TfBr6E2MSRa4t1MMhFPQAue4osUn8 -> 0x3037fb62589f848d3808f0b9bfe9762edabe150b93bab51bf3

Notice that the positions from byte 1 to byte 20 are the same: 37fb...0b93.

This is unfortunately bad news and means that the software you are using is bad.

The address that starts with M or 3 in Litecoin are pay-to-script-hash addresses (P2SH) and the software should have created P2SH outputs but it has for some reason instead created pay-to-public-key-hash outputs (P2PKH) as you can see here:

{
          "value": 15149,
          "script": "76a914a64e3a77893db78edfb3ba4abfa2106f84ba80eb88ac",
          "addresses": [
            "LaPJ9TfBr6E2MSRa4t1MMhFPQAue4osUn8"
          ],
          "script_type": "pay-to-pubkey-hash"
        },

The funds you have sent are unfortunately lost and you should stop using this software immediately since it only seems to support P2PKH addresses and not P2SH addresses.

If it is any comfort, you are not the first one to make this mistake.


Can I prove a double spend attempt with a signed tx with same input? I am designing an cross-chain atomic swap in a custom blockchain - Protoblock. I think it can be done as long as Protoblock knows how to parse p2pkh bitcoin transactions. The critical part is being able to "reverse" things when it sees a double spend.

Alice has 1 Bitcoin
Bob has 100 Fantasybit
Alice will swap 1 BTC for Bobs 100 FB

Step1) Bob signs a Protoblock "Swap" transaction(TX1a) that contains an unsigned bitcoin transaction(TX1b) that must have 1. a ScriptSig input with p2pkh from Alice(bitcoin-address) and 2. a p2pkh output to Bob(bitcoin-address)

Step2) 100 FB of Bobs is locked for 24 hours or until...

Step3) a Protoblock transaction(TX2a) is seen that contains the signature for TX1b and TXID(TX1a)

Step4) 100 FB is transferred to Alice and is locked for 24 hours or until...

Step5) a Protoblock transaction(TX3a) is seen that contains a signed bitcoin transaction(TX2b) that has 1. the same ScriptSig input(s) with p2pkh from Alice(bitcoin-address) as TX1b and 2. an output that is NOT a p2pkh output to bob(bitcoin-address)

Step6) 100 FB is sent back to Bob, the same state as before Step1

The reason for Step5 is that, a signed bitcoin transaction is not enough to prove that Bob received the bitcoin from Alice, because Alice could just sign the transaction, but not spend it to bitcoin, and just double spend it.

However, Bob will see that Alice spent the input and will create TX3a that gives him back his 100 Fantasybit. In fact, anyone can be watching bitcoin and create TX3a as a service for Bob.

Question: is there a way that Alice can spend the same inputs from TX1b, that will be undetectable with above algo?

Note: the bitcoin transaction with the outputs for the TX1b inputs, will be created by the wallet software doing the atomic swap. So Alice will first have to send her 1 Bitcoin to herself to make sure its a simple p2pkh. Here is the Protoblock code that creates the p2pkh outputs and bitcoin tx:

https://github.com/SatoshiFantasy/--skillSale/blob/4e59f50b7555527046804418d6483b0df1933637/share/fantasybit-core/FantasyAgent.cpp#L444

https://github.com/SatoshiFantasy/--skillSale/blob/4e59f50b7555527046804418d6483b0df1933637/share/fantasybit-core/FantasyAgent.cpp#L525

No Atomic Swaps are by definition atomic meaning either there's a swap and both parties redeem the coins or no . I suggest you take a look at the Decred repository to understand the mechanics of the swap .


Where can I go to read up on encryption methods used in Bitcoin? Where can I go to read up on encryption methods used in Bitcoin? I am particularly interested in the idea that I can use a private key to sign something and it proves to the world I have the private key but yet does not reveal the actual key.  This is a topic of mystery to me, how this is done.

Here's a short explanation that might help you understand it. It's grossly oversimplified but just designed to help you get the general idea.

Imagine a world in which multiplication and addition were irreversible. That is, division and subtraction do not exist. It is not too difficult mathematically to create a world where division and subtraction are trillions of times more difficult than multiplication and addition, so for practical purposes, division and subtraction are impossible.

Now, let's say we all agreed on a very large number. Call it G. It's some big number we all agree on.

Now, you can pick a random number and store this someplace very safe. Call it your "private key", S (for secret). Now, multiply it by G. Call the result your "public key", P. You can tell anyone your public key. Since they can't divide it by G, your private key will stay private.

Now, say you want to "sign" something, O. What you do is you take that something, add your secret key to it, and publish the resulting number. So you publish: O+S, that's your signature

First, nobody can tell your private key from that number. They'd have to subtract, and that's not practical. And nobody else can produce that number, they'd have to know your private key to know what to add to O.

So all we need is for someone to be able to prove that's the "right" number and we're there -- and they can do that. Why? Because G * (O+S) = G * O + G * S.

They know what you claim is O+S ... the signature. G*S is your public key. And they know O. So with just some addition and multiplication, they can compute both G * (O+S) and G*O + G*S. So they can check if the number you published really is O+S if those two are equal, thus that the person who computed it knew your private key, and thus it functions as a signature.

The challenge, of course, is to create systems in which multiplication and addition are possible but subtraction and division are not. And there the math gets complicated. Bitcoin uses a system where division requires discrete logarithms and a change to the algorithm so that it doesn't matter if addition is reversible.


Why doesn't my transaction go through? I ask to buy for 253, price drops below, the transaction does not go through, and it goes up again.

Explanation anyone? or is this something i should ask the mt.gox staff?

MtGox is a roach sack of bugs. People start with it for liquidity and fame, but it is the least reliable bitcoin exchange. Anything else is better.


Creating my own script for proof of reserves I recently came across the topic where exchanges have to constantly give a proof of solvency to prove that they hold enough bitcoin for it's clients. I was however intrigued by the way an exchange would give a proof of reserves. I was trying to build a script for generating the proof of reserves using the Invalid input scheme to prove the reserves of bitcoin a node holds. Are there any resources which I can refer to for the same?I have been struggling to find any. Any help would be very much appreciated.

A proof of reserve via invalid input is not necessarily constructable by regular means, due to a few reasons.

Proving you own all utxos in a single tx may result in a tx that is too large - while this isn't a problem for the proof, any sane wallet will refuse to construct such a tx
Using invalid inputs by definition requires you to sign an invalid tx - any sane wallet will also disallow this.
In trivial cases, a proof via invalid inputs is unnecessary - if all your coins reside in p2pkh addresses or simple multisig addresses, a single signed message signed with all the keys involved (along with appropriate redeemscripts) is sufficient.

That said, if you really do want to use a proof of reserve with invalid inputs, you can construct a raw transaction consuming all the inputs, add an invalid inputs (a utxo that doesn't exist, or has already been spent), and then sign it with any bitcoin signing tool or library - any tool that supports offline signing should have little trouble signing it (although you may still get hit by validation issues if the resulting tx is too large).


having trouble installing electrum, can't find libsecp256k1 I'm having trouble running electrum from source.

Seems I need to install libsecp256k1 (but I have bitcoin core v.18 installed so i thought i already had it). Electrum has docs about this: https://github.com/spesmilo/electrum-docs/blob/master/libsecp256k1-linux.rst#1-using-package-manager. But this command doesn't find anything on linux mint???

Traceback (most recent call last):
  File "run_electrum", line 80, in <module>
    from electrum.logging import get_logger, configure_logging
  File "/home/zach/electrum/electrum/electrum/__init__.py", line 3, in <module>
    from .wallet import Wallet
  File "/home/zach/electrum/electrum/electrum/wallet.py", line 50, in <module>
    from .simple_config import get_config
  File "/home/zach/electrum/electrum/electrum/simple_config.py", line 13, in <module>
    from . import constants
  File "/home/zach/electrum/electrum/electrum/constants.py", line 30, in <module>
    from . import bitcoin
  File "/home/zach/electrum/electrum/electrum/bitcoin.py", line 34, in <module>
    from . import ecc
  File "/home/zach/electrum/electrum/electrum/ecc.py", line 45, in <module>
    do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1()
  File "/home/zach/electrum/electrum/electrum/ecc_fast.py", line 189, in do_monkey_patching_of_python_ecdsa_internals_with_libsecp256k1
    raise Exception('libsecp256k1 library not available. '
Exception: libsecp256k1 library not available. Verifying Lightning channels is too computationally expensive without libsecp256k1, aborting.`

Bitcoin Core does not install libsecp256k1. It is packaged into the binary itself so it is not installed into the system. If libsecp256k1 is not available in your system's package managers (which it probably shouldn't because it isn't officially distributed AFAIK), you can install it from source. The instructions for that are directly in the README.


Is it secure to collect common public addresses under a wallet using BlockCypher Wallet API I am working on an exchange platform with users having separate pair of public and private keys using blockcypher api. I encountered Blockcypher Wallet API, and it seems its a pleasant way of collating Set of Public Addresses to Query Together. For some reasons, i intend to add all new generated public addresses created by any user under a single wallet name (the site name) using the "Wallet API", this will come in handy in the case where by i need to filter all incoming transactions webhook to only the public addresses under the site name into a callback url. So i needed to confirm if this is a secure way to handle it. I would appreciate if an elegant way to handle this can be suggested.

When using a third party, you will be trusting them to give you correct information. This is not just about being dishonest but also about not having bugs.

For instance consider the recent cve-2010-5141 vulnerability. If you are running a full node on your own, you can know what is going on and you can upgrade when you find out about it. But if you rely on a third party you have to trust that they upgrade and are aware of it.

As a matter of fact they apparently have not yet upgraded and on TestNet they are showing a block with exploiting transaction as valid. So theoretically you, as an exchange, can lose money if you were relying on them and if this was MainNet.


Do public bitcoin nodes have a public page to view node data? And if so can one add additional information to it? Do public bitcoin nodes have a public page to view public node data? Example is from monero public nodes: http://node.xmrbackb.one:28081/get_info -- it shows the node information.
Do Bitcoin public nodes have a public page that is accessible by the public? And if so, how can one add in additional values like for example a bitcoin address or an email address?

No, there is no such thing.
Bitcoin nodes in general only speak the P2P protocol with the public, not HTTP.


How can I earn an income from my bitcoins without revealing my identity or relinquishing control of my bitcoins? I have some Bitcoin. I don't want to part with them, but I need an income.
I'm trying to have it so that, somehow, my Bitcoins generate a small sum monthly in fiat, to my bank account.
While going through a list of "Bitcoin loan" sites, it seems that all require me to deposit the coins into their custody. I do not trust a company to hold my coins. I'm worried about exit scams or being locked out. Anything that requires KYC/AML is a no-go for me, as services have closed accounts on me before without explanation.
Is there a way to generate an income from bitcoins without giving up control? Can I earn a monthly fiat just because I own them? Or will any such offering require me to part with my coins? I just can't do that to my satoshis, or to myself.

Bitcoins are a non-productive asset. Lending services earn revenue, because they lend out the coins they borrowed from you to someone else. They connect lenders and borrowers, take most of the risk and a cut. There is some risk involved, which is why there is revenue to be earned in the first place. Without you handing the coins into the service's custody as collateral, it's unclear how the service would make any money, so they would not have any reason to pay you. More traditional forms of credit usually require you to provide your identity and a list of your assets as collateral.
Unfortunately, there is no such thing as a free lunch. Nobody is going to give you something without you either providing value or taking a risk.


Can you search a transaction by quantity? I have been looking and I cant figure out a way to find a recent transaction by quantity. Let's say I know someone sent "x" amount of BTC but I don't know who was the sender nor the receiver, this transaction however was very recent, less than an hour ago. Can I search for transactions in the blockchain by quantity sent or received?

Something like the "recent transactions" tab on blockchain.info but a complete log of that.

Thank you very much!

There are at least 2 options that I am aware of:

https://www.goochain.net/
https://github.com/bitcoin-abe/bitcoin-abe

The first option is a web based tool that will search the block explorer of your choice. The second will take the blockchain and load it into a database which you can search for your desired criteria.

I just ran a test search on goochain with the criteria below and found 26 transactions:

From : 2016-05-03 Tue 03:00 UTC

To     : 2016-05-03 Tue 04:00 UTC

3.1 BTC ≤ Amount ≤ 3.2 BTC


Will Bitcoin mining stop? According to this site there are 3,260,162.5 bitcoins left to be mined. Do you know if eventually Bitcoin mining will stop after that? If yes which other cryptocurrency can be mined for ever?

Thank you

The discontinuation of newly mined bitcoins does not mean that there will be no block rewards. Block rewards come from confirmed transaction fees also.


How to get block header hex? I am trying to research hash functions and I want to be able to use bitcoin's mining outputs as hashes. I am curious about where the actual hex value of the data that generates that hash with a lot of zeroes is. So, this is what I want: the 80 byte input that gives a 32 bit output with a lot of zeros from sha256(sha256(x)).

I am curious about where the actual hex value of the data that generates that hash with a lot of zeroes is.

It is a composite of values from the block - in brief, it is the concatenated binary (represented here in hex notation) little endian value of each of the fields:

version + previous_block_hash + merkle_root_hash + time + bits + nonce

of the block that is being mined.

These are contained in the "block header".

You have examples of Python code here: https://en.bitcoin.it/wiki/Block_hashing_algorithm , for example for block 125552:

>>> import hashlib
>>> header_hex = ("01000000" +
 "81cd02ab7e569e8bcd9317e2fe99f2de44d49ab2b8851ba4a308000000000000" +
 "e320b6c2fffc8d750423db8b1eb942ae710e951ed797f7affc8892b0f1fc122b" +
 "c7f5d74d" +
 "f2b9441a" +
 "42a14695")
>>> header_bin = header_hex.decode('hex')
>>> hash = hashlib.sha256(hashlib.sha256(header_bin).digest()).digest()
>>> hash.encode('hex_codec')
'1dbd981fe6985776b644b173a4d0385ddc1aa2a829688d1e0000000000000000'
>>> hash[::-1].encode('hex_codec')
'00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d'

Note that the value is reversed at the last step in order to be represented in the big-endian format that we humans are used to.

  So, this is what I want: the 80 byte input that gives a 32 bit output with a lot of zeros from sha256(sha256(x)).

You can check these 6 values for every block mined using any one of the many online block explorers available: for example here for the particular block of the previous example: https://blockexplorer.com/block/00000000000000001e8d6829a8a21adc5d38d0a473b144b6765798e61f98bd1d (you'll only have to convert the human time to unix time being careful with the time zone).

Here is a quick link to download blocks' headers in binary form (until May 2018) and start playing with real values. You can convert it to .csv if needed.


How do you make a good choice of server host to run an exchange on? I was looking at Amazon Web Services recently but they are based in the US - maybe not a good idea following what happened with mtgox.

I then looked at Linode as they have a pretty solid reputation, but I am concerned with the security issues they have had (bitcoinica lost all their funds because someone hacked the actual Linode admin panel, and I am still seeing security issues on their news in 2013).

I have what I think is a novel idea for an exchange and want to try and get a toy hobby project up and running... but how do you choose a server with good ram so it handle a surge in traffic? The ones I listed above are examples of what I don't want.

First of all, don't even consider using VPSes for these things. As long as there's a layer above the OS that can be hacked, the data cannot be safe.

Also, if things are going to be safe, you're going to need at least several machines. The machine that stores the bitcoin wallet information shouldn't be connected directly to the internet, and should not run on the machine that also handles the website.

As long as your server is an actual physical server at a company you can trust, you should be fine hardware-wise, as long as you don't run out of resources.

Of course, software is a far more important factor here. VPSes should be considered untrusted, as there's software running on the machine that you cannot control. As I already mentioned, don't run the webserver on the same machine where the wallets are stored, because a programming error can probably allow attackers to access those wallets.

Don't assume that network traffic between your servers is safe: a routing error or packet interception can cause a lot of trouble for you. Always encrypt traffic between the machines.

Don't trust closed-source software, and don't use beta quality software. They tend to contain more bug than open source software used by lots of people.

Always assume that your own code sucks. This is a very important part. Even if you're an extremely good software developer who has ten years of experience with security, you're going to make mistakes in your code. These things can be code injections that allow attackers to steal password, exploits that allow attackers to view the source code, etc.

But the most important part is that if you read this answer and learn new things about security, you shouldn't be starting a bitcoin exchange. You are dealing with people's money here, and if this answer taught you anything new, you definitely don't know enough about security to start a bitcoin exchange.


Why do miners seem to be using consecutive letters for the Coinbase transaction text? If you look at coin.dance, it looks like the coinbase transactions text start with consecutive letters. For example, block 478529 starts with "AM" and 478530 starts with "BM" and 478531 starts with "CM" and so on. This continues with DM, EM, ... all the way to ZM despite being mined by lots of different miners.

This looks coordinated in some way. Why is this? Can't the coinbase text be whatever the miner wants?

According to BIP 34 the coinbase transaction is required to start with the block height.  The format is a single byte giving the count of bytes to follow (currently 3) and then the block height in little-endian. See Why block height is required in coinbase? for more on the rationale.

478529 decimal is 0x074d41 in hex, so this block's coinbase must begin with the bytes 0x03 0x41 0x4d 0x07.  0x41 0x4d happen to be the ASCII codes for the letters A M.

Likewise, 478530 decimal is 0x074d42, so we start with 0x03 0x42 0x4d 0x07, and 0x42 0x4d is B M.


What is the difference between adjusted and reported volume for exchanges? I'm trying to get an idea of exchange ranking in terms of trading activity (i.e. volume). I've had a look at www.coinmarketcap.com. There are 3 sortings which are rather different:

Exchanges by adjusted volume
Exchanges by reported volume
Exchanges by liquidity

How are adjusted volume and reported volume different? Why are the rankings on both so different? I also had a look at https://nomics.com/exchanges which gives yet another ranking different from the ones above.

According to some research, reported volume is inflated by up to 95%. The figures in adjusted volume usually either remove exchanges whose reports are unreliable or attempt to determine the actual volume in some fashion. One source of highly increased volumes is that some exchange take fees for deposits and withdrawals but no fees on trades. Many sites remove trades without fees in their adjusted volume metric.

Liquidity pertains to the volume of the order books of an exchange.


What stops someone from faking a rating on OTC web of trust? What mechanisms does OTC web of trust have against someone creating several accounts and trading between with themselves over a period of time, giving each other perfect ratings.

The global ratings are fairly easy to manipulate as you describe, and it has been done before. There is some minor protection provided by the requirement that you need a positive OTC rating to rate anyone else.

#bitcoin-otc also supports "trust rating" (example) which can't be easily manipulated.


How does bitcoin prevent someone from sending more money than he/she has? I am new to bitcoin, I was wondering how bitcoin implements this particular functionality efficiently. Does it check through all blockchain records for the address of the sender. Or does each transaction store a list of previous transactions by the sender?

I am curious as to how this can be implemented efficiently?

This is called the "double-spending" problem. There's an excelent article on the Bitcoin Wiki that covers the entire mechanism.

https://en.bitcoin.it/wiki/Double-spending


Where can I turn the unique hash result of SHA256 to bitcoin? i watched on youtube from 3Brown1Blue channel about "how bitcoin works", it said what makes bitcoin valued is come from the unique hash result of SHA256. for example if someone put string to an argumen function SHA256 like SHA256("Hello World!") and consider the result of hash 000006d40bf420404a011733cfb7b190d62c65bf0bcda32b57b277d9ad9f146e, there's 5 zeros at first which we can say unique result. Then that's result make bitcoin valuable.
Now what if I found another unique result hash of SHA256 with just SHA256 encryptor online manually? How to add it to blockchain so my identity is approved by blockchain watcher that I have it value and how do I get the reward from it?

Bitcoin does not reward you for finding just anything that hashes with enough zeroes at the front, it rewards you for finding blocks whose hash is less than the current target (which gives the appearance of requiring a number of leading zeroes).
A block is a data structure that contains Bitcoin transactions as well as a header with some additional information, such as the previous block's hash, a timestamp, nonce, version number, and the hash of all of the transactions in that block. This block header is what must have a hash less than the target. If you submit to the network something that is not a validly formatted block header, then, regardless of the hash, it will be rejected. Note that you don't just submit a hash, you submit the data that is hashed, along with the hash, so that nodes can independently verify the hash.
Lastly, miners are not rewarded by "blockchain watchers" nor are their identities known or approved. Miners are rewarded because they include a transaction in their blocks that pays themselves. This transaction must meet the rules for payouts, but the payment is up to the miners to claim by them making the transaction and including it in the block that they found. This transaction could pay to whomever the miner wants to, and it can pay to multiple people as well. It can also pay to nobody and instead burn the coins. The payment does not come from somebody else who verifies the miners' identities.


Bitcoin Script: mandatory-script-verify-flag-failed Script failed an OP_EQUALVERIFY operation I try to spend a P2SH transaction (in regtest) with a timelockscript of 200 blocks. I got the following error:

  mandatory-script-verify-flag-failed (Script failed an OP_EQUALVERIFY
  operation) (code 16)

Unfortunately I can't find the error, as the script and the sequence seems to be fine.

decodescript 02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988ac
{
  "asm": "200 OP_CHECKSEQUENCEVERIFY OP_DROP OP_DUP OP_HASH160 023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a9 OP_EQUALVERIFY OP_CHECKSIG",
  "type": "nonstandard",
  "p2sh": "2NF4BoboM58w8JJgdvbe7i6J3R8Kb3Gugqi",
  "segwit": {
    "asm": "0 da6ffdda71c413d3b26344158aac0f086bf5d979df2b81f9551da5ef62ee71b0",
    "hex": "0020da6ffdda71c413d3b26344158aac0f086bf5d979df2b81f9551da5ef62ee71b0",
    "reqSigs": 1,
    "type": "witness_v0_scripthash",
    "addresses": [
      "bcrt1qmfhlmkn3csfa8vnrgs2c4tq0pp4ltktemu4cr724rkj77chwwxcq84ftzy"
    ],
    "p2sh-segwit": "2MvKhZeGAV5KpkQXYnB4BydLMwMZGw6N8Ap"
  }
}

decoderawtransaction 02000000013db72755b71d95be7f6785448b5387b6273ca26fd5e42204390899154b111a5300000000754830450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb012b02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988acc800007f0100127a00000000001976a914fd337ad3bf81e086d96a68e1f8d6a0a510f8c24a88ac00000000
{
  "txid": "7f0262e1448896a4091bf9d1c55e346766b2aa8c19895bccaf2194b610f02525",
  "hash": "7f0262e1448896a4091bf9d1c55e346766b2aa8c19895bccaf2194b610f02525",
  "version": 2,
  "size": 202,
  "vsize": 202,
  "weight": 808,
  "locktime": 0,
  "vin": [
    {
      "txid": "531a114b159908390422e4d56fa23c27b687538b4485677fbe951db75527b73d",
      "vout": 0,
      "scriptSig": {
        "asm": "30450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb[ALL] 02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988ac",
        "hex": "4830450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb012b02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988ac"
      },
      "sequence": 2130706632
    }
  ],
  "vout": [
    {
      "value": 0.08000000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 fd337ad3bf81e086d96a68e1f8d6a0a510f8c24a OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a914fd337ad3bf81e086d96a68e1f8d6a0a510f8c24a88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "n4bkvTyU1dVdzsrhWBqBw8fEMbHjJvtmJR"
        ]
      }
    }
  ]
}

The failure is happening because hash160(30450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb) is not 023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a9.

Hash160s are 160 bits long, ending up as 40 hex chars. 023fb... above is 66 chars, so no hash160 would match it. Investigate where it's coming from?

I find btcdeb https://github.com/kallewoof/btcdeb incredibly useful for these sorts of problems: it's a command line tool to allow single-stepping of bitcoin scripts. OP's script is:

30450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa... |
02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27... |
<<< scriptPubKey >>>                                               |
OP_HASH160                                                         |
ef3c5e4ee866b692245de650b178d83ca3d0fdbd                           |
OP_EQUAL                                                           |
<<< P2SH script >>>                                                |
c800                                                               |
OP_CHECKSEQUENCEVERIFY                                             |
OP_DROP                                                            |
OP_DUP                                                             |
OP_HASH160                                                         |
023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a9 |
OP_EQUALVERIFY                                                     |
OP_CHECKSIG                                                        |
#0000

And his question here can be replicated by calling:

btcdeb --txin 02000000107c60fb7c4de7528b0693f189483996f62d04527a693b86ffd940fe21c2efe65a00000000484730440220521eae742c5587ea8d0947879de20f6ff07c30a3e6fc37f3472374d94d1c57b102207cdf2e65e9812adebe37f28279ac23c7f316c5cdd00104aa92396d2768724e0201feffffff15aeb7dae6d514d833e3f25ffc1a992cb2dbc633b30c09f314e726d22ab34c2f000000004847304402206669b4a43e22272d18dcdd99527fcbfbf97bb024ea808bd9ae1ee492da5ab361022045625e98f6f8ddfb3427d4d43f66722d799fbce338f1dd8cbf2ba8c4082756d901feffffffdb2b200941d79838f30139ffc8b1b23bae1cb298a5642a4b3242c74e3614308c0000000048473044022043cb6c47831ad4903c4f657031671fe5b3e8c3e8b4c12de3bc62af6cbda60b32022052c41f1a6e767ebe663b10a4e7350ad12555b4524c0d51ceb50a929466bef89101feffffffc676855c7880b9672531cf3b5bdf170e683ecf43881cb69ded2f469e1725de370000000048473044022057f71e9d946525338e4a504f9cf55065154de09a5f85a8c68d586648246bd99f02202322de86499f035a99d90861bda53d72eb5b8bbeb0349e472290e25db8d5843601feffffff34cdc4315cee2f6c754ac9d6aff58ce87d24d2ea9f1a7427274ecec7f33acc650000000048473044022039444c85f778fd8a95cfdf4afef47ba804425d2ca97907e86393af56406f472a022029de7c2617d2e7d8c1958bd84b775e1b8d4d1e22591529dc13ae050b0b96999001feffffffd6a7bf9cd512e454b7b1b33f2484a16cf5237d8a9e6ecf49294dd7931a5e88d600000000484730440220492bbaa48ca4ea7424412d6421e87f95f0f1b5beefc4c1c818bd2a94b9b5a00402207ef391cdc9f84e88d1ff2cc7d68edb5afacd7ad0be3a478df0911b1bb1973cf401feffffff89e1344e9d47932c19b24a88062ee6166cc9704d26820690c903e3a63924b924000000004847304402207fcd1b6818c875abe2148b1dfe1553c73c2eca561ec3ce1e99c6bbab3b6543830220562dfa7391a5823563fbecf3e41361e6b7a4b3f541b39f667ad0137c726c9de801feffffffe7092dda245a178b4e50dcda70cbc9fedef3fadfef94c6dbe5dc349d105cb94e0000000048473044022002fdc279d955d8d0e60c4705b170b700d934fbf5efa1d7c8b2443ab1587d80b9022000c8d135e6f81c664487ca8431c7e6eb89a3eb618f646b2bce28b5517dbff72a01feffffff8bf3c8734ee9682ffbce41e520a2e8a466c5d46654d98cbcd4ebfcf64a73939700000000484730440220629988e915cb34552abeef352b7a1a0ebd6792d0a0c91d8d906dd6065ee68a4902207646cc98da887dd19b3d26185d5bcae423fcba036c8c1082985ac8a260e7f54001feffffff4a3b666ad423ba3a2b7a14edef7d826cf7587a2774b9f3937e75aade5698d09c000000004847304402205644ed173a99869018434ea4a1a580a1a1815431f294f134dda6cb259613962f02201d6fe1aae7fe07a88c686bf31348b07927b5088bb321af9169ddf1b232b421e601feffffff75dd734653ba95042205708b007b448aaef21cf972e8e25d76485b66a8f6c5a0000000004847304402200b4301e24066c184a4014cddec046fb9990c08caf73130e780ff9b3959e510a402206e947ea7a81cdd2ed67ae88bca5ccad5db2b29cd86cb3f57755cae19121e74d801feffffff7c704726f11711d0b75f399272c697ee49bb10aeaf170372dd50480b2fe194d9000000004847304402202bd26868009c2fc5d94525eabb1197cef6aac5b235d1623c3a762fe61295c1ba022024b9c7ecb2c28a01ba8976bd4ab9779915d37b788dc6dcdec335f89e457a99d101feffffff0a6b94c0ded59df2a0ec996581af027e4116d915e5264fb14a6555f266bec285000000004847304402203997a2d145c8cef3879c5d5dccf7758081b95d3be05443c07053d9d352d4fc2802204f66e8ceadf3147118f430404cbfa8f3b4b99d3a410d69d2a831646c1a5c2f3b01feffffff2f04521db3ecbefd9cd14ef6a594572508cbb2d9c9f544700bde46363f573926000000004847304402200fa171a3d8e4c5105504b498d039d3c386e8325b672c558e97c2751aba8ab0ba022026ba230078fac40413b0d3abc43546d3b9a779eb7af0d08544ac39355475dd4301feffffffdad37c38f84fc6fddee6510ee88705719128b1b5b2dadbc4df7e2e61164e6989000000004847304402202e8751498d9bf91cba9935100dda9cb27f404c91b1531b5dc8904278bb25b0730220537b9a18d368466680fff9c2434788f616b6d99ed46ec04c775cd041d64fc14701feffffff519a0366daed0321fcb1cbb78dd6d5d65febd7e7ea2b100c73396a98a09c2ef50000000048473044022048e89845d80f216f291001fee37e8c7178e40b97af051d57679fc46707a426bf02203ae8c2e132b4c5dbbcd97c59584a0ea9cec6a78294fe7fbfdb86d6ebe13ffc7101feffffff01809698000000000017a914ef3c5e4ee866b692245de650b178d83ca3d0fdbd8782170000 --tx 02000000013db72755b71d95be7f6785448b5387b6273ca26fd5e42204390899154b111a5300000000754830450221009b813cf658ec2c30e68fd23c369c348fd5f915f77b49581a945aa2f2f2d3c8aa022058f6a7eb78b2132d24cc260699fdc158fda6f3a0d10bc3c52bacccc03bb6b8cb012b02c800b27576a921023fb59ee7e5722a9c559d366f6ca114c73361108c04e27a18060cef7a727d58a988acc800007f0100127a00000000001976a914fd337ad3bf81e086d96a68e1f8d6a0a510f8c24a88ac00000000


Can you break down what data is encoded into a bech32 address? Can you break down what data is encoded into a bech32 address?
e.g. bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4
How do bech32 addresses on testnet, regtest, signet compare?

bech32 addresses are defined in BIP 173. A list of address prefixes on the Bitcoin wiki is here.
This slide is taken from Pieter Wuille's presentation on bech32 at SF Bitcoin Devs in March 2017.

bc is representing Bitcoin (mainnet) and is human readable.

Testnet bech32 addresses start tb

Signet (both default Signet and custom Signets) bech32 addresses also start tb (although an earlier iteration of Signet used sb).

Regtest bech32 addresses start with bcrt. This is defined in chainparams.cpp here.

1 is just a separator and doesn't represent any particular data

q is the witness version. This represents zero as the first SegWit witness version introduced was SegWit v0. Taproot introduces SegWit v1.

w508d6qejxtdg4y5r3zarvary0c5xw7k is the hash of the witness program.

v8f3t4 is the checksum

As the slide says, mainnet P2WPKH addresses are 42 characters and mainnet P2WSH addressses are 62 characters under SegWit v0. Future witness versions can be up to 74 characters although SegWit v1 addresses (Taproot) will be the same length as v0 P2WSH addresses (62 characters). Witness programs as defined under SegWit v1 are 32 bytes.
There is a bech32 demo decoder site here.


Blockchain synchronization is painfully slow / Best way to download blockchain I'm trying to setup my own Bitcoin node on Ubuntu 16.04.1 LTS.

Right now, I've stuck with blockchain synchronization. I'm letting bitcoind to run every day for at least 10-12 hours while I work and it already takes three days to download 83% of the entire data.

I have very good Internet connection, it should take no more than two hours to download 80 GB of data, however, it's taking at least 30 hours already. My connection is practically free from other downloads most of the time.

I've googled this problem: some people say that current version of the bitcoind is so fast that it doesn't matter how blockchain is downloaded throught the Bitcoin network or by torrent. Other people say, that it takes a week to download the entire blockchain.

Is there a way to optimize my setup to make it download blockchain much-much faster?
Or do I better download it via some torrent and then synchronize the differences from the network? What is the best place to find such torrent file or magnet link? Also, is it safe to download blockchain from some third-party, will bitcoind validate it?

SO, generally speaking, what is the best way to download the blockchain in order to setup a working up-to-date Bitcoin node?

$ cat /etc/issue
Ubuntu 16.04.1 LTS \n \l

$ uname -a
Linux destiny 4.4.0-47-generic #68-Ubuntu SMP Wed Oct 26 19:39:52 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

$ bitcoind -version
Bitcoin Core Daemon version v0.13.1.0-g03422e5

What usually takes time is the validation of the transactions in the blockchain, not downloading it. Bitcoin Core implements a fully validating node, which does not trust any of the information other peers give it. The only way to accomplish that is by validating everything itself.

30 hours sounds painfully long though. If you have memory to spare on your system, you absolutely should increase the database cache size. The default in 0.13 is 300 MB, but you'll see very significant speedups from using a higher value, up to 4000 or so (which would require an extra 4GB of memory).


Do multi-PoW currencies open up additional attack vectors on a blockchain? I'm curious if there have been any technical evaluations of the vulnerabilities of cryptocurrencies that utilize more than one proof of work algorithm - for instance, myriadcoin or huntercoin.

Myriadcoin uses five different PoW algorithms, with different algorithms targeted towards different hardware, so that people are able to mine with ASICs, GPUs, and CPUs. The idea is that this will make it more difficult to centralize mining and harder gain control of 51% of the hashing power, while also making mining more accessible to as many people as possible.

I'm wondering if there are any potentially unintended consequences to this that maybe some folks have already identified.

Chaining algorithms reduces security as if one part of the chain fails, the whole chain fails. And in this case fail doesn't just mean completely broken, it can also mean an ASIC-proof algorithm turning out to be not ASIC proof.


Benefits of bitcoin as national currency? As Bitcoin is crossing total M1 money of few countries, how could a country by adopting Bitcoin as national currency, mutually benefit Bitcoin and the country itself?

https://bitcointalk.org/index.php?topic=154954.0

So, there may be some benefits to a country with a very troubled currency, but I don't think those benefits would outweigh the drawbacks right now.

Firstly, because the exchange rate of BTC is still too volatile. While an increasing exchange rate may seem like a benefit to us that have some BTC in our wallet, think about someone trying to price a service. Recently I saw a post on the bitcoin subreddit where a coffee shop started accepting BTC. Unfortunately, they had hard coded an exchange rate of 30USD to 1BTC. Resulting in outrageous pricing. Shops that have to change their prices every day is a sign of a troubled currency, even if it prices going down every day.

Secondly, I'm not sure we really have the infrastructure right now to have full commerce in BTC. It's too different than fiat currency. We're moving in that direction, but there just isn't the commerce and banking infrastructure that is built of the eccentricities of BTC. A more likely is a country "pegging" their currency to BTC. But even that is very unlikely, because it would mean that country would be abdicating its control of monetary policy. It's one thing to abdicate that responsibility when you peg your currency to a fairly stable currency like the Euro or the dollar, but pegging it to BTC would be quite the wild ride. The country would have to maintain massive reserves of both its currency and BTC to try to maintain the pegged ratio.

Which leads to my next point. Even though the BTC money supply is getting large, imagine the impact of even a small country moving to BTC. If I were a bank with even $5 billion in deposits that was suddenly mandated to carry my reserve in BTC, I would be in big trouble. That would mean a sudden order to purchase $500,000,000 BTC. The Bitcoin money supply may be getting larger, but there still isn't that kind of liquidity in the BTC exchanges yet.


My Bither Hot Wallet Purchased a Bither bitcoin machine and can't figure out how to work it.  I keep getting bitcoins but don't know how to send them to my Coinbase wallet and therefore exchange them for cash.  Help

It is so easy to use Bither app.
Generating Coinbase bitcoin receiving Address
first of all you need to check your Coinbase bitcoin receiving wallet address which is shown by a QR-code (you can find out how, from here).
Sending fund
Then you should try scanning that QR-code by your Bither app. for doing it, you need to choose one of your wallet (from the middle menu which is indicated by a big B and showing total amount of your funds) then you should choose the preferred wallet. then use the send icon and scan QR code and type the amount go ahead and send funds.
caution
by the way, you should be aware of your transaction fees. Bither does not propose any offer automatically; so you should choose your own policy for transaction fee by monitoring mempool to get informed use this website to see which tx takes how long to get confirmed.


Why is Ripple's base58 alphabet so weird? In this answer I found out that Ripple uses a different base58 alphabet from Bitcoin. There aren't many materials on what that alphabet is, but I managed to find this reference:

  The base58 dictionary for ripple is: rpshnaf39wBUDNEGHJKLM4PQRST7VWXYZ2bcdeCg65jkm8oFqi1tuvAxyz

I am wondering - why is Ripple's alphabet so bizarre in comparison to Bitcoin's base58 alphabet:

  123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz

I understand that for some branding reasons one would want to put "r" as a letter for 0 and use 0 as network byte for Ripple (thus making every address start with "r"), but the same could've been accomplished by simply shifting the alphabet like so:

  rstuvwxyz123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopq

What is the logic behind the odd alphabet letter order?

I don't know about the rest of the string but I think the leading bytes are ordered that way to make the types of "addresses" be human reconizable.

From a quick look at the source I think the leading characters, rpshnaf map like so:

r = public Ripple address
p = node private
s = Ripple secret
h = ?
n = node public
a = address family generator or seed ?
f = address family generator or seed ?

Of these, wallet owners have seen the r* and s* "addresses" and those running ripple will be have seen the n* and p* ones.


How does Bitcoin verify each transaction? So I realize that the Bitcoin transaction I make has information such as my wallet number, the amount of BTC being sent, and the recipient wallet number, and this whole message is encrypted using my own private key. And that this message can be decrypted with a public key.

Now, how do all the other nodes who need to verify my message
1) Know that this message is actually from me? When did I ever send them my public key?

2)J Know that I actually have enough funds to cover the transaction?

1) Nodes need not to know its your message, nodes are ok as long as your message is in correct format and satisfying the conditions.

2) When you broadcast transaction, your wallet will provide previous unspent transaction reference in the input section. Nodes will verify if those are really unspent and if the amount in output section is less than the total amount in the referenced input transactions.


Can a Bitcoin node send messages to a program on the same machine? I`m currently programming some TCP communication in my custom Bitcoin client. I am wondering if it is possible for the official client to communicate with it if they are sitting on the same machine? For example, if I'd send a version message to localhost:8333 claiming my return address is localhost:8332, will the standard client respond as if it was communicating with a node on the internet?

Yes and no.  Don't use 8332 for your custom client's communication port, that is the default rpcport.

You can run an arbitrary number of bitcoind instances on your machine, as long as they are given different -port= and -rpcport= arguments, and they can all communicate with each other (using -addnode=127.0.0.1:...port... or -connect=127.0.0.1:...port... ).


Will the energy cost and deflationary nature of Bitcoins doom the currency to obscurity? I couldn't find enough questions that ask this head-on1, so consider that if:

Bitcoins are designed to reflect the deflationary characteristics of a specie currency; and
The distributed nature of the cryptocurrency requires a high intrinsic value (energy cost) of the coins to secure them; and
That neither deflationary contraction nor high transactional energy costs are desirable qualities of a major currency (see Background below);

Then:

Will the energy cost and deflationary nature of Bitcoins doom the currency to obscurity?

Off-blockchain solutions are acceptable answers, but will require centralising a large portion of the Bitcoin network. Or put another way: Trust moves back to centralised banking facilities.

So my guess is these two problems will doom a decentralised Bitcoin, but I open the question to the floor. :-)

Background (Due Diligence)

A high transactional energy cost is bad

  The green line in this chart reflects the power per dollar in the
  global economy; of which a tiny fraction is consumed by maintaining
  the banking network.

  (Source: Dr Tim Garrett, "A physics based economics
  model")

  As the distributed Bitcoin cryptocurrency doesn't use laws or other
  centralised off-blockchain enforcements to protect the transaction
  ledger, the energy cost per transaction can not be a fixed constant
  like normal currencies. It must be a percentage of global energy
  consumption2 to discourage state actors with a bevy of
  power stations from subverting the global Bitcoin economy.

  No society will choose a currency that requires O(N) energy to
  transfer a bank note instead of O(1) energy to transfer a bank note
  (where N is global energy consumption). Doing so would impoverish
  human development3.

A deflationary currency is bad

  Long story short, a deflationary currency requires a post-growth
  social model; which while probably a good thing, we don't actually
  have right now.

  In a classic "growth" economy, you must expand the money supply to
  reflect the size and velocity of economic activity in society. If you
  do not and the level of economic activity ever contracts (and there
  are variety of regular reasons this may occur such as a natural
  disaster or demographic bulge), then you can enter a deflationary
  death spiral as each contraction contaminates other economic activities
  that assumed an ROI in the form of interest that is now worth less or
  worthless4.

  A digital specie-based currency is deflationary in that it restricts
  the money supply.

  Inflation and hyperinflation are problems, but
  problems of unchecked greed, speculation and social inequality that
  don't disappear by sweeping the economy under a deflationary rug.

1. Although "Will deflation destroy Bitcoin?" and "How much energy will the Bitcoin network eventually consume?" come pretty close, I really want a question that collates and settles this for newcomers, without undue eager puppy optimism from early adopters. :-)
2. Production actually, but sane organisms consume energy they produce instead of throwing it away; so global consumption and production can be considered linearly proportional, though not 1:1 due to transmission inefficiencies.
3. To put this in perspective, you could provide everyone on Earth with universal education, healthcare, social security as an O(N) energy cost.
4. Don't get me started on economists of the Austrian-school. They might as well be sock puppets for the entitled mega-rich for all the benefit their pseudo-science has on ordinary human beings.

On the deflationary death-spiral part:

The bitcoin wiki has a good discussion of deflationary spiral, so that's a good place to get a counter point.

I'd like to make some of my own (amateur) observations:

Gold is currently not the most popular money used in the world not because gold is "bad" money, but because:

a) Laws make it more difficult/expensive to use for day-to-day transactions then nationals currencies (e.g. legal tender laws require capital gains tax to be collected at the time of purchases in gold), and;

b) Banks are incentivised to use fiat through the fractional reserve banking system. Why hold gold for customers when you can hold national currency and generate an order of magnitude more interest by loaning out 10x the deposit amount that is guaranteed by the central bank?

To put it another way, the absence of gold used today for your average transactions is not because citizens fear deflationary death-spirals, but because governments have purposefully made it less beneficial to use gold.
Bitcoin has been around long enough that we can at least get a sense whether falling prices has been a disaster. As far as I can tell that is not the case. All the major bitcoin  merchant services like BitPay, CoinJar and Coinbase record ever increasing purchases/sales made through the website. Yes, more people are using bitcoin, but one person spending money in the bitcoin economy is counter to the death-spiral theory. If the theory is correct, no-one should be spending bitcoins.
The deflationary death-spiral, when you think about it, describes something that in layman terms sounds pretty awesome. Theoretically prices will keep dropping to $0, meaning at some point, everyone on earth will be able to buy everything and any service for 0. Sure, the theory states that e.g. everyone will lose their job, but who cares when everything is free! At that point you don't need a job.
When I've heard the (in)famous cases of deflationary death-spirals mentioned, they seem to always conveniently ignore the broader context. For instance, the Great Depression happened at a time when the government purposefully reduced the money supply, i.e. it wasn't like the money supply was stable or predictable (like gold/bitcoin). In other words, I'm yet to hear of an example of "bad" deflation that "just happened" during a normal period of dropping prices. There's always something else going on in the economy.


How to get balance of a bitcoin p2sh address? I send some BTCs to a p2sh address. How can I get the balance of the address?

Local regtest mode

Do a search for it in blockchain.info or similar service.

Eg for an example address 3P14159f73E4gFr7JterCCQh9QjiTjiZrG you can see the result of such a query here.


Solo mining litecoin on OSX I would like to do some solo mining of litecoin on OSX.  I realize the probability is low that i will hit it. but i like the idea of the lottery.  I have a miner setup (cgminer) and i have successfully connected to a pool.  I have found lots of guides that explain how to do this on Windows like:
https://bitcointalk.org/index.php?PHPSESSID=3rq912e407g04cjq8ehdhnk457&topic=83371.0

But what all these guides tell you to do is edit litecoin.conf and then restart litecoin-qt.  But does this still apply to OSX? I don't see a litecoin.conf anywhere.  I have looked in
Library/Application Support/Litecoin
Is it still litecoin.conf in OSX? or is it a different file?

No suitable long-poll found means that your bfgminer could not find a server that will inform it of a new block appearing on the network. This is correct, since you are solo mining, and litecoin-qt doesn't supply this.

Don't worry, your setup is correct.

Not having LP only means that your miner will get informed a little bit slower by litecoin-qt about a new block a little later, and potentially doing work on a block that has just been solved for a few seconds at most.


When does a miner get the reward? Let's suppose that a miner mines a block and adds it to the blockchain. When it gets the reward ? I suspect that first of all the other nodes have to verify that its proof of work is correct and it's not cheating. Right ?

Miners don't receive rewards from anyone else - they give the reward to themselves as the output of the coinbase transaction, which includes the block subsidy and any fees from the txs in that block.

They then broadcast this block to everyone else. Each node that receives the block independently validates it to ensure it meets consensus rules (has a valid proof of work, does not contain any invalid transactions, has the correct subsidy and fees charged, etc.).

If any node believes the block is incorrect, it will reject it and continue to mine or wait for another valid block at the same height.

If the block is considered valid, it is added by each node to its own copy of the blockchain. Once 100 blocks have been mined extending the block in question, the coins in the coinbase output are considered mature and may be spent by the miner of the block.


PHP How can I validate / verify a wallet public key? Can someone please help me find some PHP open source on how to validate / verify a bitcoin wallet public key ? I am currently working on a project  and I am implementing multisig, and it seems I can't find any type of information on how to verify / validate a wallet public key.

Example of public key that I am trying to validate: xpub661MyMwAqRbcEwAAmd9DpSfoDEUar3C2e8LtpeMCaaPWMoLjAf3jY3RucUmtim729c2qzGmYPaBcFdkEUQuwgrFjTKFwEKSCfRfd949k4DC

Basically, I want to make sure the user can't add a wrong or invalid key, otherwise the multisig wallet cannot be created when the system will try to create it, and I need to prevent that

Thank you for your time!

BIP32 specifies the serialization format used by extended keys as:

  Serialization format Extended public and private keys are serialized
  as follows:

  4 byte: version bytes (mainnet: 0x0488B21E public, 0x0488ADE4 private;
  testnet: 0x043587CF public, 0x04358394 private)
  1 byte: depth: 0x00 for master nodes, 0x01 for level-1 derived keys,
  4 bytes: the fingerprint of the parent's key (0x00000000 if master key)
  4 bytes: child number. This is ser32(i) for i in xi = xpar/i, with xi the key being serialized. (0x00000000 if master key)
  32 bytes: the chain code
  33 bytes: the public key or private key data (serP(K) for public keys,
  0x00 || ser256(k) for private keys)

  This 78 byte structure can be
  encoded like other Bitcoin data in Base58, by first adding 32 checksum
  bits (derived from the double SHA-256 checksum), and then converting
  to the Base58 representation. This results in a Base58-encoded string
  of up to 112 characters. Because of the choice of the version bytes,
  the Base58 representation will start with "xprv" or "xpub" on mainnet,
  "tprv" or "tpub" on testnet.

  Note that the fingerprint of the parent
  only serves as a fast way to detect parent and child nodes in
  software, and software must be willing to deal with collisions.
  Internally, the full 160-bit identifier could be used.

  When importing a serialized extended public key, implementations must
  verify whether the X coordinate in the public key data corresponds to
  a point on the curve. If not, the extended public key is invalid.

Your PHP code must first run the b58check algorithm to verify the xpub is encoded correctly, and then decode it into the above values. Lastly, you must check that the pubkey found by decoding the xpub is a value point on the secp256k1 curve.


Bitcoin-qt is trying toload to C drive instead of my D drive So I'm running a 250 GB SSHD for my windows boot drive and basic system functions. I am running a 1 TB standard HD for my larger files (like the bitcoin ledger). How do I prevent Bitcoin-qt from loading the ledger to my C drive and instead have it load to my D drive?

You can create a bitcoin.conf file that specifies datadir=(your/desired/filepath) in order to override the default data directory location.


What happen if there's no one mining bitcoin? I read that miner are in a way contributed to the transaction progress of bitcoin. So, that means if there's no one mining anymore, the bitcoin can no longer be transacted?


What does this Blockchain info mean? Clueless This is the info but it'S all greek to me. I'm pretty nerdy about PC's but clueless in terms of bitcoins. Tell me where I can get definitive comprehensive information would be a help too.

No it’s not greek :-)
You’re first step in understanding might be to have a look at the book „Mastering Bitcoin“ by Andreas M. Antonopoulos. And if you need a translation, you might want to look here: https://www.transifex.com/bitcoinbook/public/.
The second resource is „www.bitcoin.org“, where you can find a description of the whole eco system, also in many languages.

The picture displays info about a wallet address, and it’s transactions, followed by  corresponding data to handle such a transaction in the bitcoin network. At the top left you can see the bitcoin address (1CYQ…), and it’s hash representation (look into the references I gave, why you would have hash representations). In the top middle section you see the amount of transactions for this address, and to the right a graphical representation of the address („QR code“). With QR codes you can e.g. transfer information between mobile devices via their integrated cameras. So if someone wants to send you money, he just scans the picture, instead of typing the address.
And the bottom section shows the previous transactions for this address, how values got „transferred“ from source addresses to target addresses.


What are the potential security issues when running a Lightning Node on my home network? If I was to run a lightning node on my home network (and for example, not running the node through TOR), what should I worry about?

Furthermore, what OS, settings and software should I use to minimize the threats?

This is not only related to Lightning but remains true for any critical application that you run on your PC when connected to your home network. If your home network is compromised then an attacker can possibly escalate privileges and compromise the machine on which your lightning node is running (as well as other critical applications). Lightning is thought to be analogous to how you carry cash in your wallet. It helps you make small transaction very easily while at the same time it is not the end of the world if you lose that cash from your wallet. Your major saving are stored in the bank, just like how you will use a hardware wallet to store your major Bitcoin savings. I can think of the below few cases at the top of my mind.

Send payment to any lightning node
Your lightning node has to continuously sign new commitment transactions in order to add incoming HTLCs and fulfill HTLC payments. As a result, the private keys associated with signing new transactions in the channel are exposed to an application that is continuously interacting with your home network. In case your machine gets compromised like we discussed before, your private keys are no longer safe. Thus, these keys can be used to send a lightning payment to any node that is indirectly connected to you.

Force close your channel
Since the transaction backups are kept on the machine that interacts with the home network, an attacker who has gotten access to your machine can use one of the transaction backups and broadcast it to the Bitcoin network costing you high fees as compared to a mutual settlement (in case you were the funder).

Broadcast previous commitment transaction state
The attacker might also broadcast previous transaction state making you lose almost entire balance of the channel through the revocation transaction.

Force crash your node and delete backup files
Unlike bitcoin stored in an on-chain wallet, funds in the lightning network are stateful. If you do not have backups and your channel counterparty is non-responsive, you will likely experience permanent loss of funds. This could be slightly mitigated by using the option_data_loss_protect feature, but that heavily depends that your counterparty node is honest.

The best practice will be to keep your machine clean from any shady applications, use a reputed anti-malware services and do not give share your home network Wi-Fi password.


Ripple partial payments I've read on the Ripple Wiki page for Transactions about partial payments. I am wondering how a partial payment would look when data is polled about an account? Would the transaction amount be displayed as what the payment was attempted to be sent, or the amount that actually went through? Are there any examples of how partial payments look and how they should be handled by Gateways?

It's the choice of whatever is doing the display how it wants to display the information the Ripple network provides.

The original transaction is provided. This contains the source account, the destination account, the maximum amount the transaction could pay (the "destination amount"), the maximum amount the sender was willing to pay (the "send maximum"), and an indication that partial payments were allowed (the "partial payment" flag).

In addition, the transaction metadata is provided. This contains the transaction result code which, if not success, indicates no payment at all was made. If the payment was able to be made completely, no "DeliveredAmount" field will be present in the metadata, indicating that the destination amount was in fact delivered to the destination. If the payment was in fact a partial payment, a "DeliveredAmount" field will be present, indicating the amount paid to the destination.

The metadata also contains the other consequences of the transaction. This would include reducing the balance of the sender, crediting and debiting market makers involves in the transaction, reducing or removing offers the payment used, and so on.

Some gateways do not credit partial payments automatically. It is not a good idea to make a partial payment unless there's a good reason to do so and you know the recipient wants or expects partial payments.


Given OP_VER was never used, is disabled and not considered useful can its meaning be stripped and it be made OP_SUCCESS? Given OP_VER (0x62) was never used onchain, is disabled and is not considered useful can its meaning be stripped and it be made OP_SUCCESS for the purposes of introducing a new different opcode in future?
As Andrew Poelstra describes "..there was an opcode called OP_VER, OP version. I can see some grimaces. It would push the client version onto the stack. This meant that when you upgraded Bitcoin say from 0.1 to 0.2, that’s a hard fork. Now script will execute OP_VER and push 0.1 onto the stack for some people and 0.2 onto the stack for other people. You’ve forked your chain. Fortunately nobody ever used this opcode which is good. "

BIP 342 does exactly this. (Thanks Pieter)


Why is the block size so big, taking into account a relatively small number of transactions? Why the size of the block 656143 is so big (Size: 2,337,727 bytes), taking into account a relatively small number of transactions (Number of Transactions: 84)?
Extra question: What is the block size limit in Bitcoin nowadays?
I found some guidelines here:

Bitcoin blocks now have a theoretical maximum size of 4 megabytes and a more realistic maximum size of 2 megabytes.

However, the size of the block 656143 is ~2.3Mb; therefore, a "more realistic maximum" is not that realistic :)

Why the size of the block 656143 is so big (Size: 2,337,727 bytes), taking into account a relatively small number of transactions (Number of Transactions: 84)?

It contains a number of transactions which are substantially larger than average (it is spending a very large number of outputs, legacy P2SH multisig scripts), so an assumption based on the average size of transactions does not hold.

However, the size of the block 656143 is ~2.3Mb; therefore, a "more realistic maximum" is not that realistic :)

The quote refers to the assumed average size, not including obvious outliers like this.


Is mining essentially just a way to randomly select the next winning miner? I know it's not really a completely random selection because some miners have more hashing power so their odds are increased.

But let's assume for a moment that all miners are about equal in hashing power.

The way I see it, whoever solves the current block is (almost) completely unpredictable and thus mining is just a way to randomly select a winning miner.

I understand about decentralizing and the need for a decentralized way of selecting this winner without trusting a higher authority for this random selection.

Let's imagine for a moment that there was this "god-like" machine somewhere, completely trustworthy and incorruptible, impossible to bring down or shutdown and completely fair.
Let's say this machine would select the winning miner that would create and sign the next block and get the reward and fees.

Would there still be a need for mining in that case?

Mining adds a certain level of commitment to the process.

If mining were free, a corrupt user could create thousands or millions of corrupt miners (for free) that would publish invalid blocks that made itself rich, and try to get even one of these blocks accepted.

The same is true of your "god-like" random selector:
Publish blocks, and hope you get randomly selected!

But mining is intensive: it costs money to setup a miner, and it costs electricity and networking to run a miner. You cannot fake thousands or millions of miners; each of them costs real money.

So the only way you can publish invalid blocks and hope to get rich is via a substantial investment.   The hash power of the network is so big now, that it is virtually impossible to setup a "evil" mining pool.  (If you succeeded, that would be a >51% attack)

The costs associated with mining ensure that there is a barrier to entry, and that "evil" miners cannot easily hope to overcome "honest" miners.  It ensures the integrity of the entire system.


Will I pay BID price or lowest necessary amount? I was wondering about how ASKs and BIDs are matched:

Say I set up two separate trading accounts on mtgox.

On my first account, I offer to sell 1 BTC for 1000 USD

...Nobody will buy it (at current rates) so a sell will not happen.

Now, on my second account I offer to buy 1 BTC at 1000 USD.

I guess everyone will take that offer, and the buy will happen.

But will I get the 1000 USD that my first account is willing to pay (being the highest match), or what will happen?

I have a feeling this is a 'stupid' question, but I have no experience in how trading systems work.

First account gets nothing.

Second account buys them starting from the lowest offer, going up.

Such as, there are sells:

0.30 units @ a price of 100
0.10 @ 150
0.40 @ 650
0.80 @ 850
1.00 @ 1000 (your first offer)

You post a limit order to buy 1.00 unit @ a maximum price of 1000, you get:

0.30 @ 100 (total spent 30)
0.10 @ 150 (total 45)
0.40 @ 650 (total 305)
0.20 @ 850 (total 475)

You got the amount requested (1.00 units), spending 475 instead of 1000 (the maximum you were willing to spend).

The new market depth will be:

0.60 @ 850
1.00 @ 1000 (your first offer)


What am I missing about this "guaranteed" money-making scheme that I didn't hear from anyone but just popped up in my head? Let's suppose that I have already set up an account at Exchange A and Exchange B, loaded each up with a small buffer of BTC (much less than 1 BTC), and am able to make API requests to buy/sell from these.
Now, I start pulling down sell/buy offers from both exchanges, automatically, every minute, all the time.
My script then picks the most affordable (for me) "sell" offer, regardless of the amount, and takes the offer (buys the coins).
Instantly afterwards, it takes the most profitable (for me) "buy" offer on the other change (sells the coins).
It doesn't do these actions unless it calculates that the "rest sum" is over zero.
Is this not guaranteed to make me money each time this is done? And since it's automated, I only need to set it up once and then lean back and watch guaranteed money stream into my accounts, taking some of them out every now and then?
It sounds way too good to be true, so I must be missing something. Otherwise, I'm sure that this would be done by millions of people, around the clock, and it would quickly stop working. I feel as if this is probably very well known and long since "patched".
But in terms of my understanding of how marketplaces/exchanges work, this seems like it would work. Unless there is some kind of random delay or other uncertainty which makes it impossible?
Of course, those exchanges/marketplaces all require photo id to be scanned and sent to them, so I'm unable to try this out "live", but I still want to know why this wouldn't work.

What you are describing is called Arbitrage and is done by many traders for a variety of different assets, not just cryptocurrencies. This is only guaranteed to make you money so long as there is a price difference between exchanges. The end result of many people doing arbitrage is that the exchanges all settle onto the same price.
The main difficulty in performing arbitrage is the time it takes to move assets from one exchange to another. Ideally you would buy the asset, immediately transfer it to another exchange, and then sell it. However because of physics and protocol limitations, it is not possible to immediately move Bitcoin (and most cryptocurrencies). In the time that it took to move the Bitcoin, the price may have moved to be unfavorably to you, so you may lose money, or at least, not make any.
There are ways around it such as having balances on multiple exchanges so buying on one exchange triggers a sell on another. It's not strictly the same asset, but your balance of that asset does not change. However this requires upfront capital to setup those balances.
There are efforts to make it easier to perform arbitrage by decreasing the transfer time. Layer 2 protocols such as the Lightning Network or Blockstream's Liquid network allow for fast and nearly instant transfers of Bitcoin, so they can be utilized by traders to transfer Bitcoin between exchanges to perform arbitrage.


BCC to BTC on Litebit.eu I sent .67 BCC to a BTC address on Litebit 13 days ago. The address is showing the amount of cryptocurrency and it is showing as verified.

They state on one of their webpages that unless the total is above 2000 euros and reported within 8 days they won't move. Is there a genuine reason for this or are they just casually admitting to stealing all incorrectly sent cryptocurrency under this amount? How hard can it be?

"Recovering cryptocurrency cross chain is an inherently dangerous and time-consuming process"

Many exchanges have similar policies, either officially (such as Bittrex) or unofficially.

The reason for this usually comes down to time and security. Any exchange worth their salt will have security set up in a manner to prevent human access to private keys, and prevent unauthorized tx signing even through an automated system.

While cross chain recovery is sometimes technically possible, with an exchange's systems in the mix it will often require:

Someone with a very high level of trust manually accessing private keys, or accessing a system that will sign arbitrary transactions. For most exchanges, this will only be one or two people, as anyone with this level of access could move any funds to any address, and effectively clean out the exchange.
That person's time. Due to security set ups, this kind of process will often not be a 5 or 10 minute thing. Considering that the person performing this action is going to be of a fairly high level, any time they spend on the recovery is time taken away from regular business, and is costing the exchange.

Due to this, most exchanges impose minimums and other rules on coin recovery, since it makes no sense for them to sacrifice security and time over small amounts.


What are the constraints on Bitcoin Core's wallet passphrase? I know I can't send coin without my passphrase, but I have forgotten it. All I would like to know is, is the passphrase a phrase I come up with? Or does Bitcoin Core provide the phrase? Many thanks.
Also is it just one word or a sequence of words?

is the passphrase a phrase I come up with?

Yes.
It is used to encrypt the wallet so that only you can use it.

is it just one word or a sequence of words?

It is up to you what characters to type and whether it includes spaces.
The program suggests "Please use a passphrase of ten or more random characters, or eight or more words"  So, if you are the sort of person to heed advice, you probably chose a passphrase following one or the other of those forms.

I have forgotten it.

See Are there Bitcoin password crackers I can use to recover forgotten passwords?
Don't use any online tools.


get utxo at a certain chain height I have the reference client running with a complete transaction index.
Is it possible to get all UTXO for a certain height of the chain either via bitcoin-cli or some other tool?

The utxo set is indexed by transaction_id + out_index from Bitcoin Core 0.15 onwards (just by transaction_id from 0.8 - 0.14). So in order to get all UTXOs for a certain height you need to parse the whole set and filter it by height.

There's no way of doing so with bitcoin-cli AFAIK. You can do it by using STATUS (a tool I'm coauthor of). Feel free to ask for support if needed.


does bitcoin-core support bip44 HD wallet If bitcoin-core does not support bip-44, is there any other node ?

No, Bitcoin Core uses the BIP32 derivation path m/0'/0', and you are unable to change the derivation path of the wallet in Bitcoin Core.

There is however the Hardware Wallet Interface (HWI) that might be what you are looking for.

https://github.com/bitcoin-core/HWI
https://github.com/bitcoin-core/HWI/blob/master/docs/bitcoin-core-usage.md