Esempio n. 1
0
        public async Task RegisterInputAsync(CancellationToken cancellationToken)
        {
            var response = await ArenaClient.RegisterInputAsync(RoundId, Coin.Outpoint, BitcoinSecret.PrivateKey, cancellationToken).ConfigureAwait(false);

            var remoteAliceId = response.Value;

            if (AliceId != remoteAliceId)
            {
                throw new InvalidOperationException($"Round ({RoundId}), Local Alice ({AliceId}) was computed as {remoteAliceId}");
            }
            RealAmountCredentials = response.RealAmountCredentials;
            RealVsizeCredentials  = response.RealVsizeCredentials;
            Logger.LogInfo($"Round ({RoundId}), Alice ({AliceId}): Registered an input.");
        }
Esempio n. 2
0
        public static async Task <AliceClient> CreateNewAsync(
            ArenaClient arenaClient,
            IEnumerable <Coin> coinsToRegister,
            BitcoinSecret bitcoinSecret,
            Guid roundId,
            uint256 roundHash,
            FeeRate feeRate)
        {
            IEnumerable <Money>    amounts   = coinsToRegister.Select(c => c.Amount);
            IEnumerable <OutPoint> outPoints = coinsToRegister.Select(c => c.Outpoint);
            IEnumerable <Key>      keys      = Enumerable.Repeat(bitcoinSecret.PrivateKey, coinsToRegister.Count());

            Guid aliceId = await arenaClient.RegisterInputAsync(amounts, outPoints, keys, roundId, roundHash).ConfigureAwait(false);

            AliceClient client = new(aliceId, roundId, arenaClient, coinsToRegister, feeRate);

            Logger.LogInfo($"Round ({roundId}), Alice ({aliceId}): Registered {amounts.Count()} inputs.");

            return(client);
        }