Exemple #1
0
        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);
        }
Exemple #2
0
        public static void ExportChain()
        {
            string chain = Serialyze.Serialize(Coin);

            try
            {
                File.WriteAllText(Epicoin.blockchainfile, chain);
            }
            catch (Exception)
            { }
        }
Exemple #3
0
        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);
        }
Exemple #4
0
        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;
        }
Exemple #5
0
        public string Export()
        {
            string wallet = Serialyze.Serialize(this);

            return(wallet);
        }
Exemple #6
0
 public ClientSyncChain(int port, Blockchain chain) : base("", port)
 {
     this.data = Encoding.Default.GetBytes(Serialyze.Serialize(chain));
 }
Exemple #7
0
 public ClientPeer(int port, List <string> peerList) : base("", port)
 {
     this.peerList = peerList;
     this.data     = Encoding.Default.GetBytes(Serialyze.Serialize(peerList));
 }
Exemple #8
0
 private byte[] GenData()
 {
     return(Encoding.Default.GetBytes(Serialyze.Serialize(this.Coin)));
 }