Пример #1
0
        public async Task <Sp8deTransaction> AggregatedCommit(ProtocolTransaction request, UserInfo userInfo)
        {
            var createRequest = new CreateTransactionRequest()
            {
                Type = Sp8deTransactionType.AggregatedCommit
            };

            createRequest.AddRandomSettings(request.RandomSettings);
            createRequest.AddExtended(request.Extended);

            createRequest.InnerTransactions = request.Items.Select(x => MapToInternalTransaction(x)).ToList();

            var contributorCommit = await contributorService.Commit();

            createRequest.InnerTransactions.Add(new InternalTransaction()
            {
                Type  = MapUserType(contributorCommit.Type),
                From  = contributorCommit.PubKey,
                Nonce = contributorCommit.Nonce,
                Sign  = contributorCommit.Sign
            });

            var result = await transactionNode.AddTransaction(createRequest);

            await ProcessFee(userInfo);

            return(result);
        }
Пример #2
0
        public async Task <Sp8deTransaction> Create(ProtocolTransaction request, UserInfo userInfo)
        {
            var contributorCommit = await contributorService.Commit();

            await ProcessFee(userInfo);

            return(null);
        }
Пример #3
0
        public async Task <Sp8deTransaction> AggregatedReveal(ProtocolTransaction request, UserInfo userInfo, Sp8deTransaction original)
        {
            var createRequest = new CreateTransactionRequest()
            {
                Type      = Sp8deTransactionType.AggregatedReveal,
                DependsOn = request.DependsOn
            };

            var rtx = original.InternalTransactions.First(x => x.Type == Sp8deTransactionType.InternalValidator);

            createRequest.InnerTransactions = request.Items.Select(x => MapToInternalTransaction(x)).ToList();

            var validatorCommit = new SignedItem()
            {
                Type = UserType.Validator, PubKey = rtx.From, Nonce = rtx.Nonce, Sign = rtx.Sign
            };

            var reveal = await contributorService.Reveal(validatorCommit);

            createRequest.InnerTransactions.Add(new InternalTransaction()
            {
                Type  = MapUserType(reveal.Type),
                From  = reveal.PubKey,
                Nonce = reveal.Nonce,
                Sign  = reveal.Sign,
                Data  = reveal.Seed
            });

            createRequest.AddOriginalRandomSettings(original.InputData?.Items);
            createRequest.AddExtended(request.Extended);

            var result = await transactionNode.AddTransaction(createRequest);

            await ProcessFee(userInfo);

            return(result);
        }