diff --git a/Blockchain/Client_ViggiCoin v2.0/.vs/Client_ViggiCoin v2.0/v14/.suo b/Blockchain/Client_ViggiCoin v2.0/.vs/Client_ViggiCoin v2.0/v14/.suo
new file mode 100644
index 0000000..759ca77
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/.vs/Client_ViggiCoin v2.0/v14/.suo differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.sln b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.sln
new file mode 100644
index 0000000..bf71feb
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.sln
@@ -0,0 +1,22 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 14
+VisualStudioVersion = 14.0.25420.1
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Client_ViggiCoin v2.0", "Client_ViggiCoin v2.0\Client_ViggiCoin v2.0.csproj", "{1D43135D-88C1-421F-90D3-8E4E75811B60}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {1D43135D-88C1-421F-90D3-8E4E75811B60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1D43135D-88C1-421F-90D3-8E4E75811B60}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1D43135D-88C1-421F-90D3-8E4E75811B60}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1D43135D-88C1-421F-90D3-8E4E75811B60}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.v11.suo b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.v11.suo
new file mode 100644
index 0000000..3b2deb1
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.v11.suo differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/App.config b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/App.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/App.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ArgumentWrapper.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ArgumentWrapper.cs
new file mode 100644
index 0000000..8258812
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ArgumentWrapper.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ //Wrapper usato per ritornare valori dalla funzione CPeers.DoRequest()
+ class ArgumentWrapper
+ {
+ public T Value;
+
+ public ArgumentWrapper()
+ { }
+
+ public ArgumentWrapper(T Value)
+ {
+ this.Value = Value;
+ }
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlock.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlock.cs
new file mode 100644
index 0000000..05974a7
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlock.cs
@@ -0,0 +1,49 @@
+using System;
+
+namespace Blockchain
+{
+ public class CBlock
+ {
+ public string Hash;
+ public ulong BlockNumber;
+ public string Transiction;
+ public ulong Nonce;
+ public ulong Timestamp;
+ public ushort Difficutly;
+ public static int TargetMiningTime = 60;
+
+ public CBlock()
+ { }
+
+ public CBlock(string Hash, ulong NumBlock, string Transiction, ulong Nonce, ulong Timestamp, ushort Difficutly)
+ {
+ this.Hash = Hash;
+ this.BlockNumber = NumBlock;
+ this.Transiction = Transiction;
+ this.Nonce = Nonce;
+ this.Timestamp = Timestamp;
+ this.Difficutly = Difficutly;
+ }
+
+ ///
+ /// Crea un nuovo oggetto CBlock usando una stringa che lo rappresenta.
+ ///
+ /// Stringa che rappresenta l'oggetto CBlock.
+ public static CBlock Deserialize(string SerializedBlock)
+ {
+ string[] blockField;
+ SerializedBlock = SerializedBlock.Trim('{', '}');
+ blockField = SerializedBlock.Split(';');
+ if (Program.DEBUG)
+ CIO.DebugOut("Deserializing block number: "+ blockField[1]+".");
+ return new CBlock(blockField[0], Convert.ToUInt64(blockField[1]), blockField[2], Convert.ToUInt64(blockField[3]), Convert.ToUInt64(blockField[4]), Convert.ToUInt16(blockField[5]));
+ }
+
+ /*
+ public ulong BlockNumber
+ {
+ get { return mBlockNumber; }
+ }
+ */
+ }
+}
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlockChain.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlockChain.cs
new file mode 100644
index 0000000..61a8b3a
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CBlockChain.cs
@@ -0,0 +1,66 @@
+using System.IO;
+
+namespace Blockchain
+{
+ class CBlockChain
+ {
+ private CBlock mLastBlock=null; //ultimo blocco ricevuto
+ private CBlock mLastValidBlock = null; //ultimo blocco sicuramente valido
+ #region Singleton
+ private static CBlockChain instance;
+
+ private CBlockChain()
+ {
+ Load();
+ }
+
+ public static CBlockChain Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ instance = new CBlockChain();
+ }
+ return instance;
+ }
+ }
+ #endregion Singleton
+
+ public CBlock LastBlock
+ {
+ get { return mLastBlock; }
+ }
+
+ public CBlock LastValidBlock
+ {
+ get { return mLastBlock; }
+ }
+
+ ///
+ /// Carica l'ultimo blocco della blockchain.
+ ///
+ private void Load()
+ {
+ StreamReader file = new StreamReader("blockchain.txt");
+ mLastValidBlock = CBlock.Deserialize(file.ReadLine());
+
+ }
+
+
+ internal static bool Validate(CBlock b)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ internal static void Add(CBlock b)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ internal static void Add(CBlock[] b)
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CIO.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CIO.cs
new file mode 100644
index 0000000..ea3b9db
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CIO.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ class CIO
+ {
+ //v 2.0 "Vgg"
+ //input/output da modificare se non è più su console
+ public static void WriteLine(string s)
+ {
+ Console.WriteLine(s);
+ }
+
+ public static void Write(string s)
+ {
+ Console.WriteLine(s);
+ }
+
+ public static void DebugOut(string s)
+ {
+ WriteLine(s);
+ WriteLine("");
+ }
+
+ public static string ReadLine()
+ {
+ return Console.ReadLine();
+ }
+
+
+ }
+}
+
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeer.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeer.cs
new file mode 100644
index 0000000..dd033c4
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeer.cs
@@ -0,0 +1,193 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Net.Sockets;
+using System.Net;
+using System.Security.Cryptography;
+
+namespace Blockchain
+{
+ class CPeer
+ {
+ private IPAddress mIp;
+ private int mPort;
+ private Socket mSocket;
+ //TODO: cambiare l'inizializzazione una volta definite le classi
+ private RSACryptoServiceProvider csp = null;
+ private RSACryptoServiceProvider cspMine;
+ private Thread mThreadListener;
+ private bool mConnect;
+ private CPeer()
+ {
+ }
+
+ private CPeer(IPAddress IP_Address, int Port)
+ {
+ mIp = IP_Address;
+ mPort = Port;
+ //IPEndPoint peerEndPoint = new IPEndPoint(IP_Address,Port); Serve per fare il connect
+ mSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ mConnect = false;
+ }
+
+ private CPeer(IPAddress IP_Address, int Port, Socket Sck)
+ {
+ mIp = IP_Address;
+ mPort = Port;
+ mSocket = Sck;
+ mConnect = true;
+ }
+
+ //Ritorna l'oggetto solo se i parametri sono corretti
+ public static CPeer CreatePeer(string IP_Address, int Port)
+ {
+ IPAddress ip;
+ if (IPAddress.TryParse(IP_Address, out ip))
+ return new CPeer(ip, Port);
+ else
+ return null;
+
+ }
+ public static CPeer CreatePeer(string IP_Address, int Port, Socket Sck)
+ {
+ IPAddress ip;
+ if (IPAddress.TryParse(IP_Address, out ip))
+ {
+ return new CPeer(ip, Port, Sck);
+ }
+ else
+ return null;
+ }
+
+ public string IP
+ {
+ get { return Convert.ToString(mIp); }
+ }
+
+ public int Port
+ {
+ get { return mPort; }
+ }
+
+ public Socket Socket
+ {
+ get { return mSocket; }
+ }
+
+ public bool Connect()
+ {
+ if (Program.DEBUG)
+ CIO.DebugOut("Connecting to " + mIp + ":" + mPort);
+ SocketAsyncEventArgs asyncConnection = new SocketAsyncEventArgs();
+ bool SuccessfulConnected = false;
+ asyncConnection.Completed += (object sender, SocketAsyncEventArgs e) => { SuccessfulConnected = true; };
+ asyncConnection.RemoteEndPoint = new IPEndPoint(mIp, mPort);
+ mSocket.ConnectAsync(asyncConnection);
+ Thread.Sleep(3000);
+ if (SuccessfulConnected)
+ {
+ if (Program.DEBUG)
+ CIO.DebugOut("Connection with " + mIp + ":" + mPort+" enstablished!");
+ mConnect = true;
+ mThreadListener = new Thread(new ThreadStart(Listen));
+ mThreadListener.Start();
+ return true;
+ }
+ else
+ {
+ if (Program.DEBUG)
+ CIO.DebugOut("Connection with " + mIp + ":" + mPort+" failed!");
+ asyncConnection.Dispose();
+ return false;
+ }
+ }
+
+ public void SendCommand(ECommand Cmd)
+ {
+ switch (Cmd)
+ {
+ default:
+ throw new ArgumentException("Comando al peer non supportato.");
+ }
+ }
+
+ public ECommand ReceiveCommand()
+ {
+ string msg = ReceiveString();
+ switch(msg)
+ {
+ default:
+ throw new ArgumentException("Ricevuta stringa di comando non supportata.");
+ }
+ }
+
+ public void SendString(string Msg)
+ {
+ SendData(ASCIIEncoding.ASCII.GetBytes(Msg));//non è asincrono!!
+ }
+
+ public string ReceiveString()
+ {
+ return ASCIIEncoding.ASCII.GetString(ReceiveData());
+
+ }
+
+ //TODO Criptare le comunicazioni
+ public void SendData(byte[] Msg)
+ {
+ CServer.SendData(mSocket, Msg);//non è asincrono!!
+ }
+
+ public byte[] ReceiveData()
+ {
+ return CServer.ReceiveData(mSocket);
+ }
+
+
+
+ ///
+ /// Rimane in attesa di messaggi dal peer a cui è collegato il socket mSocket.
+ ///
+ public void Listen()
+ {
+ string msg;
+ while (true) //bisogna bloccarlo in qualche modo all'uscita del programma credo
+ {
+ lock (mSocket)
+ {
+ //il timer viene settato cosicchè in caso non si ricevino comunicazioni venga ritornata un'eccezione, in modo che il programma vada avanti e tolga il lock al socket.
+ mSocket.ReceiveTimeout = 1000;
+ try
+ {
+ msg = ReceiveData();
+ if (msg == "LOCK") //(!)non serve a niente?
+ {
+ if (Program.DEBUG)
+ Console.WriteLine("LOCK received by" + mIp);
+ SendData("OK");
+ msg = ReceiveData();
+ switch (msg)
+ {
+ case "UPDATEPEERS":
+ CPeers.Instance.DoRequest(ERequest.SendPeersList,this);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ catch
+ {
+ Thread.Sleep(1000); //(!)forse è meglio attendere fuori dal lock. E forse non serve comunque perchè il thread si ferma già quando è in attesa di connessioni.
+ }
+ //il timer viene reinpostato a defoult per non causare problemi con altre comunicazioni che potrebbero avvenire in altre parti del codice.
+ mSocket.ReceiveTimeout = 0;
+ }
+ }
+ }
+
+
+ }
+}
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeers.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeers.cs
new file mode 100644
index 0000000..aa47390
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CPeers.cs
@@ -0,0 +1,230 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ class CPeers
+ {
+ private CPeer[] mPeers;
+ private int mNumReserved;
+
+ #region Singleton
+
+ private static CPeers instance;
+
+ private CPeers() { }
+
+ public static CPeers Instance
+ {
+ get
+ {
+ if (instance == null)
+ {
+ instance = new CPeers();
+ }
+ return instance;
+ }
+ }
+
+ #endregion Singleton
+
+ public CPeers(int NumConnections, int Reserved)
+ {
+ mPeers = new CPeer[NumConnections];
+ mNumReserved = Reserved;
+
+ instance = this;
+ }
+
+ public bool Insert(CPeer Peer, bool IsReserved = false)
+ {
+ //ritorna true se riesce ad inserire il peer, mentre false se il vettore è pieno o il peer è già presente nella lista
+ lock (mPeers) //rimane loccato se ritorno prima della parentesi chiusa??
+ {
+ //controlla che la connessione(e quindi il peer) non sia già presente
+ foreach (CPeer p in mPeers)
+ if (p?.IP == Peer.IP)//e se ci sono più peer nella stessa rete che si collegano su porte diverse?
+ return false;
+
+ //controlla se è il peer che si è collegato a me o sono io che mi sono collegato al peer
+ if (IsReserved)
+ for (int i = mPeers.Length - 1; i > 0; i--)
+ {
+ if (mPeers[i] == null)
+ {
+ mPeers[i] = Peer;
+ return true;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < mNumReserved; i++)
+ if (mPeers[i] == null)
+ {
+ mPeers[i] = Peer;
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+
+ public int NumConnection()
+ {
+ int n = 0;
+ for (int i = 0; i < mPeers.Length; i++)
+ {
+ if (mPeers[i] != null)
+ n++;
+ }
+ return n;
+ }
+
+ ///
+ /// Esegue una richiesta ai peer collegati.
+ ///
+ /// Richiesta da effettuare.
+ /// Parametro usato per passare un valore e/o ritornare un risultato quando necessario.
+ ///
+ public void DoRequest(ERequest Rqs, object Arg = null) //(!) rivedere i metodi di input/output del metodo
+ {
+ switch (Rqs)
+ {
+ case ERequest.UpdatePeers:
+ UpdatePeers();
+ break;
+ case ERequest.SendPeersList:
+ SendPeersList(Arg as CPeer);
+ break;
+ case ERequest.LastValidBlock:
+ RequestLastValidBlock();
+ break;
+ default:
+ throw new ArgumentException("Invalid request.");
+ }
+ }
+
+ private void UpdatePeers()
+ {
+ string ris = "";
+ string msg;
+ string[] lists;
+ string[] peers;
+ List receivedPeers = new List(), newPeers = new List();
+ for (int i = 0; i < mPeers.Length; i++)
+ {
+ if (mPeers[i] != null)
+ {
+ //blocca il peer e manda una richiesta di lock per bloccarlo anche dal nel suo client, così che non avvengano interferenze nella comunicazione
+ lock (mPeers[i].Socket)
+ {
+ mPeers[i].SendData("LOCK"); //(!)in realtà non serve a niente?
+ msg = mPeers[i].ReceiveData();
+ if (msg == "OK")
+ {
+ mPeers[i].SendData("UPDATEPEERS");
+ msg = mPeers[i].ReceiveData();
+ ris += msg + "/";
+ }
+ // mPeers[i].SendData("ENDLOCK");
+ }
+ }
+ }
+ ris = ris.TrimEnd('/');
+
+ if (ris != "")
+ {
+ lists = ris.Split('/');
+ foreach (string l in lists)
+ {
+ peers = l.Split(';');
+ foreach (string p in peers)
+ {
+ receivedPeers.Add(DeserializePeer(p));
+ }
+ }
+
+
+ bool AlreadyPresent = false;
+ //controlla tutti i peer ricevuti presenti in receivedPeers e li mette ogni peer in newPeers solo se non è un doppione e se ci si è riusciti a collegarcisi
+ foreach (CPeer rp in receivedPeers)
+ {
+ foreach (CPeer np in newPeers)
+ if (rp.IP == np.IP)
+ {
+ AlreadyPresent = true;
+ break;
+ }
+ if (!AlreadyPresent)
+ if (rp.Connect())
+ newPeers.Add(rp);
+ AlreadyPresent = false;
+ }
+ //inserisce tutti i nuovi peer GIà COLLEGATI
+ foreach (CPeer p in newPeers)
+ if (!this.Insert(p))
+ break;
+ }
+ }
+
+ private static CPeer DeserializePeer(string Peer)
+ {
+ string[] peerField = Peer.Split(',');
+ return CPeer.CreatePeer(peerField[0], Convert.ToInt32(peerField[1]));
+ }
+
+ private void SendPeersList(CPeer Peer)
+ {
+ string PeersList = "";
+ for (int i = 0; i < mPeers.Length; i++)
+ {
+ if (mPeers[i] != null)
+ PeersList += mPeers[i].IP + "," + mPeers[i].Port + ";";
+ }
+ PeersList = PeersList.TrimEnd(';');
+ Peer.SendData(PeersList);
+ }
+
+ private CTemporaryBlock RequestLastValidBlock()
+ {
+ List blocks = new List();
+ CTemporaryBlock ris = null;
+ ECommand cmd;
+ string msg;
+
+ foreach (CPeer p in mPeers)
+ {
+ p.SendCommand(ECommand.LOOK);
+ cmd = p.ReceiveCommand();
+ if (cmd == ECommand.OK)
+ {
+ p.SendCommand(ECommand.GET);
+ cmd = p.ReceiveCommand();
+ if (cmd == ECommand.OK)
+ {
+ p.SendCommand(ECommand.LASTVALID);
+ msg = p.ReceiveString();
+ blocks.Add(new CTemporaryBlock(CBlock.Deserialize(msg), p));
+ }
+ }
+ }
+
+ if (blocks[0] != null)
+ {
+ ris = blocks[0];
+ foreach (CTemporaryBlock b in blocks)
+ {
+ if (ris.BlockNumber < b.BlockNumber)
+ ris = b;
+ }
+ }
+ return ris;
+
+ }
+
+ }
+}
+
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CServer.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CServer.cs
new file mode 100644
index 0000000..87492f1
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CServer.cs
@@ -0,0 +1,206 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading;
+using System.Net;
+using System.Net.Sockets;
+using System.Security.Cryptography;
+using System.IO;
+
+namespace Blockchain
+{
+ class CServer
+ {
+ //RSA
+ //TODO: cambiare l'inizializzazione una volta definite le classi
+ public static RSACryptoServiceProvider rsaKeyPair;
+
+
+ private Thread mUpdateBlockChainThread;
+ private CPeers mPeers;
+ private static int MAX_PEERS = 30;//deve essere pari
+ private static int RESERVED_CONNECTION = MAX_PEERS / 2;//connessioni usate per chi vuole collegarsi con me
+ private static int NOT_RESERVED_CONNECTION = MAX_PEERS - RESERVED_CONNECTION;//connessioni che utilizzo io per collegarmi agli altri
+
+ private Thread mThreadListener, mThreadPeers;
+ private Socket mListener;
+ private static int DEFOULT_PORT = 100;
+
+ private ulong mLastBlockNumber;
+
+ private bool IsStopped = false; //set true per spegnere il server
+
+ private CServer(List Peers)
+ {
+ rsaKeyPair = new RSACryptoServiceProvider();// crea oggetto CSP per generare o caricare il keypair
+ if (File.Exists("keystore.xml"))// Se il file di keystore esiste viene caricato in memoria
+ {
+ rsaKeyPair = new RSACryptoServiceProvider();
+ string xmlString = rsaKeyPair.ToXmlString(true);
+ File.WriteAllText("keystore.xml", xmlString);
+ }
+ else//se il file non esiste ne viene generato uno
+ {
+ rsaKeyPair = RSA.GenRSAKey();
+ string xmlString = rsaKeyPair.ToXmlString(true);
+ File.WriteAllText("keystore.xml", xmlString);
+ }
+
+
+ mLastBlockNumber = CBlockChain.Instance.LastBlock.BlockNumber;
+ if (Program.DEBUG)
+ CIO.DebugOut("Last block number: " + mLastBlockNumber+".");
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Inizialize mPeers...");
+ mPeers = new CPeers(MAX_PEERS, RESERVED_CONNECTION);
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Inizialie the Listener...");
+ //crea un socket che attende connessioni in ingresso di peer che vogliono collegarsi, in ascolto sulla porta DEFOULT_PORT
+ IPEndPoint localEndPoint = new IPEndPoint(IPAddress.Any, DEFOULT_PORT);
+ mListener = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+ mListener.Bind(localEndPoint);
+ mListener.Listen(DEFOULT_PORT);
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Finish inizializing!");
+ Start(Peers);
+ }
+
+ public static CServer StartNewServer(List Peers)
+ {
+ if (Peers?.Count > 0)
+ return new CServer(Peers);
+ return null;
+ }
+
+ private int ConnectedPeers
+ {
+ get { return mPeers.NumConnection(); }
+ }
+
+ private void Start(List Peers)
+ {
+ if (Program.DEBUG)
+ CIO.DebugOut("Begin to enstablish connections to initial peers...");
+ //si collega ai peer inseriti nella lista iniziale.
+ foreach (CPeer p in Peers)
+ if (p.Connect())
+ if (!mPeers.Insert(p))
+ break;
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Begin to enstablish connections to other peers...");
+ mThreadPeers = new Thread(new ThreadStart(UpdatePeersList));
+ mThreadPeers.Start();
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Start listening...");
+ mThreadListener = new Thread(new ThreadStart(StartAcceptUsersConnection));
+ mThreadListener.Start();
+
+ if (Program.DEBUG)
+ CIO.DebugOut("Start update blockchain...");
+ mUpdateBlockChainThread = new Thread(new ThreadStart(UpdateBlockchain));
+ mUpdateBlockChainThread.Start();
+
+ }
+
+ private void UpdatePeersList()
+ {
+ while (!IsStopped)
+ {
+ if (mPeers.NumConnection() < NOT_RESERVED_CONNECTION)
+ mPeers.DoRequest(ERequest.UpdatePeers);
+ Thread.Sleep(10000);
+ }
+ }
+
+ //attende il collegamento di nuovi peer
+ private void StartAcceptUsersConnection()
+ {
+ //crea un eventargs per una richiesta di connessione asincrona, se la lista dei peers non è ancora piena inizia ad attendere fino a quando non riceve
+ //una richiesta di connessione o il segnale d'arresto. Se viene ricevuta una richiesta di connessione viene chiamata la funzione InsertNewPeer che
+ //inserisce il nuovo peer nella lista dei peer mPeers
+
+ //è asincrono perchè altrimenti al segnale di spegnimento non si fermerebbe
+ SocketAsyncEventArgs asyncConnection;
+ bool IncomingConnection = false;
+ if (Program.DEBUG)
+ Console.WriteLine("Attending connection...");
+ while (!IsStopped)
+ {
+ if (ConnectedPeers < MAX_PEERS)
+ {
+ IncomingConnection = false;
+ asyncConnection = new SocketAsyncEventArgs();
+ asyncConnection.Completed += (object sender, SocketAsyncEventArgs e) => { IncomingConnection = true; };
+ mListener.AcceptAsync(asyncConnection);
+ while (!IncomingConnection && !IsStopped)
+ {
+ Thread.Sleep(1000);
+ }
+ if (IncomingConnection)
+ {
+ if (Program.DEBUG)
+ CIO.DebugOut("Established connection!");
+ InsertNewPeer(asyncConnection.AcceptSocket);
+ }
+ asyncConnection.Dispose();
+
+ }
+ else
+ {
+ Thread.Sleep(10000);
+ }
+ }
+ //TODO
+ //CloseAllConnection();
+ if (Program.DEBUG)
+ CIO.WriteLine("Chiuse tutte le connessioni con gli users");
+ }
+
+ private void UpdateBlockchain()
+ {
+ ArgumentWrapper otherLastValidBlc = new ArgumentWrapper();
+ ArgumentWrapper newBlocks = new ArgumentWrapper();
+ ArgumentWrapper blockchainValidity = new ArgumentWrapper();
+
+ mPeers.DoRequest(ERequest.LastValidBlock, otherLastValidBlc);
+ if (CBlockChain.Instance.LastValidBlock.BlockNumber <= otherLastValidBlc.Value.BlockNumber)
+ {
+ mPeers.DoRequest(ERequest.DownloadMissingValidBlock, newBlocks);
+ CBlockChain.Add(newBlocks.Value);
+ mPeers.DoRequest(ERequest.DownloadSixtyBlock, newBlocks);
+ CBlockChain.Add(newBlocks.Value);
+ }
+
+ //TODO Abilitare la ricezione di nuovi blocchi.
+
+ }
+
+ private void InsertNewPeer(Socket NewConnection)
+ {
+ //crea un nuovo peer con un socket già collegato e una nuova connessione con questo peer, e la inserisce nel contenitore mConnections
+ CPeer newPeer = CPeer.CreatePeer(Convert.ToString((NewConnection.RemoteEndPoint as IPEndPoint).Address), (NewConnection.RemoteEndPoint as IPEndPoint).Port, NewConnection);
+ mPeers.Insert(newPeer, true);
+ }
+
+ static public byte[] ReceiveData(Socket Receiving)
+ {
+ byte[] data = new byte[4];
+ Receiving.Receive(data);
+ data = new byte[BitConverter.ToInt32(data, 0)];
+ Receiving.Receive(data);
+ return data;
+ }
+
+ static public void SendData(Socket Dispatcher, byte[] data)
+ {
+ Dispatcher.Send(BitConverter.GetBytes(data.Length));
+ Dispatcher.Send(data);
+ }
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CTemporaryBlock.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CTemporaryBlock.cs
new file mode 100644
index 0000000..ac004ab
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/CTemporaryBlock.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ class CTemporaryBlock:CBlock
+ {
+ private CPeer mSender;
+ public CTemporaryBlock(CBlock Block, CPeer Sender):base(Block.Hash,Block.BlockNumber,Block.Transiction,Block.Nonce,Block.Timestamp,Block.Difficutly)
+ {
+ mSender = Sender;
+ }
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.csproj b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.csproj
new file mode 100644
index 0000000..2036668
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0.csproj
@@ -0,0 +1,72 @@
+
+
+
+
+ Debug
+ AnyCPU
+ {1D43135D-88C1-421F-90D3-8E4E75811B60}
+ Exe
+ Properties
+ Client_ViggiCoin_v2._0
+ Client_ViggiCoin v2.0
+ v4.5.2
+ 512
+ true
+
+
+ AnyCPU
+ true
+ full
+ false
+ bin\Debug\
+ DEBUG;TRACE
+ prompt
+ 4
+
+
+ AnyCPU
+ pdbonly
+ true
+ bin\Release\
+ TRACE
+ prompt
+ 4
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ECommand.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ECommand.cs
new file mode 100644
index 0000000..13ff379
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ECommand.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ enum ECommand
+ {
+ LOOK,
+ OK,
+ GET,
+ LASTVALID
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ERequest.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ERequest.cs
new file mode 100644
index 0000000..dc89e12
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/ERequest.cs
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ enum ERequest
+ {
+ UpdatePeers,
+ SendPeersList,
+ LastBlockNumber,
+ UpdateBlockchain,
+ DownloadMissingBlock,
+ LastValidBlock,
+ DownloadMissingValidBlock,
+ DownloadSixtyBlock,
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Program.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Program.cs
new file mode 100644
index 0000000..9da2d57
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Program.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ class Program
+ {
+ public static bool DEBUG = true;
+ static void Main(string[] args)
+ {
+
+ //List lp = GenPeersList();
+ List lp = new List();
+ lp.Add(CPeer.CreatePeer("100.100.100.100", 1));
+
+ CServer s = CServer.StartNewServer(lp);
+
+
+ }
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Properties/AssemblyInfo.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..6d187a6
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/Properties/AssemblyInfo.cs
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// Le informazioni generali relative a un assembly sono controllate dal seguente
+// set di attributi. Modificare i valori di questi attributi per modificare le informazioni
+// associate a un assembly.
+[assembly: AssemblyTitle("Client_ViggiCoin v2.0")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Client_ViggiCoin v2.0")]
+[assembly: AssemblyCopyright("Copyright © 2016")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Se si imposta ComVisible su false, i tipi in questo assembly non saranno visibili
+// ai componenti COM. Se è necessario accedere a un tipo in questo assembly da
+// COM, impostare su true l'attributo ComVisible per tale tipo.
+[assembly: ComVisible(false)]
+
+// Se il progetto viene esposto a COM, il GUID seguente verrà utilizzato come ID della libreria dei tipi
+[assembly: Guid("1d43135d-88c1-421f-90d3-8e4e75811b60")]
+
+// Le informazioni sulla versione di un assembly sono costituite dai seguenti quattro valori:
+//
+// Versione principale
+// Versione secondaria
+// Numero di build
+// Revisione
+//
+// È possibile specificare tutti i valori oppure impostare valori predefiniti per i numeri relativi alla revisione e alla build
+// usando l'asterisco '*' come illustrato di seguito:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/RSA.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/RSA.cs
new file mode 100644
index 0000000..d6f1b36
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/RSA.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Security.Cryptography;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Blockchain
+{
+ //TODO
+ static class RSA
+ {
+ internal static byte[] Encrypt(byte[] v, RSAParameters RSAKeyInfo, bool DoOAEPPadding)
+ {
+ try
+ {
+ byte[] encryptedData;
+ //Create a new instance of RSACryptoServiceProvider.
+ using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
+ {
+
+ //Import the RSA Key information. This only needs
+ //toinclude the public key information.
+ RSA.ImportParameters(RSAKeyInfo);
+
+ //Encrypt the passed byte array and specify OAEP padding.
+ //OAEP padding is only available on Microsoft Windows XP or
+ //later.
+ encryptedData = RSA.Encrypt(v, DoOAEPPadding);
+ }
+ return encryptedData;
+ }
+ //Catch and display a CryptographicException
+ //to the console.
+ catch (CryptographicException e)
+ {
+ Console.WriteLine(e.Message);
+
+ return null;
+ }
+
+ }
+
+ internal static byte[] Decrypt(byte[] v, RSAParameters RSAKeyInfo, bool DoOAEPPadding)
+ {
+ try
+ {
+ byte[] decryptedData;
+ //Create a new instance of RSACryptoServiceProvider.
+ using (RSACryptoServiceProvider RSA = new RSACryptoServiceProvider())
+ {
+ //Import the RSA Key information. This needs
+ //to include the private key information.
+ RSA.ImportParameters(RSAKeyInfo);
+
+ //Decrypt the passed byte array and specify OAEP padding.
+ //OAEP padding is only available on Microsoft Windows XP or
+ //later.
+ decryptedData = RSA.Decrypt(v, DoOAEPPadding);
+ }
+ return decryptedData;
+ }
+ //Catch and display a CryptographicException
+ //to the console.
+ catch (CryptographicException e)
+ {
+ Console.WriteLine(e.ToString());
+
+ return null;
+ }
+
+ }
+
+ internal static RSACryptoServiceProvider GenRSAKey()
+ {
+ return new RSACryptoServiceProvider();
+
+ }
+ }
+}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe
new file mode 100644
index 0000000..786c55f
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe.config b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.exe.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.pdb b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.pdb
new file mode 100644
index 0000000..2f5363c
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.pdb differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe
new file mode 100644
index 0000000..681ab77
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.config b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.config
new file mode 100644
index 0000000..88fa402
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.config
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.manifest b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.manifest
new file mode 100644
index 0000000..061c9ca
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/Client_ViggiCoin v2.0.vshost.exe.manifest
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/blockchain.txt b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/blockchain.txt
new file mode 100644
index 0000000..954fbad
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/blockchain.txt
@@ -0,0 +1 @@
+{GENESYSBLOCK;0;;0;0;1}
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/keystore.xml b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/keystore.xml
new file mode 100644
index 0000000..2ee34e8
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/bin/Debug/keystore.xml
@@ -0,0 +1 @@
+51CiTSyVwxN7tYnNuHG81cv1LvhHIUW0Udd3C1WHtCs1N9jiyr8poEisSU3RFJwzGKvDqrel8vffsfSWJBMD8IVExlsGDx4nB5ZYIjgpw8H6V6m2ub0wkQIyxVRjP43ID3htZA5n8odHqSMLDMCZUIko73cNKsF3bjOav85sLkM=AQAB
\ No newline at end of file
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csproj.FileListAbsolute.txt b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csproj.FileListAbsolute.txt
new file mode 100644
index 0000000..124c2c8
--- /dev/null
+++ b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csproj.FileListAbsolute.txt
@@ -0,0 +1,25 @@
+c:\users\manuel\documents\visual studio 2015\Projects\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Manuel\Documents\Programmi\c#\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.pdb
+E:\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+E:\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.exe
+E:\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Marco\Documents\Visual Studio 2015\Projects\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.pdb
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\bin\Debug\Client_ViggiCoin v2.0.exe.config
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.exe
+C:\Users\Manuel\Documents\Programmi\Git\Blockchain\Blockchain\Client_ViggiCoin v2.0\Client_ViggiCoin v2.0\obj\Debug\Client_ViggiCoin v2.0.pdb
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache
new file mode 100644
index 0000000..d7bcd62
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.csprojResolveAssemblyReference.cache differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.exe b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.exe
new file mode 100644
index 0000000..786c55f
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.exe differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.pdb b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.pdb
new file mode 100644
index 0000000..2f5363c
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/Client_ViggiCoin v2.0.pdb differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
new file mode 100644
index 0000000..cc85734
Binary files /dev/null and b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
new file mode 100644
index 0000000..e69de29
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
new file mode 100644
index 0000000..e69de29
diff --git a/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs b/Blockchain/Client_ViggiCoin v2.0/Client_ViggiCoin v2.0/obj/Debug/TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
new file mode 100644
index 0000000..e69de29
diff --git a/PoC b/PoC
new file mode 100644
index 0000000..e69de29