88

In this answer, I will go through the steps necessary to redeem the second output of the transaction listed above. The answer will be limited to redeeming an output of the particular type present in this transaction (an output which requires providing a new transaction signed with a private key whose corresponding public key hashes to the hash in the script ...


45

I know this question is old, but I stumbled upon it looking how to teach myself how multisig addresses work, and I imagine others will to. So I’m going to try to explain the typical flow for creating, adding bitcoins to, and eventually spending a multisig address. This explanation is aimed at beginners, so please excuse my lack of brevity. First off, some ...


23

Enable txindex=1 in your bitcoin.conf (You'll need to rebuild the database as the transaction index is normally not maintained, start using -reindex to do so), and use the getrawtransaction call to request information about any transaction (it won't work for the genesis block's coinbase transaction though, it's a special case). Note that this will only give ...


21

What does the bits field represent? First of all, we need to understand what the 'bits' field means. Bits is in 'compact' format. This is kind of like a floating point format, but it represents big integers rather than arbitrary real numbers. The first byte indicates the number of bytes the represented number takes up, and the next one to three bytes ...


17

I am basically doing the same thing for bitcoinmonitor.net. I have a database of addresses to monitor and get notifications from bitcoind for any incoming transaction. I maintain a patchset for bitcoind which allows setting an url which will be called with any incoming unconfirmed transaction, including transaction details in a json object. Also for any new ...


15

Really old versions of Bitcoin did not use checksums in network messages (Satoshi incorrectly assumed that the TCP checksum was sufficient). When Bitcoin was changed to start using its own checksums in network messages, version and verack messages could not be immediately updated to use checksums because old clients would be unable to understand checksum-...


13

(disclaimer: I work on Bitcoin Core) As Luca already mentioned, you have to distinguish wallet implementations and the fully verifying nodes on the network. Because of how Satoshi wrote his code (a node and a wallet in the same program), the two are often confused, but this is considered a bad idea now. They can perfectly function independently. The ...


12

The characters excluded in Base58 are 0OIl. oiL are allowed, making these two valid addresses. It is impossible to send to an invalid address, as Bitcoin transaction scripts actually include raw 160-bit hashes (which by definition have a one-to-one correspondence with valid addresses), not addresses. Bitcoin clients will simply refuse to do anything if an ...


11

The answers to your questions, in order: The fee paid for a transaction is determined by the size of a transaction. Currently, if you want to do fancy things with bitcoins, you need to put a script in the transaction that sends them -- each output includes a script giving the conditions under which it may be used as an input. OP_EVAL, p2sh and CHV (check-...


11

None. It's impossible to send bitcoins to an invalid address. Those addresses are valid, though they might not be owned by anyone. Look at pszBase58 more carefully: 'o', 'i', and 'L' are allowed. The first few posts in that forum thread are wrong. The network doesn't know anything about Bitcoin addresses. At the network level, you never send bitcoins to an ...


11

Chris Larsen has been publicly identified as CEO of OpenCoin, the company behind the new Ripple. The core developers have been publicly identified as Jed McCaleb, Arthur Britto, Stefan Thomas, and me (David Schwartz).


11

The reference implementation, Bitcoin Core, is written primarily in C++, with various resource files and scripts in other languages. Another implementation, mainly used in lightweight clients like MultiBit and Bitcoin Wallet (Android), is bitcoinj. It is written in Java.


10

The statements are not on the stack, they're in the script. They start immediately after the OP_IF. They end at the first OP_ELSE or OP_ENDIF, assuming there isn't a nested OP_IF or OP_NOTIF. So it looks like this // script to put a number on the stack OP_IF // script that runs only if the number isn't zero OP_ENDIF // script that runs no matter what or: /...


10

If scripts were Turing-complete, you could construct a fairly short script that took an extremely long time to run (a la the Busy Beaver) or contained an infinite loop. This would tend to result in a denial of service against everyone on the network, when they tried to verify the transaction. And there would be no general way to tell whether a script ...


10

The basic elliptic curve operation is addition of points. The operation of applying this addition repeatedly is called the scalar multiplication of a point by an integer. The private key is the 'scalar', the point being multiplied is the 'Generator' point, the result is the public key. Scalar multiplication is basically repeated addition. Multiplying the ...


10

To understand Bitcoin Core, the best resource is probably the source code itself: https://github.com/bitcoin/bitcoin To help understand what is going on in the code, try the developer documentation and the Princeton Bitcoin Book. Keep in mind that the code gets updated faster than the documentation, so the code should be your source of truth. Some ...


9

also, the official client bitcoind has a 'validateaddress' command. see https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_Calls_list you could call that from your code if you happen to have bitcoind running already.


9

I would recommend using Homebrew or MacPorts to manage this dependency. The Homebrew package is simply pcre or pcre++. brew install pcre pcre++ The MacPorts packages are pcre and pcrexx. sudo port install pcre pcrexx


8

part of https://github.com/mikegogulski/bitcoin-php/blob/master/src/bitcoin.inc private static $hexchars = "0123456789ABCDEF"; private static $base58chars = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; public static function checkAddress($addr, $addressversion = "00") // hex byte { $addr = self::decodeBase58($addr); if (strlen($...


8

Creating a SatoshiDice-like game is rather easy. Below are the high level steps involved in making such a game. For each incoming transaction... Get the customer amount and payment address Call bitcoind getrawtransaction [The incoming transaction ID] 1. The 1 at the end will return the data in "verbose mode", which essentially the raw data in JSON ...


8

Check this: https://en.bitcoin.it/wiki/Testnet The testnet is an alternative Bitcoin block chain, to be used for testing. This allows application developers or bitcoin testers to experiment, without having to use real bitcoins or worrying about breaking the main bitcoin chain.


8

There are two Bitcoin softwares that should be differentiated: (i) the client software that everyone uses and (ii) the full Bitcoin node used by the miners. With regards to implementations, there are a variety of different clients. Just look at MultiBit, Electrum, Armory, Hive etc. Many are implemented using different programming languages and libraries. ...


8

In comparison to languages like Java or C++, Python has several advantages for coding bitcoin projects: Simplified rules of coding allows beginners and experienced alike to code and get results without getting bogged down in formatting etc Shell allows on the fly calculations Python code is easily read and as such can be edited to suit Python can be ...


8

I just published a book about it. It's called "Blockchain Programming in C#". If you're looking for tools written in C#, you should try NBitcoin. You can also find the project on GitHub. I've also written lots of articles about it: Intro: http://www.codeproject.com/Articles/768412/NBitcoin-The-most-complete-Bitcoin-port-Part-Crypt Stealth Payment, and ...


8

Tim S. pretty much covered it, but I wanted to 2 great resources which have been very helpful for myself and many others: Ken Shirriff's blog has a few Bitcoin mining related posts which use Python code to great effectiveness; whilst Bitcoin Mining The Hard Way is probably the most useful, there's also some novel use cases where Ken tries Bitcoin mining by ...


7

The URL to the api's for other currencies are: https://btc-e.com/api/2/1/ticker - BTC/USD https://btc-e.com/api/2/2/ticker - IXC/BTC https://btc-e.com/api/2/4/ticker - I0C/BTC https://btc-e.com/api/2/5/ticker - SC/BTC https://btc-e.com/api/2/6/ticker - SC/USD https://btc-e.com/api/2/7/ticker - GG/BTC https://btc-e.com/api/2/8/ticker - TBX/BTC https://btc-e....


7

Little endian. See, for example, the script_PushData unit test in the source tree that pushes one 0x5a byte onto the stack 4 different ways: // Check that PUSHDATA1, PUSHDATA2, and PUSHDATA4 create the same value on // the stack as the 1-75 opcodes do. ...


7

There is now the XChange library This is a pure Java library that has been released under the MIT license. It currently supports Mt Gox, but there are simple hooks to allow other exchanges such as Intersango and CryptoXChange to be supported. It is currently used by the MultiBit client.


Only top voted, non community-wiki answers of a minimum length are eligible