Quick Dive Into Delphi And The BlockChain, Cryptography, BitCoin, and More

Cryptography is the study of secure communications techniques that allow only the sender and intended recipient of a message to view its contents. Public Key Encryption or Asymmetric cryptography is widely used cryptography which use different keys for encryption and decryption.

  • Receiver needs to publish an encryption key, referred to as his public key which used for encrypt a message but that encrypted message can only be decrypted with the receiver’s private key.
  • Some assurance of the authenticity of a public key is needed in this scheme to avoid spoofing by adversary as the receiver. Generally, this type of cryptosystem involves trusted third party which certifies that a particular public key belongs to a specific person or entity only(Digital Signature).
  • The popular schemes used for Asymmetric cryptography were RSA, ElGamal, ECC. Though these schemes helps to secure your information, doesn’t solves data integrity which can leads to active threat. Security mechanism such as Cryptographic Hash functions are used to tackle the active modification threats.
  • A Cryptographic Hash is fixed size thumbprint that uniquely identifies an arbitrary input irrespective of input size which can be generated from Hash Algorithm. e.g) SHA-256 is a 256-bit thumbprint.

CryptoCurrency: The Idea predates BitCoin as electronic cash, an alternative virtual, eletronic currency, that is secured by cryptography, which makes it nearly impossible to counterfeit or double-spend.

BitCoin: Designed by pseudonymous Satoshi Nakamoto. Originally described in 2008 paper “bitcoin: A peer to Peer Eectronic cash system” and released an open source in 2009.

  • It is the first decentralized peer-to-peer payment network that is powered by its users with no central authority or middlemen.
  • Nobody owns the Bitcoin network much like no one owns the technology behind email. Bitcoin is controlled by all Bitcoin users around the world.
  • The Bitcoin network is sharing a public ledger called the “block chain”. This ledger contains records called blocks that is used to record transactions across many computers so that any involved block cannot be altered retroactively, without the alteration of all subsequent blocks.
  • Transaction unit is in Satoshi = 0.00000001 BTC.
  • An Individual uses a wallet to access thier BTC- the digital credentials to transfer bitcoins.
  • The authenticity of each transaction is protected by digital signatures corresponding to the sending addresses, allowing all users to have full control over sending bitcoins from their own Bitcoin addresses.
  • Anyone can process transactions using the computing power of specialized hardware and earn a reward in bitcoins for this service. This is often called “mining“.

Mining: Is a distributed consensus system that is used to confirm pending transactions by including them in the block chain. Mining is the mechanism that allows the blockchain to be a decentralized security. It secures the bitcoin system and enable a system without a central authority. 

It is the process of finding a nonce (number used once – unique number) that generates a SHA-256 hash meeting the current difficulty target. Every 2016 blocks 14 days at 10 min/block, the difficulty target is adjusted based on network’s recent performance.

Mining Proof of Work : Miners validate new transactions and record them on the global ledger ( blockchain ). On average, a block ( the structure containing transations ) is mined every 10 minutes. Miners compete to solve a difficult mathematical problem based on a cryptographic hash algorithm. The solution found is called the Proof-Of-Work

Blockchain : When there is no central ledger, how do you know which ledger is true ? Without consensus for the ledger there is no way to prevent someone from repeating a transaction mutliple times(Spending more than once) ? Blockchain solves this as each block contains the hash of the previous block. Once a new block is added to the chain, it validates all the previous blocks. The First block in the block chain is genesis block.

Ethereum: An open source, public, blockchain-based distributed computing platform featuring smart contracts.

  • A smart contract is a script that executes on a Ethereum Virtual Machine(EVM)[ A decentralized Turing-complete virtual machine on the block chain]
  • Ether is a cryptocurrency whose block chain is generated b Ethereum platform.
  • “Gas”, an internal transaction pricing mechanism, is used to mitigate spam and allocate resources on the network

BitCoin & Ethereum Price APIs :

  • REST API to retrieve BitCoin price. Request to this REST API Current Price.
  • For historical data and other currency conversions Check here
  • For other Cryptocurrencies comparison Check here

PascalCoin: Cryptocurrecy developed with FreePascal.

  • Infinite Scaling – Only keeps the last 100 blocks of the blockchain (the Flow) instead the full history. This keeps the ledger from getting large.
  • Very high transaction rate – over 100 transactions per second.
  • Supports Asserts, Sub Tokens and smart contracts.
  • Wallet available on Windows and Linux. No android and ios support yet.
  • for Current Pascalcoin Price, check here.

Watch this video Delphi and the Blockchain here. It also demonstrates the sample block chain chat application.