/// <summary>
        /// Publish a wallet contract to blockchain and save the published to local data store.
        /// </summary>
        /// <param name="newContract">A to-be-published wallet contract.</param>
        /// <param name="creator">Private key of the creator</param>
        /// <returns>Return transaction ID if published. Throw exception if there is an error.</returns>
        public async Task <string> PublishContract(WalletContract newContract, BitcoinSecret creator)
        {
            try
            {
                ValidateContract(newContract);
            }
            catch (Exception)
            {
                throw;
            }

            var Data = $"{DomainHex}{newContract.NameHex}{newContract.TokenHex}{BitConverterExtension.GetHexBytes(newContract.TotalSupply)}" +
                       $"{newContract.NoOfDecimal.ToString("x4")}{newContract.Conditions.ByteArrayToString()}";

            var transaction = await insightAPI.BuildTransaction(creator, creator.GetAddress(), creator.GetAddress(), Data.ToLower());

            var txId = await insightAPI.BroadcastTransaction(transaction);

            newContract.ID = txId.txid;
            var status = await insightAPI.GetSync();

            newContract.StartingBlock   = status.blockChainHeight;
            newContract.LastSyncedBlock = status.blockChainHeight;
            UpdateContract(newContract, true);
            return(newContract.ID);
        }
        public string GetOP_RETURN()
        {
            // 16 + 2 + 20 + 16 +
            var a             = _contract.NameHex;
            var b             = BitConverter.ToString(BitConverter.GetBytes((ushort)Operation).Reverse().ToArray()).Replace("-", "");
            var c             = TokenReceiverHashHex;
            var roundedAmount = Math.Round(Amount, _contract.NoOfDecimal);
            var d             = BitConverterExtension.GetHexBytes(roundedAmount);

            string validatedReferenceCode = ReferenceCode;
            string e = "";

            if (!string.IsNullOrEmpty(ReferenceCode))
            {
                if (ReferenceCode.Length > 20)
                {
                    validatedReferenceCode = ReferenceCode.Substring(0, Math.Min(ReferenceCode.Length, 20));
                }

                e = BitConverter.ToString(Encoding.Default.GetBytes(validatedReferenceCode)).Replace("-", "").ToLower();
            }
            var output = $"{a}{b}{c}{d}{e}";

            return(output.Substring(0, Math.Min(output.Length, 160)));
        }