Example #1
0
        public void Vote()
        {
            var vote1 = new Vote
            {
                QuestionId = new Guid("bd746b3b276e454a8B1e041cf53a8747"),
                ChoiceId   = Guid.NewGuid(),
                Time       = DateTimeOffset.Now.ToUnixTimeMilliseconds()
            };

            var keys = service.GeneratePair();

            var signer = new Signer(service);

            vote1.Signature = signer.Sign(vote1.GetData(), keys);
            var signatureBase58 = Base58.Encode(vote1.Signature);

            vote1.PublicKey = new byte[keys.PublicKey.Length];
            Buffer.BlockCopy(keys.PublicKey, 0, vote1.PublicKey, 0, keys.PublicKey.Length);

            var json = JsonSerializer.Serialize(vote1, JsonDefaultSettings.Options);

            Console.WriteLine(json);

            var vote            = JsonSerializer.Deserialize <Vote>(json, JsonDefaultSettings.Options);
            var publicKeyBase58 = Base58.Encode(vote.PublicKey);

            var verifier = new SignatureVerify(service);
        }