[#uint256]
= uint256
:mrdocs:

256&hyphen;bit opaque blob&period;

== Synopsis

Declared in `&lt;uint256&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
class uint256
    : public xref:base_blob-09.adoc[base&lowbar;blob&lt;256&gt;]
----

== Description

[NOTE]
====
This type is called uint256 for historical reasons only&period; It is an opaque blob of 256 bits and has no integer operations&period; Use arith&lowbar;uint256 if those are required&period;

====

== Base Classes

[cols="1,4"]
|===
| Name| Description
| `xref:base_blob-09.adoc[base&lowbar;blob&lt;256&gt;]`
| Template base class for fixed&hyphen;sized opaque blobs&period;
|===

== 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&lowbar;blob in reverse order&period; For example, a 4&hyphen;byte blob &lcub;0x12, 0x34, 0x56, 0x78&rcub; is represented as &quot;78563412&quot; instead of the more typical &quot;12345678&quot; representation that would be shown in a hex editor or used by typical byte&hyphen;array &sol; hex conversion functions like python&apos;s bytes&period;hex() and bytes&period;fromhex()&period;
| xref:uint256/GetUint64.adoc[`GetUint64`] 
| Reads a 64&hyphen;bit little&hyphen;endian word from the blob at a byte offset&period;
| xref:uint256/IsNull.adoc[`IsNull`] 
| Returns true if every byte of the blob is zero&period;
| xref:uint256/Serialize.adoc[`Serialize`] 
| Serializes the blob&apos;s raw bytes to a stream&period;
| xref:uint256/SetNull.adoc[`SetNull`] 
| Sets every byte of the blob to zero&period;
| xref:uint256/ToString.adoc[`ToString`] 
| Returns the blob as a hex string in reverse byte order&period;
| xref:uint256/Unserialize.adoc[`Unserialize`] 
| Deserializes the blob&apos;s raw bytes from a stream&period;
| xref:uint256/begin-04.adoc[`begin`] 
| Returns a pointer to the first byte of the blob&period;
| xref:uint256/data-0a3.adoc[`data`] 
| Returns a pointer to the blob&apos;s raw bytes&period;
| xref:uint256/end-09.adoc[`end`] 
| Returns a pointer just past the last byte of the blob&period;
| xref:uint256/operator_eq.adoc[`operator&equals;&equals;`] 
| Compares two blobs for byte&hyphen;wise equality&period;
| xref:uint256/operator_3way.adoc[`operator&lt;&equals;&gt;`] 
| Lexicographic ordering
|===


== Static Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:uint256/FromHex.adoc[`FromHex`] 
| Parses a uint256 from a hex string&period;
| xref:uint256/FromUserHex.adoc[`FromUserHex`] 
| Parses a uint256 from user&hyphen;supplied hex, allowing a &quot;0x&quot; prefix and padding&period;
| xref:uint256/size.adoc[`size`] 
| Returns the size of the blob in bytes&period;
|===


== Static Data Members

[cols="1,4"]
|===
| Name| Description
| xref:uint256/ONE.adoc[`ONE`] 
| The uint256 value equal to one&period;
| xref:uint256/ZERO.adoc[`ZERO`] 
| The all&hyphen;zero uint256 value&period;
|===


== Protected Data Members

[cols="1,4"]
|===
| Name| Description
| xref:uint256/m_data.adoc[`m&lowbar;data`] 
| Fixed&hyphen;size byte storage holding the blob&apos;s raw bytes&period;
|===


== Non-Member Functions

[cols="1,4"]
|===
| Name| Description
| xref:ArithToUint256.adoc[`ArithToUint256`]
| Converts an arithmetic 256&hyphen;bit integer to a uint256 blob&period;
| xref:AsmapVersion.adoc[`AsmapVersion`]
| Calculate the asmap version, a checksum identifying the asmap being used&period;
| xref:BlockMerkleRoot.adoc[`BlockMerkleRoot`]
| Compute the Merkle root of the transactions in a block&period; &ast;mutated is set to true if a duplicated subtree was found&period;
| xref:BlockWitnessMerkleRoot.adoc[`BlockWitnessMerkleRoot`]
| Compute the Merkle root of the witness transactions in a block&period;
| xref:CheckProofOfWork.adoc[`CheckProofOfWork`]
| Check whether a block hash satisfies the proof&hyphen;of&hyphen;work requirement specified by nBits
| xref:CheckProofOfWorkImpl.adoc[`CheckProofOfWorkImpl`]
| Implementation of CheckProofOfWork that verifies a hash against a compact target&period;
| xref:ComputeMerkleRoot.adoc[`ComputeMerkleRoot`]
| Compute a Merkle root from the provided leaf hashes&period; If non&hyphen;null, `&ast;mutated` is set to true if two identical hashes are paired at any tree level before the odd&hyphen;count hash duplication step, and false otherwise&period;
| xref:ComputeTapbranchHash.adoc[`ComputeTapbranchHash`]
| Compute the BIP341 tapbranch hash from two branches&period; Spans must be 32 bytes each&period;
| xref:ComputeTapleafHash.adoc[`ComputeTapleafHash`]
| Compute the BIP341 tapleaf hash from leaf version &amp; script&period;
| xref:ComputeTaprootMerkleRoot.adoc[`ComputeTaprootMerkleRoot`]
| Compute the BIP341 taproot script tree Merkle root from control block and leaf hash&period; Requires control block to have valid length (33 &plus; k&ast;32, with k in &lcub;0,1,&period;&period;,128&rcub;)&period;
| xref:CreateMuSig2PartialSig.adoc[`CreateMuSig2PartialSig`]
| Produce this participant&apos;s MuSig2 partial signature for the session&period;
| xref:DescriptorID.adoc[`DescriptorID`]
| Unique identifier that may not change over time, unless explicitly marked as not backwards compatible&period; This is not part of BIP 380, not guaranteed to be interoperable and should not be exposed to the user&period;
| xref:GetPackageHash.adoc[`GetPackageHash`]
| Get the hash of the concatenated wtxids of transactions, with wtxids treated as a little&hyphen;endian numbers and sorted in ascending numeric order&period;
| xref:GetRandHash.adoc[`GetRandHash`]
| Generate a random uint256&period;
| xref:GetTarget.adoc[`GetTarget`]
| &ast; Get the target for a given block index&period;
| xref:Hash-0a.adoc[`Hash`]
| Compute the 256&hyphen;bit hash of the concatenation of two objects&period;
| xref:Hash-0d.adoc[`Hash`]
| Compute the 256&hyphen;bit hash of an object&period;
| xref:IsBIP30Unspendable.adoc[`IsBIP30Unspendable`]
| Identifies blocks which coinbase output was subsequently overwritten in the UTXO set (see BIP30)&period;
| xref:LocatorEntries.adoc[`LocatorEntries`]
| Construct a list of hash entries to put in a locator&period;
| xref:MessageHash.adoc[`MessageHash`]
| Hashes a message for signing and verification in a manner that prevents inadvertently signing a transaction&period;
| xref:MuSig2SessionID.adoc[`MuSig2SessionID`]
| Computes an arbitrary unique session ID to identify ongoing signing sessions&period; It is the SHA256 of the signing (aggregate) pubkey, the participant pubkey, the sighash, and the pubnonce
| xref:ParseHashO.adoc[`ParseHashO`]
| Parse a hex&hyphen;encoded hash from a named field of an object&period;
| xref:ParseHashV.adoc[`ParseHashV`]
| Parse a hex&hyphen;encoded hash from a UniValue, throwing an RPC error if it is not valid hex&period;
| xref:SHA256Uint256.adoc[`SHA256Uint256`]
| Single&hyphen;SHA256 a 32&hyphen;byte input (represented as uint256)&period;
| xref:SignatureHash.adoc[`SignatureHash`]
| Compute the signature hash for one input under the selected signature version&period;
| xref:SignatureHashSchnorr.adoc[`SignatureHashSchnorr`]
| Compute the BIP341 Taproot signature hash for one input&period;
| xref:TransactionMerklePath.adoc[`TransactionMerklePath`]
| Compute merkle path to the specified transaction
| xref:UintToArith256.adoc[`UintToArith256`]
| Converts a uint256 blob to an arithmetic 256&hyphen;bit integer&period;
| xref:node/ReadSnapshotBaseBlockhash.adoc[`node&colon;&colon;ReadSnapshotBaseBlockhash`]
| Read the blockhash of the snapshot base block that was used to construct the chainstate&period;
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
