Breaking Down a Litecoin Transaction

 

Before we talk about Litecoin transactions, let’s talk about Litecoin addresses.

A Litecoin address is created by the following steps:

  1. A private key is created

  2. A public key is derived from the private key in one direction.  This means it’s near impossible to determine what the private key is from just the public key alone.

  3. A LTC address is derived from the public key bidirectionally through something called Base58 Check.  This means someone can figure out the Public Key from the LTC address and vice versa.

Untitled.png

Let’s pretend Alice has 1 LTC in her address.  She then sends 1 LTC to Bob.  Bob now has 1 LTC.  At first glance, all this is pretty simple.  Just plug in some numbers and push send.  But what happens underneath the hood is actually pretty complicated.  In light of this, I will only focus on the two necessary concepts of how a transaction is created to understand Confidential Transactions: the pubkey script and the amount of LTC sent.

In order to send Bob 1 LTC, Alice must do the following:

  1. Alice must first take Bob’s public key, which she decodes from his Litecoin address.

  2. She then inputs the amount of LTC she wants to send. Let’s say she chooses 1.

  3. She then writes a conditional script that says something to the effect of, “If Bob can prove he owns the private key to this public key I am sending 1 Litecoin to, he can spend use it.”  This conditional script is called a “pubkey script” or a scriptPubKey.

  4. The 1 LTC is now locked and can only be redeemed under the condition that Bob can prove he has ownership of the private key to the public key that Alice sent 1 LTC to.

  5. Alice relays this to the miners of the Litecoin network and it is then recorded in the blockchain as an Unspent Transaction Output (UTXO).

Untitled.png

Bob Sends 1 LTC to Carol

Bob 1 LTC from Alice and wants to send it to Carol.  In order to do this, he must prove he has ownership of the correct private key through something called a signature script.

There are 4 things that belong in a signature script:

  1. Bob’s Public key

  2. A signature created through Bob’s private key.

  3. The pubkey script Alice created.

  4. The LTC address Alice chose to send the 1 LTC too (which is Bob’s). 

Bob sends 1 LTC to Alice.  The wallet sees that there is 1 LTC as well as the pubkey script Alice created.  By using mathmatetical magic, the wallet is then able to prove Bob owns the correct private key by comparing the signature to the pubkey script.  It also verifies that the public key Bob provided belongs to the address Alice sent LTC to.

If all this checks out, Bob is now able to create a pubkey script of his own; this time with Carol’s LTC address.

Sidenote: In my earlier example of Alice sending Bob 1 LTC, I actually omitted the fact that Alice also had to prove she had ownership of the correct private key prior to creating her own pubkey script for simplicity’s sake.

But What Happens if it Doesn’t Check Out?

Let’s pretend Bob tries to send 2 LTC to Alice instead of 1 LTC.  The wallet would subtract 2 from 1 and return a negative number thereby rejecting the transaction.  If Bob tried to send 0.5 LTC, then the wallet would subtract 0.5 from 1, send 0.5 to Alice, and send what’s left over to one of Bob’s change addresses.   

The fact that the wallet must do math in order to send Litecoins is an important concept to understand.  In Confidential Transactions, the amount of a transaction is actually obfuscated not only from wallets, but from the public blockchain as well. This creates an accounting problem for the Litecoin network as it can no longer determine if the correct number of Litecoins are being sent or received.

Now that we understand the basic premise behind a transaction, we will go in depth into what is needed to create a Confidential Transaction including new address formats and something called “blinding keys.”

 
Resources

https://bitcoin.org/en/developer-guide#standard-transactions