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

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

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