Overview

Pantheon Overview

Contents

What is Pantheon?

Pantheon is an open-source Ethereum client developed under the Apache 2.0 license and written in Java. It runs on the Ethereum public network, private networks, and test networks such as Rinkeby and Ropsten. Pantheon implements Proof of Work (Ethash) and Proof of Authority (Clique) consensus mechanisms.

You can use Pantheon to develop enterprise applications requiring secure, high-performance transaction processing in a private network.

Our roadmap includes Pantheon with privacy features, alternative consensus mechanisms, and other enterprise features.

What can you do with Pantheon?

Pantheon includes a command line interface and JSON-RPC API for running, maintaining, debugging, and monitoring node operations in an Ethereum network. You can use the API via RPC over HTTP or via WebSockets transport, and Pub/Sub is supported. The API supports typical Ethereum functionalities such as:

  • Ether token mining
  • Smart contract development
  • Decentralized application (Dapp) development

The Pantheon client supports common smart contract and Dapp development, deployment, and operational use cases, using tools such as Truffle, Remix, and web3j. The client supports common JSON-RPC API methods such as eth, net, web3, debug, and miner.

Pantheon doesn't support Account management.

Getting Started

Getting Started

You can get started with Pantheon by:

To run a single node to connect the Ethereum mainnet or a public testnet, running from the Pantheon docker image or downloading the packaged binaries is the fastest way to get started.

To run a private network on which you can make JSON-RPC requests and send transactions, or explore Pantheon and Ethereum networks, the Private Network Quickstart runs a private network of Pantheon nodes in a Docker container.

Installation

Pantheon Installation

Note If you have installed Pantheon from the packaged binaries or are running the Docker image, you do not need to follow the procedures in this section. You can proceed with the Basic Quickstart or Starting Pantheon.

Contents

Running Locally

Running Virtually

Prerequisites

  • Disk space and RAM: Your computer should have at least 4 GB RAM. Disk space needed varies depending on the network on which you run nodes. A small test network might require 200 MB while a mainnet node might require 1.5TB. If syncing a node on mainnet, allow 1.5 TB to 2 TB for the full blockchain archive.

  • Java JDK

    IMPORTANT: Pantheon requires Java 8+ to compile; earlier versions are not supported.

  • Git or GitHub Desktop

Installation on Linux / Unix / Mac OS X

Clone the Pantheon Repository

Clone the PegaSysEng/pantheon repo to your home directory (/home/<user>):

git clone --recursive https://github.com/PegaSysEng/pantheon.git

Build Pantheon

After the cloning process completes, go to the pantheon repo directory and run git branch to make sure you're in the branch in which you cloned the Pantheon source code (by default this is the master branch).

Build the pantheon executable using gradlew. You can use the -x test option to exclude tests, which can take a long time to run and are not necessary for initial build:

./gradlew build -x test

Continue with Basic Quickstart, Private Network Quickstart, or Starting Pantheon.

Installation on Windows

Note Pantheon is currently supported only on 64-bit versions of Windows, and requires a 64-bit version of JDK/JRE. We recommend that you also remove any 32-bit JDK/JRE installations.

Install Pantheon

In Git bash, go to your working directory for repositories. Clone the PegaSysEng/pantheon repo into this directory:

git clone --recursive https://github.com/PegaSysEng/pantheon

This creates a pantheon directory under Git revision control that will contain the cloned repo contents.

Build Pantheon

Go to the pantheon directory:

cd pantheon

Open a Windows command prompt (the following won't work in Git bash). Build Pantheon with the Gradle wrapper gradlew, omitting tests as follows:

gradlew build -x test

Note To run gradlew, you must have the JAVA_HOME system variable set to the Java installation directory. For example: JAVA_HOME = C:\Program Files\Java\jdk1.8.0_181.

After the build completes, your system is ready to run Pantheon. See Starting Pantheon and other sections of Getting Started for guidance on using Pantheon.

Installation on VM

You can run Pantheon on a virtual machine (VM) on a cloud service such as AWS or Azure, or locally using a VM manager such as VirtualBox.

If you set up your own VM locally using a VM manager such as VirtualBox, there are a few considerations:

  • Make sure that Intel Virtualization Technology (VTx) and Virtualization Technology for Directed I/O (VT-d) are enabled in BIOS settings.

  • On Windows, you might need to disable Hyper-V in the Windows Feature list.

It is recommended that you create a VM with the following attributes:

  • Memory Size: Set to 4096 (recommended)

  • Create a virtual hard disk with at least 10 GB; 20 GB is recommended

  • Virtual hard disk file type: VDI (if you need to share it with other apps, use VHD)

  • (Optional) You can create a shared directory in order to copy block files or genesis files from the host computer to the VM. For details on how to create a shared directory, see "Share Folders" in Install Ubuntu on Oracle VirtualBox.

Basic Quickstart

Pantheon Quickstart

This tutorial shows you how to install Pantheon and invoke the Pantheon CLI to run a single node in default mode:

  • The node runs on the Ethereum mainnet and uses the default embedded mainnet genesis file.
  • The node does not perform mining.
  • P2P peer discovery is enabled on the default P2P port. There are a maximum of 25 P2P peer connections.
  • Listen on the default RPC over HTTP host/port.
  • Use full synchronization mode.

During the tutorial, you'll import a test block file to provide the initial blocks for the node to use, then run the node. You'll then use curl to make a call using Pantheon JSON-RPC API; this will make a request to verify that the node is running.

Installation

Install Java, Git, and Pantheon for your platform as described in Installation, then proceed through the following steps.

Run Pantheon

In this tutorial, you'll build and run Pantheon in one terminal (bash) window and run curl commands to make JSON-RPC requests in another terminal window. To do this, either open two separate instances of Terminal, or run a utility such as tmux to run a split screen terminal.

In the first terminal, go to the ~/pantheon folder:

cd pantheon

Build Pantheon as described in Installation.

To run pantheon, go to the distribution folder:

cd build/distributions/

Expand the distribution archive:

tar -xzf pantheon-<version>.tar.gz

Move to the expanded folder and run pantheon using the script to display command help:

cd pantheon-<version>/
bin/pantheon --help

Import initial blocks for the node to work with from a blocks file. You can use the provided sample blocks file as shown in the following command:

bin/pantheon import ~/pantheon/testutil/src/main/resources/1000.blocks

When the import completes successfully, you should see messages containing the following:

ImportSubCommand | Runs import sub command with blocksImportPath

KeyPairUtil | Generated new key <key> and stored it to ~/pantheon/build/distributions/pantheon-<version>/key

For more information on using the pantheon import subcommand, see Pantheon CLI Syntax.

After the import successfully completes, run Pantheon with only the --rpc-enabled option:

bin/pantheon --rpc-enabled

This runs Pantheon in default mode, meaning it runs in mainnet with the default genesis file, and peer discovery is enabled.

The --rpc-enabled option starts the JSON-RPC service.

The terminal output will indicate that the node is synchronizing.

Test the Pantheon Node

Make JSON-RPC Requests using curl

While the node is running, make a request on it using curl and the JSON-RPC API.

Switch to the bottom window using Ctrl+b o and run the following curl command:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' 127.0.0.1:8545

Note the endpoint IP and default port. You should see a result similar to the following:

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "startingBlock" : "0x3e7",
    "currentBlock" : "0x3e7",
    "highestBlock" : "0x0"
  }
}

You can now call other JSON-RPC commands listed in Pantheon JSON RPC API.

Close the Terminal Session

After you're finished running the demo, you can stop the Pantheon client by returning to the terminal window that runs the node and entering Ctrl+c.

Private Network Quickstart

Private Network Quickstart Tutorial

This tutorial describes how to use Pantheon to run a private network of Pantheon nodes in a Docker container.

Note To run the Private Network Quickstart, you must install Pantheon by cloning and building.

If you have installed Pantheon from the packaged binaries or are running the Docker image, you can proceed with the Basic Quickstart or Starting Pantheon.

Prerequisites

To run this tutorial, you must have the following installed:

Clone Pantheon Source Code

As indicated in the installation section, clone the repository.

Build Docker Images and Start Services and Network

This tutorial uses Docker Compose to simplify assembling images and running in a private network. To run the containers, go to the pantheon directory and run the following commands:

On Linux/Mac, run the following shell command provided with the code:

quickstart/runPantheonPrivateNetwork.sh

On Windows, run the following docker-compose commands:

// Run the Docker containers
quickstart\docker-compose up -d --scale node=4

// List the endpoints
quickstart\docker-compose port explorer 80

This script builds Pantheon, builds the images and runs the containers. It will also scale the regular node container to four containers to simulate a network with enough peers to synchronize.

When the process ends, it lists the running services:

        Name                       Command               State                              Ports                           
-----------------------------------------------------------------------------------------------------------------------------
quickstart_bootnode_1    /opt/pantheon/bootnode_sta ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_explorer_1    nginx -g daemon off;             Up      0.0.0.0:32770->80/tcp                                      
quickstart_minernode_1   /opt/pantheon/node_start.s ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_node_1        /opt/pantheon/node_start.s ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_node_2        /opt/pantheon/node_start.s ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_node_3        /opt/pantheon/node_start.s ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_node_4        /opt/pantheon/node_start.s ...   Up      30303/tcp, 8545/tcp, 8546/tcp                              
quickstart_rpcnode_1     /opt/pantheon/node_start.s ...   Up      30303/tcp, 0.0.0.0:32769->8545/tcp, 0.0.0.0:32768->8546/tcp

This is followed by a list of the endpoints:

****************************************************************
JSON-RPC HTTP service endpoint      : http://localhost:32770/jsonrpc   *
JSON-RPC WebSocket service endpoint : ws://localhost:32770/jsonws   *
Web block explorer address          : http://localhost:32770   *                                                                             
****************************************************************
  • Use the JSON-RPC HTTP service endpoint to access the RPC node service from your Dapp or from cryptocurrency wallets such as Metamask.
  • Use the JSON-RPC WebSocket service endpoint to access the web socket node service from your Dapp. Use the form ws://localhost:32770/jsonws.
  • Use the Web block explorer address to display the block explorer web application. View the block explorer by entering the URL in your web browser.

On Linux/Mac, to display the list of endpoints again, run the following shell command:

quickstart/listQuickstartServices.sh

On Windows, to display the list of endpoints again, run the following docker-compose command:

quickstart\docker-compose port explorer 80

Block Explorer

This tutorial uses the Alethio light block explorer.

Run the Block Explorer

Access the explorer by copying and pasting the Web block explorer address displayed when starting the private network to your browser.

The block explorer displays a summary of the private network:

Notice the explorer indicates 6 peers: the 4 regular nodes, the mining node and the bootnode.

Click on the block number to the right of Best Block to display the block details.

You can explore blocks by clicking on the blocks under Bk down the left-hand side.

You can search for a specific block, transaction hash, or address by clicking the magnifying glass in the top left-hand corner.

Run JSON-RPC Requests

Now we're ready to run requests.

You can run RPC requests on rpcnode, the node that is exposed to the host in order to listen for requests. This tutorial uses cURL to make JSON-RPC requests.

On Windows: We suggest using Postman or a similar client to make RPC requests from Windows. Using curl via Command Prompt or Windows PowerShell might not work.

This tutorial uses the placeholder http://localhost:http-rpc-port. When you run this tutorial, replace http-rpc-port with the JSON-RPC HTTP service endpoint provided when you list the endpoints. (For example, http://localhost:32770/jsonrpc.) The dynamic docker port mapping changes each time you run the network.

Requesting the Node Version

Run the following command from the host shell :

curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:http-rpc-port

The result should be as follows:

{
   "jsonrpc" : "2.0",
   "id" : 1,
   "result" : "pantheon/1.0.0"
}

Here we simply query the version of the Pantheon node, which confirms the node is running.

Now if this works, let's see some more interesting requests.

Counting Peers

Peers are the number of other nodes connected to the RPC node.

Poll the peer count using net_peerCount:

curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}' http://localhost:http-rpc-port

The result should be the following response, indicating that there are 6 peers:

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x6"
}

Requesting the Most Recent Mined Block Number

This provides the count of blocks already mined.

To do so, call eth_blockNumber to retrieve the number of the most recent block:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' http://localhost:http-rpc-port

The result of this call should be:

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x8b8"
}

Here the hexadecimal value 0x8b8 translates to 2232 in decimal; that many blocks have already been mined.

Checking the Miner Account Balance (Coinbase)

Then call eth_getBalance to retrieve the balance of the mining address defined in the miner node:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xfe3b557e8fb62b89f4916b721be55ceb828dbd73","latest"],"id":1}' http://localhost:http-rpc-port

The result of this call should be something like :

{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x79f905c6fd34e80000"
}

0x79f905c6fd34e80000 = 2250000000000000000000 Wei (2250 Ether) (you can use a unit converter )

Wait a few seconds until new blocks are mined and make this call again. The balance should increase, meaning that the miner address successfully received the mining reward.

Also you can see this information in the block explorer. It does exactly the same thing as we did manually, connecting to the rpc node using http JSON-RPC, but displays information on a web page.

Additional Requests

Now that you are familiar with basic RPC requests you can run JSON-RPC commands to send transactions. In order to send transactions, you will first need to create an account or use one of the 3 accounts created during the genesis of this test network.

Account 1

This is the mining node coinbase account:

  • Address: 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73
  • Private key : 0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63
  • Initial balance : 0xad78ebc5ac6200000 (200000000000000000000 in decimal)

    Account 2

  • Address: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57

  • Private key : 0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
  • Initial balance : 0x90000000000000000000000 (2785365088392105618523029504 in decimal)

    Account 3

  • Address: 0xf17f52151EbEF6C7334FAD080c5704D77216b732

  • Private key : 0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
  • Initial balance : 0x90000000000000000000000 (2785365088392105618523029504 in decimal)

Note: Pantheon does not provide an accounts management system, so if you want to create your own account, you will have to use a third party tool like Metamask.

Creating a Transaction Using MetaMask

After you sign in to MetaMask, connect to the private network RPC endpoint by:

  1. In the MetaMask network list, select Custom RPC.
  2. In the New RPC URL field, enter the JSON-RPC HTTP service endpoint displayed when you started the private network.

Save the configuration and return to the MetaMask main screen. Your current network is now set to the private network RPC node.

Import one of the existing accounts above into metamask using the corresponding private key.

NOTE that here we don't really care about securing the keys as it's just a tutorial, but be sure to secure your accounts when you run into a real usecase. This will be discussed in a more advanced chapter.

Once this is done, try to create another account from scratch to send some ether to.

Of course remember that here we are dealing with valueless ether as we are not on the main network but on a local private network.

In MetaMask, select the new account and copy the account address by clicking the ... button and selecting Copy Address to clipboard.

In the block explorer, search for the new account by clicking on the magnifying glass and pasting the account address into the search box. The account is displayed with a zero balance.

Send some ether from the first account (containing some ether) to the new one (that have a zero balance).

Click refresh on the browser page displaying the new account. The updated balance is displayed and reflects the transaction completed using MetaMask.

Playing with the Truffle Pet Shop Tutorial

This step is inspired by the PetShop tutorial on Truffle website.

Use the following instructions to run it with the quick-start Pantheon Docker network and a wallet to manage keys.

Prerequisites

  • Install Truffle :
npm install -g truffle
mkdir pet-shop-tutorial
cd pet-shop-tutorial
truffle unbox pet-shop
  • Install the Wallet by running the following command:
npm install truffle-privatekey-provider

Modify the Pet Shop Example

We are going to modify the truffle.js file to add our wallet provider. So modify the file to look like the following :

const PrivateKeyProvider = require("truffle-privatekey-provider");
const privateKey = "8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63";
const privateKeyProvider = new PrivateKeyProvider(privateKey, "[YOUR HTTP RPC NODE ENDPOINT]");

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // for more about customizing your Truffle configuration!
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    quickstartWallet: {
      provider: privateKeyProvider,
      network_id: "*"
    },
  }
};

Then replace the [YOUR HTTP RPC NODE ENDPOINT] placeholder with your HTTP RPC node endpoint. http://localhost:32770/jsonrpc in this case.

The private address indicated in the file is the miner address so we know we will have funds in it. You don't need to change it.

Once this is done, you can go through the regular tutorial steps.

When you have to run a truffle command, you only have to indicate the right network to use, as in the following command using the --network quickstartWallet option :

truffle migrate --network quickstartWallet

You're now able to see the transactions and contracts deployed on your local docker network on the block explorer.

Shut Down the Network and Remove the Containers

To shut down the network and delete all containers:

On Linux/Mac, run the following shell command:

quickstart/removePantheonPrivateNetwork.sh

On Windows, run the following docker-compose command:

quickstart\docker-compose down

Note On Windows, the quickstart creates a volume called quickstart_public-keys. Remove this volume using docker volume rm quickstart_public-keys.

Stop and restart the Private Network without Removing the Containers

To shut down the network without deleting the containers:

On Linux/Mac, run the following shell command:

quickstart/stopPantheonPrivateNetwork.sh

On Windows, run the following docker command:

docker-compose stop

(This command will also stop other running containers unrelated to quickstart.)

To restart the private network:

On Linux/Mac, run the following shell command:

quickstart/resumePantheonPrivateNetwork.sh

On Windows, run the following docker command:

docker-compose start

Starting Pantheon

Starting Pantheon

Pantheon nodes can be used for varying purposes as described in the Overview. Nodes can connect to the Ethereum mainnet, public testnets such as Ropsten, or private networks.

Local Block Data

When connecting to a network other than the network previously connected to, you must either delete the local block data or use the --datadir option to specify a different data directory.

To delete the local block data, delete the database directory in the pantheon/build/distribution/pantheon-0.8.0-<version> directory.

Genesis Configuration

Pantheon specifies the genesis configuration, and sets the network ID and bootnodes when connecting to mainnet, Rinkeby, and Ropsten.

When --dev-mode is specified, Pantheon uses the development mode genesis configuration.

The genesis files defining the genesis configurations are in the Pantheon source files.

To define a genesis configuration, create a genesis file (for example, genesis.json) and specify the file using the --genesis option.

Run a Node on Ethereum Mainnet

To run a node on the Ethereum mainnet:

$ bin/pantheon

To run a node on mainnet with the HTTP JSON-RPC service enabled:

$ bin/pantheon --rpc-enabled

Run a Node on Ropsten Testnet

Note From v0.8.2 or when building from source, use the --ropsten option instead of the following options. For v0.8.1, use the following options.

Replace <path> with the path to the /pantheon directory.

To run a node on Ropsten:

$ bin/pantheon --network-id=3 --genesis=<path>/pantheon/ethereum/core/src/main/resources/ropsten.json --bootnodes=enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303,enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303

To run a node on Ropsten with the HTTP JSON-RPC service enabled and allow Remix to access the node:

$ bin/pantheon --rpc-enabled --rpc-cors-origins "http://remix.ethereum.org" --network-id=3 --genesis=<path>/pantheon/ethereum/core/src/main/resources/ropsten.json --bootnodes=enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303,enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303

Run a Node on Rinkeby Testnet

Replace <path> with the path where the Rinkeby chain data is to be saved.

To run a node on Rinkeby specifying a data directory:

$ bin/pantheon --rinkeby --datadir=<path>/rinkebyDataDir

Run a Node for Testing

To run a node that mines blocks at a rate suitable for testing purposes:

$ bin/pantheon --dev-mode --bootnodes= --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-cors-origins "all" --ws-enabled --rpc-enabled

Running Pantheon from Docker Image

Run Pantheon from Docker Image

A Docker image is provided to run a Pantheon node in a Docker container.

Use this Docker image to run a single Pantheon node without installing Pantheon.

Prerequisites

To run Pantheon from the Docker image, you must have Docker installed.

Quickstart

To run a Pantheon node in a container connected to the Ethereum mainnet:

docker run pegasyseng/pantheon:latest

Command Line Options

You cannot use the following Pantheon command line options when running Pantheon from the Docker image:

All other Pantheon command line options work in the same way as when Pantheon is installed locally.

Persisting Data

Specify a Docker volume to persist data between stopping and restarting the container. This is the equivalent of specifying the -datadir option.

If a Docker volume is not specified, all data saved to the data directory is removed each time the container is stopped.

To run Pantheon specifying a volume for the data directory:

docker run --mount type=bind,source=/<pantheonDataDir>,target=/var/lib/pantheon pegasyseng/pantheon:latest

Where <pantheonDataDir> is the volume to which the data is saved.

Custom Configuration File

Specify a custom configuration file to provide a file containing key/value pairs for command line options. This is the equivalent of specifying the --config option.

To run Pantheon specifying a custom configuration file:

docker run --mount type=bind,source=/<path/myconf.toml>,target=/etc/pantheon/pantheon.conf pegasyseng/pantheon:latest

Where myconf.toml is your custom configuration file and path is the absolute path to the file. For example:

docker run --mount type=bind,source=/Users/username/pantheon/myconf.toml,target=/etc/pantheon/pantheon.conf pegasyseng/pantheon:latest

Custom Genesis File

Specify a custom genesis file to configure the blockchain. This is equivalent to specifying the --genesis option.

To run Pantheon specifying a custom genesis file:

docker run --mount type=bind,source=</path/mygenesis.json>,target=/etc/pantheon/genesis.json pegasyseng/pantheon:latest

Where mygenesis.json is your custom configuration file and path is the absolute path to the file. For example:

docker run --mount type=bind,source=/Users/username/pantheon/mygenesis.json,target=/etc/pantheon/genesis.json pegasyseng/pantheon:latest

Exposing Ports

Expose ports for P2P peer discovery, JSON-RPC service, and WebSockets. This is required to use the defaults ports or specify different ports (the equivalent of specifying the --rpc-listen, --p2p-listen, --ws-listen options).

To run Pantheon exposing local ports for access:

docker run -p <localportJSON-RPC>:8545 -p <localportWS>:8546 -p <localportP2P>:30303 pegasyseng/pantheon:latest --rpc-enabled --ws-enabled

For example, to enable RPC calls to http://127.0.0.1:8545 and P2P discovery on http://127.0.0.1:13001:

docker run -p 8545:8545 -p 13001:30303 pegasyseng/pantheon:latest --rpc-enabled

Starting Pantheon

Run a Node on Ethereum Mainnet

To run a node on the Ethereum mainnet:

docker run -p 30303:30303 --mount type=bind,source=/<myvolume/pantheon>,target=/var/lib/pantheon pegasyseng/pantheon:latest

To run a node on mainnet with the HTTP JSON-RPC service enabled:

docker run -p 8545:8545 -p 30303:30303 --mount type=bind,source=/<myvolume/pantheon>,target=/var/lib/pantheon pegasyseng/pantheon:latest --rpc-enabled

Run a Node on Ropsten Testnet

Save a local copy of the Ropsten genesis file.

To run a node on Ropsten:

docker run -p 30303:30303 --mount type=bind,source=/<myvolume/pantheon/ropsten>,target=/var/lib/pantheon --mount type=bind,source=/<path>/ropsten.json,target=/etc/pantheon/genesis.json pegasyseng/pantheon:latest --network-id=3 --bootnodes=enode://6332792c4a00e3e4ee0926ed89e0d27ef985424d97b6a45bf0f23e51f0dcb5e66b875777506458aea7af6f9e4ffb69f43f3778ee73c81ed9d34c51c4b16b0b0f@52.232.243.152:30303,enode://94c15d1b9e2fe7ce56e458b9a3b672ef11894ddedd0c6f247e0f1d3487f52b66208fb4aeb8179fce6e3a749ea93ed147c37976d67af557508d199d9594c35f09@192.81.208.223:30303

Run a Node on Rinkeby Testnet

To run a node on Rinkeby:

docker run -p 30303:30303 --mount type=bind,source=/<myvolume/pantheon/rinkeby>,target=/var/lib/pantheon pegasyseng/pantheon:latest --rinkeby

Run a Node for Testing

To run a node that mines blocks at a rate suitable for testing purposes with WebSockets enabled:

docker run -p 8546:8546 --mount type=bind,source=/<myvolume/pantheon/testnode>,target=/var/lib/pantheon pegasyseng/pantheon:latest --dev-mode --bootnodes= --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-cors-origins "all" --ws-enabled

Stopping Pantheon and Cleaning up Resources

When you're done running nodes, you can shut down the node container without deleting resources. Alternatively, you can delete the container (after stopping it) and its associated volume. Run docker container ls and docker volume ls to obtain the container and volume names. Then run the following commands:

To stop a container:

docker stop <container-name>

To delete a container:

docker rm <container-name>

To delete a container volume (optional):

docker volume rm <volume-name>

Network ID and Chain ID

Network ID and Chain ID

Ethereum networks have a network ID and a chain ID. The network ID is specified using the --network-id option and the chain ID is specified in the genesis file.

For most networks including mainnet and the public testnets, the network ID and the chain ID are the same.

The network ID is defined by Pantheon when connecting to the Ethereum mainnet (1), Rinkeby (4), and Ropsten(3).

When using the --dev-mode or --genesis options, specify the network ID using the --network-id option.

Node Keys

Node Keys

Each node has a node key pair consisting of a node private key and node public key.

Node Private Key

If a key file does not exist in the data directory and the --node-private-key option is not specified when Pantheon is started, a node private key is generated and written to the key file. If Pantheon is stopped and restarted without deleting the key file, the same private key is used when Pantheon is restarted.

If a key file exists in the data directory when Pantheon is started, the node is started with the private key in the key file.

Note The private key is not encrypted.

Node Public Key

The node public key is displayed in the log after starting Pantheon. Use the export-pub-key subcommand to export the public key to a file.

The node public key is also referred to as the node ID. The node ID forms part of the enode URL for a node.

Specifying a Custom Node Private Key File

Use the --node-private-key option to specify a custom key file in any location.

If the key file exists, the node is started with the private key in the custom key file. If the custom key file does not exist, a node private key is generated and written to the custom key file.

For example, the following command either reads the node private key from the privatekeyfile or writes the generated private key to the privatekeyfile:

bin/pantheon --node-private-key "/Users/username/privatekeyfile"

Networking

Networking

Pantheon uses the network to find and connect to peers.

Firewalls and Incoming Connections

The default logging configuration does not list node connection and disconnection messages.

To enable listing of node connection and disconnection messages, specify the command line option --logging=DEBUG. For more verbosity, specify --logging=TRACE.

The console logs connection and disconnection events when the log level is DEBUG or higher. If Successfully accepted connection from ... is displayed, connections are getting through the firewalls. For example:

2018-10-16 12:37:35.479-04:00 | nioEventLoopGroup-3-1 | INFO  | NettyP2PNetwork | Successfully accepted connection from 0xa979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c

If connections are not getting through the firewalls, ensure the peer discovery port is open on your firewall.

Peer Discovery Port

The --p2p-listen option specifies the host and port on which P2P peer discovery listens. The default is 127.0.0.1:30303.

Limiting Peers

Limiting peers reduces the bandwidth used by Pantheon. It also reduces the CPU time and disk access used to manage and respond to peers.

Use the --max-peers command line option to reduce the maximum number of peers. The default is 25.

Use the --max-trailing-peers option to reduce the maximum P2P peer connections for peers that are trailing behind the local chain head. The default is unlimited but the number of trailing peers cannot exceed the value specified by --max-peers.

Trailing peers cannot be used to get new blocks and are more likely to be requesting blocks from you. Limiting trailing peers may reduce the time taken to catch up to the chain head when synchronizing.

No Discovery

The --no-discovery command line option disables P2P peer discovery. Only use this option if you are running a test node or a test network with fixed nodes.

Accounts for Testing

Accounts for Testing

You can use existing accounts for testing by including them in the genesis file for a private network. Alternatively, Pantheon provides predefined accounts in development mode.

Development Mode

When you start Pantheon with the --dev-mode command line option, the dev.json genesis file is used by default.

The dev.json genesis file defines the accounts below that can be used for testing.

Warning Do not use the following accounts on mainnet or any public network except for testing. The private keys are displayed here so the accounts are not secure.

Account 1 (Miner Coinbase Account)
  • Address: 0xfe3b557e8fb62b89f4916b721be55ceb828dbd73
  • Private key : 0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63
  • Initial balance : 0xad78ebc5ac6200000 (200000000000000000000 in decimal)

    Account 2
  • Address: 0x627306090abaB3A6e1400e9345bC60c78a8BEf57

  • Private key : 0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3
  • Initial balance : 0x90000000000000000000000 (2785365088392105618523029504 in decimal)

    Account 3
  • Address: 0xf17f52151EbEF6C7334FAD080c5704D77216b732

  • Private key : 0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f
  • Initial balance : 0x90000000000000000000000 (2785365088392105618523029504 in decimal)

    Genesis File

To use existing test accounts, specify the accounts and balances in a genesis file for your test network. For an example of defining accounts in the genesis file, refer to dev.json.

Use the --genesis command line option to start Pantheon with the genesis file defining the existing accounts.

Logging

Logging

Pantheon uses Log4J2 for logging. There are two methods to configure logging behavior:

  • Basic - changes the log level.
  • Advanced - configures the output and format of the logs.

Note For most use-cases, the basic method provides sufficient configurability.

Basic Log Level Setting

Use the --logging command line option to specify the logging verbosity. The --logging option changes the volume of events displayed in the log.

Advanced Custom Logging

You can provide your own logging configuration using the standard Log4J2 configuration mechanisms. For example, the following Log4J2 configuration is the same as the default configuration except logging of stack traces for exceptions is excluded.

<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="INFO">
  <Properties>
    <Property name="root.log.level">INFO</Property>
  </Properties>

  <Appenders>
    <Console name="Console" target="SYSTEM_OUT">
      <PatternLayout pattern="%d{yyyy-MM-dd HH:mm:ss.SSSZZZ} | %t | %-5level | %c{1} | %msg %throwable{short.message}%n" />    </Console>
  </Appenders>
  <Loggers>
    <Root level="${sys:root.log.level}">
      <AppenderRef ref="Console" />
    </Root>
  </Loggers>
</Configuration>

To use your custom configuration, set the environment variable LOG4J_CONFIGURATION_FILE to the location of your configuration file.

If you have more specific requirements, you can create your own log4j2 configuration.

For Bash-based executions, you can set the variable for only the scope of the program execution by setting it before starting Pantheon. For example, to set the debug logging and start Pantheon connected to the Rinkeby testnet:

LOG4J_CONFIGURATION_FILE=./debug.xml bin/pantheon --rinkeby

Testing and Developing Nodes

Testing and Developing Nodes

Bootnodes

Bootnodes are used to initially discover peers.

Mainnet and Public Testnets

For mainnet and Rinkeby, Pantheon predefines a list of enonde URLs. For Ropsten, bootnodes are specified using the --bootnodes option.

Private Networks

To start a bootnode for a private network:

  1. Export the public key to a file:

    pantheon export-pub-key bootnode

    The node public key is exported to the bootnode file.

  2. Start the bootnode, specifying:

    • An empty string for the --bootnodes option because this is the bootnode.
    • The network ID for your private network.

      pantheon --bootnodes="" --network-id 123 

To specify this bootnode for another node, the enode URL for the --bootnodes option is enode://<id>@<host:port> where:

  • <id> is the node public key written to the specified file (bootnode in the above example) excluding the initial 0x.
  • <host:port> is the host and port the bootnode is listening on for P2P peer discovery. Specified by the --p2p-listen option for the bootnode (default is 127.0.0.1:30303).

For example, if the --p2p-listen option is not specified and the node public key exported is 0xc35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f

Then the enode URL is: enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303

Note The default host and port for P2P peer discovery is 127.0.0.1:30303. The --p2p-listen option can be used to specify a host and port.

To start a node specifying the bootnode for P2P discovery:

pantheon --datadir=/tmp/pantheon/30301 --p2p-listen=127.0.0.1:30301 --network-id=123 --bootnodes=enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb99bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303

Proof of Authority

Proof of Authority

Pantheon implements the Clique Proof-of-Authority (PoA) consensus protocol. Clique is used by the Rinkeby testnet and can be used for private networks.

In PoA networks, transactions and blocks are validated by approved accounts, known as signers. Signers take turns to create the next block. Existing signers propose and vote to add or remove signers.

Initial Signers

Before starting a private network using Clique, create at least one

Specify at least 1 but preferably

  • Must create 1 or more (preferably at least 3) private keys (Pantheon doesn't do account management so probably externally or start nodes with different data directories to get private key)
  • 32 bytes/64 characters of vanity data
  • signers nX40 characters for each one - left pad with zeros
  • followed by 65 bytes/130 - usually this is the signature for the block but because this is the genesis block it's unsigned

Then need to start network with the nodes specified as initial signers - refer to Node Keys topic.

Process as per Slack DM. Trent getting back to me.

Genesis File

To use Clique in a private network, Pantheon requires a PoA genesis file. When connecting to Rinkeby, Pantheon uses the rinkeby.json genesis file in the /pantheon/ethereum/core/src/main/resources directory.

A PoA genesis file defines properties specific to Clique:

{
  "config": {
    ....
    "clique": {
      "period": 15,
      "epoch": 30000
    }
  },
  ...
  "extraData": "0x0000000000000000000000000000000000000000000000000000000000000000dd37f65db31c107f773e82a4f85c693058fef7a90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
  ...
}

The properties specific to Clique are:

  • period - Block time in seconds.
  • epoch - Number of blocks after which to reset all votes.
  • extraData - Specifies initial signers.

To connect to the Rinkeby testnet, start Pantheon with the --rinkeby option. To start a node on a PoA private network, use the --network-id and --genesis options.

Adding and Removing Signers

To propose adding or removing signers using the JSON-RPC methods, you must enable the RPC interface using the --rpc-enabled option. If also using the --rpc-api option, include CLIQUE.

The JSON-RPC methods to add or remove signers are:

To propose adding a signer, call clique_propose specifying the address of the proposed signer and true. For example,

curl -X POST --data '{"jsonrpc":"2.0","method":"clique_propose","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73", true], "id":1}' <JSON-RPC-endpoint:port>

When the next block is created by the signer, a vote is added to the block for the proposed signer.

When more than half of the existing signers propose adding the signer and their votes have been distributed in blocks, the signer is added and can begin signing blocks.

Use clique_getSigners to return a list of the signers and to confirm that your proposed signer has been added.

curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"], "id":1}' <JSON-RPC-endpoint:port>

To discard your proposal after confirming the signer was added, call clique_discard specifying the address of the proposed signer. For example:

 curl -X POST --data '{"jsonrpc":"2.0","method":"clique_discard","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73"], "id":1}' <JSON-RPC-endpoint:port>

The process for removing a signer is the same as adding a signer except you specify false as the second parameter of clique_propose.

Epoch Transition

At each epoch transition, all pending votes collected from received blocks are discarded. Existing proposals remain in effect and signers re-add their vote the next time they create a block.

Define the number of blocks between epoch transitions in the genesis file.

Passing JVM Options

Passing JVM Options to Pantheon

To perform tasks such as attaching a debugger or configuring the garbage collector, pass JVM options to Pantheon.

Pantheon passes the contents of the PANTHEON_OPTS environmental variable to the JVM. Set standard JVM options in the PANTHEON_OPTS variable.

For Bash-based executions, you can set the variable for only the scope of the program execution by setting it before starting Pantheon. For example:

PANTHEON_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 bin/pantheon --rinkeby

Creating and Sending Transactions

Transactions

You can send signed transactions using the eth_sendRawTransaction JSON-RPC API method.

These examples describe how to create a signed raw transaction that can be passed to eth_sendRawTransaction.

To avoid exposing your private keys, create signed transactions offline.

The examples use the following libraries to create signed transactions:

Note: Other libraries (such as webj3 or ethereumj) and tools (such as MyEtherWallet or MyCrypto) can also be used to create signed transactions.

Example JS scripts are provided to create signed raw transaction strings to:

Note: Node.js must be installed to run JS scripts.

The example JS scripts can be used to create raw transactions to send in the private network created by the Private Network Quickstart. The JSON-RPC endpoint in the examples must be updated to the endpoint for the private network displayed after running the quickstart/runPantheonPrivateNetwork.sh script.

To create and display the transaction string, run the JS script. For example:

node create_signed_raw_transaction.js

To send a signed transaction, run:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["raw_transaction_string"],"id":1}' <JSON-RPC-endpoint:port>

Where:

  • raw_transaction_string is the signed raw transaction string displayed by the JS script.
  • <JSON-RPC-endpoint:port> is the JSON-RPC endpoint.

For example:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf86a808203e882520894f17f52151ebef6c7334fad080c5704d77216b732896c6b935b8bbd400000801ca08ce4a6c12f7f273321c5dc03910744f8fb11573fcce8140aa44486d385d22fb3a051f6bcc918bf3f12e06bfccfd1451bea5c517dffee0777ebd50caf177b17f383"],"id":1}' http://localhost:8545

All accounts and private keys in the examples are from the dev.json genesis file in the /pantheon/ethereum/core/src/main/resources directory.

Sending Ether

The following is an example of JavaScript that displays a signed transaction string to send ether.

const web3 = require('web3')
const ethTx = require('ethereumjs-tx')

// web3 initialization - must point to the HTTP JSON-RPC endpoint
const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'))

// Sender address and private key
// Second acccount in dev.json genesis file
// Exclude 0x at the beginning of the private key
const addressFrom = '0x627306090abaB3A6e1400e9345bC60c78a8BEf57'
const privKey = Buffer.from('c87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3', 'hex')

// Receiver address and value to transfer
// Third account in dev.json genesis file
const addressTo = '0xf17f52151EbEF6C7334FAD080c5704D77216b732'
const valueInEther = 2000

// Get the address transaction count in order to specify the correct nonce
txnCount = web3.eth.getTransactionCount(addressFrom, "pending");

// Create the transaction object
var txObject = {
    nonce: web3.toHex(txnCount),
    gasPrice: web3.toHex(1000),
    gasLimit: web3.toHex(21000),
    to: addressTo,
    value: web3.toHex(web3.toWei(valueInEther, 'ether'))
};

// Sign the transaction with the private key
const tx = new ethTx(txObject);
tx.sign(privKey)

//Convert to raw transaction string
const serializedTx = tx.serialize();
const rawTxHex = '0x' + serializedTx.toString('hex');

console.log("Raw transaction string=" + rawTxHex)

Deploying a Contract

The following is an example of JavaScript that displays a signed raw transaction string to deploy a contract.

const web3 = require('web3')
const ethTx = require('ethereumjs-tx')

// web3 initialization - must point to the HTTP JSON-RPC endpoint
const web3 = new Web3(new Web3.providers.HttpProvider('http://127.0.0.1:8545'))

// Deployer address and private key
// First account in the dev.json genesis file
const addressFrom = '0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73'
const privKey = Buffer.from('8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63', 'hex')

// Compiled contract hash - can obtain from Remix by clicking the Details button in the Compile tab. 
// Compiled contract hash is value of data parameter in the WEB3DEPLOY section
const contractData = '0x608060405234801561001057600080fd5b5060dc8061001f6000396000f3006080604052600436106049576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680633fa4f24514604e57806355241077146076575b600080fd5b348015605957600080fd5b50606060a0565b6040518082815260200191505060405180910390f35b348015608157600080fd5b50609e6004803603810190808035906020019092919050505060a6565b005b60005481565b80600081905550505600a165627a7a723058202bdbba2e694dba8fff33d9d0976df580f57bff0a40e25a46c398f8063b4c00360029'

// Get the address transaction count in order to specify the correct nonce
txnCount = web3.eth.getTransactionCount(addressFrom, "pending");

var txObject = {
   nonce: web3.toHex(txnCount),
   gasPrice: web3.toHex(1000),
   gasLimit: web3.toHex(126165),
   data: contractData
};

const tx = new ethTx(txObject);
tx.sign(privKey)

const serializedTx = tx.serialize();
const rawTxHex = '0x' + serializedTx.toString('hex');

console.log("Raw transaction string=" + rawTxHex); 

eth_call or eth_sendRawTransaction

You can interact with contracts using eth_call or eth_sendRawTransaction.

eth_call eth_sendRawTransaction
Read-only Write
Invokes contract function locally Broadcasts to network
Does not change state of blockchain Updates blockchain (for example, transfers ether between accounts)
Does not consume gas Requires gas
Synchronous Asynchronous
Return value of contract function available immediately Returns transaction hash only. Possible transaction may not be included in a block (for example, if the gas price is too low)

Using Wallets for Account Management

Using Wallets for Account Management

Pantheon does not implement private key management. Use third-party tools (for example, MetaMask and web3j) for creating accounts.

In Pantheon, you can use the JSON-RPC methods:

Mining

Mining

Start Pantheon with the following options to enable mining:

bin/pantheon --miner-enabled --miner-coinbase <account>

Where <account> is the account to which mining rewards are to be paid. For example, fe3b557e8fb62b89f4916b721be55ceb828dbd73.

JSON-RPC API methods for mining are:

RPC Pub/Sub

RPC Pub/Sub

Contents

  • Event Publication and Subscription
  • Creating Subscriptions
  • Canceling Subscriptions

Event Publication and Subscription

Pantheon supports event publication and subscription with the RPC Pub/Sub methods. Using these methods, your client can wait for events instead of polling for them. You invoke the RPC Pub/Sub methods over WebSockets. (Note that these methods cannot be called over HTTP.)

  • Your client calls eth_subscribe to create a subscription that waits for particular events.
  • Your client calls eth_unsubscribe to cancel an existing subscription.
  • The server invokes eth_subscription to publish (report) notifications of event occurrences to your client. Your client never calls this method.

Subscriptions

When you subscribe to particular events (using eth_subscribe), the node returns a subscription ID. For each matching event that occurs, the node uses eth_subscription to return a notification with relevant data and the subscription ID.

Subscriptions require a full duplex connection, so you need to invoke the RPC Pub/Sub methods over WebSockets. You can use a tool such as wscat, a Node.js based command-line tool.

Subscriptions are coupled to a connection. If the connection is closed, all subscriptions that have been created over this connection will be removed.

The types of events that you can subscribe to are:

New Headers (newHeads)

This subscription sends a notification each time a new header is appended to the chain. This includes chain reorganizations. You can use the bloom filter to determine if the block contains logs of interest. In case of a chain reorganization the subscription will emit all new headers for the new chain. Therefore the subscription can emit multiple headers on the same height.

You can filter blocks using elements from the Block Object. For example, you can use the logsBloom parameter to filter blocks containing logs of interest to you.

The following is an example of newHeads notifications:

>> {"id": 1, "method": "eth_subscribe", "params": ["newHeads"]}
<< {"jsonrpc":"2.0","id":2,"result":"0x1"}

<< {
  "jsonrpc": "2.0",
  "method": "eth_subscription",
  "params": {
    "result": {
      "difficulty": "0x15d9223a23aa",
      "extraData": "0xd983010305844765746887676f312e342e328777696e646f7773",
      "gasLimit": "0x47e7c4",
      "gasUsed": "0x38658",
      "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      "miner": "0xf8b483dba2c3b7176a3da549ad41a48bb3121069",
      "nonce": "0x084149998194cc5f",
      "number": "0x1348c9",
      "parentHash": "0x7736fab79e05dc611604d22470dadad26f56fe494421b5b333de816ce1f25701",
      "receiptRoot": "0x2fab35823ad00c7bb388595cb46652fe7886e00660a01e867824d3dceb1c8d36",
      "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      "stateRoot": "0xb3346685172db67de536d8765c43c31009d0eb3bd9c501c9be3229203f15f378",
      "timestamp": "0x56ffeff8",
      "transactionsRoot": "0x0167ffa60e3ebc0b080cdb95f7c0087dd6c0e61413140e39d94d3468d7c9689f"
    },
    "subscription": "0x1"
  }
}

Logs (logs)

Returns logs included in new imported blocks and match the given filter criteria. In a chain reorganization, previous sent logs from the old chain are resent with the removed property set to true. Logs from transactions included in the new chain are sent. Therefore a subscription can send logs for the same transaction multiple times.

logs subscriptions can take as a parameter an object with the following fields:

  • address - (optional) Either an address or an array of addresses. Returns only logs created from these addresses.
  • topics - (optional) Returns only logs that match the specified topics.

The following is an example of logs notifications:

>> {"id": 1, "method": "eth_subscribe", "params": ["logs", {"address": "0x8320fe7702b96808f7bbc0d4a888ed1468216cfd", "topics": ["0xd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902"]}]}
<< {"jsonrpc":"2.0","id":2,"result":"0x3"}

<< {"jsonrpc":"2.0","method":"eth_subscription","params": {"subscription":"0x3","result":{"address":"0x8320fe7702b96808f7bbc0d4a888ed1468216cfd","blockHash":"0x61cdb2a09ab99abf791d474f20c2ea89bf8de2923a2d42bb49944c8c993cbf04","blockNumber":"0x29e87","data":"0x00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000003","logIndex":"0x0","topics":["0xd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902"],"transactionHash":"0xe044554a0a55067caafd07f8020ab9f2af60bdfe337e395ecd84b4877a3d1ab4","transactionIndex":"0x0"}}}

Pending Transactions (pendingTransactions)

Returns the hash of transactions in the pending state and signed with a key available in the node. If a transaction that was previously part of the canonical chain isn't in the new canonical chain after a reorganization, it will be sent again.

pendingTransactions takes no parameters.

The returned data is a transaction hash.

The following is an example of pendingTransactions notifications:

>> {"id": 1, "method": "eth_subscribe", "params": ["pendingTransactions"]}
<< {"jsonrpc":"2.0","id":2,"result":"0x2"}

<< {
        "jsonrpc":"2.0",
        "method":"eth_subscription",
        "params":{
            "subscription":"0x2",
            "result":"0xd6fdc5cc41a9959e922f30cb772a9aef46f4daea279307bc5f7024edc4ccd7fa"
        }
    }

Syncing (syncing)

Indicates whether the node is currently synchronizing. The result can either be a boolean indicating that the synchronization has finished (false) or an object with various progress indicators, indicating that synchronization is in progress.

>> {"id": 1, "method": "eth_subscribe", "params": ["syncing"]}
<< {"jsonrpc":"2.0","id":2,"result":"0x4"}

<< {
    "jsonrpc":"2.0",
    "method":"eth_subscription",
    "params":{"subscription":"0x6",
      "result":{"startingBlock":"0x0",
      "currentBlock":"0x3e80",
      "highestBlock":"0x67b93c"}
    }
}

Notifications

Notifications are sent for current events only, not past events.

Notifications are stored in an internal buffer to be sent to the client. If the client falls behind and the number of buffered notifications reaches a limit (currently 10k), the connection will be closed. Keep in mind that subscribing to certain events can cause a flood of notifications; for example, listening for all logs when the node synchronizes.

Creating Subscriptions

eth_subscribe creates a subscription that waits for particular events. If successful, it returns the subscription ID.

Parameters

When you call eth_subscribe, supply the type of event to subscribe to, plus optional arguments.

subscriptionType : string - A type of event to which to subscribe:

  • newHeads
  • logs
  • pendingTransactions
  • syncing

Optional arguments are described above for each of the subscription types.

Returns

subscriptionID : - The ID of the subscription.

Request

>> {"id": 1, "method": "eth_subscribe", "params": ["newHeads", {"includeTransactions": true}]}

Result

<< {"id": 1, "jsonrpc": "2.0", "result": "0x5"}

Canceling Subscriptions

eth_unsubscribe cancels an existing subscription. It returns a boolean indicating whether the subscription was cancelled successfully.

Note: Only the connection that created a subscription is able to unsubscribe from it. If another connection tries to unsubscribe, it will receive a SubscriptionNotFound response with no information about existing subscriptions.

Parameters

subscriptionID : - The ID of the subscription to cancel. You receive this ID from eth_subscribe.

Returns

result : boolean - true if the subscription was cancelled successfully; otherwise false.

Request

>> {"id": 1, "method": "eth_unsubscribe", "params": ["0x1"]}

Result

<< {"jsonrpc":"2.0","id":1,"result":true}

Publishing Subscriptions

eth_subscription is the method the node uses to publish (report) notifications of event occurrences. You do not call this method. The node invokes eth_subscription to return a notification with relevant data and the subscription ID for each matching event that occurs.

Parameters

None

Returns

subscription : string - The subscription ID.

result : object - An object containing relevant block data. For example, for pending transactions the returned data is a transaction hash. For detailed information on this data, see Block Object.

Debugging Pantheon

FAQ

My command line options are not working as I expected?

Ensure quotes have not been automatically converted to smart quotes or hyphens combined if copying and pasting.

Pantheon CLI Reference

Pantheon Command Line Interface Reference

This reference describes the syntax of the Pantheon Command Line Interface (CLI) options and subcommands.

pantheon [OPTIONS] [COMMAND]

Runs the Pantheon Ethereum full node client.

Options

--banned-nodeids=<bannedNodeId&gt[,<bannedNodeId>...]...
List of node IDs to ban from the P2P network. The node ID is the public key of the node. The banned node IDs can be specified with or without the 0x prefix.
>Note This option is only available from v0.8.2 or when building from source.
--bootnodes=<enode://id@host:port>[,<enode://id@host:port>...]...
List of comma-separated enode URLs for P2P discovery bootstrap.
When connecting to mainnet and Rinkeby, the default is a predefined list of enode URLs. Specify bootnodes when connecting to Ropsten or a private network.

--config=<PATH>
The path to the TOML configuration file. The default is none. The TOML file is composed of key/value pairs. Each key is the same as the corresponding CLI option name without the leading dashes (--). The config option is not used in the config file. Values must be treated according to TOML specifications for string, numbers, arrays and Booleans. Example: # Valid TOML config file datadir="~/pantheondata" # Path # Network bootnodes=["enode://001@123:4567", "enode://002@123:4567", "enode://003@123:4567"] p2p-listen="1.2.3.4:1234" # IP:port max-peers=42 rpc-listen="5.6.7.8:5678" # IP:port ws-listen="9.10.11.12:9101" # IP:port # Chain genesis="~/genesis.json" # Path to the custom genesis file sync-mode="fast"# should be FAST or FULL (or fast or full) # Mining miner-enabled=true miner-coinbase="0x0000000000000000000000000000000000000002"

> Note: This option is not used when running Pantheon from the Docker image.
--datadir=<PATH>
The path to the Pantheon data directory. The default location is the /build/distributions/pantheon- directory in the Pantheon installation directory.
> Note: This option is not used when running Pantheon from the Docker image.
--dev-mode
Set this option to true to run in development mode. For example, specify this option to perform CPU mining more easily in a private test network. In development mode, a custom genesis configuration specifies the chain ID. When using this option, also set the --network-id option to the network you use for development. Default is false.
> Note: The --dev-mode option overrides the --genesis option. If both are specified, the development mode configuration is used.

--genesis=<PATH>
The path to the genesis file. The default is the embedded genesis file for the Ethereum mainnet. When using this option, it is recommended to also set the --network-id option.
> Note: This option is not used when running Pantheon from the Docker image. > Note: The --genesis option is overriden by the --dev-mode option. If both are specified, the specified genesis file is ignored and the development mode configuration used.
--max-peers=<INTEGER>
Specifies the maximum P2P peer connections that can be established. The default is 25.

--max-trailing-peers=<INTEGER>
Specifies the maximum P2P peer connections for peers that are trailing behind the local chain head. The default is unlimited but the number of trailing peers cannot exceed the value specified by --max-peers.

--miner-coinbase=<Ethereum account address>
The account to which mining rewards are to be paid. You must specify a coinbase if you enable mining.

--miner-enabled
Set this option to true when the node performs mining. The default is false.

--miner-extraData=<Extra data>
A hex string representing the 32 bytes to be included in the extra data field of a mined block. The default is 0x.

--miner-minTransactionGasPriceWei=<minTransactionGasPrice>
The minimum price that a transaction offers for it to be included in a mined block The default is 1000.

--network-id=<INTEGER>
P2P network identifier. The default is set to mainnet with value 1.

--no-discovery
Disables P2P peer discovery. The default is false.

--node-private-key=<PATH>
<PATH> is the path of the private key file of the node. The default is the key file in the data directory. If no key file exists, a key file containing the generated private key is created; otherwise, the existing key file specifies the node private key.
> Note The private key is not encrypted. >Note This option is only available from v0.8.2 or when building from source.
--ottoman
Synchronize against the Ottoman test network. This is only useful if you are using an IBFT genesis file. The default is false.
> Note: IBFT is not currently supported. Support for IBFT is in active development.
--p2p-listen=<HOST:PORT>
Specifies the host and port on which P2P peer discovery listens. The default is 127.0.0.1:30303.
> Note This option is not used when running Pantheon from the Docker image.
--rinkeby
Uses the Rinkeby test network. Default is false.
--ropsten
Uses the Ropsten test network. Default is false.
> Note This option is only available when building from source. For v0.8.1, refer here.
--rpc-enabled
Set to true to enable the JSON-RPC service (RPC over HTTP). The default is false.

--rpc-listen=<HOST:PORT>
Specifies the host and port on which JSON-RPC listens. The default is 127.0.0.1:8545.
> Note: This option is not used when running Pantheon from the Docker image.
--rpc-api=<api name>[,...]...
Comma-separated APIs to enable on the JSON-RPC channel. When you use this option, the --rpc-enabled option must also be specified. The available API options are: ETH, NET, WEB3, CLIQUE, IBFT, DEBUG, and MINER. The default is: ETH, NET, WEB3, CLIQUE, IBFT.
> Note: IBFT is not currently supported. Support for IBFT is in active development.
--rpc-cors-origins=<rpcCorsAllowedOrigins>
Specifies domain URLs for CORS validation. Domain URLs must be enclosed in double quotes and comma-separated. Listed domains will be allowed access to node data (whitelisted). If your client interacts with Pantheon using a browser app (such as Remix using a direct connection or a block explorer), you must whitelist the client domains. For example, the following allows Remix to interact with your Pantheon node without using MetaMask: --rpc-cors-origins "http://remix.ethereum.org" Note: MetaMask runs as native code so does not require CORS validation. If Remix is connecting to the node through MetaMask, it also does not require CORS validation. The default value is "none". If you don't whitelist any domains, you won't be able to use webapps to interact with your Pantheon node. You can whitelist one or more domains with a comma-separated list. For example: --rpc-cors-origins "http://foo.com, https://bar.io" For development purposes, you can use "all" to accept requests from any domain, but we don't recommend this for production code.

--ws-enabled
Set to true to enable the WS-RPC (WebSockets) service. The default is false.

--ws-api=<api name>[,...]...
Comma-separated APIs to enable on Websockets channel. When you use this option, the --ws-enabled option must also be specified. The available API options are: ETH, NET, WEB3, CLIQUE, IBFT, DEBUG, and MINER. The default is: ETH, NET, WEB3, CLIQUE, IBFT.
> Note: IBFT is not currently supported. Support for IBFT is in active development.
--ws-listen=<HOST:PORT>
Host and port for WS-RPC (Websocket) to listen on. The default is 127.0.0.1:8546.
> Note: This option is not used when running Pantheon from the Docker image.
-h, --help
Show the help message and exit.

-l, --logging=<LEVEL>
Sets the logging verbosity. Log levels are OFF, FATAL, WARN, INFO, DEBUG, TRACE, ALL. Default is INFO.

-V, --version
Print version information and exit.

Commands

Pantheon subcommands are:

  • import

    Imports blocks from the specified file into the blockchain database:

    pantheon import <block-file>

  • export-pub-key

    Exports node public key to the specified file.

    pantheon export-pub-key <key-file>


###


Pantheon is licensed under Apache License 2.0.

JSON-RPC API Reference

Contents

Pantheon JSON-RPC API

The Pantheon JSON-RPC API uses the JSON (RFC 4627) data format, which can represent objects and data fields as collections of name/value pairs, in a relatively readable, hierarchical form. Values have specific data types such as QUANTITIES (decimal integers, hexadecimal numbers, strings) and UNFORMATTED DATA (byte arrays, account addresses, hashes, and bytecode arrays).

RPC is the remote procedure call protocol (RFC 1831), which is stateless and transport agnostic in that the concepts can be used within the same process, over sockets, over HTTP, or in many various message passing environments.

Using the Pantheon JSON-RPC API

Endpoint Address and Port

In this reference, the placeholder <JSON-RPC-http-endpoint:port> and <JSON-RPC-ws-endpoint:port> means an endpoint (IP address and port) of the JSON-RPC service of a Pantheon node respectively for http endpoint and for WebSocket endpoint. To activate JSON-RPC using http or WebSocket, see --rpc-listen and --ws-listen options in the CLI documentation.

The transport attributes are:

  • HTTP: Listens by default on port 8545
  • WebSockets: Listens by default on port 8546

HTTP and WebSocket Requests

HTTP

To make RPC over HTTP requests, you can use the curl tool, available in many systems using curl source code or pre-compiled packages.

curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53}' <JSON-RPC-http-endpoint:port>

WebSockets

To make requests over WebSockets, this reference uses wscat, a Node.js based command-line tool.

First connect to the WebSockets server using wscat (you only need to connect once per session):

wscat -c ws://<JSON-RPC-ws-endpoint:port>

After the connection is established, the terminal will display a '>' prompt. Send individual requests as a JSON data package at each prompt:

{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53}

Block Parameter

When you make requests that might have different results depending on the block accessed, the block parameter specifies the block. Several methods, such as eth_getTransactionByBlockNumberAndIndex, have a block parameter.

The block parameter can have the following values:

  • blockNumber : quantity - Block number. Can be specified in hexadecimal or decimal. 0 represents the genesis block.
  • earliest : tag - Earliest (genesis) block.
  • latest : tag - Last block mined.
  • pending : tag - Last block mined plus pending transactions. Use only with eth_getTransactionCount.

Not Supported by Pantheon

Account Management

Account management relies on private key management in the client which is not implemented by Pantheon.

Use eth_sendRawTransaction to send signed transactions; eth_sendTransaction is not implemented.

Use third-party wallets for account management.

Protocols

Pantheon does not implement the Whisper and Swarm protocols.

JSON-RPC Methods

The following lists the Pantheon JSON-RPC API commands:

web3 Methods

net Methods

eth Methods

debug Methods

miner Methods

clique Methods

ibft Methods

IBFT is not currently supported. Support for IBFT is in active development.


JSON-RPC API Reference


web3_clientVersion

Returns the current client version.

Parameters

None

Returns

result : string - Current client version.

Request Data
{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53}

For an explanation of how to make an HTTP or WebSockets request using this data, see HTTP and WebSocket Requests.

Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "pantheon/1.0.0"
}

web3_sha3

Returns a SHA3 hash of the specified data. The result value is a Keccak-256 hash, not the standardized SHA3-256.

Parameters

DATA - Data to convert to a SHA3 hash.

Returns

result (DATA) - SHA3 result of the input data.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c00"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x5e39a0a66544c0668bde22d61c47a8710000ece931f13b84d3b2feb44ec96d3f"
}

net_version

Returns the current chain ID.

Parameters

None

Returns

result : string - Current chain ID.

  • 1 - Ethereum Mainnet
  • 2 - Morden Testnet (deprecated)
  • 3 - Ropsten Testnet
  • 4 - Rinkeby Testnet
  • 42 - Kovan Testnet
Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result

Mainnet:

{
  "jsonrpc" : "2.0",
  "id" : 51,
  "result" : "1"
}

Ropsten:

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "3"
}

net_listening

Indicates whether the client is actively listening for network connections.

Parameters

None

Returns

result (BOOLEAN) - true if the client is actively listening for network connections; otherwise false.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : true
}

net_peerCount

Returns the number of peers currently connected to the client.

Parameters

None

Returns

result : integer - Number of connected peers in hexadecimal.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x5"
}

eth_syncing

Returns an object with data about the sync status, or FALSE if not syncing.

Parameters

None

Returns

result : Object|Boolean - An object with sync status data or FALSE, when not syncing:

  • startingBlock : QUANTITY - The block at which the import started (will only be reset, after the sync reached his head).
  • currentBlock : QUANTITY - The current block, same as eth_blockNumber.
  • highestBlock: QUANTITY - The estimated highest block.
Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":51}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 51,
  "result" : {
    "startingBlock" : "0x1d4bff",
    "currentBlock" : "0x1d4bff",
    "highestBlock" : "0x0"
  }

eth_chainId

Returns chain ID.

Note This method is only available from v0.8.2 or when building from source.

Parameters

None

Returns

result : quantity - Chain ID in hexadecimal.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":51}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 51,
  "result" : "0x7e2"
}

eth_coinbase

Returns the client coinbase address.

To set a coinbase address, call the pantheon CLI with the --miner-coinbase option set to a valid Ethereum account address. You can get the Ethereum account address from a client such as MetaMask or Etherscan. For example:

bin/pantheon --genesis=/home/donn/pantheon/ethereum/core/src/main/resources/ropsten.json --miner-coinbase="0xDD37f65dB31c107F773E82a4F85C693058fEf7a9" --dev-mode=true --rpc-enabled
Parameters

None

Returns

result (DATA, 20 bytes) - Current coinbase address.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0xdd37f65db31c107f773e82a4f85c693058fef7a9"
}
Errors

If you have not specified a coinbase, you will receive this message:

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "error" : {
    "code" : -32000,
    "message" : "Coinbase must be explicitly specified"
  }
}

eth_mining

Indicates whether the client is actively mining new blocks. Mining is paused while the client synchronizes with the network regardless of command settings or methods called.

Parameters

None

Returns

result (BOOLEAN) - true if the client is actively mining new blocks; otherwise false.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_mining","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : true
}

eth_gasPrice

Returns the current gas unit price in wei.

Parameters

None

Returns

result (QUANTITY) - Integer value representing the current gas unit price in wei.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x3e8"
}

eth_accounts

Returns a list of account addresses that the client owns.

NOTE: This method returns an empty object because Pantheon does not support account management.

Parameters

None

Returns

Array of data : List of 20-byte account addresses owned by the client.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":53}'  <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : [ ]
}

eth_blockNumber

Returns the index of the current block the client is processing.

Parameters

None

Returns

result : QUANTITY - Hexadecimal integer representing the 0-based index of the block that the client is currently processing.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":51}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 51,
  "result" : "0x2377"
}

eth_getBalance

Returns the account balance of the specified address.

Parameters

DATA - 20-byte account address from which to retrieve the balance.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : QUANTITY - Integer value of the current balance in wei.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xdd37f65db31c107f773e82a4f85c693058fef7a9", "latest"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x0"
}

eth_getStorageAt

Returns the value of a storage position at a specified address.

Parameters

DATA - A 20-byte storage address.

QUANTITY - Integer index of the storage position.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : DATA - The value at the specified storage position.

Request

Calculating the correct position depends on the storage you want to retrieve.

curl -X POST --data '{"jsonrpc":"2.0","method": "eth_getStorageAt","params": ["0x‭3B3F3E‬","0x0","latest"],"id": 53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x0000000000000000000000000000000000000000000000000000000000000000"
}

eth_getTransactionCount

Returns the number of transactions sent from a specified address.

Parameters

DATA - 20-byte account address.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : QUANTITY - Integer representing the number of transactions sent from the specified address.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x1"
}

eth_getBlockTransactionCountByHash

Returns the number of transactions in the block matching the given block hash.

Parameters

DATA - 32-byte block hash.

Returns

result : QUANTITY - Integer representing the number of transactions in the specified block.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : null
}

eth_getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the specified block number.

Parameters

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : QUANTITY - Integer representing the number of transactions in the specified block.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0xe8"],"id":51}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 51,
  "result" : "0x8"
}

eth_getUncleCountByBlockHash

Returns the number of uncles in a block from a block matching the given block hash.

Parameters

DATA - 32-byte block hash.

Returns

result : QUANTITY - Integer representing the number of uncles in the specified block.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockHash","params":["0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238"],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : null
}

eth_getUncleCountByBlockNumber

Returns the number of uncles in a block matching the specified block number.

Parameters

QUANTITY|TAG - Integer representing either the 0-based index of the block within the blockchain, or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : QUANTITY - Integer representing the number of uncles in the specified block.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockNumber","params":["0xe8"],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : "0x1"
}

eth_getCode

Returns the code of the smart contract at the specified address. Compiled smart contract code is stored as a hexadecimal value.

Parameters

DATA - 20-byte contract address.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result : DATA - Code stored at the specified address.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa50a51c09a5c451c52bb714527e1974b686d8e77", "latest"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
    "jsonrpc": "2.0",
    "id": 53,
    "result": "0x60806040526004361060485763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f2458114604d57806355241077146071575b600080fd5b348015605857600080fd5b50605f6088565b60408051918252519081900360200190f35b348015607c57600080fd5b506086600435608e565b005b60005481565b60008190556040805182815290517f199cd93e851e4c78c437891155e2112093f8f15394aa89dab09e38d6ca0727879181900360200190a1505600a165627a7a723058209d8929142720a69bde2ab3bfa2da6217674b984899b62753979743c0470a2ea70029"
}

eth_sendRawTransaction

Sends a signed transaction. A transaction can send ether, deploy a contract, or interact with a contract.

You can interact with contracts using eth_sendRawTransaction or eth_call.

To avoid exposing your private key, create signed transactions offline and send the signed transaction data using this method. For information on creating signed transactions and using eth_sendRawTransaction, refer to Using Pantheon.

Note: Pantheon does not implement eth_sendTransaction.

Parameters

DATA - Hash of the signed raw transaction in hexadecimal format; for example:

params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"]
Returns

result : DATA - 32-byte transaction hash, or zero hash if the transaction is not yet available.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "id":1,
  "jsonrpc": "2.0",
  "result": "0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331"
}

eth_call

Invokes a contract function locally and does not change the state of the blockchain.

You can interact with contracts using eth_sendRawTransaction or eth_call.

Parameters

OBJECT - Transaction call object.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result (DATA) - Return value of the executed contract.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"to":"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13","value":"0x1"}, "latest"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
    "jsonrpc": "2.0",
    "id": 53,
    "result": "0x"
}

eth_estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. (Per Etherscan: gas price * gas used.) The transaction is added to the blockchain. The estimate may be significantly more than the amount of gas actually used by the transaction for reasons including EVM mechanics and node performance.

Parameters

NOTE: Parameters are the same as the eth_call parameters, except that all properties are optional. If you do not specify a gas limit, Pantheon uses the gas limit from the pending block as an upper bound. As a result, the returned estimate might not be enough to execute the call or transaction when the amount of gas is higher than the pending block's gas limit.

OBJECT - Transaction call object.

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Returns

result (QUANTITY) - Amount of gas used.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0x687422eea2cb73b5d3e242ba5456b782919afc85","to":"0xdd37f65db31c107f773e82a4f85c693058fef7a9","value":"0x1"}],"id":53}' <JSON-RPC-endpoint:port>
Result

The following result yields a gas amount estimate of 21000 wei (0x5208) for the transaction.

{
  "jsonrpc" : "2.0",
  "id" : 54,
  "result" : "0x5208"
}

eth_getBlockByHash

Returns information about the block by hash.

Parameters

DATA - 32-byte hash of a block.

Boolean - If true, returns the full transaction objects; if false, returns the transaction hashes.

Returns

result : OBJECT - Block object , or null when no block is found.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x16b69965a5949262642cfb5e86368ddbbe57ab9f17d999174a65fd0e66580d8f", false],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : {
    "number" : "0x7",
    "hash" : "0x16b69965a5949262642cfb5e86368ddbbe57ab9f17d999174a65fd0e66580d8f",
    "parentHash" : "0xe9bd4b277983580ef0eabad6011891f8b6aff9381a78bd1c4faca374a48b3e09",
    "nonce" : "0x46acb59e85b5bb6d",
    "sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "transactionsRoot" : "0x7aa0913c235f272eb6ed6ab74ba5a057e0a62c1c1d1dbccfd971221e6b6e83a3",
    "stateRoot" : "0xfaf6520d6e3d24107a4309855593341ab87a1744dbb6eea4e709b92e9c9107ca",
    "receiptsRoot" : "0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2",
    "miner" : "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
    "difficulty" : "0x5",
    "totalDifficulty" : "0x10023",
    "extraData" : "0x",
    "size" : "0x270",
    "gasLimit" : "0x1000000",
    "gasUsed" : "0x5208",
    "timestamp" : "0x5bbbe99f",
    "uncles" : [ ],
    "transactions" : [ "0x2cc6c94c21685b7e0f8ddabf277a5ccf98db157c62619cde8baea696a74ed18e" ]
  }
}

eth_getBlockByNumber

Returns information about a block by block number.

Parameters

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

Boolean - If true, returns the full transaction objects; if false, returns only the hashes of the transactions.

Returns

result : OBJECT - Block object , or null when no block is found.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x64", true],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "number" : "0x64",
    "hash" : "0xdfe2e70d6c116a541101cecbb256d7402d62125f6ddc9b607d49edc989825c64",
    "parentHash" : "0xdb10afd3efa45327eb284c83cc925bd9bd7966aea53067c1eebe0724d124ec1e",
    "nonce" : "0x37129c7f29a9364b",
    "sha3Uncles" : "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
    "logsBloom" : "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
    "transactionsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "stateRoot" : "0x90c25f6d7fddeb31a6cc5668a6bba77adbadec705eb7aa5a51265c2d1e3bb7ac",
    "receiptsRoot" : "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
    "miner" : "0xbb7b8287f3f0a933474a79eae42cbca977791171",
    "difficulty" : "0x42be722b6",
    "totalDifficulty" : "0x19b5afdc486",
    "extraData" : "0x476574682f4c5649562f76312e302e302f6c696e75782f676f312e342e32",
    "size" : "0x21e",
    "gasLimit" : "0x1388",
    "gasUsed" : "0x0",
    "timestamp" : "0x55ba43eb",
    "uncles" : [ ],
    "transactions" : [ ]
  }
}

eth_getTransactionByHash

Returns transaction information for the specified transaction hash.

Parameters

DATA - 32-byte transaction hash.

Returns

Object - Transaction object, or null when no transaction is found.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : {
    "blockHash" : "0x510efccf44a192e6e34bcb439a1947e24b86244280762cbb006858c237093fda",
    "blockNumber" : "0x422",
    "from" : "0xfe3b557e8fb62b89f4916b721be55ceb828dbd73",
    "gas" : "0x5208",
    "gasPrice" : "0x3b9aca00",
    "hash" : "0xa52be92809541220ee0aaaede6047d9a6c5d0cd96a517c854d944ee70a0ebb44",
    "input" : "0x",
    "nonce" : "0x1",
    "to" : "0x627306090abab3a6e1400e9345bc60c78a8bef57",
    "transactionIndex" : "0x0",
    "value" : "0x4e1003b28d9280000",
    "v" : "0xfe7",
    "r" : "0x84caf09aefbd5e539295acc67217563438a4efb224879b6855f56857fa2037d3",
    "s" : "0x5e863be3829812c81439f0ae9d8ecb832b531d651fb234c848d1bf45e62be8b9"
  }
}

eth_getTransactionByBlockHashAndIndex

Returns transaction information for the specified block hash and transaction index position.

Parameters

DATA - 32-byte hash of a block.

QUANTITY - Integer representing the transaction index position.

Returns

Object - Transaction object, or null when no transaction is found.

Request

This request returns the 3rd transaction in the 82990 block on the Ropsten testnet. You can also view this block and transaction on Etherscan.

Note: You must be synchronized to at least the block containing the transaction for the request to return it.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7", "0x2"], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "blockHash" : "0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7",
    "blockNumber" : "0x1442e",
    "from" : "0x70c9217d814985faef62b124420f8dfbddd96433",
    "gas" : "0x3d090",
    "gasPrice" : "0x57148a6be",
    "hash" : "0xfc766a71c406950d4a4955a340a092626c35083c64c7be907060368a5e6811d6",
    "input" : "0x51a34eb8000000000000000000000000000000000000000000000029b9e659e41b780000",
    "nonce" : "0x2cb2",
    "to" : "0xcfdc98ec7f01dab1b67b36373524ce0208dc3953",
    "transactionIndex" : "0x2",
    "value" : "0x0",
    "v" : "0x2a",
    "r" : "0xa2d2b1021e1428740a7c67af3c05fe3160481889b25b921108ac0ac2c3d5d40a",
    "s" : "0x63186d2aaefe188748bfb4b46fb9493cbc2b53cf36169e8501a5bc0ed941b484"
  }
 }

eth_getTransactionByBlockNumberAndIndex

Returns transaction information for the specified block number and transaction index position.

Parameters

QUANTITY|TAG - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Block Parameter.

QUANTITY - The transaction index position.

Returns

Object - Transaction object, or null when no transaction is found.

Request

This request returns the 3rd transaction in the 82990 block on the Ropsten testnet. You can also view this block and transaction on Etherscan.

Note: You must be synchronized to at least the block containing the transaction for the request to return it.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["82990", "0x2"], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : {
    "blockHash" : "0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7",
    "blockNumber" : "0x1442e",
    "from" : "0x70c9217d814985faef62b124420f8dfbddd96433",
    "gas" : "0x3d090",
    "gasPrice" : "0x57148a6be",
    "hash" : "0xfc766a71c406950d4a4955a340a092626c35083c64c7be907060368a5e6811d6",
    "input" : "0x51a34eb8000000000000000000000000000000000000000000000029b9e659e41b780000",
    "nonce" : "0x2cb2",
    "to" : "0xcfdc98ec7f01dab1b67b36373524ce0208dc3953",
    "transactionIndex" : "0x2",
    "value" : "0x0",
    "v" : "0x2a",
    "r" : "0xa2d2b1021e1428740a7c67af3c05fe3160481889b25b921108ac0ac2c3d5d40a",
    "s" : "0x63186d2aaefe188748bfb4b46fb9493cbc2b53cf36169e8501a5bc0ed941b484"
  }
}

eth_getTransactionReceipt

Returns the receipt of a transaction by transaction hash. Receipts for pending transactions are not available.

Parameters

DATA - 32-byte hash of a transaction.

Returns

Object - Transaction receipt object, or null when no receipt is found.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0x504ce587a65bdbdb6414a0c6c16d86a04dd79bfcc4f2950eec9634b30ce5370f"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "blockHash": "0xe7212a92cfb9b06addc80dec2a0dfae9ea94fd344efeb157c41e12994fcad60a",
        "blockNumber": "0x50",
        "contractAddress": null,
        "cumulativeGasUsed": "0x5208",
        "from": "0x627306090abab3a6e1400e9345bc60c78a8bef57",
        "gasUsed": "0x5208",
        "logs": [],
        "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
        "status": "0x1",
        "to": "0xf17f52151ebef6c7334fad080c5704d77216b732",
        "transactionHash": "0xc00e97af59c6f88de163306935f7682af1a34c67245e414537d02e422815efc3",
        "transactionIndex": "0x0"
    }
}

eth_newFilter

Creates a topic filter with the specified options to notify (log) when the state changes. To determine whether the state has changed, call eth_getFilterChanges.

Parameters

Object - Filter options object.

Note: Topics are order-dependent. A transaction with a log containing topics [A, B] would be matched with the following topic filters:

  • [] - Match any topic
  • [A] - Match A in first position (and any topic thereafter)
  • [null, B] - Match any topic in first position AND B in second position (and any topic thereafter)
  • [A, B] - Match A in first position AND B in second position (and any topic thereafter)
  • [[A, B], [A, B]] - Match (A OR B) in first position AND (A OR B) in second position (and any topic thereafter)

For example, params could be specified as follows:

params: [{
  "fromBlock": "earliest",
  "toBlock": "0x4",
  "address": "0xc94770007dda54cF92009BFF0dE90c06F603a09f",
  "topics": ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", null, ["0x000000000000000000000000a94f5374fce5edbc8e2a8697c15331677e6ebf0b", "0x0000000000000000000000000aff3454fce5edbc8cca8697c15331677e6ebccc"]]
}]
Returns

result : QUANTITY - The filter ID.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"topics":[]}],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x3"
}

Invalid params error:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newFilter","params":[{"fromBlock": "earliest","toBlock": "latest","address": "0xDD37f65dB31c107F773E82a4F85C693058fEf7a9","topics": []}],"id":53}' 127.0.0.1:8545

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "error" : {
    "code" : -32602,
    "message" : "Invalid params"
  }
}

eth_newBlockFilter

Creates a filter in the node that notifies when a new block arrives. To determine whether the state has changed, call eth_getFilterChanges.

Parameters

None

Returns

QUANTITY - Hexadecimal integer filter ID. Each time you call this method, it creates a new filter, and the index is incremented by 1.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result

Assuming you have previously called eth_newBlockFilter two times, it will assign a filter ID of 3:

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x3"
}

eth_newPendingTransactionFilter

Creates a filter in the node that notifies when new pending transactions arrive. To check if the state has changed, call eth_getFilterChanges.

Parameters

None

Returns

QUANTITY - Hexadecimal integer filter ID. Each time you call this method, it creates a new filter, and the index is incremented by 1.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newPendingTransactionFilter","params":[],"id":53}' <JSON-RPC-endpoint:port>
Result

Assuming you have previously called eth_newBlockFilter three times, it will assign a filter ID of 4:

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : "0x4"
}

eth_uninstallFilter

Uninstalls a filter with the specified ID. This method should always be called when notification is no longer needed. Note that filters time out when they are not requested with eth_getFilterChanges for a period of time.

This method deletes filters of any type: block filters, pending transaction filters, and state (topic) filters.

Parameters

QUANTITY - Hexadecimal integer filter ID specifying the filter to be deleted.

Returns

Boolean - true if the filter was successfully uninstalled; otherwise false.

Request

The following request deletes the block filter with an ID of 0x4:

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_uninstallFilter","params":["0x4"],"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : true
}

eth_getFilterChanges

Polls the specified filter and returns an array of logs that have occurred since the last poll.

Parameters

QUANTITY - Hexadecimal integer filter ID.

Returns

result : Array of Object - List of logs, or an empty array if nothing has changed since the last poll.

  • For filters created with eth_newBlockFilter, returns 32-byte DATA block hashes; for example ["0x3454645634534..."].

  • For filters created with eth_newPendingTransactionFilter, returns transaction hashes (32-byte DATA); for example ["0x6345343454645..."].

  • For filters created with eth_newFilter, returns log objects.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0xa"]:"id":53}' <JSON-RPC-endpoint:port>
Result

The following response indicates that nothing has changed since the last poll:

{
  "jsonrpc" : "2.0",
  "id" : 53,
  "result" : [ ]
}

eth_getFilterLogs

Returns an array of logs matching the filter with the specified ID.

Parameters

QUANTITY - Integer representing the filter ID.

Returns

Same as eth_getFilterChanges.

Request

The following example requests logs for filter ID 0x16 (22 decimal):

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterLogs","params":["0x3"]"id":53}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : [ {
    "logIndex" : "0x0",
    "removed" : false,
    "blockNumber" : "0x14427",
    "blockHash" : "0x677bf4b962464e6dfd548d6a30b6c703dd78c7cc3602825a7013a6e90a001d2a",
    "transactionHash" : "0x7bf9876a9de3c0add38495e21a17b96c81b3f18e0990a4a3aecdf9f47fea0eed",
    "transactionIndex" : "0x0",
    "address" : "0xe8fe77d1576d0972d453b49bfaa84d716173d133",
    "data" : "0x0000000000000000000000001046c9bdec0e634fbd7cf91afebd93cc854432b10000000000000000000000002101416eeaf73acb66d124f79efde9631662a83a0000000000000000000000006f72045702a34c473da863945221965c61528bd3",
    "topics" : [ "0xc36800ebd6079fdafc3a7100d0d1172815751804a6d1b7eb365b85f6c9c80e61", "0x000000000000000000000000b344324aa2a82a6fda8459e40923e1fd65bfac36" ]
  } ]
}

eth_getLogs

Returns an array of all logs matching a specified filter object.

Parameters

Object - Filter options object

Returns

Same as eth_getFilterChanges.

Request

The request above returns the logs for the 82893 block on the Ropsten testnet. You can also view this block on Etherscan.

Note: You must be synchronised to at least the requested block for the request to return the logs.

curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"blockhash":"0x677bf4b962464e6dfd548d6a30b6c703dd78c7cc3602825a7013a6e90a001d2a"}], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : [ {
    "logIndex" : "0x0",
    "removed" : false,
    "blockNumber" : "0x14427",
    "blockHash" : "0x677bf4b962464e6dfd548d6a30b6c703dd78c7cc3602825a7013a6e90a001d2a",
    "transactionHash" : "0x7bf9876a9de3c0add38495e21a17b96c81b3f18e0990a4a3aecdf9f47fea0eed",
    "transactionIndex" : "0x0",
    "address" : "0xe8fe77d1576d0972d453b49bfaa84d716173d133",
    "data" : "0x0000000000000000000000001046c9bdec0e634fbd7cf91afebd93cc854432b10000000000000000000000002101416eeaf73acb66d124f79efde9631662a83a0000000000000000000000006f72045702a34c473da863945221965c61528bd3",
    "topics" : [ "0xc36800ebd6079fdafc3a7100d0d1172815751804a6d1b7eb365b85f6c9c80e61", "0x000000000000000000000000b344324aa2a82a6fda8459e40923e1fd65bfac36" ]
  } ]
}

eth_getWork

Returns the hash of the current block, the seed hash, and the target boundary condition to be met.

Parameters

None

Returns

result : Array of DATA with the following fields:

  • DATA, 32 Bytes - Hash of the current block header (pow-hash).
  • DATA, 32 Bytes - The seed hash used for the DAG.
  • DATA, 32 Bytes - The target boundary condition to be met; 2^256 / difficulty.
Request
curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getWork","params":[],"id":1}' <JSON-RPC-endpoint:port>
Result
{
  "id":1,
  "jsonrpc":"2.0",
  "result": [
      "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "0x5EED00000000000000000000000000005EED0000000000000000000000000000",
      "0xd1ff1c01710000000000000000000000d1ff1c01710000000000000000000000"
    ]
}

clique_discard

Discards a proposal to add or remove a signer with the specified address.

Parameters

data - 20-byte address of proposed signer.

Returns

result: boolean - true

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_discard","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73"], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : true
}

clique_getSigners

Lists signers for the specified block.

Parameters

quantity|tag - Integer representing a block number or one of the string tags latest, earliest, or pending, as described in Default Block Parameter.

Returns

result: array of data - List of 20-byte addresses of signers.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSigners","params":["latest"], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : [ "0x42eb768f2244c8811c63729a21a3569731535f06", "0x7ffc57839b00206d1ad20c69a1981b489f772031", "0xb279182d99e65703f0076e4812653aab85fca0f0" ]
}

clique_getSignersAtHash

Lists signers for the specified block.

Parameters

data - 32-byte block hash.

Returns

result: array of data - List of 20-byte addresses of signers.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_getSignersAtHash","params":["0x98b2ddb5106b03649d2d337d42154702796438b3c74fd25a5782940e84237a48"], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : [ "0x42eb768f2244c8811c63729a21a3569731535f06", "0x7ffc57839b00206d1ad20c69a1981b489f772031", "0xb279182d99e65703f0076e4812653aab85fca0f0" ]
}

clique_propose

Proposes adding or removing a signer with the specified address.

Parameters

data - 20-byte address.

boolean - true to propose adding signer or false to propose removing signer.

Returns

result: boolean - true

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_propose","params":["0xFE3B557E8Fb62b89F4916B721be55cEb828dBd73", true], "id":1}' <JSON-RPC-endpoint:port>
Result
{
  "jsonrpc" : "2.0",
  "id" : 1,
  "result" : true
}

clique_proposals

Returns current proposals.

Parameters

None

Returns

result:object - Map of account addresses to corresponding boolean values indicating the proposal for each account.

If the boolean value is true, the proposal is to add a signer. If false, the proposal is to remove a signer.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"clique_proposals","params":[], "id":1}' <JSON-RPC-endpoint:port>
Result
{
    "jsonrpc": "2.0",
    "id": 1,
    "result": {
        "0x42eb768f2244c8811c63729a21a3569731535f07": false,
        "0x12eb759f2222d7711c63729a45c3585731521d01": true
    }
}

debug_traceTransaction

Attempts to run the transaction as it was executed on the network. It will replay transactions that might already have been executed before it attempts to execute the transaction that corresponds to the specified hash.

You can use this method with tools such as Remix when you want to execute a transaction step-by-step.

Parameters

transactionHash : data - The transaction hash.

options : string - (Optional) Specifies request options as follows:

  • disableStorage : BOOL - true disables storage capture. The default is false.
  • disableMemory : BOOL - true disables memory capture. The default is false.
  • disableStack : BOOL - true disables stack capture. The default is false.
  • tracer : STRING - A tracer object that enables JavaScript-based transaction tracing. If you specify a tracer object, the previous four arguments are ignored. A tracer object has two methods, step and result:
    • step is a function that takes two arguments, log and db. This function is called for each step of the EVM, or when an error occurs, as the specified transaction is traced.
    • log has the following fields:
      • pc : number - The current program counter.
      • op : object - An OpCode object representing the current opcode.
      • gas : number - The amount of gas remaining.
      • gasPrice : number - The cost in wei of each unit of gas.
      • memory : object - A structure representing the contract's memory space.
      • stack : array[big.Int] - The EVM execution stack.
      • depth : number - The execution depth.
      • account : data - The address of the account executing the current operation.
      • err : If an error occured, this field contains information about the error. If err is non-null, you can ignore all other fields.
  • timeout : STRING - A duration string that overrides the default timeout of 5 seconds for JavaScript-based tracing calls. A duration string is a signed sequence of decimal numbers, each with an optional fraction and a unit suffix, such as "300ms", "-1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
Returns

A tracer object, as described above.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params”:[“0xaaaaaaaaaaaaaaaaaaa”,{“disableStorage":true}],"id”:1}' <JSON-RPC-endpoint:port>
Result
{...}

miner_start

Starts the CPU mining process on the client.

Parameters

None

Returns

result : boolean | integer - true if the mining start request was received successfully; otherwise returns an error. An example of an error condition would be when a coinbase has not been specified.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":1}' <JSON-RPC-endpoint:port>
Result
{...}

miner_stop

Stops the CPU mining process on the client.

Parameters

None

Returns

result : boolean | integer - true if the mining stop request was received successfully; otherwise returns an error. An example of an error condition would be when a coinbase has not been specified.

Request
curl -X POST --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}' <JSON-RPC-endpoint:port>
Result
{...}

Objects

The following objects are parameters for or returned by JSON-RPC Methods:

Block Object

Returned by eth_getBlockByHash and eth_getBlockByNumber.

Key Type Value
number Quantity, Integer Block number. null when block is pending.
hash Data, 32 bytes Hash of the block. null when block is pending.
parentHash Data, 32 bytes Hash of the parent block.
nonce Data, 8 bytes Hash of the generated proof of work. null when block is pending.
sha3Uncles Data, 32 bytes SHA3 of the uncle's data in the block.
logsBloom Data, 256 bytes Bloom filter for the block logs. null when block is pending.
transactionsRoot Data, 32 bytes Root of the transaction trie for the block.
stateRoot Data, 32 bytes Root of the final state trie for the block.
receiptsRoot Data, 32 bytes Root of the receipts trie for the block.
miner Data, 20 bytes Address to which mining rewards were paid.
difficulty Quantity, Integer Difficulty for this block.
totalDifficulty Quantity, Integer Total difficulty of the chain until this block.
extraData Data Extra data field of this block.
size Quantity, Integer Size of block in bytes.
gasLimit Quantity Maximum gas allowed in this block.
gasUsed Quantity Total gas used by all transactions in this block.
timestamp Quantity Unix timestamp when block was collated.
transactions Array Array of transaction objects, or 32 byte transaction hashes depending on the specified boolean parameter.
uncles Array Array of uncle hashes.

Filter Options Object

Parameter for eth_newFilter and eth_getLogs.

Key Type Required/Optional Value
fromBlock Quantity |Tag Optional Integer block number or latest, pending, earliest. See Block Parameter. Default is latest.
toBlock Quantity |Tag Optional Integer block number or latest, pending, earliest. See Block Parameter. Default is latest.
address Data | Array Optional Contract address or array of addresses from which logs originate.
topics Array of Data, 32 bytes each Optional Array of 32-byte topics. Topics are order-dependent. Each topic can also be an array of DATA with "or" options.

eth_getLogs has an additional key.

Key Type Required/Optional Value
blockhash Data, 32 bytes Optional Hash of block for which to return logs. If blockhash is specified, fromBlock and toBlock cannot be specified.

Log Object

Returned by eth_getFilterChanges and transaction receipt objects can contain an array of log objects.

Key Type Value
removed Tag true when log removed due to chain reorganization. false if valid log.
logIndex Quantity, Integer Log index position in the block. null when log is pending.
transactionIndex Quantity, Integer Index position of transaction from which log was created. null when log is pending.
transactionHash Data, 32 bytes Hash of transaction from which log was created. null when log is pending.
blockHash Data, 32 bytes Hash of block in which log included. null when log is pending.
blockNumber Quantity Number of block in which log included. null when log is pending.
address Data, 20 bytes Address from which log originated.
data Data Non-indexed arguments of log.
topics Array of Data, 32 bytes each 0 to 4 indexed log arguments. In Solidity, the first topic is the hash of the signature of the event (for example, Deposit(address, bytes32, unit256)) except you declare the event with an anonymous specifier.)

Transaction Object

Returned by eth_getTransactionByHash, eth_getTransactionByBlockHashAndIndex, and eth_getTransactionsByBlockNumberAndIndex.

Key Type Value
blockHash Data, 32 bytes Hash of block containing this transaction. null when transaction is pending.
blockNumber Quantity Block number of block containing this transaction. null when transaction is pending.
from Data, 20 bytes Address of the sender.
gas Quantity Gas provided by the sender.
gasPrice Quantity Gas price provided by the sender in Wei.
hash Data, 32 bytes Hash of the transaction.
input Data Data sent with the transaction.
nonce Quantity Number of transactions made by the sender before this one.
to Data, 20 bytes Address of the receiver. null if a contract creation transaction.
transactionIndex Quantity, Integer Index position of transaction in the block. null when transaction is pending.
value Quantity Value transferred in Wei.
v Quantity ECDSA Recovery ID
r Data, 32 bytes ECDSA signature r
s Data, 32 bytes ECDSA signature s

Transaction Call Object

Parameter for eth_call and eth_estimateGas.

Note: All parameters are optional for eth_estimateGas

Key Type Required/Optional Value
from Data, 20 bytes Optional Address from which transaction sent.
to Data, 20 bytes Required Address to which transaction is directed.
gas Quantity, Integer Optional Gas provided for the transaction execution. eth_call consumes zero gas, but this parameter may be needed by some executions.
gasPrice Quantity, Integer Optional gasPrice used for each paid gas.
value Quantity, Integer Optional Value sent with this transaction.
data Data Optional Hash of the method signature and encoded parameters. For details see Ethereum Contract ABI.

Transaction Receipt Object

Returned by eth_getTransactionReceipt.

Key Type Value
blockHash Data, 32 bytes Hash of block containing this transaction.
blockNumber Quantity Block number of block containing this transaction.
contractAddress Data, 20 bytes Contract address created, if contract creation transaction; otherwise, null.
cumulativeGasUsed Quantity Total amount of gas used by previous transactions in the block and this transaction.
from Data, 20 bytes Address of the sender.
gasUsed Quantity Amount of gas used by this specific transaction.
logs Array Array of log objects generated by this transaction.
logsBloom Data, 256 bytes Bloom filter for light clients to quickly retrieve related logs.
status Quantity Either 1 (success) or 0 (failure)
to Data, 20 bytes Address of the receiver, if sending ether; otherwise, null.
transactionHash Data, 32 bytes Hash of the transaction.
transactionIndex Quantity, Integer Index position of transaction in the block.

Note: For pre-Byzantium transactions, the transaction receipt object includes the following instead of status:

Key Type Value
root Data, 32 bytes Post-transaction stateroot