<p>Pantheon is an open-source Ethereum client 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 and Proof of Authority (Clique) consensus mechanisms. </p>
<p>You can use Pantheon to develop enterprise applications requiring secure, high-performance transaction processing in a private network. </p>
<p>Our roadmap includes Pantheon with privacy features, alternative consensus mechanisms, and other enterprise features.</p>
<h3id="what-can-you-do-with-pantheon-">What can you do with Pantheon?</h3>
<p>Pantheon includes a <ahref="#Pantheon-CLI-Syntax">command line interface</a> and <ahref="#JSON-RPC-API">JSON-RPC API</a> 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:</p>
<p>The Pantheon client supports common smart contract and Dapp development, deployment, and operational use cases, using tools such as <ahref="http://truffleframework.com/">Truffle</a>, <ahref="https://github.com/ethereum/remix">Remix</a>, and <ahref="https://web3j.io/">web3j</a>. The client supports common JSON-RPC API methods such as eth, net, web3, debug, and miner.</p>
<p><strong>Note</strong> If you have installed Pantheon from the <ahref="https://pegasys.tech/">packaged binaries</a> or are running the <ahref="https://hub.docker.com/u/pegasyseng/">Docker image</a>, this section is not relevant. </p>
<p>Continue with <ahref="#Quickstart">Basic Quickstart</a> or <ahref="#Starting-Pantheon">Starting Pantheon</a>.</p>
<li><ahref="#installation-on-linux--unix--mac-os-x">Installation on Linux / Unix / Mac OS X</a></li>
<li><ahref="#installation-on-windows">Installation on Windows</a></li>
</ul>
<h3id="running-virtually">Running Virtually</h3>
<ul>
<li><ahref="#installation-on-vm">Installation on VM</a></li>
</ul>
<h2id="installation-on-linux-unix-mac-os-x">Installation on Linux / Unix / Mac OS X</h2>
<h4id="prerequisites">Prerequisites</h4>
<ul>
<li><p>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 and the sync mode you use. A small test network might require 200 MB while a mainnet node might require 1.5TB. If you use fast sync mode, allow 500 GB for the fast blockchain import snapshot. If you use full sync mode, allow 1.5 TB to 2 TB for the full blockchain archive.</p>
<p><strong>IMPORTANT:</strong> Pantheon requires Java 8+ to compile; earlier versions are not supported.</p>
</blockquote>
</li>
<li><p><ahref="https://git-scm.com/downloads">Git</a> or <ahref="https://desktop.github.com/">GitHub Desktop</a></p>
</li>
</ul>
<h4id="clone-the-pantheon-repository">Clone the Pantheon Repository</h4>
<blockquote>
<p>Note: We recommend that you create and copy a personal access token (PAT) for your GitHub account (with all <code>repo</code> scopes enabled) in order to clone the Pantheon repo.</p>
</blockquote>
<p>Clone the <strong>PegaSysEng/pantheon</strong> repo to your home directory (<code>/home/<user></code>). When Git prompts you for your username and password, enter the PAT as the password. For example:</p>
<p>After the cloning process completes, go to the <code>pantheon</code> repo directory and run <code>git branch</code> to make sure you're in the branch in which you cloned the Pantheon source code (by default this is the <code>master</code> branch).</p>
<p>Build the pantheon executable using <code>gradlew</code>. You can use the <code>-x test</code> option to exclude tests, which can take a long time to run and are not necessary for initial build:</p>
<preclass="hljs">./gradlew <spanclass="hljs-keyword">build </span>-x test</pre><p>Continue with <ahref="#Quickstart">Basic Quickstart</a>, <ahref="#Docker-Quickstart">Docker Quickstart</a>, or <ahref="#Starting-Pantheon">Starting Pantheon</a>.</p>
<h2id="installation-on-windows">Installation on Windows</h2>
<p><strong>IMPORTANT:</strong> Pantheon requires Java 8+ to compile; earlier versions are not supported.</p>
</blockquote>
</li>
<li><p><ahref="https://git-scm.com/downloads">Git</a> or <ahref="https://desktop.github.com/">GitHub Desktop</a></p>
</li>
</ul>
<h4id="install-pantheon">Install Pantheon</h4>
<p>Log in to your <ahref="https://github.com">GitHub</a> account and open <strong>Settings > Developer Settings > Personal Access Token</strong>. Create and copy a personal access token (PAT) for your GitHub account in order to clone the Pantheon repo. In <strong>Scopes</strong>, select <strong>repo</strong>, and click <strong>Generate</strong>. When GitHub lists the generated token, click the clipboard icon to copy its value. Save this value, as you can only view it once.</p>
<p>In Git bash, go to your working directory for repositories. Clone the <strong>PegaSysEng/pantheon</strong> repo into this directory. This will create a <code>pantheon</code> directory under Git revision control, and will contain the cloned PegaSysEng/pantheon repo contents.</p>
<p>When you invoke <code>git clone</code>, Git will prompt you for your username and password. Enter the PAT instead of your password. The command and response should look like the following:</p>
<p>After the cloning process completes, navigate to the <code>pantheon</code> directory, which should contain the Gradle wrapper <code>gradlew</code>:</p>
<preclass="hljs"><spanclass="hljs-built_in">cd</span><repos-<spanclass="hljs-built_in">dir</span>>\pantheon</pre><p>Build the Pantheon JAR on Windows with <code>gradlew</code>:</p>
<preclass="hljs"><spanclass="hljs-attribute">gradlew build</span></pre><p>Or build using <code>assembleDist</code>:</p>
<p>NOTE: To run <code>gradlew</code>, you must have the <strong>JAVA_HOME</strong> system variable set to the Java installation location.
For example: <code>JAVA_HOME = C:\Program Files (x86)\Java\jdk1.8.0_181</code>.</p>
</blockquote>
<p>Pantheon should begin to build and the output will be displayed in the console.</p>
<h2id="installation-on-vm">Installation on VM</h2>
<p>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 <ahref="https://www.virtualbox.org/">VirtualBox</a>.</p>
<p>If you set up your own VM locally using a VM manager such as <ahref="https://www.virtualbox.org/">VirtualBox</a>, there are a few considerations:</p>
<ul>
<li><p>Make sure that Intel Virtualization Technology (VTx) and Virtualization Technology for Directed I/O (VT-d) are enabled in BIOS settings.</p>
</li>
<li><p>On Windows, you might need to disable Hyper-V in the Windows Feature list.</p>
</li>
</ul>
<p>It is recommended that you create a VM with the following attributes:</p>
<ul>
<li><p>Memory Size: Set to 4096 (recommended)</p>
</li>
<li><p>Create a virtual hard disk with at least 10 GB; 20 GB is recommended</p>
</li>
<li><p>Virtual hard disk file type: VDI (if you need to share it with other apps, use VHD)</p>
</li>
<li><p>(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 <ahref="https://linus.nci.nih.gov/bdge/installUbuntu.html">Install Ubuntu on Oracle VirtualBox</a>.</p>
<p><strong>[<em>This is preliminary content for the Pantheon Alpha release.</em>]</strong></p>
<p>This tutorial shows you how to install Pantheon and invoke the Pantheon CLI to run a single node in default mode:</p>
<ul>
<li>The node runs on the Ethereum mainnet and uses the default embedded mainnet genesis file.</li>
<li>The node does not perform mining.</li>
<li>P2P peer discovery is enabled on the default P2P port. There are a maximium of 25 P2P peer connections.</li>
<li>Listen on the default RPC over HTTP host/port.</li>
<li>Use full synchronization mode.</li>
</ul>
<p>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 <code>curl</code> to make a call using Pantheon JSON-RPC API; this will make a request to verify that the node is running.</p>
<h2id="installation">Installation</h2>
<p>Install Java, Git, and Pantheon for your platform as described in <ahref="#Installation">Installation</a>, then proceed through the following steps.</p>
<h2id="run-pantheon">Run Pantheon</h2>
<p>In this tutorial, you'll build and run Pantheon in one terminal (bash) window and run <code>curl</code> commands to make JSON-RPC requests in another terminal window. To do this, either open two separate instances of <code>Terminal</code>, or run a utility such as <ahref="https://github.com/tmux/tmux/wiki">tmux</a> to run a split screen terminal.</p>
<p>In the first terminal, go to the <code>~/pantheon</code> folder:</p>
<preclass="hljs"><spanclass="hljs-built_in">cd</span> pantheon</pre><p>Build Pantheon as described in <ahref="#Installation">Installation</a>.</p>
<p>To run <code>pantheon</code>, go to the distribution folder:</p>
<preclass="hljs"><spanclass="hljs-built_in">cd</span> build/distributions/</pre><p>Expand the distribution archive:</p>
<preclass="hljs">tar -xzf pantheon-0.8.0-SNAPSHOT.tar.gz</pre><p>Move to the expanded folder and run <code>pantheon</code> using the script to display command help:</p>
bin/pantheon --<spanclass="hljs-built_in">help</span></pre><p>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:</p>
<preclass="hljs">bin/pantheon import ~/pantheon/testutil/src/main/resources/1000.blocks</pre><p>When the import completes successfully, you should see messages containing the following:</p>
<preclass="hljs">ImportSubCommand | Runs import sub <spanclass="hljs-built_in">command</span> with blocksImportPath
KeyPairUtil | Generated new key <key> and stored it to ~/pantheon/build/distributions/pantheon-0.8.0-SNAPSHOT/key</pre><p>For more information on using the <code>pantheon import</code> subcommand, see <ahref="#Pantheon-CLI-Syntax">Pantheon CLI Syntax</a>.</p>
<p>After the import successfully completes, run Pantheon with only the <code>--rpc-enabled</code> option:</p>
<preclass="hljs">bin/pantheon <spanclass="hljs-comment">--rpc-enabled</span></pre><p>This runs Pantheon in default mode, meaning it runs in mainnet with the default genesis file, and peer discovery is enabled.</p>
<p>The <code>--rpc-enabled</code> option starts the JSON-RPC service. </p>
<p>The terminal output will indicate that the node is synchronizing.</p>
<h2id="test-the-pantheon-node">Test the Pantheon Node</h2>
<h4id="make-json-rpc-requests-using-curl">Make JSON-RPC Requests using curl</h4>
<p>While the node is running, make a request on it using curl and the JSON-RPC API.</p>
<p>Switch to the bottom window using <code>Ctrl+b o</code> and run the following <code>curl</code> command:</p>
<preclass="hljs">curl -X POST --data '{<spanclass="hljs-string">"jsonrpc"</span>:<spanclass="hljs-string">"2.0"</span>,<spanclass="hljs-string">"method"</span>:<spanclass="hljs-string">"eth_syncing"</span>,<spanclass="hljs-string">"params"</span>:<spanclass="hljs-string">[]</span>,<spanclass="hljs-string">"id"</span>:<spanclass="hljs-number">1</span>}' <spanclass="hljs-number">127.0.0.1:8545</span></pre><p>Note the endpoint IP and default port. You should see a result similar to the following:</p>
}</pre><p>You can now call other JSON-RPC commands listed in <ahref="#JSON-RPC-API">Pantheon JSON RPC API</a>.</p>
<h2id="close-the-terminal-session">Close the Terminal Session</h2>
<p>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 <code>Ctrl+c</code>.</p>
<p>Pantheon nodes can be used for varying purposes as described in the <ahref="#Overview">Overview</a>. Nodes can connect to the Ethereum mainnet, public testnets such as Ropsten, or private networks.</p>
<h2id="local-block-data">Local Block Data</h2>
<p>When connecting to a network other than the network previously connected to, you must either delete the local block data or use the <code>--datadir</code> option to specify a different data directory. </p>
<p>To delete the local block data, delete the <code>database</code> directory in the <code>pantheon/build/distribution/pantheon-0.8.0-SNAPSHOT</code> directory.</p>
<p>All other <ahref="https://github.com/PegaSysEng/pantheon/wiki/Pantheon-CLI-Syntax">Pantheon command line options</a> work in the same way as when Pantheon is installed locally.</p>
<h3id="persisting-data">Persisting Data</h3>
<p>Specify a Docker volume to persist data between stopping and restarting the container. This is the equivalent of specifying the <code>-datadir</code> option. </p>
<p>If a Docker volume is not specified, all data saved to the data directory is removed each time the container is stopped. </p>
<p>To run Pantheon specifying a volume for the data directory: </p>
<preclass="hljs">docker run -v /<myvolume/pantheon>:/var/lib/pantheon pegasyseng/pantheon:latest</pre><p>Where <code><myvolume/pantheon></code> is the directory to which the data is saved. </p>
<p>Specify a custom configuration file to provide a file containing key/value pairs for command line options. This is the equivalent of specifying the <code>--config</code> option. </p>
<p>To run Pantheon specifying a custom configuration file: </p>
<preclass="hljs">docker run -v </path/myconf.toml>:/etc/pantheon/pantheon.conf pegasyseng/pantheon:latest</pre><p>Where <code>myconf.toml</code> is your custom configuration file and <code>path</code> is the absolute path to the file. For example:</p>
<preclass="hljs">docker run -v /Users/madelinemurray/pegasys-jenkins/docker/pantheon/myconf.toml:/etc/pantheon/pantheon.conf pegasyseng/pantheon:latest</pre><h3id="custom-genesis-file">Custom Genesis File</h3>
<p>Specify a custom genesis file to configure the blockchain. This is equivalent to specifying the <code>--genesis</code> option.</p>
<p>To run Pantheon specifying a custom genesis file: </p>
<preclass="hljs">docker run -v </path/mygenesis.json>:/etc/pantheon/genesis.json pegasyseng/pantheon:latest</pre><p>Where <code>mygenesis.json</code> is your custom configuration file and <code>path</code> is the absolute path to the file. For example:</p>
<preclass="hljs">docker run -v /Users/madelinemurray/pegasys-jenkins/docker/pantheon/mygenesis.json:/etc/pantheon/genesis.json pegasyseng/pantheon:latest</pre><h3id="exposing-ports">Exposing Ports</h3>
<p>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 <code>--rpc-listen</code>, <code>--p2plisten</code>, <code>--ws-listen</code> options).</p>
<p>To run Pantheon exposing local ports for access: </p>
<preclass="hljs">docker run -p <localportJSON-RPC>:8545 -p <localportWS>:8546 -p <localportP2P>:30303 pegasyseng/pantheon:latest --rpc-enabled --ws-enabled</pre><p>For example, to enable RPC calls to <ahref="http://127.0.0.1:8545">http://127.0.0.1:8545</a> and P2P discovery on <ahref="http://127.0.0.1:13001">http://127.0.0.1:13001</a>:</p>
<preclass="hljs">docker run -p 8545:8545 -p 13001:30303 pegasyseng/pantheon:latest --rpc-enabled</pre><h2id="starting-pantheon">Starting Pantheon</h2>
<h3id="run-a-node-on-ethereum-mainnet">Run a Node on Ethereum Mainnet</h3>
<p>To run a node on the Ethereum mainnet: </p>
<preclass="hljs">docker run -v /<myvolume/pantheon>:/var/lib/pantheon pegasyseng/pantheon:latest</pre><p>To run a node on mainnet with the HTTP JSON-RPC service enabled: </p>
<preclass="hljs">docker run -p 8545:8545 -v /<myvolume/pantheon>:/var/lib/pantheon pegasyseng/pantheon:latest --rpc-enabled</pre><h2id="run-a-node-on-ropsten-testnet">Run a Node on Ropsten Testnet</h2>
<p>Save a local copy of the <ahref="https://github.com/PegaSysEng/pantheon/blob/master/ethereum/core/src/main/resources/ropsten.json">Ropsten genesis file</a>. </p>
<p>To run a node on Ropsten: </p>
<preclass="hljs">docker run -v /<myvolume/pantheon/ropsten>:/var/lib/pantheon -v ropsten.json:/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</pre><h2id="run-a-node-on-rinkeby-testnet">Run a Node on Rinkeby Testnet</h2>
<p>To run a node on Rinkeby: </p>
<preclass="hljs">docker run -v /<myvolume/pantheon/rinkeby>:/var/lib/pantheon pegasyseng/pantheon:latest --rinkeby</pre><h2id="run-a-node-for-testing">Run a Node for Testing</h2>
<p>To run a node that mines blocks at a rate suitable for testing purposes with WebSockets enabled: </p>
<preclass="hljs">docker run -p 8546:8546 -v /<myvolume/pantheon/testnode>:/var/lib/pantheon pegasyseng/pantheon:latest --dev-mode --bootnodes= --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-cors-origins "all" --ws-enabled</pre><pclass="page"id="Transactions"></p><h1>Creating and Sending Transactions</h1>
<p>You can send signed transactions using the <ahref="https://github.com/PegaSysEng/pantheon/wiki/JSON-RPC-API#eth_sendrawtransaction"><code>eth_sendRawTransaction</code></a> JSON-RPC API method.</p>
<p>These examples describe how to create a signed raw transaction that can be passed to <ahref="https://github.com/PegaSysEng/pantheon/wiki/JSON-RPC-API#eth_sendrawtransaction"><code>eth_sendRawTransaction</code></a>.</p>
<p><strong>Note:</strong> Other libraries (such as <ahref="https://github.com/web3j/web3j">webj3</a> or <ahref="https://github.com/ethereum/ethereumj">ethereumj</a>) and tools (such as <ahref="https://kb.myetherwallet.com/offline/making-offline-transaction-on-myetherwallet.html">MyEtherWallet</a> or <ahref="https://mycrypto.com/">MyCrypto</a>) can also be used to create signed transactions. </p>
</blockquote>
<p>Example JS scripts are provided to create signed raw transaction strings to: </p>
<p><strong>Note:</strong><ahref="https://nodejs.org/en/download/">Node.js</a> must be installed to run JS scripts. </p>
</blockquote>
<p>The example JS scripts can be used to create raw transactions to send in the private network created by the <ahref="#docker-quickstart">Docker Quickstart</a>. The <code>JSON-RPC endpoint</code> in the examples must be updated to the endpoint for the private network displayed after running the <code>quickstart/runPantheonPrivateNetwork.sh</code> script. </p>
<p>To create and display the transaction string, run the JS script. For example:</p>
<preclass="hljs">curl -X POST --data <spanclass="hljs-string">'{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["raw_transaction_string"],"id":1}'</span><JSON-RPC-endpoint:port></pre><p>Where:</p>
<preclass="hljs">curl -X POST --data <spanclass="hljs-string">'{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xf86a808203e882520894f17f52151ebef6c7334fad080c5704d77216b732896c6b935b8bbd400000801ca08ce4a6c12f7f273321c5dc03910744f8fb11573fcce8140aa44486d385d22fb3a051f6bcc918bf3f12e06bfccfd1451bea5c517dffee0777ebd50caf177b17f383"],"id":1}'</span> http://localhost:8545</pre><p>All accounts and private keys in the examples are from the <code>dev.json</code> genesis file in the <code>/pantheon/ethereum/core/src/main/resources</code> directory.</p>
// Compiled contract <spanclass="hljs-built_in">hash</span> - can obtain from Remix by clicking the Details button <spanclass="hljs-keyword">in</span> the Compile tab.
// Compiled contract <spanclass="hljs-built_in">hash</span> is value of data parameter <spanclass="hljs-keyword">in</span> the WEB3DEPLOY section
console.log(<spanclass="hljs-string">"Raw transaction string="</span> + rawTxHex); </pre><h2id="eth_call-or-eth_sendrawtransaction">eth_call or eth_sendRawTransaction</h2>
<p>You can interact with contracts using <ahref="#JSON-RPC-APIeth_call">eth_call</a> or <ahref="#JSON-RPC-APIeth_sendrawtransaction">eth_sendRawTransaction</a>. </p>
<table>
<thead>
<tr>
<th>eth_call</th>
<th>eth_sendRawTransaction</th>
</tr>
</thead>
<tbody>
<tr>
<td>Read-only</td>
<td>Write</td>
</tr>
<tr>
<td>Invokes contract function locally</td>
<td>Broadcasts to network</td>
</tr>
<tr>
<td>Does not change state of blockchain</td>
<td>Updates blockchain (for example, transfers ether between accounts)</td>
</tr>
<tr>
<td>Does not consume gas</td>
<td>Requires gas</td>
</tr>
<tr>
<td>Synchronous</td>
<td>Asynchronous</td>
</tr>
<tr>
<td>Return value of contract function available immediately</td>
<td>Returns transaction hash only. Possible transaction may not be included in a block (for example, if the gas price is too low)</td>
<pclass="page"id="Account-Management"></p><h1>Using Wallets for Account Management</h1>
<h2id="using-wallets-for-account-management">Using Wallets for Account Management</h2>
<p>Pantheon does not implement private key management. Use third-party tools (for example, <ahref="https://consensys.zendesk.com/hc/en-us/articles/360004685212-Generating-MetaMask-Wallet-New-UI-">MetaMask</a> and <ahref="https://web3j.io/">web3j</a>) for creating accounts. </p>
<p>In Pantheon, you can use the JSON-RPC methods:</p>
<ul>
<li><ahref="#JSON-RPC-API.mdeth_getbalance">eth_getBalance</a> to obtain the account balance</li>
<li><ahref="#JSON-RPC-API.mdeth_sendrawtransaction">eth_sendRawTransaction</a> to transfer ether or create and interact with contracts (for more information, refer to <ahref="#transactions">Transactions</a>). </li>
<p>Bootnodes are used to initially discover peers. </p>
<h3id="mainnet-and-public-testnets">Mainnet and Public Testnets</h3>
<p>For mainnet and Rinkeby, Pantheon predefines a list of enonde URLs. For Ropsten, bootnodes are specified using the <ahref="#Starting-Pantheonrun-a-node-on-ropsten-testnet"><code>--bootnodes</code> option</a>. </p>
<h3id="private-networks">Private Networks</h3>
<p>To start a bootnode for a private network:</p>
<ol>
<li><p>Export the public key to a file:</p>
<preclass="hljs">pantheon export-pub-key bootnode</pre><p>The node public key is exported to the <code>bootnode</code> file. </p>
</li>
<li><p>Start the bootnode, specifying:</p>
<ul>
<li>An empty string for the <code>--bootnodes</code> option because this is the bootnode. </li>
<li><p>The network ID for your private network. </p>
<p>To specify this bootnode for another node, the enode URL for the <code>--bootnodes</code> option is <code>enode://<id>@<host:port></code> where:</p>
<ul>
<li><code><id></code> is the node public key written to the specified file (<code>bootnode</code> in the above example) excluding the initial 0x. </li>
<li><code><host:port></code> is the host and port the bootnode is listening on for P2P peer discovery. Specified by the <code>--p2p-listen</code> option for the bootnode (default is <code>127.0.0.1:30303</code>).</li>
</ul>
<p>For example, if the <code>--p2p-listen</code> option is not specified and the node public key exported is <code>0xc35c3ec90a8a51fd5703594c6303382f3ae6b2ecb9589bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f</code></p>
<p><strong>[<em>This is preliminary content for the Pantheon Alpha release.</em>]</strong></p>
<h2id="contents">Contents</h2>
<ul>
<li>Event Publication and Subscription</li>
<li>Creating Subscriptions</li>
<li>Canceling Subscriptions</li>
</ul>
<h2id="event-publication-and-subscription">Event Publication and Subscription</h2>
<p>Pantheon supports event publication and subscription with RPC Pub/Sub methods. Using RPC Pub/Sub, your client can wait for events instead of polling for them. You invoke the RPC Pub/Sub methods over WebSockets; the methods are:</p>
<ul>
<li><code>eth_subscribe</code> - Creates a subscription that waits for particular events.</li>
<li><code>eth_unsubscribe</code> - Cancels an existing subscription.</li>
<li><code>eth_subscription</code> - Publishes (reports) notifications of event occurrences.</li>
</ul>
<h3id="subscriptions">Subscriptions</h3>
<p>When you subscribe to particular events (using <code>eth_subscribe</code>), the node returns a subscription ID. For each matching event that occurs, the node uses <code>eth_subscription</code> to return a notification with relevant data and the subscription ID.</p>
<p>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 <ahref="https://github.com/websockets/wscat">wscat</a>, a Node.js based command-line tool.</p>
<p>Subscriptions are coupled to a connection. If the connection is closed, all subscriptions that have been created over this connection will be removed.</p>
<p>The types of events that you can subscribe to are:</p>
<h4id="newblockheaders">NewBlockHeaders</h4>
<p>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 that are interested to them.
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.</p>
<p>You can filter blocks using elements from the <ahref="https://github.com/PegaSysEng/pantheon/wiki/JSON-RPC-API#block-object">Block Object</a>. For example, you can use the <code>logsBloom</code> parameter to filter blocks containing logs of interest to you.</p>
<p>The following is an example of <code>NewBlockHeaders</code> notifications:</p>
<p>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 <code>true</code>. Logs from transactions included in the new chain are sent. Therefore a subscription can send logs for the same transaction multiple times.</p>
<p><code>Logs</code> subscriptions can take as a parameter an <code>object</code> with the following fields:</p>
<ul>
<li><code>address</code> - (optional) Either an address or an array of addresses. Returns only logs created from these addresses.</li>
<li><code>topics</code> - (optional) Returns only logs that match the specified topics.</li>
</ul>
<p>The following is an example of <code>Logs</code> notifications:</p>
<p>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.</p>
<p><code>PendingTransactions</code> takes no parameters.</p>
<p>The returned data is a transaction hash.</p>
<p>The following is an example of <code>PendingTransactions</code> notifications:</p>
<p>Indicates when the node starts or stops synchronizing. The result can either be a <code>boolean</code> indicating that the synchronization has started (<code>true</code>), finished (<code>false</code>) or an <code>object</code> with various progress indicators.</p>
<p>Notifications are sent for current events only, not past events.</p>
<p>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.</p>
<p><code>eth_unsubscribe</code> cancels an existing subscription. It returns a boolean indicating whether the subscription was cancelled successfully.</p>
<blockquote>
<p><strong>Note:</strong> Only the connection that created a subscription is able to unsubscribe from it. If another connection tries to unsubscribe, it will receive a <code>SubscriptionNotFound</code> response with no information about existing subscriptions.</p>
</blockquote>
<h4id="parameters">Parameters</h4>
<p><code>subscriptionID</code> : - The ID of the subscription to cancel. You receive this ID from <code>eth_subscribe</code>.</p>
<h4id="returns">Returns</h4>
<p><code>result</code> : <code>boolean</code> - <code>true</code> if the subscription was cancelled successfully; otherwise <code>false</code>.</p>
<p><code>eth_subscription</code> publishes (reports) notifications of event occurrences. You do not call this method. The node invokes <code>eth_subscription</code> to return a notification with relevant data and the subscription ID for each matching event that occurs.</p>
<h4id="parameters">Parameters</h4>
<p>None</p>
<h4id="returns">Returns</h4>
<p><code>subscription</code> : <code>string</code> - The subscription ID. </p>
<p><code>result</code> : <code>object</code> - 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 <ahref="https://github.com/PegaSysEng/pantheon/wiki/JSON-RPC-API#block-object">Block Object</a>.</p>
<li><p>How do I tell if my firewall is correctly configured to accept incoming connections?
** pantheon.log lists incoming connections. If you see "Successfully accepted connection from" in the log, connections are getting through the firewalls. Example:</p>
<p> 2018-10-16 12:37:35.479-04:00 | nioEventLoopGroup-3-1 | INFO | NettyP2PNetwork | Successfully accepted connection from 0xa979fb575495b8d6db44f750317d0f4622bf4c2aa3365d6af7c284339968eef29b69ad0dce72a4d8db5ebb4968de0e3bec910127f134779fbcb0cb6d3331163c</p>
<h2id="pantheon-command-line-interface-reference">Pantheon Command Line Interface Reference</h2>
<p>This reference describes the syntax of the Pantheon Command Line Interface (CLI) options and subcommands.</p>
<preclass="hljs">pantheon <spanclass="hljs-string">[OPTIONS]</span><spanclass="hljs-string">[COMMAND]</span></pre><p>Runs the Pantheon Ethereum full node client.</p>
<dd>List of comma-separated enode URLs for P2P discovery bootstrap. </dd>
<dd>When connecting to mainnet and Rinkeby, the default is a predefined list of enode URLs. Specify bootnodes when <ahref="https://github.com/PegaSysEng/pantheon/wiki/Starting-Pantheon#run-a-node-on-ropsten-testnet">connecting to Ropsten</a> or a <ahref="https://github.com/PegaSysEng/pantheon/wiki/Testing-Developing-Nodes#bootnodes">private network.</a></dd>
<dd>The path to the TOML configuration file. The default is <code>none</code>. The TOML file is composed of key/value pairs. Each key is the same as the corresponding CLI option name without the leading dashes (<code>--</code>). The config option is not used in the config file. Values must be treated according to TOML specifications for string, numbers, arrays and Booleans.
><strong>Note:</strong> This option is not used when running Pantheon from the <ahref="#Run-Docker-Imagecustom-configuration-file">Docker image</a>.
<dd>The path to the Pantheon data directory. The default location is the <code>/build/distributions/pantheon-1.0.0-SNAPSHOT</code> directory in the Pantheon installation directory.</dd>
Set this option to <code>true</code> to run nodes in development mode which means you can run nodes in private or test networks. This is useful, for example, to do CPU mining more easily. In development mode, you use a custom genesis file that specifies a particular chain ID. When you set this option, you should also set the <code>--network-id</code> option to the specific network you use for development. The default is <code>false</code>.
</dd>
<br>
<dt><code>--genesis=<PATH></code></dt>
<dd>The path to the genesis file. The default is the embedded genesis file in the Pantheon mainnet.</dd>
<dd>P2P network identifier. The default is set to mainnet with value <code>1</code>.</dd>
<br>
<dt><code>--no-discovery</code></dt>
<dd>Disables P2P peer discovery. The default is <code>false</code>.</dd>
<br>
<dt><code>--ottoman</code></dt>
<dd>Synchronize against the Ottoman test network. This is only useful if you are using an IBFT genesis file. For more information, see <ahref="https://github.com/ethereum/EIPs/issues/650">IBFT consensus protocol PR #650</a>. The default is <code>false</code>.</dd>
<dd>Comma-separated APIs to enable on the JSON-RPC channel. The <code>--rpc-enabled</code> option must be specified with this option. The default is: <code>ETH, NET, WEB3</code>. The <code>DEBUG</code> and <code>MINER</code> APIs can also be enabled.</dd>
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:
<strong>Note:</strong> 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 <code>"none"</code>. 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:
For development purposes, you can use <code>"all"</code> to accept requests from any domain, but we don't recommend this for production code.
<dd>Comma-separated APIs to enable on Websockets channel. The <code>--ws-enabled</code> option must be specified with this option. The default is: <code>ETH, NET, WEB3</code>. The <code>DEBUG</code> and <code>MINER</code> APIs can also be enabled.</dd>
<p><strong>[<em>This content is preliminary and will be published pending tech review for the Pantheon Alpha release.</em>]</strong></p>
<p>The Pantheon JSON-RPC API uses the <ahref="http://json.org/">JSON</a> (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).</p>
<p>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.</p>
<h2id="using-the-pantheon-json-rpc-api">Using the Pantheon JSON-RPC API</h2>
<h3id="endpoint-address-and-port">Endpoint Address and Port</h3>
<p>In this reference, the placeholder
<code><JSON-RPC-http-endpoint:port></code> and <code><JSON-RPC-ws-endpoint:port></code> 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 <ahref="https://github.com/PegaSysEng/pantheon/wiki/Pantheon-CLI-Syntax">--rpc-listen and --ws-listen options in the CLI documentation</a>.</p>
<p>The transport attributes are:</p>
<ul>
<li>HTTP: Listens by default on port 8545</li>
<li>WebSockets: Listens by default on port 8546</li>
<li>IPC Socket: Listens by default on $BASE/jsonrpc.ipc</li>
</ul>
<h3id="http-and-websocket-requests">HTTP and WebSocket Requests</h3>
<h4id="http">HTTP</h4>
<p>To make RPC over HTTP requests, you can use the <code>curl</code> tool, available in many systems using <ahref="https://curl.haxx.se/download.html">curl source code or pre-compiled packages</a>.</p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53}' <JSON-RPC-http-endpoint:port></pre><h4id="websockets">WebSockets</h4>
<p>To make requests over WebSockets, this reference uses <ahref="https://github.com/websockets/wscat">wscat</a>, a Node.js based command-line tool.</p>
<p>First connect to the WebSockets server using <code>wscat</code> (you only need to connect once per session):</p>
<preclass="hljs">wscat -c ws://<JSON-RPC-ws-endpoint:port></pre><p>After the connection is established, the terminal will display a '>' prompt. Send individual requests as a JSON data package at each prompt:</p>
<p>When you make requests that might have different results depending on the block accessed, the block parameter specifies the block. Several methods, such as <ahref="#eth_gettransactionbyblocknumberandindex">eth_getTransactionByBlockNumberAndIndex</a>, have a block parameter.</p>
<p>The block parameter can have the following values:</p>
<ul>
<li><code>blockNumber</code> : <code>quantity</code> - Block number. Can be specified in hexadecimal or decimal. 0 represents the genesis block.</li>
<h2id="account-management-not-supported-by-pantheon">Account Management Not Supported by Pantheon</h2>
<p>Account management relies on private key management in the client which is not implemented by Pantheon. </p>
<p>Use <ahref="#eth_sendrawtransaction"><code>eth_sendRawTransaction</code></a> to send signed transaction; <code>eth_sendTransaction</code> is not implemented. </p>
<p>Use wallets for <ahref="#Account-Management">account management</a>. </p>
<p><strong>[<em>Note for Alpha release: The following lists only the Pantheon JSON-RPC API commands that are currently fully or partially implemented.</em>]</strong></p>
<p>The following lists the Pantheon JSON-RPC API commands:</p>
<p><code>result</code> : <em>string</em> - The current client version.</p>
<h5id="request-data">Request Data</h5>
<preclass="hljs">{<spanclass="hljs-attr">"jsonrpc"</span>:<spanclass="hljs-string">"2.0"</span>,<spanclass="hljs-attr">"method"</span>:<spanclass="hljs-string">"web3_clientVersion"</span>,<spanclass="hljs-attr">"params"</span>:[],<spanclass="hljs-attr">"id"</span>:<spanclass="hljs-number">53</span>}</pre><p>For an explanation of how to make an HTTP or WebSockets request using this data, see <ahref="#http-and-websocket-requests">HTTP and WebSocket Requests</a>.</p>
<p>Returns a <ahref="https://en.wikipedia.org/wiki/SHA-3">SHA3</a> hash of the specified data. The result value is a <ahref="https://keccak.team/keccak.html">Keccak-256</a> hash, not the standardized SHA3-256.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - The data to convert to a SHA3 hash.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> (<em>DATA</em>) - The SHA3 result of the input data.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c00"],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>To set a coinbase address, call the pantheon CLI with the <code>--miner-coinbase</code> 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:</p>
<p><strong>NOTE:</strong> This method returns an empty object because Pantheon <ahref="#account-management-not-supported-by-pantheon">does not support account management</a>.</p>
<p>Returns the index of the current block the client is processing.</p>
<h5id="parameters">Parameters</h5>
<p>None</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>QUANTITY</em> - Hexadecimal integer representing the 0-based index of the block that the client is currently processing.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":51}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns the account balance of the specified address.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - 20-byte account address from which to retrieve the balance.</p>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>QUANTITY</em> - Integer value of the current balance in wei.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xdd37f65db31c107f773e82a4f85c693058fef7a9", "latest"],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns the value of a storage position at a specified address.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - A 20-byte storage address.</p>
<p><code>QUANTITY</code> - Integer index of the storage position.</p>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>DATA</em> - The value at the specified storage position.</p>
<h5id="request">Request</h5>
<p>Calculating the correct position depends on the storage you want to retrieve.</p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method": "eth_getStorageAt","params": ["0x3B3F3E","0x0","latest"],"id": 53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns the number of transactions sent from a specified address.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - A 20-byte account address.</p>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>QUANTITY</em> - Integer representing the number of transactions sent from the specified address.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xc94770007dda54cF92009BFF0dE90c06F603a09f","latest"],"id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns the number of transactions in a block matching the specified block number.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>QUANTITY</em> - Integer representing the number of transactions in the specified block.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0xe8"],"id":51}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns the number of uncles in a block matching the specified block number.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY|TAG</code> - Integer representing either the 0-based index of the block within the blockchain, or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>QUANTITY</em> - Integer representing the number of uncles in the specified block.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getUncleCountByBlockNumber","params":["0xe8"],"id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>DATA</em> - Code stored at the specified address.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa50a51c09a5c451c52bb714527e1974b686d8e77", "latest"],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Sends a signed transaction. A transaction can send ether, deploy a contract, or interact with a contract. </p>
<p>You can interact with contracts using <ahref="#Using-Pantheoneth_call-or-eth_sendrawtransaction">eth_sendRawTransaction or eth_call</a>.</p>
<p>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 <code>eth_sendRawTransaction</code>, refer to <ahref="https://github.com/PegaSysEng/pantheon/wiki/Using-Pantheon#transactions">Using Pantheon</a>. </p>
<p><em>QUANTITY|TAG</em> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> (<em>DATA</em>) - Return value of the executed contract.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0xdd37f65db31c107f773e82a4f85c693058fef7a9","to":"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13","value":"0.1"}],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>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.</p>
<h5id="parameters">Parameters</h5>
<blockquote>
<p><strong>NOTE:</strong> Parameters are the same as the eth_call parameters, except that all properties are optional. If you do not specify a <code>gas</code> 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.</p>
<p><em>QUANTITY|TAG</em> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> (<em>QUANTITY</em>) - The amount of gas used.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0x687422eea2cb73b5d3e242ba5456b782919afc85","to":"0xdd37f65db31c107f773e82a4f85c693058fef7a9","value":"0x1"}],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>The following result yields a gas amount estimate of 21000 wei (0x5208) for the transaction.</p>
<p>Returns information about the block by hash.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - 32-byte hash of a block.</p>
<p><code>Boolean</code> - If <code>true</code>, returns the full <ahref="#transaction-object">transaction objects</a>; if <code>false</code>, returns the transaction hashes.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>OBJECT</em> - <ahref="#block">Block object</a> , or <code>null</code> when no block is found. </p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x16b69965a5949262642cfb5e86368ddbbe57ab9f17d999174a65fd0e66580d8f", false],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns information about a block by block number.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<p><code>Boolean</code> - If <code>true</code>, returns the full <ahref="#transaction-object">transaction objects</a>; if <code>false</code>, returns only the hashes of the transactions.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <em>OBJECT</em> - <ahref="#block">Block object</a> , or <code>null</code> when no block is found. </p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x64", true],"id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns transaction information for the specified block hash and transaction index position.</p>
<h5id="parameters">Parameters</h5>
<p><code>DATA</code> - 32-byte hash of a block.</p>
<p><code>QUANTITY</code> - Integer representing the transaction index position.</p>
<h5id="returns">Returns</h5>
<p>Object - <ahref="#transaction-object">Transaction object</a>, or <code>null</code> when no transaction is found.</p>
<h5id="request">Request</h5>
<p>This request returns the 3rd transaction in the 82990 block on the Ropsten testnet. You can also view this <ahref="https://ropsten.etherscan.io/txs?block=82990">block</a> and <ahref="https://ropsten.etherscan.io/tx/0xfc766a71c406950d4a4955a340a092626c35083c64c7be907060368a5e6811d6">transaction</a> on Etherscan. </p>
<p><strong>Note:</strong> You must be synchronized to at least the block containing the transaction for the request to return it. </p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0xbf137c3a7a1ebdfac21252765e5d7f40d115c2757e4a4abee929be88c624fdb7", "0x2"], "id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Returns transaction information for the specified block number and transaction index position.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY|TAG</code> - Integer representing a block number or one of the string tags <code>latest</code>, <code>earliest</code>, or <code>pending</code>, as described in <ahref="#block-parameter">Block Parameter</a>.</p>
<p><code>QUANTITY</code> - The transaction index position.</p>
<h5id="returns">Returns</h5>
<p>Object - <ahref="#transaction-object">Transaction object</a>, or <code>null</code> when no transaction is found.</p>
<h5id="request">Request</h5>
<p>This request returns the 3rd transaction in the 82990 block on the Ropsten testnet. You can also view this <ahref="https://ropsten.etherscan.io/txs?block=82990">block</a> and <ahref="https://ropsten.etherscan.io/tx/0xfc766a71c406950d4a4955a340a092626c35083c64c7be907060368a5e6811d6">transaction</a> on Etherscan. </p>
<p><strong>Note:</strong> You must be synchronized to at least the block containing the transaction for the request to return it.</p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["82990", "0x2"], "id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Creates a topic filter with the specified options to notify (log) when the state changes. To determine whether the state has changed, call <ahref="#eth_getFilterChanges">eth_getFilterChanges</a>.</p>
<p><strong>Note:</strong> Topics are order-dependent. A transaction with a log containing topics <code>[A, B]</code> would be matched with the following topic filters:</p>
<ul>
<li>[] - Match any topic</li>
<li>[A] - Match A in first position (and any topic thereafter)</li>
<li>[null, B] - Match any topic in first position AND B in second position (and any topic thereafter)</li>
<li>[A, B] - Match A in first position AND B in second position (and any topic thereafter)</li>
<li>[[A, B], [A, B]] - Match (A OR B) in first position AND (A OR B) in second position (and any topic thereafter)</li>
</ul>
<p>For example, params could be specified as follows:</p>
<p>Creates a filter in the node that notifies when a new block arrives. To determine whether the state has changed, call <ahref="#eth_getFilterChanges">eth_getFilterChanges</a>.</p>
<h5id="parameters">Parameters</h5>
<p>None</p>
<h5id="returns">Returns</h5>
<p><code>QUANTITY</code> - A hexadecimal integer filter ID. Each time you call this method, it creates a new filter, and the index is incremented by 1.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newBlockFilter","params":[],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Assuming you have previously called <code>eth_newBlockFilter</code> two times, it will assign a filter ID of 3:</p>
<p>Creates a filter in the node that notifies when new pending transactions arrive. To check if the state has changed, call <ahref="#eth_getFilterChanges">eth_getFilterChanges</a>.</p>
<h5id="parameters">Parameters</h5>
<p>None</p>
<h5id="returns">Returns</h5>
<p><code>QUANTITY</code> - A hexadecimal integer filter ID. Each time you call this method, it creates a new filter, and the index is incremented by 1.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_newPendingTransactionFilter","params":[],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Assuming you have previously called <code>eth_newBlockFilter</code> three times, it will assign a filter ID of 4:</p>
<p>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 <ahref="#eth_getFilterChanges">eth_getFilterChanges</a> for a period of time.</p>
<p>This method deletes filters of any type: block filters, pending transaction filters, and state (topic) filters.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY</code> - A hexadecimal integer filter ID specifying the filter to be deleted.</p>
<h5id="returns">Returns</h5>
<p><code>Boolean</code> - <code>true</code> if the filter was successfully uninstalled; otherwise <code>false</code>.</p>
<h5id="request">Request</h5>
<p>The following request deletes the block filter with an ID of 0x4:</p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_uninstallFilter","params":["0x4"],"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>Polls the specified filter and returns an array of logs that have occurred since the last poll.</p>
<h5id="parameters">Parameters</h5>
<p><code>QUANTITY</code> - A hexadecimal integer filter ID.</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <code>Array of Object</code> - List of logs, or an empty array if nothing has changed since the last poll.</p>
<ul>
<li><p>For filters created with <code>eth_newBlockFilter</code>, returns 32-byte <em>DATA</em> block hashes; for example <code>["0x3454645634534..."]</code>.</p>
</li>
<li><p>For filters created with <code>eth_newPendingTransactionFilter</code>, returns transaction hashes (32-byte <em>DATA</em>); for example <code>["0x6345343454645..."]</code>.</p>
</li>
<li><p>For filters created with <code>eth_newFilter</code>, returns <ahref="#log-object">log objects</a>. </p>
</li>
</ul>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getFilterChanges","params":["0xa"]:"id":53}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>The following response indicates that nothing has changed since the last poll:</p>
<p>Same as <ahref="#eth_getFilterChanges">eth_getFilterChanges</a>.</p>
<h5id="request">Request</h5>
<p>The request above returns the logs for the 82893 block on the Ropsten testnet. You can also view this <ahref="https://ropsten.etherscan.io/block/82983">block</a> on Etherscan. </p>
<p><strong>Note:</strong> You must be synchronised to at least the requested block for the request to return the logs.</p>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"eth_getLogs","params":[{"blockhash":"0x677bf4b962464e6dfd548d6a30b6c703dd78c7cc3602825a7013a6e90a001d2a"}], "id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<p>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.</p>
<p>You can use this method with tools such as Remix when you want to execute a transaction step-by-step.</p>
<h5id="parameters">Parameters</h5>
<p><code>transactionHash</code> : <code>data</code> - The transaction hash.</p>
<p><code>options</code> : <code>string</code> - (Optional) Specifies request options as follows:</p>
<ul>
<li><code>disableStorage</code> : <code>BOOL</code> - <code>true</code> disables storage capture. The default is <code>false</code>.</li>
<li><code>disableMemory</code> : <code>BOOL</code> - <code>true</code> disables memory capture. The default is <code>false</code>.</li>
<li><code>disableStack</code> : <code>BOOL</code> - <code>true</code> disables stack capture. The default is <code>false</code>.</li>
<li><code>tracer</code> : <code>STRING</code> - 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, <code>step</code> and <code>result</code>:<ul>
<li><code>step</code> is a function that takes two arguments, <code>log</code> and <code>db</code>. This function is called for each step of the EVM, or when an error occurs, as the specified transaction is traced.</li>
<li><code>log</code> has the following fields:<ul>
<li><code>pc</code> : <code>number</code> - The current program counter.</li>
<li><code>op</code> : <code>object</code> - An <code>OpCode</code> object representing the current opcode.</li>
<li><code>gas</code> : <code>number</code> - The amount of gas remaining.</li>
<li><code>gasPrice</code> : <code>number</code> - The cost in wei of each unit of gas.</li>
<li><code>memory</code> : <code>object</code> - A structure representing the contract's memory space.</li>
<li><code>stack</code> : <code>array[big.Int]</code> - The EVM execution stack.</li>
<li><code>depth</code> : <code>number</code> - The execution depth.</li>
<li><code>account</code> : <code>data</code> - The address of the account executing the current operation.</li>
<li><code>err</code> : If an error occured, this field contains information about the error. If <code>err</code> is non-null, you can ignore all other fields.</li>
</ul>
</li>
</ul>
</li>
<li><code>timeout</code> : <code>STRING</code> - 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".</li>
</ul>
<h5id="returns">Returns</h5>
<p>A <code>tracer</code> object, as described above.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params”:[“0xaaaaaaaaaaaaaaaaaaa”,{“disableStorage":true}],"id”:1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<preclass="hljs">{...}</pre><hr>
<h4id="miner_start">miner_start</h4>
<p>Starts the CPU mining process on the client.</p>
<h5id="parameters">Parameters</h5>
<p>None</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <code>boolean | integer</code> - <code>true</code> 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.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"miner_start","params":[],"id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<preclass="hljs">{...}</pre><hr>
<h4id="miner_stop">miner_stop</h4>
<p>Stops the CPU mining process on the client.</p>
<h5id="parameters">Parameters</h5>
<p>None</p>
<h5id="returns">Returns</h5>
<p><code>result</code> : <code>boolean | integer</code> - <code>true</code> 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.</p>
<h5id="request">Request</h5>
<preclass="hljs">curl -X POST --data '{"jsonrpc":"2.0","method":"miner_stop","params":[],"id":1}' <JSON-RPC-endpoint:port></pre><h5id="result">Result</h5>
<preclass="hljs">{...}</pre><hr>
<h2id="objects">Objects</h2>
<p>The following objects are parameters for or returned by JSON-RPC Methods:</p>
<td>Integer block number or <code>latest</code>, <code>pending</code>, <code>earliest</code>. See <ahref="#block-paramter">Block Parameter</a>. Default is <code>latest</code>.</td>
<td>Integer block number or <code>latest</code>, <code>pending</code>, <code>earliest</code>. See <ahref="#block-paramter">Block Parameter</a>. Default is <code>latest</code>.</td>
<td>Hash of block for which to return logs. If <code>blockhash</code> is specified, <code>fromBlock</code> and <code>toBlock</code> cannot be specified.</td>
</tr>
</tbody>
</table>
<h4id="log-object">Log Object</h4>
<p>Returned by <ahref="#eth_getFilterChanges">eth_getFilterChanges</a> and <ahref="#transaction-receipt-object">transaction receipt objects</a> can contain an array of log objects. </p>
<table>
<thead>
<tr>
<th>Key</th>
<thstyle="text-align:center">Type</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>removed</code></td>
<tdstyle="text-align:center">Tag</td>
<td><code>true</code> when log removed due to chain reorganization. <code>false</code> if valid log.</td>
<td>Index position of transaction from which log was created. <code>null</code> when log is pending.</td>
</tr>
<tr>
<td><code>transactionHash</code></td>
<tdstyle="text-align:center">Data, 32 bytes</td>
<td>Hash of transaction from which log was created. <code>null</code> when log is pending.</td>
</tr>
<tr>
<td><code>blockHash</code></td>
<tdstyle="text-align:center">Data, 32 bytes</td>
<td>Hash of block in which log included. <code>null</code> when log is pending.</td>
</tr>
<tr>
<td><code>blockNumber</code></td>
<tdstyle="text-align:center">Quantity</td>
<td>Number of block in which log included. <code>null</code> when log is pending.</td>
</tr>
<tr>
<td><code>address</code></td>
<tdstyle="text-align:center">Data, 20 bytes</td>
<td>Address from which log originated.</td>
</tr>
<tr>
<td><code>data</code></td>
<tdstyle="text-align:center">Data</td>
<td>Non-indexed arguments of log.</td>
</tr>
<tr>
<td><code>topics</code></td>
<tdstyle="text-align:center">Array of Data, 32 bytes each</td>
<td>0 to 4 indexed log arguments. In Solidity, the first topic is the hash of the signature of the event (for example, <code>Deposit(address, bytes32, unit256)</code>) except you declare the event with an anonymous specifier.) </td>
<p>Returned by <ahref="#eth_gettransactionbyhash">eth_getTransactionByHash</a>, <ahref="#eth_gettransactionbyblockhashandindex">eth_getTransactionByBlockHashAndIndex</a>, and <ahref="#eth_gettransactionbyblocknumberandindex">eth_getTransactionsByBlockNumberAndIndex</a>.</p>
<table>
<thead>
<tr>
<th>Key</th>
<thstyle="text-align:center">Type</th>
<th>Value</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>blockHash</code></td>
<tdstyle="text-align:center">Data, 32 bytes</td>
<td>Hash of block containing this transaction. <code>null</code> when transaction is pending.</td>
</tr>
<tr>
<td><code>blockNumber</code></td>
<tdstyle="text-align:center">Quantity</td>
<td>Block number of block containing this transaction. <code>null</code> when transaction is pending.</td>
</tr>
<tr>
<td><code>from</code></td>
<tdstyle="text-align:center">Data, 20 bytes</td>
<td>Address of the sender.</td>
</tr>
<tr>
<td><code>gas</code></td>
<tdstyle="text-align:center">Quantity</td>
<td>Gas provided by the sender.</td>
</tr>
<tr>
<td><code>gasPrice</code></td>
<tdstyle="text-align:center">Quantity</td>
<td>Gas price provided by the sender in Wei.</td>
</tr>
<tr>
<td><code>hash</code></td>
<tdstyle="text-align:center">Data, 32 bytes</td>
<td>Hash of the transaction.</td>
</tr>
<tr>
<td><code>input</code></td>
<tdstyle="text-align:center">Data</td>
<td>Data sent with the transaction.</td>
</tr>
<tr>
<td><code>nonce</code></td>
<tdstyle="text-align:center">Quantity</td>
<td>Number of transactions made by the sender before this one.</td>
</tr>
<tr>
<td><code>to</code></td>
<tdstyle="text-align:center">Data, 20 bytes</td>
<td>Address of the receiver. <code>null</code> if a contract creation transaction.</td>