Table of Contents

Class DaemonProxy

Namespace
chia.dotnet
Assembly
chia-dotnet.dll

WebSocketRpcClient for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the PlotterProxy and having it's own procedures

public sealed class DaemonProxy : ServiceProxy, IServiceProxy
Inheritance
DaemonProxy
Implements
Inherited Members
Extension Methods

Remarks

ctor

Constructors

DaemonProxy(WebSocketRpcClient, string)

WebSocketRpcClient for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the PlotterProxy and having it's own procedures

public DaemonProxy(WebSocketRpcClient rpcClient, string originService)

Parameters

rpcClient WebSocketRpcClient

IRpcClient instance to use for rpc communication

originService string

Origin

Remarks

ctor

Methods

AddPrivateKey(string, string, CancellationToken)

Adds a private key to the keychain, with the given entropy and passphrase. The keychain itself will store the public key, and the entropy bytes, but not the passphrase.

public Task<uint> AddPrivateKey(string mnemonic, string passphrase, CancellationToken cancellationToken = default)

Parameters

mnemonic string

Mnemonic entropy of the key

passphrase string

Keyring passphrase

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<uint>

Awaitable Task

CheckKeys(string, CancellationToken)

Checks the keys

public Task CheckKeys(string rootPath, CancellationToken cancellationToken = default)

Parameters

rootPath string

The config root path

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

Remarks

This seems to send the daemon out to lunch

CreateProxyFrom<T>()

Create a new derived ServiceProxy instance sharing this daemon's RpcClient

public T CreateProxyFrom<T>() where T : ServiceProxy

Returns

T

The ServiceProxy

Type Parameters

T

The type of ServiceProxy to create

Remarks

This only works for daemons because they can forward messages to other services through their WebSocketRpcClient

DeleteAllKeys(CancellationToken)

Deletes all keys from the keychain

public Task DeleteAllKeys(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

DeleteKeyByFingerprint(uint, CancellationToken)

Deletes all keys which have the given public key fingerprint

public Task DeleteKeyByFingerprint(uint fingerprint, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

DeleteLabel(uint, CancellationToken)

Removes the label assigned to the key with the given fingerprint.

public Task DeleteLabel(uint fingerprint, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

cancellationToken CancellationToken

Returns

Task

Exit(CancellationToken)

Tells the daemon at the RPC endpoint to exit.

public Task Exit(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

Remarks

There isn't a way to start the daemon remotely via RPC, so take care that you have access to the RPC host if needed

GetAllPrivateKeys(CancellationToken)

Returns all private keys as a tuple of key, and entropy bytes (i.e. mnemonic) for each key.

public Task<IEnumerable<PrivateKeyData>> GetAllPrivateKeys(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<PrivateKeyData>>

All of the PrivateKeys

GetFirstPrivateKey(CancellationToken)

Returns the first private key

public Task<PrivateKeyData> GetFirstPrivateKey(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<PrivateKeyData>

The first PrivateKey

GetKey(uint, bool, CancellationToken)

Locates and returns KeyData matching the provided fingerprint

public Task<KeyData> GetKey(uint fingerprint, bool includeSecrets = false, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

includeSecrets bool

Include secrets

cancellationToken CancellationToken

Returns

Task<KeyData>

GetKeyForFingerprint(uint, CancellationToken)

Gets the private key associated with the given fingerprint

public Task<PrivateKeyData> GetKeyForFingerprint(uint fingerprint, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<PrivateKeyData>

The PrivateKey

GetKeyringStatus(CancellationToken)

Retrieves the status of the keyring

public Task<KeyringStatus> GetKeyringStatus(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<KeyringStatus>

Awaitable Task

GetKeys(uint, bool, CancellationToken)

Returns the KeyData of all keys which can be retrieved

public Task<IEnumerable<KeyData>> GetKeys(uint fingerprint, bool includeSecrets = false, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

includeSecrets bool

Include secrets

cancellationToken CancellationToken

Returns

Task<IEnumerable<KeyData>>

GetStatus(CancellationToken)

Get whether the genesis block has been initialized

public Task<bool> GetStatus(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<bool>

Boolean indicator

GetVersion(CancellationToken)

Get the installed version of chia at the endpoint

public Task<string> GetVersion(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<string>

The chia version as a string

GetWalletAddresses(IEnumerable<uint>?, bool, uint, uint, CancellationToken)

Returns the list of addresses.

public Task<IDictionary<uint, IEnumerable<WalletAddress>>> GetWalletAddresses(IEnumerable<uint>? fingerprints = null, bool nonObserverDerivation = false, uint index = 0, uint count = 1, CancellationToken cancellationToken = default)

Parameters

fingerprints IEnumerable<uint>
nonObserverDerivation bool
index uint
count uint
cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IDictionary<uint, IEnumerable<WalletAddress>>>

A dictionary of fingerprints and WalletAddress

IsKeyringLocked(CancellationToken)

Determine if the keyring is locked

public Task<bool> IsKeyringLocked(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<bool>

Boolean indicator as to whether the keyring is locked

IsRunning(string, CancellationToken)

Determines if the named service is running.

public Task<bool> IsRunning(string service, CancellationToken cancellationToken = default)

Parameters

service string

The service name

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<bool>

Boolean indicator as to whether the service is running

OnEventMessage(Message)

protected override void OnEventMessage(Message msg)

Parameters

msg Message

Ping(CancellationToken)

Sends ping message to the service

public Task Ping(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

RegisterService(string, CancellationToken)

Registers this daemon to receive messages. This is needed to receive responses from services other than the daemon. This is not a ServiceNames but usually the name of the consumer application such as 'wallet_ui'

public Task RegisterService(string service, CancellationToken cancellationToken = default)

Parameters

service string

The name to register

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

RegisterService(CancellationToken)

Registers this WebSocket to receive messages using OriginService This is needed to receive responses from services other than the daemon.

public Task RegisterService(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

RemoveKeyringPassphrase(string, CancellationToken)

Remove the key ring passphrase

public Task RemoveKeyringPassphrase(string currentPassphrase, CancellationToken cancellationToken = default)

Parameters

currentPassphrase string

The current keyring passphrase

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

RunningServices(CancellationToken)

Get the list of running services

public Task<IEnumerable<string>> RunningServices(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task<IEnumerable<string>>

A list of services

SetKeyringPassphrase(string, string, string, bool, CancellationToken)

Update the key ring passphrase

public Task SetKeyringPassphrase(string currentPassphrase, string newPassphrase, string passphraseHint, bool savePassphrase = false, CancellationToken cancellationToken = default)

Parameters

currentPassphrase string

The current keyring passphrase

newPassphrase string

The new keyring passphrase

passphraseHint string

A passphrase hint

savePassphrase bool

Should the passphrase be saved

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

SetLabel(uint, string, CancellationToken)

Assigns the given label to the first key with the given fingerprint.

public Task SetLabel(uint fingerprint, string label, CancellationToken cancellationToken = default)

Parameters

fingerprint uint

The fingerprint

label string

The label

cancellationToken CancellationToken

Returns

Task

StartService(string, CancellationToken)

Starts the named service.

public Task StartService(string service, CancellationToken cancellationToken = default)

Parameters

service string

The ServiceNames of the service

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

StopService(string, CancellationToken)

Stops the named service

public Task StopService(string service, CancellationToken cancellationToken = default)

Parameters

service string

The ServiceNames of the service

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

UnlockKeyring(string, CancellationToken)

Unlock the keyring

public Task UnlockKeyring(string key, CancellationToken cancellationToken = default)

Parameters

key string

Keyring passphrase

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

ValidateKeyringPassphrase(string, CancellationToken)

Test the validity of a passphrase

public Task ValidateKeyringPassphrase(string key, CancellationToken cancellationToken = default)

Parameters

key string

Keyring passphrase

cancellationToken CancellationToken

A token to allow the call to be cancelled

Returns

Task

Awaitable Task

Events

KeyringStatusChanged

Event raised when the keyring status changes

public event EventHandler<dynamic>? KeyringStatusChanged

Event Type

EventHandler<dynamic>
for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the and having it's own procedures

StateChanged

Event raised when the Daemon or Plotter changes state

public event EventHandler<dynamic>? StateChanged

Event Type

EventHandler<dynamic>
for the daemon interface. The daemon can be used to proxy messages to and from other chia services as well as controlling the and having it's own procedures