From the course: Blockchain Programming in iOS Using Swift

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

Initializing the blockchain

Initializing the blockchain

- [Instructor] Okay, so let's continue with our quest of building the core framework for our Blockchain API. Right now we have a Blockchain class. We also have a block class which represents single, or each block in the Blockchain, and we also have a transaction class which represents many transactions that can be added to the block. And these transactions can be: Mary is sending twenty dollars to John, Steve is sending ten dollars to Mary and so on. Now one thing to note about the Blockchain is that the first block in the Blockchain is called the Genesis Block. And that block contains the rewards for the miners. So when you create a Blockchain it will have the Genesis Block, which contains a reward, of course. So let's go ahead and create our Genesis Block. Which it's going to serve as the first block at index zero inside the Blockchain. Once we have that, we need to create the Blockchain, but right now the Blockchain, well, doesn't really have any Initializers, so let's go ahead and…

Contents