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: the value must be an even-length hex string, an empty string being zero bytes.
Declaration
public static Blob FromJson(JsonNode token)
Parameters
| Type | Name | Description |
|---|---|---|
| JsonNode | token | json token |
Returns
| Type | Description |
|---|---|
| Blob | A Blob object |
Remarks
A value that is not hex is refused rather than encoded as text, as rippled and xrpl.js
refuse it. Encoding it would sign bytes other than the value the caller was given and
showed, with no signal - and non-ASCII characters would become ?. Text is
encoded explicitly, with FromAscii(string) or FromString(string, Encoding).
Exceptions
| Type | Condition |
|---|---|
| FormatException | The value is not an even-length hex string. |
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 |