• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# NBitcoin.uint256类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中NBitcoin.uint256的典型用法代码示例。如果您正苦于以下问题:C# uint256类的具体用法?C# uint256怎么用?C# uint256使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



uint256类属于NBitcoin命名空间,在下文中一共展示了uint256类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ComputeChecksum

 public void ComputeChecksum(uint256 hashBlock)
 {
     MemoryStream ms = new MemoryStream();
     hashBlock.ReadWrite(ms, true);
     this.ReadWrite(ms, true);
     CalculatedChecksum = Hashes.Hash256(ms.ToArray());
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:7,代码来源:BlockUndo.cs


示例2: GetBlock

 public Block GetBlock(uint256 id, List<byte[]> searchedData)
 {
     var block = Get(id);
     if(block == null)
         return null;
     return block;
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:7,代码来源:IndexedBlockStore.cs


示例3: GetFromCache

		public Transaction GetFromCache(uint256 txId)
		{
			using(@lock.LockRead())
			{
				return _Transactions.TryGet(txId);
			}
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:7,代码来源:CachedTransactionRepository.cs


示例4: GetHeader

 public BlockHeader GetHeader(uint256 hash)
 {
     var pos = _Index.Get<DiskBlockPos>(hash.ToString());
     if(pos == null)
         return null;
     var stored = _Store.Enumerate(false, new DiskBlockPosRange(pos)).FirstOrDefault();
     if(stored == null)
         return null;
     return stored.Item.Header;
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:10,代码来源:IndexedBlockStore.cs


示例5: Put

		public static void Put(this ITransactionRepository repo, uint256 txId, Transaction tx)
		{
			try
			{
				repo.PutAsync(txId, tx).Wait();
			}
			catch(AggregateException aex)
			{
				ExceptionDispatchInfo.Capture(aex.InnerException).Throw();
			}
		}
开发者ID:crowar,项目名称:NBitcoin,代码行数:11,代码来源:ITransactionRepository.cs


示例6: uint256

		public uint256(uint256 b)
		{
			pn0 = b.pn0;
			pn1 = b.pn1;
			pn2 = b.pn2;
			pn3 = b.pn3;
			pn4 = b.pn4;
			pn5 = b.pn5;
			pn6 = b.pn6;
			pn7 = b.pn7;
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:11,代码来源:UInt2561.cs


示例7: PutAsync

		public Task PutAsync(uint256 txId, Transaction tx)
		{
			using(@lock.LockWrite())
			{
				if(!_Transactions.ContainsKey(txId))
					_Transactions.AddOrReplace(txId, tx);
				else
					_Transactions[txId] = tx;
			}
			return _Inner.PutAsync(txId, tx);
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:11,代码来源:CachedTransactionRepository.cs


示例8: Get

		public static Transaction Get(this ITransactionRepository repo, uint256 txId)
		{
			try
			{
				return repo.GetAsync(txId).Result;
			}
			catch(AggregateException aex)
			{
				ExceptionDispatchInfo.Capture(aex.InnerException).Throw();
				return null;
			}
		}
开发者ID:crowar,项目名称:NBitcoin,代码行数:12,代码来源:ITransactionRepository.cs


示例9: GetAsync

		public async Task<Transaction> GetAsync(uint256 txId)
		{
			using(HttpClient client = new HttpClient())
			{
				var tx = await client.GetAsync(BaseUri.AbsoluteUri + "transactions/" + txId + "?format=raw").ConfigureAwait(false);
				if(tx.StatusCode == System.Net.HttpStatusCode.NotFound)
					return null;
				tx.EnsureSuccessStatusCode();
				var bytes = await tx.Content.ReadAsByteArrayAsync().ConfigureAwait(false);
				return new Transaction(bytes);
			}
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:12,代码来源:QBitNinjaTransactionRepository.cs


示例10: PartialMerkleTree

        // Construct a partial merkle tree from a list of transaction id's, and a mask that selects a subset of them
        public PartialMerkleTree(uint256[] vTxid, bool[] vMatch)
        {
            fBad = false;
            nTransactions = (uint)vTxid.Length;

            // calculate height of tree
            int nHeight = 0;
            while(CalcTreeWidth(nHeight) > 1)
                nHeight++;

            // traverse the partial tree
            TraverseAndBuild(nHeight, 0, vTxid, vMatch);
        }
开发者ID:nikropht,项目名称:NBitcoin,代码行数:14,代码来源:PartialMerkleTree.cs


示例11: PartialMerkleTree

		public PartialMerkleTree(uint256[] vTxid, bool[] vMatch)
		{
			if(vMatch.Length != vTxid.Length)
				throw new ArgumentException("The size of the array of txid and matches is different");
			TransactionCount = (uint)vTxid.Length;

			MerkleNode root = MerkleNode.GetRoot(vTxid);
			BitWriter flags = new BitWriter();

			MarkNodes(root, vMatch);
			BuildCore(root, flags);

			Flags = flags.ToBitArray();
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:14,代码来源:PartialMerkleTree.cs


示例12: CheckMerkleBranch

 public static uint256 CheckMerkleBranch(uint256 hash, List<uint256> vMerkleBranch, int nIndex)
 {
     if(nIndex == -1)
         return 0;
     foreach(var otherside in vMerkleBranch)
     {
         if((nIndex & 1) != 0)
             hash = Hash(otherside, hash);
         else
             hash = Hash(hash, otherside);
         nIndex >>= 1;
     }
     return hash;
 }
开发者ID:royosherove,项目名称:NBitcoin,代码行数:14,代码来源:Block.cs


示例13: MerkleBlock

		public MerkleBlock(Block block, uint256[] txIds)
		{
			header = block.Header;

			List<bool> vMatch = new List<bool>();
			List<uint256> vHashes = new List<uint256>();
			for(int i = 0 ; i < block.Transactions.Count ; i++)
			{
				var hash = block.Transactions[i].GetHash();
				vHashes.Add(hash);
				vMatch.Add(txIds.Contains(hash));
			}
			_PartialMerkleTree = new PartialMerkleTree(vHashes.ToArray(), vMatch.ToArray());
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:14,代码来源:MerkleBlock.cs


示例14: TryParse

		public static bool TryParse(string hex, out uint256 result)
		{
			if(hex == null)
				throw new ArgumentNullException("hex");
			result = null;
			if(hex.Length != WIDTH_BYTE * 2)
				return false;
			if(!((HexEncoder)Encoders.Hex).IsValid(hex))
				return false;
			var ret = new uint256();
			ret.SetHex(hex);
			result = ret;
			return true;
		}
开发者ID:jamie-tigereye,项目名称:NBitcoin,代码行数:14,代码来源:UInt2561.cs


示例15: TryParse

		public static bool TryParse(string hex, out uint256 result)
		{
			if(hex == null)
				throw new ArgumentNullException("hex");
			if (hex.StartsWith("0x", StringComparison.OrdinalIgnoreCase))
				hex = hex.Substring(2);
			result = null;
			if(hex.Length != WIDTH_BYTE * 2)
				return false;
			if(!((HexEncoder)Encoders.Hex).IsValid(hex))
				return false;			
			result = new uint256(hex);
			return true;
		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:14,代码来源:UInt2561.cs


示例16: ReadWrite

			public void ReadWrite(BitcoinStream stream)
			{
				if(stream.Serializing)
				{
					var b = Value.ToBytes();
					stream.ReadWrite(ref b);
				}
				else
				{
					byte[] b = new byte[WIDTH_BYTE];
					stream.ReadWrite(ref b);
					_Value = new uint256(b);
				}
			}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:14,代码来源:UInt2561.cs


示例17: PutAsync

		public Task PutAsync(uint256 txId, Transaction tx)
		{
			if(WriteThrough)
			{
				using(@lock.LockWrite())
				{

					if(!_Transactions.ContainsKey(txId))
					{

						_Transactions.AddOrReplace(txId, tx);
						EvictIfNecessary(txId);
					}
					else
						_Transactions[txId] = tx;
				}
			}
			return _Inner.PutAsync(txId, tx);
		}
开发者ID:crowar,项目名称:NBitcoin,代码行数:19,代码来源:CachedTransactionRepository.cs


示例18: GetAsync

		public async Task<Transaction> GetAsync(uint256 txId)
		{
			bool found = false;
			Transaction result = null;
			using(@lock.LockRead())
			{
				found = _Transactions.TryGetValue(txId, out result);
			}
			if(!found)
			{
				result = await _Inner.GetAsync(txId).ConfigureAwait(false);
				using(@lock.LockWrite())
				{
					_Transactions.AddOrReplace(txId, result);
				}
			}
			return result;

		}
开发者ID:woutersmit,项目名称:NBitcoin,代码行数:19,代码来源:CachedTransactionRepository.cs


示例19: GetAsync

		public async Task<Transaction> GetAsync(uint256 txId)
		{
			while(true)
			{
				using(HttpClient client = new HttpClient())
				{
					var response = await client.GetAsync(BlockrAddress + "tx/raw/" + txId).ConfigureAwait(false);
					if(response.StatusCode == HttpStatusCode.NotFound)
						return null;
					var result = await response.Content.ReadAsStringAsync().ConfigureAwait(false);
					var json = JObject.Parse(result);
					var status = json["status"];
					var code = json["code"];
					if(status != null && status.ToString() == "error")
					{
						throw new BlockrException(json);
					}
					var tx = new Transaction(json["data"]["tx"]["hex"].ToString());
					return tx;
				}
			}
		}
开发者ID:xcrash,项目名称:NBitcoin,代码行数:22,代码来源:BlockrTransactionRepository.cs


示例20: GetBlock

        public Block GetBlock(uint256 blockId)
        {
            var ms = new MemoryStream();
            var container = Configuration.GetBlocksContainer();
            try
            {

                container.GetPageBlobReference(blockId.ToString()).DownloadToStream(ms);
                ms.Position = 0;
                Block b = new Block();
                b.ReadWrite(ms, false);
                return b;
            }
            catch(StorageException ex)
            {
                if(ex.RequestInformation != null && ex.RequestInformation.HttpStatusCode == 404)
                {
                    return null;
                }
                throw;
            }
        }
开发者ID:bijakatlykkex,项目名称:NBitcoin.Indexer,代码行数:22,代码来源:IndexerClient.cs



注:本文中的NBitcoin.uint256类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Math.BigInteger类代码示例发布时间:2022-05-26
下一篇:
C# NBitcoin.Transaction类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap