Go has a Framework for Crypto-currency called Crypto which cover topics to build a secured blockchain, i am not a blockchain developer so i am not going to dive deep into blockchain structures i will speak from a background that i was working on the very early stages of a blockchain network in Go and stopped at Markov Tree (I don't know when I will complete this side project but i hope it will be soon), BlockChain can be understood from it's name, it's a chain of blocks connected together by a secured string(hash)like sha256, sha1 or md5 .
All the above Techniques ensure a secured immutable block but not completely secured, a-lot of techniques is used to spoil the security of the blockchain like rainbow table attack, hashing is used in blockchain to hash the pointer of the block so they reference one another.
for example if the id of the block is a string of a value equals to "I_Love_Tanya_Romanov" the equivalent hash of this string in Sha256 is "1ce39a808b22328f862d730bcc77a542798faaa4f2ebb8eed3185b8272e492fa".
the Algorithm or idea behind this conversion is technique called hashing if you're familiar with the data structure HashTable that every index in the HashTable or every row has a key and this key is generated from a hash function the hash function is measured to be good or bad by something called collision resistance which means how the hash function every time generates a unique key without collision with another hash.
(Collision means two strings can generate the same hash from one hash function)
it's impossible to find another string which will generate the same hash of the hash of the string "I_Love_Tanya_Romanov".
So HashFunction is mathematical function which takes an input a string and generates an output (hash) but it's a one way function which means if i attempted to go trace the output to find the original input i will fail and if i succeed then this is considered a weak HashFunction.
Now back to the Rainbow table how it manages to make this function a two way function, putting it simply by storing the hashes of famous passwords like 123456, i think you figured out know why some websites recommend making the password a mix of characters and number and special characters like (?,.,/, etc...) to ensure you don't use a trivial password which it's hash can be found in a database.
GoLang has a library called crypto which deals with the cryptocurrency problems like storing hash of password and this kind of problems now to it
the following method generates a hash of a string:-
func hash(s string) string{
hash := sha256.Sum256([]byte (s))
hashstring := string(hash[:])
return hashstring
}
this hash is used as a link between the block for example when linking between two blocks in a blockchain the hash is the pointer which link between the two blocks, let's imagine the Blockchain as a linked list(list or array) of blocks
Block1 <- Block2 <- Block3 <- Block4
this sign <- is the pointer which is stored as hash so this why blockchain is hard to break because even if you broke a chain the preceding ones won't be affected because Block2 can reach Block1 but Block1 can't Reach Block2 which makes blockchain a reversed linked list instead of using linking to the next node the next node linked to the previous node.
the first node (Block1) is called genesis and it doesn't reference to any other block.
Fun to Read :-
https://en.wikipedia.org/wiki/Rainbow_table
https://www.researchgate.net/publication/318131748_An_Overview_of_Blockchain_Technology_Architecture_Consensus_and_Future_Trends
Top comments (0)