Skip to main content

RPC API Reference

Complete reference for the Bitmark Core JSON-RPC interface.

Connection

Configuration

In bitmark.conf:

server=1
rpcuser=username
rpcpassword=password
rpcallowip=127.0.0.1
rpcport=9266

Making Requests

# Using curl
curl -u username:password \
-d '{"jsonrpc":"1.0","method":"getinfo","params":[]}' \
http://127.0.0.1:9266/

# Using bitmark-cli
bitmark-cli <method> [params...]

Blockchain Commands

getblockchaininfo

Returns blockchain state information.

bitmark-cli getblockchaininfo

Response:

{
"chain": "main",
"blocks": 500000,
"headers": 500000,
"bestblockhash": "0x1a2b3c...",
"difficulty": 12345.678,
"mediantime": 1705312000,
"verificationprogress": 1.0,
"chainwork": "0x..."
}

getblock

Returns block data.

bitmark-cli getblock <hash> [verbosity]
ParameterTypeDescription
hashstringBlock hash
verbosityint0=hex, 1=json, 2=json+tx

getblockhash

Returns hash of block at height.

bitmark-cli getblockhash <height>

getblockcount

Returns current block height.

bitmark-cli getblockcount

getdifficulty

Returns current difficulty.

bitmark-cli getdifficulty

getbestblockhash

Returns hash of best (tip) block.

bitmark-cli getbestblockhash

Transaction Commands

getrawtransaction

Returns raw transaction data.

bitmark-cli getrawtransaction <txid> [verbose]

decoderawtransaction

Decodes a raw transaction hex.

bitmark-cli decoderawtransaction <hex>

sendrawtransaction

Broadcasts a raw transaction.

bitmark-cli sendrawtransaction <hex>

gettxout

Returns details about an unspent output.

bitmark-cli gettxout <txid> <vout> [include_mempool]

Wallet Commands

getbalance

Returns wallet balance.

bitmark-cli getbalance [account] [minconf]

getnewaddress

Generates a new address.

bitmark-cli getnewaddress [label]

getaddressesbyaccount

Returns addresses for an account.

bitmark-cli getaddressesbyaccount <account>

sendtoaddress

Sends to an address.

bitmark-cli sendtoaddress <address> <amount> [comment] [comment_to]

listtransactions

Lists recent transactions.

bitmark-cli listtransactions [account] [count] [skip]

listunspent

Lists unspent outputs.

bitmark-cli listunspent [minconf] [maxconf] [addresses]

signrawtransaction

Signs a raw transaction.

bitmark-cli signrawtransaction <hex> [prevtxs] [privkeys]

dumpprivkey

Reveals private key for an address.

bitmark-cli dumpprivkey <address>
warning

This exposes the private key! Use with caution.

importprivkey

Imports a private key.

bitmark-cli importprivkey <privkey> [label] [rescan]

walletpassphrase

Unlocks encrypted wallet.

bitmark-cli walletpassphrase <passphrase> <timeout>

walletlock

Locks the wallet.

bitmark-cli walletlock

encryptwallet

Encrypts the wallet.

bitmark-cli encryptwallet <passphrase>

backupwallet

Creates wallet backup.

bitmark-cli backupwallet <destination>

Mining Commands

getmininginfo

Returns mining status.

bitmark-cli getmininginfo

Response:

{
"blocks": 500000,
"currentblocksize": 1000,
"currentblocktx": 0,
"difficulty": 12345.678,
"networkhashps": 1000000,
"pooledtx": 5,
"generate": false,
"genproclimit": -1
}

setgenerate

Enables/disables mining.

bitmark-cli setgenerate <generate> [genproclimit]
ParameterTypeDescription
generatebooltrue to enable
genproclimitintThread count (-1 = all)

setminingalgo

Sets mining algorithm.

bitmark-cli setminingalgo <algo>
AlgoAlgorithm
0SCRYPT
1SHA256D
2YESCRYPT
3ARGON2D
4X17
5LYRA2REv2
6EQUIHASH
7CRYPTONIGHT

getnetworkhashps

Returns estimated network hash rate.

bitmark-cli getnetworkhashps [blocks] [height]

getblocktemplate

Returns data for constructing a block.

bitmark-cli getblocktemplate [params]

submitblock

Submits a new block.

bitmark-cli submitblock <hex>

Network Commands

getnetworkinfo

Returns network information.

bitmark-cli getnetworkinfo

getpeerinfo

Returns connected peer information.

bitmark-cli getpeerinfo

getconnectioncount

Returns number of connections.

bitmark-cli getconnectioncount

addnode

Attempts to add a peer.

bitmark-cli addnode <node> <add|remove|onetry>

disconnectnode

Disconnects a peer.

bitmark-cli disconnectnode <node>

ping

Pings all peers.

bitmark-cli ping

Utility Commands

validateaddress

Validates an address.

bitmark-cli validateaddress <address>

createmultisig

Creates a multisig address.

bitmark-cli createmultisig <nrequired> <keys>

estimatefee

Estimates transaction fee.

bitmark-cli estimatefee <nblocks>

signmessage

Signs a message with address.

bitmark-cli signmessage <address> <message>

verifymessage

Verifies a signed message.

bitmark-cli verifymessage <address> <signature> <message>

Control Commands

help

Lists commands or gets help.

bitmark-cli help [command]

stop

Stops the daemon.

bitmark-cli stop

getinfo

Returns general information (deprecated, use specific commands).

bitmark-cli getinfo

Error Codes

CodeMeaning
-1Miscellaneous error
-3Invalid parameter
-5Invalid address
-6Insufficient funds
-13Wallet unlock needed
-14Wrong passphrase
-25Transaction rejected
-26Already in chain

See Also