コード例 #1
0
        //public static void TransferTokenFrontTest(string FromAddress_Buyer, string ToAddress_Owner, string Amount)
        //{
        //    Task task = System.Threading.Tasks.Task.Run(async () => await (DoTransaction(FromAddress_Buyer, ToAddress_Owner, Amount)));
        //}

        public async static Task <CreateWalletModel> CreateUserWallet()
        {
            ITrace            telemetria   = new Trace();
            CreateWalletModel _walletModel = new CreateWalletModel();

            try
            {
                //Generate RandomPassword
                string _passphrase = Guid.NewGuid().ToString().Replace("-", "") + GetRandomNumber(1842).ToString();

                string _blobname = BlobManager.CreateUsrWalletBlobFile(_passphrase, ConfigurationManager.AppSettings["azure-storage-connectionstring"]);

                var web3           = new Nethereum.Web3.Web3(ConfigurationManager.AppSettings["BlockchainURL"]);
                var _walletAddress = await web3.Personal.NewAccount.SendRequestAsync(_passphrase);

                _walletModel = new CreateWalletModel()
                {
                    blobname = _blobname, walletaddress = _walletAddress
                };
            }
            catch (Exception e)
            {
                var messageException = telemetria.MakeMessageException(e, System.Reflection.MethodBase.GetCurrentMethod().Name);
                telemetria.Critical(messageException);
            }

            return(_walletModel);
        }