Beispiel #1
0
        protected override void OnOpen(object sender, EventArgs e)
        {
            var request = new BtccLoginRequest
            {
                ClientRequestId = Guid.NewGuid().ToString("N"),
                Date            = DateTime.UtcNow.ToString("yyyyMMdd"),
                Account         = PublicKey
            };

            request.Signature = SignatureEngine.ComputeSignature(SignatureEngine.ComputeHash(PrivateKey), SignatureEngine.PrepareMessage(request, SignatureEngine.MessageSignatureOrdering.Alphabetical));
            SendMessage(c => c.Send(JsonConvert.SerializeObject(request)));
        }
 // Sign() will calculate relevant account signiture information and insert into your message request body
 private Request Sign(SignedRequest request)
 {
     request.ClientRequestId = Guid.NewGuid().ToString("N");
     request.Account         = credentials.Account;
     request.Date            = DateTime.UtcNow.ToString("yyyyMMdd");
     request.Signature       = $"ALPHA-{SignatureEngine.ComputeSignature(SignatureEngine.ComputeHash(credentials.Key), SignatureEngine.PrepareMessage(request, SignatureEngine.MessageSignatureOrdering.Alphabetical))}";
     return(request);
 }