Esempio n. 1
0
        private BlockBase CreateTransferAssetToUtxoBlock(byte[][] assetIds, int index, ulong tagId, ConfidentialAccount receiver, byte[] sk = null)
        {
            byte[] assetId = assetIds[index];

            byte[]  secretKey       = sk ?? ConfidentialAssetsHelper.GetRandomSeed();
            byte[]  transactionKey  = ConfidentialAssetsHelper.GetTrancationKey(secretKey);
            byte[]  destinationKey  = ConfidentialAssetsHelper.GetDestinationKey(secretKey, receiver.PublicViewKey, receiver.PublicSpendKey);
            byte[]  blindingFactor  = ConfidentialAssetsHelper.GetRandomSeed();
            byte[]  assetCommitment = ConfidentialAssetsHelper.GetAssetCommitment(assetId, blindingFactor);
            ulong[] assetAmounts    = new ulong[assetIds.Length];
            for (int i = 0; i < assetAmounts.Length; i++)
            {
                assetAmounts[i] = 1;
            }

            TransferAssetToUtxoBlock transferAssetToUtxoBlock = new TransferAssetToUtxoBlock
            {
                TagId                = tagId,
                AssetIds             = assetIds,
                AssetAmounts         = assetAmounts,
                TransactionPublicKey = transactionKey,
                DestinationKey       = destinationKey,
                AssetId              = assetId,
                AssetCommitment      = assetCommitment,
                SurjectionProof      = ConfidentialAssetsHelper.CreateNewIssuanceSurjectionProof(assetCommitment, assetIds, index, blindingFactor),
                EcdhTuple            = ConfidentialAssetsHelper.CreateEcdhTupleCA(blindingFactor, assetId, secretKey, receiver.PublicViewKey)
            };

            FillHeightInfo(transferAssetToUtxoBlock);
            FillSyncData(transferAssetToUtxoBlock);
            FillRawData(transferAssetToUtxoBlock);

            return(transferAssetToUtxoBlock);
        }