Class OutputDescriptor
public abstract class OutputDescriptor : IEquatable<OutputDescriptor>
- Inheritance
-
OutputDescriptor
- Implements
- Derived
- Inherited Members
- Extension Methods
Properties
Network
public Network Network { get; }
Property Value
- Network
Methods
AddChecksum(string)
public static string AddChecksum(string desc)
Parameters
descstring
Returns
Equals(OutputDescriptor?)
Indicates whether the current object is equal to another object of the same type.
public bool Equals(OutputDescriptor? other)
Parameters
otherOutputDescriptorAn object to compare with this object.
Returns
Equals(object?)
Determines whether the specified object is equal to the current object.
public override sealed bool Equals(object? obj)
Parameters
objobjectThe object to compare with the current object.
Returns
GetCheckSum(string)
public static string GetCheckSum(string desc)
Parameters
descstring
Returns
GetHashCode()
Serves as the default hash function.
public override int GetHashCode()
Returns
- int
A hash code for the current object.
GetScriptPubKeyType()
Infer the address type for that descriptor. When it is impossible, just return null. e.g. In case of descriptors those are agnostic to the actual scriptpubkey format (e.g. "multi"), it just returns null.
public ScriptPubKeyType? GetScriptPubKeyType()
Returns
- ScriptPubKeyType?
IsRange()
public bool IsRange()
Returns
IsSolvable()
Output descriptor has solvability property.
Which means whether we are able to know how to create ScirptSig (or witness)
for the descriptor.
It is always false for addr() and raw(), and otherwise true.
But this may change in the future, see: https://github.com/bitcoin/bitcoin/issues/24114
for the discussion.
public bool IsSolvable()
Returns
IsTopLevelOnly()
public bool IsTopLevelOnly()
Returns
NewAddr(IDestination, Network)
public static OutputDescriptor NewAddr(IDestination dest, Network network)
Parameters
destIDestinationnetworkNetwork
Returns
NewCombo(PubKeyProvider, Network)
public static OutputDescriptor NewCombo(PubKeyProvider pk, Network network)
Parameters
pkPubKeyProvidernetworkNetwork
Returns
NewMulti(uint, IEnumerable<PubKeyProvider>, bool, Network, bool)
public static OutputDescriptor NewMulti(uint m, IEnumerable<PubKeyProvider> pks, bool isSorted, Network network, bool isTapScript = false)
Parameters
muintpksIEnumerable<PubKeyProvider>isSortedboolnetworkNetworkisTapScriptbool
Returns
NewPK(PubKeyProvider, Network)
public static OutputDescriptor NewPK(PubKeyProvider pk, Network network)
Parameters
pkPubKeyProvidernetworkNetwork
Returns
NewPKH(PubKeyProvider, Network)
public static OutputDescriptor NewPKH(PubKeyProvider pk, Network network)
Parameters
pkPubKeyProvidernetworkNetwork
Returns
NewRaw(Script, Network)
public static OutputDescriptor NewRaw(Script sc, Network network)
Parameters
scScriptnetworkNetwork
Returns
NewRawTr(PubKeyProvider, Network)
public static OutputDescriptor NewRawTr(PubKeyProvider outputPubkeyProvider, Network network)
Parameters
outputPubkeyProviderPubKeyProvidernetworkNetwork
Returns
NewSH(OutputDescriptor, Network)
public static OutputDescriptor NewSH(OutputDescriptor inner, Network network)
Parameters
innerOutputDescriptornetworkNetwork
Returns
NewTr(PubKeyProvider, Network, TapTree?)
public static OutputDescriptor NewTr(PubKeyProvider innerPubKey, Network network, OutputDescriptor.TapTree? tapTree = null)
Parameters
innerPubKeyPubKeyProvidernetworkNetworktapTreeOutputDescriptor.TapTree
Returns
NewWPKH(PubKeyProvider, Network)
public static OutputDescriptor NewWPKH(PubKeyProvider pk, Network network)
Parameters
pkPubKeyProvidernetworkNetwork
Returns
NewWSH(OutputDescriptor, Network)
public static OutputDescriptor NewWSH(OutputDescriptor inner, Network network)
Parameters
innerOutputDescriptornetworkNetwork
Returns
Parse(string, Network, bool, ISigningRepository?)
Parse descriptor from string representation.
OutputDescriptor class does not hold private key data in memory, so if you want to parse
private key, you must pass the reference to the DB with repo argument.
Parser will inject private keys they've found into the DB. this can later be used with other methods
such as TryGetPrivateString
public static OutputDescriptor Parse(string desc, Network network, bool requireCheckSum = false, ISigningRepository? repo = null)
Parameters
descstringdescriptor to parse
networkNetworkNetwork for the descriptor.
requireCheckSumboolif true, Do not parse descriptors without checksum. default: false
repoISigningRepositoryrepository to inject private key information.
Returns
ToString()
Returns a string that represents the current object.
public override string ToString()
Returns
- string
A string that represents the current object.
TryExpand(uint, ISigningRepository, out List<Script>, IDictionary<uint, ExtPubKey>?)
Expand descriptor into actual scriptPubKeys.
public bool TryExpand(uint pos, ISigningRepository repo, out List<Script> outputScripts, IDictionary<uint, ExtPubKey>? cache = null)
Parameters
posuintposition index to expand
repoISigningRepositoryrepository to which to put resulted information.
outputScriptsList<Script>resulted scriptPubKey
cacheIDictionary<uint, ExtPubKey>
Returns
TryExpand(uint, Func<KeyId, Key?>, ISigningRepository, out List<Script>, bool, IDictionary<uint, ExtPubKey>?)
Expand descriptor into actual scriptPubKeys. TODO: cache
public bool TryExpand(uint pos, Func<KeyId, Key?> privateKeyProvider, ISigningRepository repo, out List<Script> outputScripts, bool isTaproot = false, IDictionary<uint, ExtPubKey>? cache = null)
Parameters
posuintposition index to expand
privateKeyProviderFunc<KeyId, Key>provider to inject private keys in case of hardened derivation
repoISigningRepositoryrepository to which to put resulted information.
outputScriptsList<Script>resulted scriptPubKey
isTaprootboolcacheIDictionary<uint, ExtPubKey>
Returns
TryParse(string, Network, out OutputDescriptor?, bool, ISigningRepository?)
Parse descriptor from string representation.
OutputDescriptor class does not hold private key data in memory, so if you want to parse
private key, you must pass the reference to the DB with repo argument.
Parser will inject private keys they've found into the DB. this can later be used with other methods
such as TryGetPrivateString
public static bool TryParse(string desc, Network network, out OutputDescriptor? result, bool requireCheckSum = false, ISigningRepository? repo = null)
Parameters
descstringdescriptor to parse
networkNetworkNetwork for the descriptor.
resultOutputDescriptorrequireCheckSumboolIf true, Do not parse descriptors without checksum. Default: false
repoISigningRepositoryrepository to inject private key information.