I created a simple "blockchain" on Java.
Blockchain class is an ArrayList<> of Blocks. The blocks are made by: hashcode, previous hashcode and nonse counter. When a block is created, it is added to the blockchain but, until the algorithm (SHA256) is resolved, it is not possible to allocate others. If the hashcode is unique, it is added successfully or the block is removed.
What I would like to do now is to share the blockchain on a network, so the SHA256 algorithm will not be resolved by the local machine, but by a user on the network (for exaple, bitcoin mining).
So my question is: how can I share the same object on different machines in a network?
You can download the code from Git:
Its a bit of a complex question. There are different ways but usually a Node will keep a list of nodes it is connected too and will notify them for changes. Also once they start communicating you should start worrying about differences in the chain (for example if chain on one node is different from chain on another node but both are valid). For bitcoin it takes the longer one as valid.
It is a very broad question with a very broad answer. You can see a simple javascript implementation of a blockchain using websockets here:
https://github.com/lhartikk/naivechain
Or a simple python implementation: https://github.com/sMustafov/Blockchain/blob/master/blockchain.py
Or here is one written by me in Java :) which is not complete though but it was just to do some training and ideas
https://github.com/veso1001/blockchain/tree/master/src/main/java/imbachain