darkfid JSON-RPC API
blockchain methods
blockchain.get_slot
Queries the blockchain database for a block in the given slot.
Returns a readable block upon success.
[src]
--> {"jsonrpc": "2.0", "method": "blockchain.get_slot", "params": [0], "id": 1}
<-- {"jsonrpc": "2.0", "result": {...}, "id": 1}
blockchain.merkle_roots
Queries the blockchain database for all available merkle roots.
[src]
--> {"jsonrpc": "2.0", "method": "blockchain.merkle_roots", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": [..., ..., ...], "id": 1}
tx methods
tx.transfer
Transfer a given amount of some token to the given address.
Returns a transaction ID upon success.
[src]
--> {"jsonrpc": "2.0", "method": "tx.transfer", "params": ["darkfi" "gdrk", "1DarkFi...", 12.0], "id": 1}
<-- {"jsonrpc": "2.0", "result": "txID...", "id": 1}
wallet methods
wallet.keygen
wallet.get_key
wallet.export_keypair
wallet.import_keypair
wallet.set_default_address
wallet.get_balances
wallet.keygen
Attempts to generate a new keypair and returns its address upon success.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.keygen", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": "1DarkFi...", "id": 1}
wallet.get_key
Fetches public keys by given indexes from the wallet and returns it in an
encoded format. -1
is supported to fetch all available keys.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.get_key", "params": [1, 2], "id": 1}
<-- {"jsonrpc": "2.0", "result": ["foo", "bar"], "id": 1}
wallet.export_keypair
Exports the given keypair index.
Returns the encoded secret key upon success.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.export_keypair", "params": [0], "id": 1}
<-- {"jsonrpc": "2.0", "result": "foobar", "id": 1}
wallet.import_keypair
Imports a given secret key into the wallet as a keypair.
Returns the public counterpart as the result upon success.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.import_keypair", "params": ["foobar"], "id": 1}
<-- {"jsonrpc": "2.0", "result": "pubfoobar", "id": 1}
wallet.set_default_address
Sets the default wallet address to the given index.
Returns true
upon success.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.set_default_address", "params": [2], "id": 1}
<-- {"jsonrpc": "2.0", "result": true, "id": 1}
wallet.get_balances
Queries the wallet for known balances.
Returns a map of balances, indexed by network
, and token ID.
[src]
--> {"jsonrpc": "2.0", "method": "wallet.get_balances", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": [{"btc": [100, "Bitcoin"]}, {...}], "id": 1}
misc methods
ping
Returns a pong
to the ping
request.
[src]
--> {"jsonrpc": "2.0", "method": "ping", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": "pong", "id": 1}
clock
Returns current system clock in Timestamp
format.
[src]
--> {"jsonrpc": "2.0", "method": "clock", "params": [], "id": 1}
<-- {"jsonrpc": "2.0", "result": {...}, "id": 1}