RPC Usage
The Iron Fish process exposes an RPC server which can be used to communicate with nodes over TCP, IPC, and HTTP. The request and response patterns are similar to JSON HTTP and also return streaming responses.
API Reference
Refer to our RPC docs
JavaScript SDK
Currently Iron Fish only supports a JavaScript SDK. An example of interaction to fetch your account's public address looks like:
async function main(): Promise<void> {
const sdk = await IronfishSdk.init({ dataDir: '~/.dev0' });
const client = await sdk.connectRpc();
const response = await client.wallet.getAccountPublicKey({
account: '<account>',
});
console.log(response);
}
If you are not using JavaScript / TypeScript, it's recommended to write your own client that interacts with the node over HTTP, TCP, or IPC.
HTTP Adapter
If you'd like to enable HTTP binding to your RPC server, run the following:
ironfish config:set enableRpcHttp true
ironfish config:set rpcHttpHost 0.0.0.0
You can similarly configure rpcHttpHost and rpcHttpPort if you'd like to customize the host and port.