How Sistas Can Launch a Distributed Enterprise Blockchain Ecosystem Using SQL Server Azure and SQL Server Express

bchain_chick The Wall Street Journal published an article about the technology talent shortage and stated data analytics is the greatest demand – this blog has told countless people over and over for years to learn database technology including business intelligence. Project managers and business analysts are also in demand and I know a few sistas already in these fields living that good life, driving nice too. But there is one tech skill sector the Wall Street Journal mentioned in their article: Experts in blockchain, the online ledger technology best known for supporting Bitcoin, are being offered $250,000 in salary in some circles. I have already advised the Global Urban Collective of the demand and potential of the blockchain and most of them already got it in their head that the blockchain is hot right now. And the Global Urban Collective have a series of code to run a complete blockchain system if they want to invest the time and effort. However, I got a little secret – you sistas are going to get the first article in the entire world on how to actually create a blockchain system using an enterprise level RDMS such as SQL Server. In this article, we will show you sistas exactly how to create an enterprise blockchain system and possibly create a portfolio as a blockchain architect to apply for those $250,000 jobs which I know are in New York, London at Level39, Singapore, Hong Kong, Dubai but in reality you sistas can create your own blockchain operation to introduce various disruptive new business models to the marketplace. So yeah, I’m about to be showing you sistas all that. Wow, you sistas be getting all the good stuff from Dream and Hustle..yall sistas must be special or something. Understanding the Blockchain blockchain_diagram The diagram above is how the blockchain is defined by Bitcoin and offshoots of Bitcoin protocol such as Ethereum. I want you sistas to understand this diagram and then forget about it because we are going to use an enterprise RDMS (that means relational database management system, my sista) that can deliver the same result but more scalable, secure and faster to transverse. The diagram show block 10, block 11, block 12 and these can be thought of as database rows or excel rows for all you sistas working on Excel. Okay, let me shout out you Microsoft Access sistas while we at it, put those hands up! In each block, you will see the following components: Prev_Hash. This is the previous one-way encryption of the last record before it to “chain” these blocks together, which is why it is called the “blockchain” and the thought is you cannot manipulate this chain which make the blockchain a reliable dataset because it cannot be tampered with or manipulated easily. Timestamp. This is like a notary timestamp to mark the time this record was entered into the blockchain and this is important because time move forward and this also provide sequential identifier to help you know what was the last record to append the previous hash to the new block. Tx_Root. The “tx” is short for transaction and I don’t know why people still code that way, that is so played out and old school. If you look at the middle part of the Tx_Root in the diagram where it look like a org chart, that is called a “Merkle Tree” and let me explain this a little. The Merkle Tree is a way to group the hashes together so you will see Tx0 and Tx1 create a respective Hash0 and Hash1. Then you hash together Hash0 and Hash1 to make Hash01 which hash with Hash23 to make the root hash. To validate the blockchain on this system, you have to repeat that process I describe of hashing Tx0,Tx1,Tx2,Tx3 all the way up to get the TxRoot and see if your result match TxRoot. But you don’t have to do this step in SQL Server and this Merkle Tree probably don’t need to be done in an enterprise setting either. Don’t worry about this stuff but these cats out here probably wanting to see how smart you are will want to ask you about the Merkle Tree and I just explained it to you. Nonce. This is just a random number or characters designed to “salt” the hash. The purpose is to add it to the MD5 hashing scheme to create a more unique hash value. If you look at how passwords are stored in ASP.NET, you will see the word “salt” instead which is the same as nonce. Here is the thing I want you sistas to realize – most of these cats running off the mouth about blockchain are “Satoshi” fanatics and purists with little tolerance for deviation instead of real-world enterprise information architects that know how to really get the job done and scalable. What I’m about to show you sistas is how to deliver the blockchain solution using the concept above and some of the stuff above but leveraging an existing enterprise product such as SQL Server to deliver the same blockchain solution. SQL Server Azure and SQL Server Express sql_azure SQL Server is an extremely powerful and robust database system and the beautiful thing is, this database that used to cost $20,000 to get running, you can now basically get in the cloud for a decent monthly price (less than your cable bill watching those reality TV shows) and there is an SQL Server Express version that is basically free but very powerful when you get under the hood of the free Express version. If you look at the diagram above, I want you to notice something about the cloud – you can create a SQL Server database in the cloud and it can be synced among several smaller databases around the world! And that is where the free version of SQL Server Express come in as it can be used by others to establish “subscriber nodes” to download the blockchain from the SQL Server cloud and these satellite nodes can transverse and validate the blockchain hash to trust the distributed ledger. Now as a low-tech work-around, it is even possible to export the data out of the database to a flat-file (that is a text file that is tab-delimited or comma-delimited) with the hash intact and distributed it traditional peer-to-peer as an ad-hoc way to distribute the blockchain just using the SQL Server Express free version. So if we just briefly go into the information architecture here – you sistas can create a blockchain in the cloud, let it distribute worldwide to SQL Server Express nodes via the Replication feature or you can export the blockchain data to a flat-file to be distributed and loaded into systems. If you sistas are really thinking right now, you sistas should realize you just have the power to create a blockchain solution to help your sistas in Africa like the one sista in Botswana who want to create a queued registry for organ donation with the blockchain. But let’s talk about the blockchain solutions you sistas can do for a minute before we get into details. Type of Blockchain Solutions solutions The blockchain is basically a ledger of records that can be trusted to be authentic due to the hashing applied to each record in a chained fashion. So this ledger can be distributed among several parties and this cut out the middleman in a lot of transactions. That is why the blockchain is so disruptive and in demand because of the savings that it can create. According to the Office of the Inspector General (USA), these are the areas that the blockchain can provide service and disrupt: Financial Services. Blockchain can operate as an accounting ledger containing balance and transactions. For the Global Urban Collective, we are making corporate financial activity available to our shareholders using the blockchain. This make corporations and non-profits totally transparent and our books can be inspected and trusted by potential investors and shareholders. But money transfers, remittance and e-commerce can be all based on the blockchain, like using cryptocurrency on social media selling. Smart Contracts. The agreement can be digitally signed by parties and stored on the blockchain and the fact there is a timestamp and distributed records among many nodes (witnesses) make the contract enforceable with preponderance of evidence in a court of law. This remove the need for lawyers and also allow the ability to enter micro-contracts such as terms and conditions and this is also the case to create insurance clauses or performance contracts such as making an instant royalty payment music streaming service on the blockchain. Smart Property. Assets can be recorded on the blockchain as well as the owner and the owner can digitally sign the right of an asset to another person or entity and vice versa. This is what Ghana and other African nations want to do to create a land registry using the blockchain. But the biggest and most lucrative that is being discussed is the marriage and pre-marriage and divorce industry. Couples can put their assets on the blockchain that they own separately, they purchased during the marriage and all of this information is on the blockchain during the divorce so no one argues over who gets what – this is predicted to be the biggest advantage of the blockchain not yet realized, destroying the corrupt and biased American divorce court system. Authentication Services. The term authentication means it is assumed you are who you say you are based on the providing certain information. So if you know for example, the encryption code stored on the blockchain last November at 9:00am and it has your ID, then this can validate who you are. The blockchain is not an ID system, it can check your activities and allow you to have an additional layer of security to prove who you are based on activity. One solution you hear a lot of is removing corruption from voting in foreign countries – if a person places a vote, it is placed on the blockchain and that person cannot double-vote. But that person can use a public key to vote and only the public key is registered to prevent identity of the voter and the vote. Records Management. The blockchain can record official records and where most of the records can be encrypted information so this allow the blockchain to have government records, crime blotters that police and politicians cannot go back and erase or modify and most important – this will allow patient records be stored on the blockchain and unlocked by the medical provider using public/private key encryption. For example, the doctor provides his/her public key and the patient encrypt their data using the doctor public key where only the doctor can decrypt the data – this is a powerful breakthrough in many Latin America, Southeast Asia and African emerging economies to get health records. Network and Device Management. This is the futuristic part – a smart device can automatically scan the blockchain looking for instructions and execute against those instructions. For example, the smart vending machine at your job can write to the blockchain that it does not see the RFID for granola bars meaning it sold out. The ordering system can constantly scan the blockchain and pick up the message from the vending machine that it sold out of granola bars and create an order and instructions to refill the vending machine with granola bars – this is the Fourth Industrial Revolution bot-to-bot technology that going to wipe out a lot of jobs but create a lot of high-paying blockchain and bot programming jobs. Ok, now that you see all of the opportunities and possibilities of the blockchain, let’s get into showing you sistas how to put something together by implementing the blockchain on SQL Server. Example Blockchain Model Using SQL Server kicks In this example, I want to create a blockchain model scenario to show you how to implement the solution and it’s pretty straightforward if you just follow what I’m about to write. Now, the sista in the picture above had a nice blog going called “College Kicks” where she goes out and find nice kicks at discount and resale shops and her blog is at http://mycollegekicks.blogspot.com/ and she got a YouTube spot at https://www.youtube.com/channel/UCzuQdpVOcIiUb7xIN9HzEMQ and she got a podcast and she is one of my favorite self-branded sistas out there. So this sista inspired the fictional blockchain model I’m going to present to you as a demostration. Let’s say someone into buying/selling/trading kicks want to step it up a notch and create a social media selling marketplace that spans Instagram, Facebook and Twitter and Snapchat that focus on buyers and sellers using their own branded cryptocurrency and all transactions are recorded on the blockchain. What this setup will do is create a “smart marketplace” where buyers and sellers can research each other on the blockchain to trust each other like Ebay such as number of previous sales and verify if the other party have the funds to actually buy the kicks. What the blockchain will do is create a “smart marketplace” where it is not just buyers/sellers but real data behind the buyers and sellers enhancing the kicks trading game experience using the blockchain. table_structure I created the two database tables above which are pretty easy if you think about it and it make sense and let me explain. This is a generic table that probably can be used for any social media marketplace blockchain and the first table is sm_transactions or social media transactions which contain the transaction details between the seller and buyer. The address will be an id or the public key of the person when they are buying or selling on the marketplace and the transaction is recorded. The asset_address is the item so it can be kicks or you can make it anything like purse, real estate or whatever down the road when you want to do more things with the blockchain. Now, I don’t get too detailed but there are two phases – the first phase is an “unconfirmed” transaction that will be a copy of this table that anybody can start a buy/sell transaction or a bid/ask transaction where bid is someone putting up a price for an item or ask is someone selling and asking for a certain price – this is how the stock market works. Once the two parties enter the information in the “unconfirmed” and the deal is “confirmed” with the cryptocurrency verifying the transaction, then the transaction is moved to the blockchain which is the table above – just want you sistas to understand this part. Let’s talk about the columns real quick – the id column is a unique identifier that will be used internally to add additional tables and offer fast lookup on the database system. The row_num column is an automatically incrementing number system like 1,2,3 so when we want to get the last row inserted to chain the previous hash to the incoming hash, I look for the max number in row_num. The timestamp is when the system recorded the entry into the blockchain as an official transaction. Now the other table is important – this is where the hash is stored and many people will ask why this is in a separate database table and not on the first table? The reason is the hash will be based on all of the values in the first table and I have to write the hash outside to have an accurate value that others can test. But when we distribute this blockchain, we will join both tables to make it look together. sp_insert (click to enlarge) This is the stored procedure you going to have to type out yourself because I want you to learn this stuff instead of trying to copy/paste. It is not a lot of code anyway but if you want this, then get to typing. What I done with the stored procedure above was create the one statement you only need for your blockchain, insert the seller address, the buyer address and the asset and let the stored procedure I created do the hashing and create the blockchain – that’s it. Now, if you haven’t noticed and most of you smart sistas are now realizing, I just showed you sistas how to “blockchain” any existing database out there, right? So the whole blockchain thing is just hype – any advanced database programmer can implement a blockchain on any dataset so let the media keep writing up blockchain talking about blockchain is so complex and so hard and stuff – nah, you sistas are good and I just showed you sistas what to do. Copy and paste what I just put out there. Second thing you should notice is the primitive models of the blockchain startups are just amateur hour while I just leverage an existing enterprise level database system like SQL Server I been working on for the past 15 years and know how scalable and powerful it can work – I stored and processed more than a billion rows on SQL Server systems and got quick response with queries. Smart cats leverage existing systems, not create some “Satoshi” manifesto and spend too much time worshiping the tenants of a manifesto. records So all you have to do is run the stored procedure like sm_transactions_insert with random numbers like I did in the picture to create 3 rows of data records in the sm_transaction main table and create 2 more corresponding rows in the hash table that have the blockchain hash_stamp. Please note for this demo, I did not include the nonce to make things simple – it is optional but you can add it to your blockchain if you want and I already coded the nonce in the stored procedure. sp_validate (click to enlarge) To validate the blockchain or any of the subscribers want to validate your blockchain from the SQL Server subscription, all they have to do is run the validate stored procedure that will create a table that will show what the blockchain hash value is in the database and a manual computation of the hash and see that it matches. So when I run this stored procedure, here are my results: blockchain_results You should see the “hash_stamp” generated in the database match my hash computation where I take each previous row and hash it with the hash of the main record of buyer, seller and asset. Now, another column can be created to see if hash_stamp is equal to hash_computer - if one row does not equal, then the whole blockchain is compromised and not to be trusted. But if everything equals out, then this is a valid blockchain and now you sistas have a real blockchain on your hands. How Sistas Should Proceed Forward with the Blockchain yougotone2 You sistas are now powered with the blockchain and can run out there and start making creative destruction and disruption happen in this world. As you saw, the blockchain is not as complicated or complex as these blockchain-hyping tech magazines and blogs make it out to be. Also, the smart way to do technology is always leverage the tried and true platform such as SQL Server which is a workhorse and take advantage of the cloud and express version to distribute your blockchain in an enterprise fashion. My first step with this SQL Server blockchain solution is to have the Global Urban Collective play with the code and setup and once the GUC give the okay, I will update this blog with downloadable code to run and provide additional instructions. Then what you sistas want to do is decide what you want to do with the blockchain technology? Create your database then add the second blockchain table to support blockchain functionality like you saw how I did. If you want to pursue the $250k enterprise career in the blockchain, then focus on creating a portfolio and use case for several blockchain projects that can show how a corporation can save money. Also browse a lot of blockchain whitepapers and previous blockchain hackathons and start swaggerjacking ideas for your hustle or for your portfolio.

5 thoughts on “How Sistas Can Launch a Distributed Enterprise Blockchain Ecosystem Using SQL Server Azure and SQL Server Express

    1. The front-end is done in the form of a wallet or a client app. I will be covering this in mid-October with my own implementation.

Comments are closed.