The prevalent idea of modern day cryptographic currencies originated when Bitcoin launched in 2009. With Bitcoin, for the first time in history, the world had access to a completely decentralized medium of exchange. This medium of exchange reliably transfers value from one entity to another in a hostile, trust-less environment by solving a problem that previously necessitated centralized entities, such as financial banks, to arbiter value exchanges.
The main role of the centralized entity was to assure the recipient that the money has been taken from the sender, and given to the recipient, and the sender could no longer spend the same money (i.e., double spend it). The problem of double spending can be modeled under an abstract Byzantine Generals' Problem that focuses on achieving majority consensus in a decentralized network.
The Byzantine Generals' Problem is a topic that deserves its own blog post. For now, let's just remember that the problem of double spending was thought impossible to solve in a decentralized manner before Bitcoin solved it. This solution was implemented in what is now called the Blockchain.
What is the Blockchain?
In simple terms, the Blockchain is a book of accounts that is divided into batches of transactions, or blocks, which are naturally a collection of transactions. Bitcoin uses a number of technologies that came before it, including decentralized file sharing (see: BitTorrent), Public Key Cryptography, and Proof of Work Hashing (see: Hashcash). Bitcoin introduced a new technology: the Blockchain. Most subsequent cryptographic currencies, such as Dogecoin, use the same technology with minor changes (e.g., a different Proof of Work hashing algorithm).
The Blockchain facilitates reliable transfer of units of account (later on referred to as values) between certain cryptographically valid entities. In Bitcoin, the total units of account that will ever exist is 2.1 Quadrillion Satoshis, or 21 Million Bitcoin. In Dogecoin, this is 100 Billion Dogecoin until March 2015, and 5 Billion additional Dogecoin annually after that. Dogecoin and Bitcoin consist of two separate networks of peer-to-peer nodes. Each Bitcoin or Dogecoin node tries to keep its local copy of the book of accounts up-to-date.
In order to make use of the power of the Blockchain and its fast, decentralized, low-fee transactions, one must understand what constitutes a transaction:
A transaction is simply a cryptographically verifiable instruction from the sender to transfer value the sender owns to one or more valid recipients. The sender(s), and receiver(s), have cryptographically verifiable identities, known as addresses (see: Public Key Cryptography).
In the Blockchain, here's what a (simplified) transaction looks like:
"txid": <a unique transaction identifier>
"inputs": <an array of inputs>
"outputs": <an array of outputs>
"tx_hex": <transaction content as a hexcode string>
"blockhash": <a unique block identifier this transaction belongs to>
"time": <the time this transaction's block was processed>
"confirmations": <number of blocks that confirmed this transaction>
The very basic parts to understand in the above snippet are: a transaction has inputs, and outputs. The inputs are specifications of which values to transfer from the sender's address(es), and the outputs are specifications of how much of the total input value each recipient's address(es) receives. Inputs in this transaction were outputs in a previous transaction, with the exception of when the network generates new coins.
New coins are generated by the Dogecoin network as rewards for miners for solving a block (example), i.e., miners work hard to find the correct hash for a batch of transactions, also known as a block (see: Hashcash, Proof of Work). If the total input values are higher than the total output values, the difference is paid to miners of the block as a transaction fee. Total input value is never less than the total output value in a single transaction.
When a miner finds a new block, they confirm all the transactions contained within it as valid. However, a block does not exist on its own -- it is linked to blocks previously solved in a chain of blocks all the way to the Genesis Block. The Genesis Block was created when Bitcoin or Dogecoin networks were created (see: Dogecoin Genesis Block). Therefore, where a block is solved, and appended to a chain of previously found blocks, it confirms the transactions within it, as well as the transactions in all the previous blocks in its chain. Hence the name: Blockchain.
So, what is the Blockchain? In very concise terms, it is a chain of blocks!
A Transaction's Journey to Being Confirmed
Figure 1 (below) shows a simplified version of the steps a transaction goes through from the time it is created, to the time it is included in the Blockchain, i.e., confirmed.
Interacting with the Blockchain
Now that you have better understanding of what the Blockchain is, go ahead and dive into it. Use the SoChain API for querying for transactions, addresses, blocks, and if you create transactions, you can push them into the Dogecoin network using the same API. If you're in the mood to muck around and debug your own project, use the Dogecoin Test Network (DOGETEST) instead of the Dogecoin Main Network (DOGE). If you need any kind of help with this, including getting Dogecoin for experimenting with the Test Network, contact us directly.
We will cover technical details of creating transactions in a later blog post.
Disclaimer: This is not a technical specification of the Blockchain. It is intended for newcomers, and simplified as such.