Class Blob
The Blob type is a length-prefixed field with arbitrary data.
Two common fields that use this type are SigningPubKey and TxnSignature, which contain (respectively)
the public key and signature that authorize a transaction to be executed.
Blob fields have no further structure to their contents, so they consist of
exactly the amount of bytes indicated in the variable-length encoding, after the Field ID and length prefixes.
Variable length encoded type
Inheritance
Implements
Namespace: Xrpl.BinaryCodec.Types
Assembly: Xrpl.BinaryCodec.dll
Syntax
public class Blob : ISerializedType
Fields
| Edit this page View SourceBuffer
Declaration
public readonly byte[] Buffer
Field Value
| Type | Description |
|---|---|
| byte[] |
Methods
| Edit this page View SourceFromAscii(string)
Create a Blob object from a hex-string
Declaration
public static Blob FromAscii(string blob)
Parameters
| Type | Name | Description |
|---|---|---|
| string | blob | existing hex-string in ASCII |
Returns
| Type | Description |
|---|---|
| Blob | A Blob object |
FromHex(string)
Declaration
public static Blob FromHex(string value)
Parameters
| Type | Name | Description |
|---|---|---|
| string | value |
Returns
| Type | Description |
|---|---|
| Blob |
FromJson(JsonNode)
Defines how to read a Blob from json. Accepts both hex-encoded strings and ASCII strings. If the string is valid hex (even length, all hex chars), it's decoded as hex. Otherwise, it's treated as ASCII and converted to bytes.
Declaration
public static Blob FromJson(JsonNode token)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonNode | token | json token |
Returns
| Type | Description |
|---|---|
| Blob | A Blob object |
FromParser(BinaryParser, int?)
Defines how to read a Blob from a BinaryParser
Declaration
public static Blob FromParser(BinaryParser parser, int? hint = null)
Parameters
| Type | Name | Description |
|---|---|---|
| BinaryParser | parser | The binary parser to read the Blob from |
| int? | hint | The length of the blob, computed by readVariableLengthLength() and passed in |
Returns
| Type | Description |
|---|---|
| Blob | A Blob object |
FromString(string, Encoding)
Create a Blob object from a hex-string
Declaration
public static Blob FromString(string blob, Encoding encoding)
Parameters
| Type | Name | Description |
|---|---|---|
| string | blob | existing hex-string |
| Encoding | encoding | string encoding |
Returns
| Type | Description |
|---|---|
| Blob | A Blob object |
ToBytes(IBytesSink)
to bytes Sink
Declaration
public void ToBytes(IBytesSink sink)
Parameters
| Type | Name | Description |
|---|---|---|
| IBytesSink | sink | bytes Sink container |
ToJson()
Get the JSON representation of this type
Declaration
public JsonNode ToJson()
Returns
| Type | Description |
|---|---|
| JsonNode |
ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| string |
Overrides
Operators
| Edit this page View Sourceimplicit operator Blob(byte[])
Declaration
public static implicit operator Blob(byte[] value)
Parameters
| Type | Name | Description |
|---|---|---|
| byte[] | value |
Returns
| Type | Description |
|---|---|
| Blob |
implicit operator Blob(JsonNode)
Declaration
public static implicit operator Blob(JsonNode token)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonNode | token |
Returns
| Type | Description |
|---|---|
| Blob |