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.

Resolving conflicts

Resolving conflicts

- [Mohammad] In the last lecture we learned that how we can register nodes, and also start mining on different nodes. Now we're gonna learn that how we can resolve conflicts between different nodes, so let's get started. I'm gonna jump into the blockchain service and create a function which will be responsible for resolving the conflicts between blockchains existing on different nodes. I've called this function, resolve, and this is going to take in a completion which will return us a blockchain, the resolved blockchain in this case. Let's go ahead and also mark this as escaping because we will be sending the blockchain back, so let's call it, escaping. The first thing we need to do is we need to get all the different nodes, so these are all the nodes on the servers on which the blockchain is running, and in the previous lectures we have already shown that how you can register different nodes. Now I'm gonna go ahead and iterate through all the nodes. For each node I'm gonna go ahead…

Contents