[#uint256] = uint256 :mrdocs: 256‐bit opaque blob. == Synopsis Declared in `<uint256.h>` [source,cpp,subs="verbatim,replacements,macros,-callouts"] ---- class uint256 : public xref:base_blob-09.adoc[base_blob<256>] ---- == Description [NOTE] ==== This type is called uint256 for historical reasons only. It is an opaque blob of 256 bits and has no integer operations. Use arith_uint256 if those are required. ==== == Base Classes [cols="1,4"] |=== | Name| Description | `xref:base_blob-09.adoc[base_blob<256>]` | Template base class for fixed‐sized opaque blobs. |=== == Member Functions [cols="1,4"] |=== | Name| Description | xref:uint256/2constructor-09.adoc[`uint256`] [.small]#[constructor]# | Constructors | xref:uint256/GetHex.adoc[`GetHex`] | The hex representation used by GetHex(), ToString(), and FromHex() is unusual, since it shows bytes of the base_blob in reverse order. For example, a 4‐byte blob {0x12, 0x34, 0x56, 0x78} is represented as "78563412" instead of the more typical "12345678" representation that would be shown in a hex editor or used by typical byte‐array / hex conversion functions like python's bytes.hex() and bytes.fromhex(). | xref:uint256/GetUint64.adoc[`GetUint64`] | Reads a 64‐bit little‐endian word from the blob at a byte offset. | xref:uint256/IsNull.adoc[`IsNull`] | Returns true if every byte of the blob is zero. | xref:uint256/Serialize.adoc[`Serialize`] | Serializes the blob's raw bytes to a stream. | xref:uint256/SetNull.adoc[`SetNull`] | Sets every byte of the blob to zero. | xref:uint256/ToString.adoc[`ToString`] | Returns the blob as a hex string in reverse byte order. | xref:uint256/Unserialize.adoc[`Unserialize`] | Deserializes the blob's raw bytes from a stream. | xref:uint256/begin-04.adoc[`begin`] | Returns a pointer to the first byte of the blob. | xref:uint256/data-0a3.adoc[`data`] | Returns a pointer to the blob's raw bytes. | xref:uint256/end-09.adoc[`end`] | Returns a pointer just past the last byte of the blob. | xref:uint256/operator_eq.adoc[`operator==`] | Compares two blobs for byte‐wise equality. | xref:uint256/operator_3way.adoc[`operator<=>`] | Lexicographic ordering |=== == Static Member Functions [cols="1,4"] |=== | Name| Description | xref:uint256/FromHex.adoc[`FromHex`] | Parses a uint256 from a hex string. | xref:uint256/FromUserHex.adoc[`FromUserHex`] | Parses a uint256 from user‐supplied hex, allowing a "0x" prefix and padding. | xref:uint256/size.adoc[`size`] | Returns the size of the blob in bytes. |=== == Static Data Members [cols="1,4"] |=== | Name| Description | xref:uint256/ONE.adoc[`ONE`] | The uint256 value equal to one. | xref:uint256/ZERO.adoc[`ZERO`] | The all‐zero uint256 value. |=== == Protected Data Members [cols="1,4"] |=== | Name| Description | xref:uint256/m_data.adoc[`m_data`] | Fixed‐size byte storage holding the blob's raw bytes. |=== == Non-Member Functions [cols="1,4"] |=== | Name| Description | xref:ArithToUint256.adoc[`ArithToUint256`] | Converts an arithmetic 256‐bit integer to a uint256 blob. | xref:AsmapVersion.adoc[`AsmapVersion`] | Calculate the asmap version, a checksum identifying the asmap being used. | xref:BlockMerkleRoot.adoc[`BlockMerkleRoot`] | Compute the Merkle root of the transactions in a block. *mutated is set to true if a duplicated subtree was found. | xref:BlockWitnessMerkleRoot.adoc[`BlockWitnessMerkleRoot`] | Compute the Merkle root of the witness transactions in a block. | xref:CheckProofOfWork.adoc[`CheckProofOfWork`] | Check whether a block hash satisfies the proof‐of‐work requirement specified by nBits | xref:CheckProofOfWorkImpl.adoc[`CheckProofOfWorkImpl`] | Implementation of CheckProofOfWork that verifies a hash against a compact target. | xref:ComputeMerkleRoot.adoc[`ComputeMerkleRoot`] | Compute a Merkle root from the provided leaf hashes. If non‐null, `*mutated` is set to true if two identical hashes are paired at any tree level before the odd‐count hash duplication step, and false otherwise. | xref:ComputeTapbranchHash.adoc[`ComputeTapbranchHash`] | Compute the BIP341 tapbranch hash from two branches. Spans must be 32 bytes each. | xref:ComputeTapleafHash.adoc[`ComputeTapleafHash`] | Compute the BIP341 tapleaf hash from leaf version & script. | xref:ComputeTaprootMerkleRoot.adoc[`ComputeTaprootMerkleRoot`] | Compute the BIP341 taproot script tree Merkle root from control block and leaf hash. Requires control block to have valid length (33 + k*32, with k in {0,1,..,128}). | xref:CreateMuSig2PartialSig.adoc[`CreateMuSig2PartialSig`] | Produce this participant's MuSig2 partial signature for the session. | xref:DescriptorID.adoc[`DescriptorID`] | Unique identifier that may not change over time, unless explicitly marked as not backwards compatible. This is not part of BIP 380, not guaranteed to be interoperable and should not be exposed to the user. | xref:GetPackageHash.adoc[`GetPackageHash`] | Get the hash of the concatenated wtxids of transactions, with wtxids treated as a little‐endian numbers and sorted in ascending numeric order. | xref:GetRandHash.adoc[`GetRandHash`] | Generate a random uint256. | xref:GetTarget.adoc[`GetTarget`] | * Get the target for a given block index. | xref:Hash-0a.adoc[`Hash`] | Compute the 256‐bit hash of the concatenation of two objects. | xref:Hash-0d.adoc[`Hash`] | Compute the 256‐bit hash of an object. | xref:IsBIP30Unspendable.adoc[`IsBIP30Unspendable`] | Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30). | xref:LocatorEntries.adoc[`LocatorEntries`] | Construct a list of hash entries to put in a locator. | xref:MessageHash.adoc[`MessageHash`] | Hashes a message for signing and verification in a manner that prevents inadvertently signing a transaction. | xref:MuSig2SessionID.adoc[`MuSig2SessionID`] | Computes an arbitrary unique session ID to identify ongoing signing sessions. It is the SHA256 of the signing (aggregate) pubkey, the participant pubkey, the sighash, and the pubnonce | xref:ParseHashO.adoc[`ParseHashO`] | Parse a hex‐encoded hash from a named field of an object. | xref:ParseHashV.adoc[`ParseHashV`] | Parse a hex‐encoded hash from a UniValue, throwing an RPC error if it is not valid hex. | xref:SHA256Uint256.adoc[`SHA256Uint256`] | Single‐SHA256 a 32‐byte input (represented as uint256). | xref:SignatureHash.adoc[`SignatureHash`] | Compute the signature hash for one input under the selected signature version. | xref:SignatureHashSchnorr.adoc[`SignatureHashSchnorr`] | Compute the BIP341 Taproot signature hash for one input. | xref:TransactionMerklePath.adoc[`TransactionMerklePath`] | Compute merkle path to the specified transaction | xref:UintToArith256.adoc[`UintToArith256`] | Converts a uint256 blob to an arithmetic 256‐bit integer. | xref:node/ReadSnapshotBaseBlockhash.adoc[`node::ReadSnapshotBaseBlockhash`] | Read the blockhash of the snapshot base block that was used to construct the chainstate. |=== [.small]#Created with https://www.mrdocs.com[MrDocs]#