# JSON-RPC Methods
Check the JSON-RPC methods supported on Majestic StarChain.
# Pre-requisite Readings
# Endpoints
Method | Namespace | Implemented | Public | Notes |
---|---|---|---|---|
web3_clientVersion | Web3 | ✔ | ✔ | |
web3_sha3 | Web3 | ✔ | ✔ | |
net_version | Net | ✔ | ✔ | |
net_peerCount | Net | ✔ | ✔ | |
net_listening | Net | ✔ | ✔ | |
eth_protocolVersion | Eth | ✔ | ✔ | |
eth_syncing | Eth | ✔ | ✔ | |
eth_gasPrice | Eth | ✔ | ✔ | |
eth_accounts | Eth | ✔ | ✔ | |
eth_blockNumber | Eth | ✔ | ✔ | |
eth_getBalance | Eth | ✔ | ✔ | |
eth_getStorageAt | Eth | ✔ | ✔ | |
eth_getTransactionCount | Eth | ✔ | ✔ | |
eth_getBlockTransactionCountByNumber | Eth | ✔ | ✔ | |
eth_getBlockTransactionCountByHash | Eth | ✔ | ✔ | |
eth_getCode | Eth | ✔ | ✔ | |
eth_sign | Eth | ✔ | ✔ | |
eth_sendTransaction | Eth | ✔ | ✔ | |
eth_sendRawTransaction | Eth | ✔ | ✔ | |
eth_call | Eth | ✔ | ✔ | |
eth_estimateGas | Eth | ✔ | ✔ | |
eth_getBlockByNumber | Eth | ✔ | ✔ | |
eth_getBlockByHash | Eth | ✔ | ✔ | |
eth_getTransactionByHash | Eth | ✔ | ✔ | |
eth_getTransactionByBlockHashAndIndex | Eth | ✔ | ✔ | |
eth_getTransactionReceipt | Eth | ✔ | ✔ | |
eth_newFilter | Eth | ✔ | ✔ | |
eth_newBlockFilter | Eth | ✔ | ✔ | |
eth_newPendingTransactionFilter | Eth | ✔ | ✔ | |
eth_uninstallFilter | Eth | ✔ | ✔ | |
eth_getFilterChanges | Eth | ✔ | ✔ | |
eth_getFilterLogs | Eth | ✔ | ✔ | |
eth_getLogs | Eth | ✔ | ✔ | |
eth_getTransactionbyBlockNumberAndIndex | Eth | ✔ | ||
eth_getWork | Eth | N/A | ✔ | PoW-only |
eth_submitWork | Eth | N/A | ✔ | PoW-only |
eth_submitHashrate | Eth | |||
eth_getCompilers | Eth | |||
eth_compileLLL | Eth | |||
eth_compileSolidity | Eth | |||
eth_compileSerpent | Eth | |||
eth_signTransaction | Eth | |||
eth_mining | Eth | ❌ | ||
eth_coinbase | Eth | ✔ | ||
eth_hashrate | Eth | N/A | ❌ | PoW-only |
eth_getUncleCountByBlockHash | Eth | N/A | PoW-only | |
eth_getUncleCountByBlockNumber | Eth | N/A | PoW-only | |
eth_getUncleByBlockHashAndIndex | Eth | N/A | PoW-only | |
eth_getUncleByBlockNumberAndIndex | Eth | N/A | PoW-only | |
eth_getProof | Eth | ✔ | ||
eth_subscribe | Websocket | ✔ | ||
eth_unsubscribe | Websocket | ✔ | ||
personal_importRawKey | Personal | ✔ | ❌ | |
personal_listAccounts | Personal | ✔ | ❌ | |
personal_lockAccount | Personal | ✔ | ❌ | |
personal_newAccount | Personal | ✔ | ❌ | |
personal_unlockAccount | Personal | ✔ | ❌ | |
personal_sendTransaction | Personal | ✔ | ❌ | |
personal_sign | Personal | ✔ | ❌ | |
personal_ecRecover | Personal | ✔ | ❌ | |
personal_initializeWallet | Personal | ✔ | ❌ | |
personal_unpair | Personal | ✔ | ❌ | |
db_putString | DB | |||
db_getString | DB | |||
db_putHex | DB | |||
db_getHex | DB | |||
shh_post | SSH | |||
shh_version | SSH | |||
shh_newIdentity | SSH | |||
shh_hasIdentity | SSH | |||
shh_newGroup | SSH | |||
shh_addToGroup | SSH | |||
shh_newFilter | SSH | |||
shh_uninstallFilter | SSH | |||
shh_getFilterChanges | SSH | |||
shh_getMessages | SSH | |||
admin_addPeer | Admin | ❌ | ||
admin_datadir | Admin | ❌ | ||
admin_nodeInfo | Admin | ❌ | ||
admin_peers | Admin | ❌ | ||
admin_startRPC | Admin | ❌ | ||
admin_startWS | Admin | ❌ | ||
admin_stopRPC | Admin | ❌ | ||
admin_stopWS | Admin | ❌ | ||
clique_getSnapshot | Clique | |||
clique_getSnapshotAtHash | Clique | |||
clique_getSigners | Clique | |||
clique_proposals | Clique | |||
clique_propose | Clique | |||
clique_discard | Clique | |||
clique_status | Clique | |||
debug_backtraceAt | Debug | |||
debug_blockProfile | Debug | ✔ | ||
debug_cpuProfile | Debug | ✔ | ||
debug_dumpBlock | Debug | |||
debug_gcStats | Debug | ✔ | ||
debug_getBlockRlp | Debug | |||
debug_goTrace | Debug | ✔ | ||
debug_freeOSMemory | Debug | ✔ | ||
debug_memStats | Debug | ✔ | ||
debug_mutexProfile | Debug | ✔ | ||
debug_seedHash | Debug | |||
debug_setHead | Debug | |||
debug_setBlockProfileRate | Debug | ✔ | ||
debug_setGCPercent | Debug | ✔ | ||
debug_setMutexProfileFraction | Debug | ✔ | ||
debug_stacks | Debug | ✔ | ||
debug_startCPUProfile | Debug | ✔ | ||
debug_startGoTrace | Debug | ✔ | ||
debug_stopCPUProfile | Debug | ✔ | ||
debug_stopGoTrace | Debug | ✔ | ||
debug_traceBlock | Debug | ✔ | ||
debug_traceBlockByNumber | Debug | ✔ | ||
debug_traceBlockByHash | Debug | ✔ | ||
debug_traceBlockFromFile | Debug | |||
debug_standardTraceBlockToFile | Debug | |||
debug_standardTraceBadBlockToFile | Debug | |||
debug_traceTransaction | Debug | ✔ | ||
debug_verbosity | Debug | |||
debug_vmodule | Debug | |||
debug_writeBlockProfile | Debug | ✔ | ||
debug_writeMemProfile | Debug | ✔ | ||
debug_writeMutexProfile | Debug | ✔ | ||
les_serverInfo | Les | |||
les_clientInfo | Les | |||
les_priorityClientInfo | Les | |||
les_addBalance | Les | |||
les_setClientParams | Les | |||
les_setDefaultParams | Les | |||
les_latestCheckpoint | Les | |||
les_getCheckpoint | Les | |||
les_getCheckpointContractAddress | Les | |||
miner_getHashrate | Miner | ✔ | ❌ | No-op |
miner_setExtra | Miner | ✔ | ❌ | No-op |
miner_setGasPrice | Miner | ✔ | ❌ | Needs node restart |
miner_start | Miner | ✔ | ❌ | No-op |
miner_stop | Miner | ✔ | ❌ | No-op |
miner_setGasLimit | Miner | ✔ | ❌ | No-op |
miner_setEtherbase | Miner | ✔ | ❌ | |
txpool_content | TxPool | ✔ | ||
txpool_inspect | TxPool | ✔ | ||
txpool_status | TxPool | ✔ |
Block Number can be entered as a Hex string, "earliest"
, "latest"
or "pending"
.
Below is a list of the RPC methods, the parameters and an example response from the namespaces.
# Web3 Methods
# web3_sha3
Returns Keccak-256 (not the standardized SHA3-256) of the given data.
# Parameters (1)
1: input hexutil.Bytes
- Required: ✓ Yes
# Result
# Client Examples
# Net Methods
# net_version
Returns the current network id.
# net_peerCount
Returns the number of peers currently connected to the client.
# net_listening
Returns if client is actively listening for network connections.
# Eth Methods
# eth_protocolVersion
Returns the current ethereum protocol version.
# eth_syncing
The sync status object may need to be different depending on the details of Tendermint's sync protocol. However, the 'synced' result is simply a boolean, and can easily be derived from Tendermint's internal sync state.
# eth_gasPrice
Returns the current gas price in the default EVM denomination parameter.
# eth_accounts
Returns array of all eth accounts.
# eth_blockNumber
Returns the current block height.
# eth_getBalance
Returns the account balance for a given account address and Block Number.
# Parameters
Account Address
Block Number or Block Hash (EIP-1898 (opens new window))
# eth_getStorageAt
Returns the storage address for a given account address.
# Parameters
Account Address
Integer of the position in the storage
Block Number or Block Hash (EIP-1898 (opens new window))
# eth_getTransactionCount
Returns the total transaction for a given account address and Block Number.
# Parameters
Account Address
Block Number or Block Hash (EIP-1898 (opens new window))
# eth_getBlockTransactionCountByNumber
Returns the total transaction count for a given block number.
# Parameters
- Block number
# eth_getBlockTransactionCountByHash
Returns the total transaction count for a given block hash.
# Parameters
- Block Hash
# eth_getCode
Returns the code for a given account address and Block Number.
# Parameters
Account Address
Block Number or Block Hash (EIP-1898 (opens new window))
# eth_sign
The sign
method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message)))
.
By adding a prefix to the message makes the calculated signature recognizable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.
The address to sign with must be unlocked.
# Parameters
Account Address
Message to sign
# eth_sendTransaction
Sends transaction from given account to a given account.
# Parameters
Object containing:
from
:DATA
, 20 Bytes - The address the transaction is send from.to
:DATA
, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.gas
: QUANTITY - (optional, default: 90000) Integer of the gas provided for the transaction execution. It will return unused gas.gasPrice
: QUANTITY - (optional, default: To-Be-Determined) Integer of the gasPrice used for each paid gasvalue
: QUANTITY - value sent with this transactiondata
:DATA
- The compiled code of a contract OR the hash of the invoked method signature and encoded parameters. For details see Ethereum Contract ABInonce
: QUANTITY - (optional) Integer of a nonce. This allows to overwrite your own pending transactions that use the same nonce.
# eth_sendRawTransaction
Creates new message call transaction or a contract creation for signed transactions.
You can get signed transaction data using the personal_sign
method.
# Parameters
- The signed transaction data
# eth_call
Executes a new message call immediately without creating a transaction on the block chain.
# Parameters
Object containing:
from
:DATA
, 20 Bytes - (optional) The address the transaction is sent from.to
:DATA
, 20 Bytes - The address the transaction is directed to.gas
: QUANTITY - gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.gasPrice
: QUANTITY - gasPrice used for each paid gasvalue
: QUANTITY - value sent with this transactiondata
:DATA
- (optional) Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI in the Solidity documentationBlock number or Block Hash (EIP-1898 (opens new window))
# eth_estimateGas
Returns an estimate value of the gas required to send the transaction.
# Parameters
Object containing:
from
:DATA
, 20 Bytes - The address the transaction is send from.to
:DATA
, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.value
:QUANTITY
- value sent with this transaction
# eth_getBlockByNumber
Returns information about a block by block number.
# Parameters
Block Number
If true it returns the full transaction objects, if false only the hashes of the transactions.
# eth_getBlockByHash
Returns the block info given the hash found in the command above and a bool.
# Parameters
Hash of a block.
If true it returns the full transaction objects, if false only the hashes of the transactions.
# eth_getTransactionByHash
Returns transaction details given the ethereum tx something.
# Parameters
- hash of a transaction
# eth_getTransactionByBlockHashAndIndex
Returns transaction details given the block hash and the transaction index.
# Parameters
Hash of a block.
Transaction index position.
# eth_getTransactionReceipt
Returns the receipt of a transaction by transaction hash.
Note: Tx Code from Tendermint and the Ethereum receipt status are switched:
Tendermint | Ethereum | |
---|---|---|
Success | 0 | 1 |
Fail | 1 | 0 |
# Parameters
- Hash of a transaction
# eth_newFilter
Create new filter using topics of some kind.
# Parameters
- hash of a transaction
# eth_newBlockFilter
Creates a filter in the node, to notify when a new block arrives.
# eth_newPendingTransactionFilter
Creates a filter in the node, to notify when new pending transactions arrive.
# eth_uninstallFilter
Removes the filter with the given filter id. Returns true if the filter was successfully uninstalled, otherwise false.
# Parameters
- The filter id
# eth_getFilterChanges
Polling method for a filter, which returns an array of logs which occurred since last poll.
# Parameters
- The filter id
# eth_getFilterLogs
Returns an array of all logs matching filter with given id.
# Parameters
QUANTITY
- The filter id
# eth_getLogs
Returns an array of all logs matching a given filter object.
# Parameters
Object containing:
fromBlock
:QUANTITY|TAG
- (optional, default:"latest"
) Integer block number, or"latest"
for the last mined block or"pending"
,"earliest"
for not yet mined transactions.toBlock
:QUANTITY|TAG
- (optional, default:"latest"
) Integer block number, or"latest"
for the last mined block or"pending"
,"earliest"
for not yet mined transactions.address
:DATA|Array
, 20 Bytes - (optional) Contract address or a list of addresses from which logs should originate.topics
: Array ofDATA
, - (optional) Array of 32 BytesDATA
topics. Topics are order-dependent. Each topic can also be an array ofDATA
with “or” options.blockhash
: (optional, future) With the addition of EIP-234 (opens new window),blockHash
will be a new filter option which restricts the logs returned to the single block with the 32-byte hashblockHash
. UsingblockHash
is equivalent tofromBlock
=toBlock
= the block number with hashblockHash
. IfblockHash
is present in in the filter criteria, then neitherfromBlock
nortoBlock
are allowed.
# eth_coinbase
Returns the account the mining rewards will be send to.
# eth_getProof
Returns the account- and storage-values of the specified account including the Merkle-proof.
# Parameters
Address of account or contract
Integer of the position in the storage
Block Number or Block Hash (EIP-1898 (opens new window))
# WebSocket Methods
Read about websockets in events
# eth_subscribe
subscribe using JSON-RPC notifications. This allows clients to wait for events instead of polling for them.
It works by subscribing to particular events. The node will return a subscription id. For each event that matches the subscription a notification with relevant data is send together with the subscription id.
# Parameters
Subscription Name
Optional Arguments
# eth_unsubscribe
Unsubscribe from an event using the subscription id
# Parameters
- Subscription ID
# Personal Methods
# personal_importRawKey
Private: Requires authentication.
Imports the given unencrypted private key (hex encoded string) into the key store, encrypting it with the passphrase.
Returns the address of the new account.
# Parameters (2)
1: privkey string
- Required: ✓ Yes
2: password string
- Required: ✓ Yes
# personal_listAccounts
Private: Requires authentication.
Returns a list of addresses for accounts this node manages.
# personal_lockAccount
Private: Requires authentication.
Removes the private key with given address from memory. The account can no longer be used to send transactions.
# Parameters
- Account Address
# personal_newAccount
Private: Requires authentication.
Generates a new private key and stores it in the key store directory. The key file is encrypted with the given passphrase. Returns the address of the new account.
# Parameters
- Passphrase
# personal_unlockAccount
Private: Requires authentication.
Decrypts the key with the given address from the key store.
Both passphrase and unlock duration are optional when using the JavaScript console. The unencrypted key will be held in memory until the unlock duration expires. If the unlock duration defaults to 300 seconds. An explicit duration of zero seconds unlocks the key until geth exits.
The account can be used with eth_sign
and eth_sendTransaction
while it is unlocked.
# Parameters
Account Address
Passphrase
Duration
# personal_sendTransaction
Private: Requires authentication.
Validate the given passphrase and submit transaction.
The transaction is the same argument as for eth_sendTransaction
and contains the from
address. If the passphrase can be used to decrypt the private key belonging to tx.from
the transaction is verified, signed and send onto the network.
The account is not unlocked globally in the node and cannot be used in other RPC calls.
# Parameters
Object containing:
from
:DATA
, 20 Bytes - The address the transaction is send from.to
:DATA
, 20 Bytes - (optional when creating new contract) The address the transaction is directed to.value
: QUANTITY - value sent with this transactionPassphrase
# personal_sign
Private: Requires authentication.
The sign method calculates an Ethereum specific signature with: sign(keccack256("\x19Ethereum Signed Message:\n" + len(message) + message)))
,
# Parameters
Message
Account Address
Password
# personal_ecRecover
Private: Requires authentication.
ecRecover
returns the address associated with the private key that was used to calculate the signature in personal_sign
.
# Parameters
Message
Signature returned from
personal_sign
# personal_initializeWallet
Private: Requires authentication.
Initializes a new wallet at the provided URL, by generating and returning a new private key.
# Parameters (1)
Parameters must be given by position.
1: url string
- Required: ✓ Yes
# Client Examples
# personal_unpair
Private: Requires authentication.
Unpair deletes a pairing between wallet and the node.
# Parameters (2)
URL
Pairing password
# Client Examples
# Debug Methods
# debug_traceTransaction
The traceTransaction
debugging method will attempt to run the transaction in the exact same manner as it was executed on the network. It will replay any transaction that may have been executed prior to this one before it will finally attempt to execute the transaction that corresponds to the given hash.
# Parameters
- Trace Config
# debug_traceBlockByNumber
The traceBlockByNumber
endpoint accepts a block number and will replay the block that is already present in the database.
# Parameters
- Trace Config
# Miner Methods
# miner_getHashrate
Private: Requires authentication.
Get the hashrate in H/s (Hash operations per second).
Proof-of-Work specific. This endpoint always returns 0
.
# miner_setExtra
Private: Requires authentication.
Sets the extra data a validator can include when proposing blocks. This is capped at 32 bytes.
Unsupported. This endpoint always returns an error
# Parameters
- Data
# miner_setGasPrice
Private: Requires authentication.
Sets the minimal gas price used to accept transactions. Any transaction below this limit is excluded from the validator block proposal process.
This method requires a node
restart after being called because it changes the configuration file.
Make sure your mjtd start
call is not using the flag minimum-gas-prices
because this value will be used instead of the one set on the configuration file.
# Parameters
- Hex Gas Price
# miner_start
Private: Requires authentication.
Start the CPU validation process with the given number of threads.
Unsupported. This endpoint always returns an error
# Parameters
- Hex Number of threads
# miner_stop
Private: Requires authentication.
Stop the validation operation.
Unsupported. This endpoint always performs a no-op.
# miner_setGasLimit
Private: Requires authentication.
Sets the gas limit the miner will target when mining. Note: on networks where EIP-1559 (opens new window) is activated, this should be set to twice what you want the gas target (i.e. the effective gas used on average per block) to be.
Unsupported. This endpoint always returns false
# Parameters
- Hex gas limit
# Parameters
- Hex Number of threads
# miner_setEtherbase
Private: Requires authentication.
Sets the etherbase. It changes the wallet where the validator rewards will be deposited.
# Parameters
- Account Address
# TxPool Methods
# txpool_content
Returns a list of the exact details of all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.
# Parame (0)
# Client Examples
# Result
# txpool_inspect
Returns a list on text format to summarize all the transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only. This is a method specifically tailored to developers to quickly see the transactions in the pool and find any potential issues.
# Parameters (0)
# Client Examples
# Result
# txpool_status
Returns the number of transactions currently pending for inclusion in the next block(s), as well as the ones that are being scheduled for future execution only.