public async Task <bool> SaveDataAsync(string gethConnectionUrl, IAccountUnlock accuntUnlock, IndexDBContext dbContext, IndexDBs indexDB, ITransationData transationData)
        {
            ISuitableBlockData suitableData = new SuitableBlockData(31744);
            //获取适合保存到以太坊区块中的字符串长度
            var photoStrings = suitableData.GetArrayListForSaving(transationData.IdPhotoData);

            //保存到以太坊网络中
            var    web3        = new Web3Geth(gethConnectionUrl);
            string resultHashs = null;

            foreach (var photoString in photoStrings)
            {
                var input = new TransactionInput(new HexUTF8String(photoString).HexValue, new HexBigInteger("0xffffff"), transationData.Address);
                await accuntUnlock.UnlockAccountAsync(gethConnectionUrl, transationData.Address, transationData.Password);

                resultHashs += await web3.Eth.Transactions
                               .SendTransaction
                               .SendRequestAsync(input) + " ";
            }

            //将交易哈希与个人信息保存到索引数据库
            var isSuccessful = await SaveTxHashToIndexDB(dbContext, indexDB, transationData, resultHashs);

            if (!isSuccessful)
            {
                return(false);
            }
            return(true);
        }
        protected virtual async Task <bool> SaveTxHashToIndexDB(IndexDBContext dbContext, IndexDBs indexDB, ITransationData transationData, string HashString)
        {
            indexDB.ID             = transationData.ID;
            indexDB.AccountAddress = transationData.Address;
            indexDB.TransationHash = HashString;

            try
            {
                await dbContext.indexs.AddAsync(indexDB);

                await dbContext.SaveChangesAsync();

                return(true);
            }
            catch (Exception e)
            {
                return(false);
            }
        }
        public async Task <ITransationData> PriKeyQueryAsync(string gethConnectionUrl, IndexDBContext dbContext, ITransationData transationData, string ID, Func <ITransationData, IndexDB.IndexDBs, ITransationData> requiredData)
        {
            string IdPhotoData = null;
            //从索引数据库拿到交易哈希列表字符串
            var dataIndex = await GetTxHashFormIndexDBAsnyc(dbContext, ID);

            //拆分成交易哈希字符串数字
            string[] TxHashs = dataIndex.TransationHash.Trim().Split(' ');
            //使用交易哈希得到私链中保存的图片数据片段
            var web3 = new Web3Geth(gethConnectionUrl);

            foreach (var Txhash in TxHashs)
            {
                var result = await web3.Eth.Transactions
                             .GetTransactionByHash
                             .SendRequestAsync(Txhash);

                //拼接片段
                IdPhotoData += new Nethereum.Hex.HexConvertors
                               .HexUTF8StringConvertor()
                               .ConvertFromHex(result.Input);
            }
            //将数据转换成传输模型
            transationData.IdPhotoData = IdPhotoData;
            transationData.ID          = dataIndex.ID;
            transationData.Address     = dataIndex.AccountAddress;
            //如果没有委托,直接返回
            if (requiredData == null)
            {
                return(transationData);
            }
            //使用委托使得用户可以实现传输模型接口,自定义需要获得的数据
            transationData = requiredData.Invoke(transationData, dataIndex);
            return(transationData);
        }