コード例 #1
0
ファイル: Transaction.cs プロジェクト: radtek/BitSharp
        public Transaction(UInt32 version, ImmutableArray <TxInput> inputs, ImmutableArray <TxOutput> outputs, UInt32 lockTime, UInt256?hash = null)
        {
            this._version  = version;
            this._inputs   = inputs;
            this._outputs  = outputs;
            this._lockTime = lockTime;

            var sizeEstimate = 0L;

            for (var i = 0; i < inputs.Length; i++)
            {
                sizeEstimate += inputs[i].ScriptSignature.Length;
            }

            for (var i = 0; i < outputs.Length; i++)
            {
                sizeEstimate += outputs[i].ScriptPublicKey.Length;
            }
            sizeEstimate       = (long)(sizeEstimate * 1.5);
            this._sizeEstimate = sizeEstimate;

            this._hash = hash ?? DataCalculator.CalculateTransactionHash(version, inputs, outputs, lockTime);

            this.notDefault = true;
            this.hashCode   = this._hash.GetHashCode();
        }
コード例 #2
0
        public BlockHeader(UInt32 version, UInt256 previousBlock, UInt256 merkleRoot, UInt32 time, UInt32 bits, UInt32 nonce, UInt256 hash = null)
        {
            this._version       = version;
            this._previousBlock = previousBlock;
            this._merkleRoot    = merkleRoot;
            this._time          = time;
            this._bits          = bits;
            this._nonce         = nonce;

            this._hash = hash ?? DataCalculator.CalculateBlockHash(version, previousBlock, merkleRoot, time, bits, nonce);

            this.hashCode = this._hash.GetHashCode();
        }
コード例 #3
0
ファイル: BlockHeader.cs プロジェクト: radtek/BitSharp
 public UInt256 CalculateTarget()
 {
     return(DataCalculator.BitsToTarget(this.Bits));
 }
コード例 #4
0
ファイル: BlockHeader.cs プロジェクト: radtek/BitSharp
 public BigInteger CalculateWork()
 {
     return(DataCalculator.CalculateWork(this));
 }