コード例 #1
0
        /// <summary>
        /// A default constructor of Wallet service. (Need to initialized from a ContractService object.)
        /// </summary>
        /// <param name="contract">A wallet contract object</param>
        /// <param name="contractService">A wallet contract service object</param>
        /// <param name="db">LiteDB database object</param>
        /// <param name="userPrivateKey">User's private key</param>
        /// <param name="api">Insight-based compatible API (>0.4)</param>
        /// <param name="TransferFee">Fee for token transfer</param>
        /// <returns>A wallet service is used to obtain all the ledger from the wallet. Private key is used to create the ledger on the user's behalf.</returns>
        internal WalletService(WalletContract contract, ContractService contractService, LiteDatabase db, BitcoinSecret userPrivateKey, IInsightAPI api, decimal TransferFee)
        {
            this.TransferFee     = TransferFee;
            this.userPrivateKey  = userPrivateKey;
            this.contractService = contractService;
            this.contract        = contract;
            this.api             = api;
            this.db = db;
            byte[] myByte    = Encoding.ASCII.GetBytes(contract.ID);
            var    encrypted = NBitcoin.Crypto.Hashes.RIPEMD160(myByte, myByte.Length);
            var    hashID    = encrypted.ByteArrayToString();

            ledger       = db.GetCollection <Ledger>($"Ledger-{hashID}");
            account      = db.GetCollection <Account>($"Account-{hashID}");
            ownerAddress = new BitcoinPubKeyAddress(contract.OwnerPublicAddress, contractService.MainNetwork);
        }
コード例 #2
0
 /// <summary>
 /// A constructor of contract service
 /// </summary>
 /// <param name="api">Bitpay Insight compatible API (>0.4)</param>
 /// <param name="connectionString">LiteDB connection string</param>
 /// <param name="network">NBitcoin-compatible blockchain network</param>
 /// <returns>A contract service is used to manage electronic money contract in data store.</returns>
 public ContractService(string connectionString, IInsightAPI api, Network network)
 {
     ContractSetup(connectionString, api, network);
 }
コード例 #3
0
        /// <summary>
        /// A constructor of contract service
        /// </summary>
        /// <param name="api">Bitpay Insight compatible API (>0.4)</param>
        /// <param name="connectionString">LiteDB connection string</param>
        /// <returns>A contract service is used to manage electronic money contract in data store.</returns>
        public ContractService(string connectionString, IInsightAPI api)
        {
            var network = NBitcoin.Altcoins.Digibyte.Instance.Mainnet;

            ContractSetup(connectionString, api, network);
        }
コード例 #4
0
 /// <summary>
 /// A constructor of helper class for provider part which handle document management and consent ask.
 /// </summary>
 /// <param name="privateKey">User's private key</param>
 /// <param name="network">NBitcoin-compatible blockchain network</param>
 /// <param name="builder">Option builder for IStorageManager</param>
 /// <param name="api">Insight-based block explorer (>0.4)</param>
 public ProviderHelper(string privateKey, IInsightAPI api, IOptionBuilder builder, Network network = null) : base(privateKey, network, api)
 {
     storageManager = new GDriveStorageManager();
     storageManager.SetBuilder(builder);
 }