I have two questions regarding the content of your book.
a) Does the book also cover the cryptographical details of the blockchain? Or is the reader expected to know these?
b) I see that there is a chapter on Unit testing the application. Is integration testing also covered?
You should consider making your code more readable, so it's easier to understand for people to review your code. Here are some points to consider:
- You have one long method with nested for/if. Consider using methods. You could, for example, create a method which takes a Strings and a number n as input and prints the string n times.
- Try to find an alternative for the first_time / second_time.
You could use a switch with an enum. This could be an option if you want to reuse the conditions and keep the switch short.
Here is a simplified example. Please note that I do not advocate this pattern, but it might be appropriate in some cases.