How OP_EQUALVERIFY works in a standard transaction?

3 weeks ago I began learning about Bitcoins, and now I’m analyzing how it works internally. My problem is that I can’t understand what two public key hashes are compare to use de OP_EQUALVERIFY, because I understand that sender’s public key is compare with receiver’s public key, but they aren’t the same hash.

Here is an example:
A script is: the scriptSig of your tx + the scriptPubkey of the tx you spent

In the same example:
The scriptSig of your tx is: Sig + your pubkey
The scriptPubkey of the tx you spent is (according to blockexplorer):

OP_DUP OP_HASH160 fc88853163ab2a9646908a82e8a87b6f185c2047 OP_EQUALVERIFY OP_CHECKSIG

I hope

ripemd160(sha256('0x0457d7d7af586aaad529b5770bb43295051e7090e2bc884181d608dae2517c7812b25e326753cbe0b767f579bbcb5cffe492d22b93f2ff5501074eb9e8f8547c4a'))  
 = fc88853163ab2a9646908a82e8a87b6f185c2047...

I read that but I can’t understand that the stack and scripts function.
The stack is empty. On the first step the Sender’s Signature and Public Key are combined. Then these two constants are added in the stack. Then the Public Key is duplicated. After that this duplicated item is hashed. Now the Receiver´s Public Key Hash is added to the stack. The script compares the equality between the two slack items and finally the signature is checked for two slack items.

Is that correct? I think that i’m wrong with something.
If it is posible to someone answer or reply me

Thanks.

How can market-based transaction fees scale?

Can someone please explain to me what I am missing?

I don’t see how variable, market-based transaction fees can scale. I go to a merchant’s website to buy, how do I select a mining peer to pay transaction fee to? Do I attach some bounty that any peer can earn if that peer wins the Proof-of-Work block? But what if my bounty isn’t high enough to attract a peer given high transaction volume competing for priorities? Or not enough to cover any peer’s mining overhead. How do I know how much to bid to be sure my transaction completed in a timely manner?

This sounds very complex and unreliable and not at all like something that can scale to customers. Customers want to click one button and be done with the purchase and not waiting unknown hours debugging their payment processing. Amazon’s One Click.

I don’t see how with different peers charging different fees (to match their market dynamics), the sender of a transaction can know the amount to bid to get in the next block? It is impossible because the tx fees are not uniform and the random selection of the next peer is not knowable in advance.

what do red and green bars at bitcoinity.org mean?

The changebars graph at http://bitcoinity.org has red and green bars. Some of them below and some above zero.

What is their meaning?

  • If they are above zero
    • and are green
    • and are red
  • if they are below zero
    • and are green
    • and are red?

Is there a wikipedia article about that kind of graph? What would the search term be?

The rest of the graph is explained here http://i.imgur.com/516v5Nz.jpg but not the red and green bars.

Thank you.

Is it possible to create an address from a predefined private key?

I was not sure how to formulate the question title. What I want to achieve is the same as VanityGen and many other tools do to create an address starting with a predefined part, but with private keys.

So basically I want to create a Bitcoin public/private key pair of which the private key begins with a string I define.

Are there tools that already do this? If not, is it possible? How should it be done theoretically?

Is Bitcoin’s Economic Majority those who already own coins or those who will buy or keep coins?

The Economic Majority theory says that the power to control the Bitcoin protocol is held by those who [own] bitcoins.

But the article then goes on to read:

The ability for a protocol change to be successfully implemented
ultimately rests with those who accept bitcoins in exchange for value.

So that refers to investors and those who accept bitcoins for income or revenue but then aren’t immediately spending or cashing out the coins they received.

But that power doesn’t lie with those who already hold the coins but instead it lies with those who are willing to accept the newly issued coins under the revised protocol or coins with taint from coins issued under a revised protocol.

So, is the Economic Majority those that already hold bitcoins or is it instead just those who will hold the bitcoins generated following a change to the protocol? If so, how would that be best worded?

How can I convert a SHA256 hash into a Bitcoin base58 private key?

How can I take the output of sha256sum

sudofox@ubuntu:~$ echo -n 'Hi guys!' | sha256sum
7542fb6685f9fd8f37d56faf62f0bb4563684a51539e4b26f0840db361e0027c  -

and turn it into a Base58Check encoded private key?

I need to be able to do this with a list of SHA256 keys. Is there a script I can download, or must I spend a few weeks making it just so I can make my temporary addresses?

In response to first comment:
No, I must input a string, like “fluttershy”, for example, into sha256sum and then I must encode the output of sha256sum into a base58check private key.

string –>sha256sum –> some automagic process, which is the purpose of this question –> bitcoin private key.

Update: For anyone wanting to use Grondilu’s Bitcoin Bash Tools: You need to source the bitcoin.sh file after extracting it into your directory to use the functions.

source ./bitcoin.sh

Update 2 (Aug 2017): Rewrote script to go from step 1 to WIF in one go. You can just add the declaration of base58 and the encodeBase58 functions from bitcoin.sh if you want to skip the rest of the lib.

#!/bin/bash
#Tool to convert bitcoin privkeys into WIF keys
# by sudofox

source ./bitcoin.sh

KEY=$1 # first arg

# add 0x80 to beginning
EXTENDEDKEY=$(echo 80$KEY)
FIRSTHASH=$(echo -n "$EXTENDEDKEY" |xxd -r -p |sha256sum -b|awk '{print $1}')
SECONDHASH=$(echo -n "$FIRSTHASH" |xxd -r -p |sha256sum -b|awk '{print $1}')
CHECKSUM=$(echo $SECONDHASH|cut -c1-8)
FINAL=$(encodeBase58 $EXTENDEDKEY$CHECKSUM)
echo $FINAL

The usage would be

./sha256_to_privkey.sh key

where in my example (see Stephen Gornick’s answer), key would be

807542FB6685F9FD8F37D56FAF62F0BB4563684A51539E4B26F0840DB361E0027CCD5C4A8E

Do the same thing for the various functions, modifying as needed. Hope this helps anyone struggling to use the tools.

When BTC is traded at a Bitstamp, Mt Gox (or similar) what is the algorithm for matching Buys to Sells? How do partial fills occur?

I’m trying to understand how a partial fill would / should happen at an exchange and how that would occur

For example, if the BTC rate was $10/BTC and

  • Someone wanted to buy 100 BTC at $10

The only sellers were

  • One seller wants to sell 50 coins for $10 USD
  • One seller wants to sell 50 coins for $9.90 USD

Question

  1. Would the final transaction not be completed because not enough matching shares were available? (fair benefit)

  2. Would the purchaser be charged $10 * 50 + $9.90 * 50 = $995 (purchaser saves $5)

  3. Would the purchaser be charged $1,000 and the price was increased from $9.90 to $10 (seller gains unexpected $5)

  4. Would the exchange purchase the shares at $9.90 and quickly resell them for $10 (exchange benefit)

  5. If #4 occurs, should the exchange still charge a fee on top of profits already made?

What is expected in this scenario?

To put this in better context, I’m comparing #4 to SEC Rule 605 to encourage open reporting and trade equality. Namely requiring market centers (Mt Gox) to disclose the extent to which they provide executions at prices better than the public quotes to investors using limit orders.