Copyright 2020 Nimiq community.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Attributes

rpc [RW]

Public Instance methods

Accounts ()

Accounts - Returns a list of addresses owned by client.

def Accounts
  result = @rpc.request("accounts")
  return result
end

BlockNumber ()

BlockNumber - Returns the height of most recent block.

def BlockNumber
  result = @rpc.request("blockNumber")
  return result
end

Consensus ()

Consensus - Returns information on the current consensus state.

def Consensus
  result = @rpc.request("consensus")
  return result
end

Constant (name, value = nil)

Constant - Returns or overrides a constant value. When no parameter is given, it returns the value of the constant. When giving a value as parameter, it sets the constant to the given value. To reset the constant to the default value, the parameter “reset” should be used.

def Constant(name, value = nil)
  if value
    result = @rpc.request("constant", name, value)
  else
    result = @rpc.request("constant", name)
  end
  return result
end

CreateAccount ()

CreateAccount - Creates a new account and stores its private key in the client store.

def CreateAccount
  result = @rpc.request("createAccount")
  return result
end

CreateRawTransaction (transaction)

CreateRawTransaction - Creates and signs a transaction without sending it. The transaction can then be send via `sendRawTransaction` without accidentally replaying it.

def CreateRawTransaction(transaction)
  result = @rpc.request("createRawTransaction", transaction)
  return result
end

GetAccount (address)

GetAccount - Returns details for the account of given address.

def GetAccount(address)
  result = @rpc.request("getAccount", address)
  return result
end

GetBalance (address)

GetBalance - Returns the balance of the account of given address.

def GetBalance(address)
  result = @rpc.request("getBalance", address)
  return result
end

GetBlockByHash (blockHash, fullTransactions = nil)

GetBlockByHash - Returns information about a block by hash.

def GetBlockByHash(blockHash, fullTransactions = nil)
  if fullTransactions
    result = @rpc.request("getBlockByHash", blockHash, fullTransactions)
  else
    result = @rpc.request("getBlockByHash", blockHash)
  end
  return result
end

GetBlockByNumber (blockHash, fullTransactions = nil)

GetBlockByNumber - Returns information about a block by block number.

def GetBlockByNumber(blockHash, fullTransactions = nil)
  if fullTransactions
    result = @rpc.request("getBlockByNumber", blockHash, fullTransactions)
  else
    result = @rpc.request("getBlockByNumber", blockHash)
  end
  return result
end

GetBlockTemplate ()

GetBlockTemplate - Returns a template to build the next block for mining. This will consider pool instructions when connected to a pool.

def GetBlockTemplate()
  result = @rpc.request("getBlockTemplate")
  return result
end

GetBlockTransactionCountByHash (blockHash)

GetBlockTransactionCountByHash - Returns the number of transactions in a block from a block matching the given block hash.

def GetBlockTransactionCountByHash(blockHash)
  result = @rpc.request("getBlockTransactionCountByHash", blockHash)
  return result
end

GetBlockTransactionCountByNumber (blockNumber)

GetBlockTransactionCountByNumber - Returns the number of transactions in a block matching the given block number.

def GetBlockTransactionCountByNumber(blockNumber)
  result = @rpc.request("getBlockTransactionCountByNumber", blockNumber)
  return result
end

GetTransactionByBlockHashAndIndex (blockHash, transactionIndex)

GetTransactionByBlockHashAndIndex - Returns information about a transaction by block hash and transaction index position.

def GetTransactionByBlockHashAndIndex(blockHash, transactionIndex)
  result = @rpc.request("getTransactionByBlockHashAndIndex", blockHash, transactionIndex)
  return result
end

GetTransactionByBlockNumberAndIndex (blockHeight, transactionIndex)

GetTransactionByBlockNumberAndIndex - Returns information about a transaction by block number and transaction index position.

def GetTransactionByBlockNumberAndIndex(blockHeight, transactionIndex)
  result = @rpc.request("getTransactionByBlockNumberAndIndex", blockHeight, transactionIndex)
  return result
end

GetTransactionByHash (transactionHash)

GetTransactionByHash - Returns the information about a transaction requested by transaction hash.

def GetTransactionByHash(transactionHash)
  result = @rpc.request("getTransactionByHash", transactionHash)
  return result
end

GetTransactionReceipt (transactionHash)

GetTransactionReceipt - Returns the receipt of a transaction by transaction hash.

def GetTransactionReceipt(transactionHash)
  result = @rpc.request("getTransactionReceipt", transactionHash)
  return result
end

GetTransactionsByAddress (address, transactionsNumber = nil)

GetTransactionsByAddress - Returns the latest transactions successfully performed by or for an address.

def GetTransactionsByAddress(address, transactionsNumber = nil)
  if transactionsNumber
    result = @rpc.request("getTransactionsByAddress", address, transactionsNumber)
  else
    result = @rpc.request("getTransactionsByAddress", address)
  end
  return result
end

GetWork ()

GetWork - Returns instructions to mine the next block. This will consider pool instructions when connected to a pool. Parameters getWork Address to use as a miner for this block. This overrides the address provided during startup or from the pool. Hex-encoded value for the extra data field. This overrides the address provided during startup or from the pool.

def GetWork
  result = @rpc.request("getWork")
  return result
end

Hashrate ()

Hashrate - Returns the number of hashes per second that the node is mining with.

def Hashrate
  result = @rpc.request("hashrate")
  return result
end

Log (tag, logLevel)

Log - Sets the log level of the node. If the tag is '*' the log level will be set globally, otherwise the log level is applied only on this tag. Log levels valid options: `trace`, `verbose`, `debug`, `info`, `warn`, `error`, `assert`

def Log(tag, logLevel)
  result = @rpc.request("log", tag, logLevel)
  return result
end

Mempool ()

Mempool - Returns information on the current mempool situation. This will provide an overview of the number of transactions sorted into buckets based on their fee per byte (in smallest unit).

def Mempool
  result = @rpc.request("mempool")
  return result
end

MempoolContent ()

MempoolContent - Returns transactions that are currently in the mempool.

def MempoolContent
  result = @rpc.request("mempoolContent")
  return result
end

MinFeePerByte (setMinFee = nil)

MinFeePerByte - Returns or sets the minimum fee per byte. Integer setMinFee (optional) - The new minimum fee per byte.

def MinFeePerByte(setMinFee = nil)
  if setMinFee
    result = @rpc.request("minFeePerByte", setMinFee)
  else
    result = @rpc.request("minFeePerByte")
  end
  return result
end

MinerAddress ()

MinerAddress - Returns the miner address.

def MinerAddress
  result = @rpc.request("minerAddress")
  return result
end

MinerThreads (setThreads = nil)

MinerThreads - Returns or sets the number of CPU threads for the miner. Integer setThreads (optional) - The number of threads to allocate for mining.

def MinerThreads(setThreads = nil)
  if setThreads
    result = @rpc.request("minerThreads", setThreads)
  else
    result = @rpc.request("minerThreads")
  end
  return result
end

Mining ()

Mining - Returns `true` if client is actively mining new blocks.

def Mining
  result = @rpc.request("mining")
  return result
end

PeerCount ()

PeerCount - Returns number of peers currently connected to the client.

def PeerCount
  result = @rpc.request("peerCount")
  return result
end

PeerList ()

PeerList - Returns list of peers known to the client.

def PeerList
  result = @rpc.request("peerList")
  return result
end

PeerState (peerAddress)

PeerState - Returns the state of the peer.

def PeerState(peerAddress)
  result = @rpc.request("peerState", peerAddress)
  return result
end

Pool (poolAddress)

Pool - Returns or sets the mining pool. When no parameter is given, it returns the current mining pool. When a value is given as parameter, it sets the mining pool to that value.

one

definition 1

two

definition 2

@param [String/Boolean] poolAddress (optional) - The mining pool connection string (url:port) or boolean to enable/disable pool mining.

def Pool(poolAddress)
  result = @rpc.request("pool")
  return result
end

PoolConfirmedBalance ()

PoolConfirmedBalance - Returns the confirmed mining pool balance.

def PoolConfirmedBalance
  result = @rpc.request("poolConfirmedBalance")
  return result
end

PoolConnectionState ()

PoolConnectionState - Returns the connection state to mining pool.

def PoolConnectionState
  result = @rpc.request("poolConnectionState")
  return result
end

SendRawTransaction (signedTransaction)

SendRawTransaction - Sends a signed message call transaction or a contract creation, if the data field contains code.

def SendRawTransaction(signedTransaction)
  result = @rpc.request("sendRawTransaction", signedTransaction)
  return result
end

SendTransaction (transaction)

SendTransaction - Creates new message call transaction or a contract creation, if the data field contains code.

def SendTransaction(transaction)
  result = @rpc.request("sendTransaction", transaction)
  return result
end

SubmitBlock (block)

SubmitBlock - Submits a block to the node. When the block is valid, the node will forward it to other nodes in the network. String - Hex-encoded full block (including header, interlink and body). When submitting work from getWork, remember to include the suffix.

def SubmitBlock(block)
  result = @rpc.request("submitBlock", block)
  return result
end

Syncing ()

Syncing - Returns an object with data about the sync status or `false`.

def Syncing
  result = @rpc.request("syncing")
  return result
end