public byte[] SendBlock(long time) { DataMine dataMine = new DataMine(this.difficulty, this.BlockToMine, this.Worker.Address[0], time); byte[] datasend = Encoding.Default.GetBytes(Serialyze.Serialize(dataMine)); return(datasend); }
public static void ExportChain() { string chain = Serialyze.Serialize(Coin); try { File.WriteAllText(Epicoin.blockchainfile, chain); } catch (Exception) { } }
private byte[] GenData() { DataMine dataMine; byte[] datasend; if (this.Coin.BlockToMines.Count != 0) { dataMine = new DataMine(this.Coin.Difficulty, this.Coin.BlockToMines[0], null); datasend = Encoding.Default.GetBytes(Serialyze.Serialize(dataMine)); } else { dataMine = new DataMine(this.Coin.Difficulty, null, null); datasend = Encoding.Default.GetBytes(Serialyze.Serialize(dataMine)); } return(datasend); }
public void Send() { int timeout = 1000; byte[] datasend = Encoding.Default.GetBytes(Serialyze.Serialize(DataTrans)); bool send = false; this.Init(); while (IsConnected(this._tcpClient) && Epicoin.Continue && !send && timeout >= 0 && !this.error) { Stream stm = this._tcpClient.GetStream(); stm.Write(datasend, 0, datasend.Length); send = true; stm.Close(); timeout--; } this._tcpClient.Close(); if (timeout < 0) { this.error = true; } this.DataTrans = null; return; }
public string Export() { string wallet = Serialyze.Serialize(this); return(wallet); }
public ClientSyncChain(int port, Blockchain chain) : base("", port) { this.data = Encoding.Default.GetBytes(Serialyze.Serialize(chain)); }
public ClientPeer(int port, List <string> peerList) : base("", port) { this.peerList = peerList; this.data = Encoding.Default.GetBytes(Serialyze.Serialize(peerList)); }
private byte[] GenData() { return(Encoding.Default.GetBytes(Serialyze.Serialize(this.Coin))); }