mirror of https://github.com/hyperledger/besu
Doc migration (#381)
Readthedoc migration, still some content to update from the wiki that were updated after I made the last diff - fixes #406 by configuring readthedocs - fixes #407 by configuring material theme - fixes #408 by adding footer with jQuery to enable readthedocs.org versions - fixes #409 - fixes #410 - fixes #411
parent
8e855aac09
commit
ec2b904aec
@ -0,0 +1,20 @@ |
||||
description: Ethereum accounts used for testing only on private network |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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`](/Reference/Pantheon-CLI-Syntax/#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. |
||||
|
||||
{!global/test_accounts.md!} |
||||
|
||||
## 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`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/dev.json). |
||||
|
||||
Use the [`--genesis`](/Reference/Pantheon-CLI-Syntax/#genesis) command line option to start Pantheon with the genesis file defining the existing accounts. |
@ -0,0 +1,52 @@ |
||||
description: Pantheon log level setting and log formatting |
||||
path: blob/master/pantheon/src/main/resources/ |
||||
source: log4j2.xml |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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`](../Reference/Pantheon-CLI-Syntax.md#logging) command line option to specify the logging verbosity. The [`--logging`](../Reference/Pantheon-CLI-Syntax.md#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](https://github.com/PegaSysEng/pantheon/blob/master/pantheon/src/main/resources/log4j2.xml) except logging of stack traces for exceptions is excluded. |
||||
|
||||
```xml tab="log4j2.xml" |
||||
<?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](https://logging.apache.org/log4j/2.x/manual/configuration.html). |
||||
|
||||
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: |
||||
|
||||
```bash |
||||
$ LOG4J_CONFIGURATION_FILE=./debug.xml bin/pantheon --rinkeby |
||||
``` |
@ -0,0 +1,13 @@ |
||||
description: Pantheon network ID and chain ID implementation |
||||
<!--- END of page meta data --> |
||||
|
||||
# Network ID and Chain ID |
||||
|
||||
Ethereum networks have a **network ID** and a **chain ID**. The network ID is specified using the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#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 automatically set by Pantheon when connecting to the Ethereum mainnet ==1==, Rinkeby ==4==, and Ropsten ==3==. |
||||
|
||||
When using the [`--dev-mode`](../Reference/Pantheon-CLI-Syntax.md#dev-mode) or [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis) options, specify the network ID using the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) option. |
||||
|
@ -0,0 +1,41 @@ |
||||
description: Pantheon networking is about P2P discovery and communication between peers and access to the JSON RPC APIs |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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 [`--logging`](../Reference/Pantheon-CLI-Syntax.md#logging) 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: |
||||
|
||||
!!! example "Example log output" |
||||
`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`](../Reference/Pantheon-CLI-Syntax.md#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`](../Reference/Pantheon-CLI-Syntax.md#max-peers) command line option to reduce the maximum number of peers. The default is 25. |
||||
|
||||
Use the [`--max-trailing-peers`](../Reference/Pantheon-CLI-Syntax.md#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`](../Reference/Pantheon-CLI-Syntax.md#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`](../Reference/Pantheon-CLI-Syntax.md#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. |
||||
|
||||
## Monitoring Peer Connections |
||||
|
||||
Use the [`debug_metrics`](../Reference/JSON-RPC-API-Methods.md#debug_metrics) JSON-RPC API method to obtain information about peer connections. |
@ -0,0 +1,37 @@ |
||||
description: Pantheon private and public key used to identify node |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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`](../Reference/Pantheon-CLI-Syntax.md#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. |
||||
|
||||
!!!info |
||||
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`](../Reference/Pantheon-CLI-Syntax.md#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](Testing-Developing-Nodes.md#private-networks) for a node. |
||||
|
||||
## Specifying a Custom Node Private Key File |
||||
|
||||
Use the [`--node-private-key`](../Reference/Pantheon-CLI-Syntax.md#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`: |
||||
|
||||
!!! example |
||||
```bash |
||||
bin/pantheon --node-private-key "/Users/username/privatekeyfile" |
||||
``` |
@ -0,0 +1,16 @@ |
||||
description: Passing Java virtual machine JVM options to Pantheon at runtime |
||||
<!--- END of page meta data --> |
||||
|
||||
# Passing JVM Options |
||||
|
||||
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. |
||||
|
||||
!!! example |
||||
```bash |
||||
$ PANTHEON_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 \ |
||||
$ bin/pantheon --rinkeby |
||||
``` |
@ -0,0 +1,80 @@ |
||||
description: Pantheon Clique Proof-of-Authority (PoA) consensus protocol implementation |
||||
path: blob/master/config/src/main/resources/ |
||||
source: rinkeby.json |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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. |
||||
|
||||
## Genesis File |
||||
|
||||
To use Clique in a private network, Pantheon requires a PoA genesis file. When connecting to Rinkeby, Pantheon uses the [`rinkeby.json`](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/rinkeby.json) genesis file in the `/pantheon/config/src/main/resources` directory. |
||||
|
||||
A PoA genesis file defines properties specific to Clique: |
||||
|
||||
!!! example "Genesis JSON file (stripped)" |
||||
```json |
||||
{ |
||||
"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` - Initial signers are specified after the 32 bytes reserved for vanity data. |
||||
|
||||
To connect to the Rinkeby testnet, start Pantheon with the [`--rinkeby`](../Reference/Pantheon-CLI-Syntax.md#rinkeby) command line option. To start a node on a PoA private network, use the [`--network-id`](../Reference/Pantheon-CLI-Syntax.md#network-id) command line option and [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis`) option. |
||||
|
||||
### 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`](../Reference/Pantheon-CLI-Syntax.md#rpc-enabled) option. If also using the [`--rpc-api`](../Reference/Pantheon-CLI-Syntax.md#rpc-api) option, include `CLIQUE`. |
||||
|
||||
The JSON-RPC methods to add or remove signers are: |
||||
|
||||
* [clique_propose](../Reference/JSON-RPC-API-Methods.md#clique_propose) |
||||
* [clique_getSigners](../Reference/JSON-RPC-API-Methods.md#clique_getsigners) |
||||
* [clique_discard](../Reference/JSON-RPC-API-Methods.md#clique_discard) |
||||
|
||||
To propose adding a signer, call `clique_propose` specifying the address of the proposed signer and `true`. |
||||
!!! example "JSON-RPC clique_propose Request Example" |
||||
```bash |
||||
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. |
||||
!!! example "JSON-RPC clique_getSigners Request Example" |
||||
```bash |
||||
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. |
||||
!!! example "JSON-RPC clique_discard Request Example" |
||||
```bash |
||||
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. |
@ -0,0 +1,57 @@ |
||||
description: Pantheon Clique Proof-of-Authority (PoA) consensus protocol implementation |
||||
path: blob/master/ethereum/core/src/main/resources/ |
||||
source: rinkeby.json |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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`](../Reference/Pantheon-CLI-Syntax.md#bootnodes) option. |
||||
|
||||
### Private Networks |
||||
|
||||
To start a bootnode for a private network: |
||||
|
||||
1. Export the public key to a file: |
||||
|
||||
!!! example |
||||
```bash |
||||
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`](../Reference/Pantheon-CLI-Syntax.md#bootnodes) option because this is the bootnode. |
||||
* The network ID for your private network. |
||||
|
||||
!!! example |
||||
```bash |
||||
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`). |
||||
|
||||
!!! 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` |
||||
|
||||
!!! info |
||||
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: |
||||
|
||||
!!! example |
||||
```bash |
||||
pantheon --datadir=/tmp/pantheon/30301 --p2p-listen=127.0.0.1:30301 --network-id=123 --bootnodes=enode://c35c3ec90a8a51fd5703594c6303382f3ae6b2ecb99bab2c04b3794f2bc3fc2631dabb0c08af795787a6c004d8f532230ae6e9925cbbefb0b28b79295d615f@127.0.0.1:30303 |
||||
``` |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 24 KiB |
@ -0,0 +1,14 @@ |
||||
description: Getting started with Pantheon |
||||
<!--- END of page meta data --> |
||||
|
||||
# Getting started overview |
||||
|
||||
You can get started with Pantheon by: |
||||
|
||||
* Starting a node as described in [Starting Pantheon](Starting-Pantheon.md) |
||||
* Running from the [Pantheon Docker image](Run-Docker-Image.md) |
||||
* Using the [Private Network Quickstart](Private-Network-Quickstart.md) |
||||
|
||||
To run a single node to connect the Ethereum mainnet or a public testnet, running from the Pantheon [Docker image](Run-Docker-Image.md) or [installing the packaged binaries](../Installation/Install-Binaries.md) 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 a private Ethereum network, the [Private Network Quickstart](Private-Network-Quickstart.md) runs a private network of Pantheon nodes in Docker containers. |
@ -0,0 +1,460 @@ |
||||
description: Pantheon private network quickstart tutorial |
||||
<!--- END of page meta data --> |
||||
|
||||
# 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](../Installation/Build-From-Source.md). |
||||
|
||||
If you have installed Pantheon from the [packaged binaries](Intallation/Install-Binaries) or are running the [Docker image](Run-Docker-Image), you can proceed with [Starting Pantheon](Starting-Pantheon). |
||||
|
||||
|
||||
## Prerequisites |
||||
|
||||
To run this tutorial, you must have the following installed: |
||||
|
||||
- [Docker and Docker-compose](https://docs.docker.com/compose/install/) |
||||
|
||||
- [Git command line](https://git-scm.com/) |
||||
|
||||
- [Curl command line](https://curl.haxx.se/download.html) |
||||
|
||||
- A web browser that supports [Metamask](https://metamask.io/) (currently Chrome, Firefox, Opera, and Brave), and has the MetaMask plug-in installed. This tutorial uses screenshots from Brave. |
||||
|
||||
|
||||
## Clone Pantheon Source Code |
||||
|
||||
As indicated in [the installation section](../Installation/Build-From-Source.md#clone-the-pantheon-repository), clone the repository. |
||||
|
||||
## Build Docker Images and Start Services and Network |
||||
|
||||
This tutorial uses [Docker Compose](https://docs.docker.com/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: |
||||
|
||||
Run the following commands : |
||||
|
||||
```bash tab="Linux/macOS" |
||||
# Shell script are provided in the Quickstart directory |
||||
|
||||
quickstart/runPantheonPrivateNetwork.sh |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
// Run the docker-compose commands directly |
||||
|
||||
// Run the services and ask for 4 regular nodes |
||||
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: |
||||
|
||||
!!! example "Docker-compose services list example" |
||||
```log |
||||
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: |
||||
|
||||
!!! example "Endpoint list example" |
||||
```log |
||||
**************************************************************** |
||||
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. |
||||
|
||||
To display the list of endpoints again, run the following shell command: |
||||
|
||||
```bash tab="Linux/macOS" |
||||
# Shell script are provided in the Quickstart directory |
||||
|
||||
quickstart/listQuickstartServices.sh |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
// Run the docker-compose commands directly |
||||
|
||||
quickstart\docker-compose port explorer 80 |
||||
``` |
||||
|
||||
## Block Explorer |
||||
|
||||
This tutorial uses the [Alethio light block explorer](https://aleth.io/). |
||||
|
||||
### 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: |
||||
|
||||
![Block Explorer](ExplorerSummary.png) |
||||
|
||||
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. |
||||
|
||||
![Block Details](ExplorerBlockDetails.png) |
||||
|
||||
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. |
||||
|
||||
![Explorer Search](ExplorerSearch.png) |
||||
|
||||
## 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](https://curl.haxx.se/download.html) to make JSON-RPC requests. |
||||
|
||||
!!!tip |
||||
**On Windows:** We suggest using [Postman](https://www.getpostman.com/) or a similar client to make RPC requests. |
||||
|
||||
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 : |
||||
|
||||
```bash |
||||
curl -X POST --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}' http://localhost:http-rpc-port |
||||
``` |
||||
|
||||
The result should be as follows: |
||||
|
||||
```json |
||||
{ |
||||
"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`: |
||||
|
||||
```bash |
||||
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: |
||||
|
||||
```json |
||||
{ |
||||
"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: |
||||
|
||||
```bash |
||||
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: |
||||
|
||||
```json |
||||
{ |
||||
"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: |
||||
|
||||
```bash |
||||
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 : |
||||
|
||||
```json |
||||
{ |
||||
"jsonrpc" : "2.0", |
||||
"id" : 1, |
||||
"result" : "0x79f905c6fd34e80000" |
||||
} |
||||
``` |
||||
|
||||
!!!info |
||||
0x79f905c6fd34e80000 = 2250000000000000000000 Wei (2250 Ether) |
||||
|
||||
you can use a unit [converter](https://etherconverter.online/) to go from wei to ether. |
||||
|
||||
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, see . |
||||
|
||||
{!global/test_accounts.md!} |
||||
|
||||
!!!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**. |
||||
1. 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](https://metamask.zendesk.com/hc/en-us/articles/360015489331-Importing-an-Account-New-UI-) |
||||
using the corresponding private key. |
||||
|
||||
!!!note |
||||
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](https://metamask.zendesk.com/hc/en-us/articles/360015289452-Creating-Additional-MetaMask-Wallets-New-UI-) |
||||
to send some ether to. |
||||
|
||||
!!!info |
||||
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](https://metamask.zendesk.com/hc/en-us/articles/360015488991-Sending-Ether-New-UI-) |
||||
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. |
||||
|
||||
### Truffle Pet Shop Tutorial |
||||
|
||||
With a couple of modifications, we can use the private network in this tutorial as the blockchain for the [PetShop tutorial on Truffle website](https://truffleframework.com/tutorials/pet-shop). |
||||
|
||||
#### Prerequisites |
||||
|
||||
* [Node.js v6+ LTS and npm](https://nodejs.org/en/) (comes with Node) |
||||
|
||||
#### Install Truffle and Unpack Truffle Box |
||||
|
||||
Install Truffle : |
||||
|
||||
```bash |
||||
npm install -g truffle |
||||
``` |
||||
|
||||
!!!note |
||||
`npm` requires `sudo` on Linux. |
||||
|
||||
Create a `pet-shop-tutorial` directory and move into it: |
||||
|
||||
```bash |
||||
mkdir pet-shop-tutorial |
||||
cd pet-shop-tutorial |
||||
``` |
||||
|
||||
Unpack Pet Shop [truffle box](https://truffleframework.com/boxes): |
||||
|
||||
`truffle unbox pet-shop` |
||||
|
||||
Install the [wallet](https://www.npmjs.com/package/truffle-privatekey-provider): |
||||
|
||||
```bash |
||||
npm install truffle-privatekey-provider |
||||
``` |
||||
!!!note |
||||
`npm` requires `sudo` on Linux. |
||||
|
||||
#### Modify the Pet Shop Example |
||||
|
||||
Modify the `truffle.js` file in the `pet-shop-tutorial` directory to add our wallet provider: |
||||
|
||||
```javascript |
||||
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: "*" |
||||
}, |
||||
} |
||||
}; |
||||
``` |
||||
|
||||
Replace `<YOUR HTTP RPC NODE ENDPOINT>` with your HTTP RPC node endpoint (for example, `http://localhost:32770/jsonrpc`). |
||||
|
||||
The private key is the miner address which means it will have funds. |
||||
|
||||
Once this is done, you can continue with the [regular tutorial steps](https://truffleframework.com/tutorials/pet-shop#directory-structure) on the Truffle website until Step 3 in the [Migration section](https://truffleframework.com/tutorials/pet-shop#migration). |
||||
|
||||
#### Use Pantheon Private Network Instead of [Ganache](https://truffleframework.com/ganache) |
||||
|
||||
We are going to use our private network instead of Ganache, so skip steps 3, 4, and 5 in the [Migration section](https://truffleframework.com/tutorials/pet-shop#migration). |
||||
|
||||
In step 4, specify our private network: |
||||
|
||||
```bash |
||||
truffle migrate --network quickstartWallet |
||||
``` |
||||
|
||||
Output similar to the following is displayed (your addresses will differ): |
||||
|
||||
```log |
||||
Using network 'quickstartWallet'. |
||||
|
||||
Running migration: 1_initial_migration.js |
||||
Deploying Migrations... |
||||
... 0xfc1dbc1eaa14fa283c2c4415364579da0d195b3f2f2fefd7e0edb600a6235bdb |
||||
Migrations: 0x9a3dbca554e9f6b9257aaa24010da8377c57c17e |
||||
Saving successful migration to network... |
||||
... 0x77cc6e9966b886fb74268f118b3ff44cf973d32b616ed4f050b3eabf0a31a30e |
||||
Saving artifacts... |
||||
Running migration: 2_deploy_contracts.js |
||||
Deploying Adoption... |
||||
... 0x5035fe3ea7dab1d81482acc1259450b8bf8fefecfbe1749212aca86dc765660a |
||||
Adoption: 0x2e1f232a9439c3d459fceca0beef13acc8259dd8 |
||||
Saving successful migration to network... |
||||
... 0xa7b5a36e0ebc9c25445ce29ff1339a19082d0dda516e5b72c06ee6b99a901ec0 |
||||
Saving artifacts... |
||||
``` |
||||
|
||||
Search for the deployed contracts and transactions in the block explorer using the addresses displayed in your output. |
||||
|
||||
Continue with the regular tutorial steps in the [Testing the smart contract section](https://truffleframework.com/tutorials/pet-shop#testing-the-smart-contract). |
||||
|
||||
To run the tests in the [Running the tests section](https://truffleframework.com/tutorials/pet-shop#running-the-tests), specify our private network: |
||||
|
||||
```bash |
||||
truffle test --network quickstartWallet |
||||
``` |
||||
|
||||
Output similar to the following is displayed: |
||||
```log |
||||
Using network 'quickstartWallet'. |
||||
|
||||
Compiling ./contracts/Adoption.sol... |
||||
Compiling ./test/TestAdoption.sol... |
||||
Compiling truffle/Assert.sol... |
||||
Compiling truffle/DeployedAddresses.sol... |
||||
|
||||
|
||||
TestAdoption |
||||
✓ testUserCanAdoptPet (2071ms) |
||||
✓ testGetAdopterAddressByPetId (6070ms) |
||||
✓ testGetAdopterAddressByPetIdInArray (6077ms) |
||||
|
||||
|
||||
3 passing (37s) |
||||
``` |
||||
|
||||
Continue with the regular tutorial steps in the [Creating a user interface to interact with the smart contract section](https://truffleframework.com/tutorials/pet-shop#creating-a-user-interface-to-interact-with-the-smart-contract). |
||||
|
||||
We have already connected our private network to MetaMask so you can skip the [Installing and configuring MetaMask section](https://truffleframework.com/tutorials/pet-shop#installing-and-configuring-metamask). |
||||
|
||||
Continue with the regular tutorial steps from the [Installing and configuring lite-server section](https://truffleframework.com/tutorials/pet-shop#installing-and-configuring-lite-server) to the end of the tutorial. |
||||
|
||||
When you adopt pets in the browser and approve the transaction in MetaMask, you will be able to see the transactions in the block explorer. |
||||
|
||||
## Shut Down the Network and Remove the Containers |
||||
|
||||
To shut down the network and delete all containers: |
||||
|
||||
```bash tab="Linux/macOS" |
||||
# Shell script are provided in the Quickstart directory |
||||
|
||||
quickstart/removePantheonPrivateNetwork.sh |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
// Run the docker-compose commands directly |
||||
|
||||
quickstart\docker-compose down |
||||
``` |
||||
|
||||
!!!note |
||||
On Windows, the quickstart creates a volume called `quickstart_public-keys` but it's not automatically removed. 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: |
||||
|
||||
```bash tab="Linux/macOS" |
||||
# Shell script are provided in the Quickstart directory |
||||
|
||||
quickstart/stopPantheonPrivateNetwork.sh |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
// Run the docker-compose commands directly |
||||
|
||||
quickstart\docker-compose stop |
||||
``` |
||||
|
||||
(This command will also stop other running containers unrelated to quickstart.) |
||||
|
||||
To restart the private network: |
||||
|
||||
```bash tab="Linux/macOS" |
||||
# Shell script are provided in the Quickstart directory |
||||
|
||||
quickstart/resumePantheonPrivateNetwork.sh |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
// Run the docker-compose commands directly |
||||
|
||||
quickstart\docker-compose start |
||||
``` |
@ -0,0 +1,153 @@ |
||||
description: Run Pantheon using the official docker image |
||||
<!--- END of page meta data --> |
||||
|
||||
# Running 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](https://docs.docker.com/install/) installed. |
||||
|
||||
## Quickstart |
||||
|
||||
To run a Pantheon node in a container connected to the Ethereum mainnet: |
||||
|
||||
```bash |
||||
docker run pegasyseng/pantheon:latest |
||||
``` |
||||
|
||||
## Command Line Options |
||||
|
||||
!!!attention |
||||
You cannot use the following Pantheon command line options when running Pantheon from the Docker image: |
||||
|
||||
* [`--datadir`](../Reference/Pantheon-CLI-Syntax.md#datadir), see [Persisting Data](#persisting-data) |
||||
* [`--config`](../Reference/Pantheon-CLI-Syntax.md#config), see [Custom Configuration File](#custom-configuration-file) |
||||
* [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis), see [Custom Genesis File](#custom-genesis-file). |
||||
* [`--rpc-listen`](../Reference/Pantheon-CLI-Syntax.md#rpc-listen), [`--p2plisten`](../Reference/Pantheon-CLI-Syntax.md#p2plisten), [`--ws-listen`](../Reference/Pantheon-CLI-Syntax.md#ws-listen), see [Exposing Ports](#exposing-ports) |
||||
|
||||
All other [Pantheon command line options](/Reference/Pantheon-CLI-Syntax) 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`](../Reference/Pantheon-CLI-Syntax.md#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: |
||||
|
||||
```bash |
||||
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`](../Reference/Pantheon-CLI-Syntax.md#config) option. |
||||
|
||||
To run Pantheon specifying a custom configuration file: |
||||
```bash |
||||
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. |
||||
!!!example |
||||
```bash |
||||
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: |
||||
```bash |
||||
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. |
||||
|
||||
!!!example |
||||
```bash |
||||
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`](../Reference/Pantheon-CLI-Syntax.md#rpc-listen), |
||||
[`--p2p-listen`](../Reference/Pantheon-CLI-Syntax.md#p2p-listen), [`--ws-listen`](../Reference/Pantheon-CLI-Syntax.md#ws-listen) options). |
||||
|
||||
To run Pantheon exposing local ports for access: |
||||
```bash |
||||
$ docker run -p <localportJSON-RPC>:8545 -p <localportWS>:8546 -p <localportP2P>:30303 pegasyseng/pantheon:latest --rpc-enabled --ws-enabled |
||||
``` |
||||
|
||||
!!!example |
||||
To enable RPC calls to http://127.0.0.1:8545 and P2P discovery on http://127.0.0.1:13001: |
||||
```bash |
||||
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: |
||||
|
||||
```bash |
||||
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: |
||||
```bash |
||||
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](https://github.com/PegaSysEng/pantheon/blob/master/config/src/main/resources/ropsten.json). |
||||
|
||||
To run a node on Ropsten: |
||||
```bash |
||||
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: |
||||
```bash |
||||
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: |
||||
```bash |
||||
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: |
||||
```bash |
||||
docker stop <container-name> |
||||
``` |
||||
|
||||
To delete a container: |
||||
```bash |
||||
docker rm <container-name> |
||||
``` |
||||
|
||||
To delete a container volume (optional): |
||||
```bash |
||||
docker volume rm <volume-name> |
||||
``` |
@ -0,0 +1,115 @@ |
||||
description: Starting Pantheon |
||||
<!--- END of page meta data --> |
||||
|
||||
# Starting Pantheon |
||||
|
||||
Pantheon nodes can be used for varying purposes as described in the [Overview](../index.md). |
||||
Nodes can connect to the Ethereum mainnet, public testnets such as Ropsten, or private networks. |
||||
|
||||
## Prerequisites |
||||
|
||||
[Pantheon Installed](../Installation/Overview.md) |
||||
|
||||
## 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`](../Reference/Pantheon-CLI-Syntax.md#datadir) option to specify a different data directory. |
||||
|
||||
To delete the local block data, delete the `database` directory in the `pantheon/build/distribution/pantheon-<version>` directory. |
||||
|
||||
## Genesis Configuration |
||||
|
||||
Pantheon specifies the genesis configuration, and sets the network ID and bootnodes when connecting to [Mainnet](#run-a-node-on-ethereum-mainnet), |
||||
[Rinkeby](#run-a-node-on-rinkeby-testnet), and [Ropsten](#run-a-node-on-ropsten-testnet). |
||||
|
||||
When [`--dev-mode`](../Reference/Pantheon-CLI-Syntax.md#dev-mode) is specified, Pantheon uses the development mode genesis configuration. |
||||
|
||||
The genesis files defining the genesis configurations are in the [Pantheon source files](https://github.com/PegaSysEng/pantheon/tree/master/config/src/main/resources). |
||||
|
||||
To define a genesis configuration, create a genesis file (for example, `genesis.json`) and specify the file |
||||
using the [`--genesis`](../Reference/Pantheon-CLI-Syntax.md#genesis) option. |
||||
|
||||
## Confirm Node is Running |
||||
|
||||
If you have started Pantheon with the [`--rpc-enabled`](../Reference/Pantheon-CLI-Syntax.md#rpc-enabled) option, use [cURL](https://curl.haxx.se/) to |
||||
call [JSON-RPC API methods](../Reference/JSON-RPC-API-Methods.md) to confirm the node is running. |
||||
|
||||
!!!example |
||||
|
||||
* `eth_chainId` returns the chain ID of the network. |
||||
|
||||
```bash |
||||
$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_chainId","params":[],"id":1}' 127.0.0.1:8545 |
||||
``` |
||||
|
||||
* `eth_syncing` returns the starting, current, and highest block. |
||||
|
||||
```bash |
||||
$ curl -X POST --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}' 127.0.0.1:8545 |
||||
``` |
||||
|
||||
For example, after connecting to mainnet `eth_syncing` will return something similar to: |
||||
|
||||
```json |
||||
{ |
||||
"jsonrpc" : "2.0", |
||||
"id" : 1, |
||||
"result" : { |
||||
"startingBlock" : "0x0", |
||||
"currentBlock" : "0x2d0", |
||||
"highestBlock" : "0x66c0" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Run a Node on Ethereum Mainnet |
||||
|
||||
To run a node on the Ethereum mainnet: |
||||
|
||||
```bash |
||||
$ bin/pantheon |
||||
``` |
||||
|
||||
To run a node on mainnet with the HTTP JSON-RPC service enabled: |
||||
|
||||
```bash |
||||
$ bin/pantheon --rpc-enabled |
||||
``` |
||||
|
||||
## Run a Node on Ropsten Testnet |
||||
|
||||
!!!note |
||||
From v0.8.2 or when [building from source](../Installation/Overview.md), use the [`--ropsten` option](../Reference/Pantheon-CLI-Syntax.md#options) |
||||
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: |
||||
|
||||
```bash |
||||
$ 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: |
||||
|
||||
```bash |
||||
$ 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: |
||||
|
||||
```bash |
||||
$ 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: |
||||
|
||||
```bash |
||||
$ bin/pantheon --dev-mode --network-id="2018" --bootnodes= --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-cors-origins "all" --ws-enabled --rpc-enabled |
||||
``` |
@ -0,0 +1,133 @@ |
||||
description: Building Pantheon from source code |
||||
<!--- END of page meta data --> |
||||
|
||||
# Build from Source |
||||
|
||||
## Prerequisites |
||||
|
||||
* [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
||||
|
||||
!!!important |
||||
Pantheon requires Java 8+ to compile; earlier versions are not supported. |
||||
|
||||
* [Git](https://git-scm.com/downloads) or [GitHub Desktop](https://desktop.github.com/) |
||||
|
||||
## Running Locally |
||||
|
||||
* [Installation on Linux / Unix / Mac OS X](#installation-on-linux-unix-mac-os-x) |
||||
* [Installation on Windows](#installation-on-windows) |
||||
|
||||
## Running On Virtual Machine |
||||
|
||||
* [Installation on VM](#installation-on-vm) |
||||
|
||||
|
||||
## Installation on Linux / Unix / Mac OS X |
||||
|
||||
###Clone the Pantheon Repository |
||||
|
||||
Clone the **PegaSysEng/pantheon** repo to your home directory (`/home/<user>`): |
||||
|
||||
```bash |
||||
$ git clone --recursive https://github.com/PegaSysEng/pantheon.git |
||||
``` |
||||
|
||||
### Build Pantheon |
||||
|
||||
After cloning, go to the `pantheon` directory. |
||||
|
||||
Build Pantheon with the Gradle wrapper `gradlew`, omitting tests as follows: |
||||
|
||||
```bash |
||||
$ ./gradlew build -x test |
||||
``` |
||||
|
||||
Go to the distribution directory: |
||||
```bash |
||||
$ cd build/distributions/ |
||||
``` |
||||
|
||||
Expand the distribution archive: |
||||
```bash |
||||
$ tar -xzf pantheon-<version>.tar.gz |
||||
``` |
||||
|
||||
Move to the expanded folder and display the Pantheon help to confirm installation. |
||||
````bash |
||||
$ cd pantheon-<version>/ |
||||
$ bin/pantheon --help |
||||
```` |
||||
|
||||
Continue with the [Private Network Quickstart](../Getting-Started/Private-Network-Quickstart.md) or [Starting Pantheon](../Getting-Started/Starting-Pantheon.md). |
||||
|
||||
|
||||
## 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: |
||||
|
||||
```bat |
||||
git clone --recursive https://github.com/PegaSysEng/pantheon |
||||
``` |
||||
|
||||
### Build Pantheon |
||||
|
||||
Go to the `pantheon` directory: |
||||
|
||||
```bat |
||||
cd pantheon |
||||
``` |
||||
|
||||
Open a Windows command prompt. Build Pantheon with the Gradle wrapper `gradlew`, omitting tests as follows: |
||||
|
||||
```bat |
||||
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`. |
||||
|
||||
Go to the distribution directory: |
||||
```bat |
||||
cd build\distributions |
||||
``` |
||||
|
||||
Expand the distribution archive: |
||||
```bat |
||||
tar -xzf pantheon-<version>.tar.gz |
||||
``` |
||||
|
||||
Move to the expanded folder and display the Pantheon help to confirm installation. |
||||
```bat |
||||
cd pantheon-<version> |
||||
bin\pantheon --help |
||||
``` |
||||
|
||||
Continue with the [Private Network Quickstart](../Getting-Started/Private-Network-Quickstart.md) or [Starting Pantheon](../Getting-Started/Starting-Pantheon.md). |
||||
|
||||
|
||||
## 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](https://www.virtualbox.org/). |
||||
|
||||
If you set up your own VM locally using a VM manager such as [VirtualBox](https://www.virtualbox.org/), 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](https://linus.nci.nih.gov/bdge/installUbuntu.html). |
@ -0,0 +1,69 @@ |
||||
description: Install Pantheon from binary distribution |
||||
<!--- END of page meta data --> |
||||
|
||||
# Install Binary Distribution |
||||
|
||||
## Mac OS with Homebrew |
||||
|
||||
### Prerequisites |
||||
|
||||
* [Homebrew](https://brew.sh/) |
||||
|
||||
### Install Using Homebrew |
||||
|
||||
```bash |
||||
$ brew tap pegasyseng/pantheon |
||||
$ brew install pantheon |
||||
``` |
||||
Display Pantheon command line help to confirm installation: |
||||
|
||||
```bash |
||||
$ pantheon --help |
||||
``` |
||||
|
||||
## Windows with Chocolatey |
||||
|
||||
### Prerequisites |
||||
|
||||
* [Chocolatey](Install-Chocolatey.md) |
||||
|
||||
### Install Using Chocolatey |
||||
|
||||
To install from [Chocolatey package](https://chocolatey.org/packages/pantheon/): |
||||
|
||||
```bat |
||||
choco install pantheon |
||||
``` |
||||
|
||||
Display Pantheon command line help to confirm installation: |
||||
|
||||
```bat |
||||
pantheon --help |
||||
``` |
||||
|
||||
## Linux / Unix / Windows without Chocolatey |
||||
|
||||
### Prerequisites |
||||
|
||||
* [Java JDK](http://www.oracle.com/technetwork/java/javase/downloads/index.html) |
||||
|
||||
!!!attention |
||||
Pantheon requires Java 8+ to compile; earlier versions are not supported. |
||||
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 from Packaged Binaries |
||||
|
||||
Download the Pantheon [packaged binaries](https://bintray.com/consensys/pegasys-repo/pantheon/_latestVersion#files). |
||||
|
||||
Unpack the downloaded files and change into the `pantheon-<release>` directory. |
||||
|
||||
Display Pantheon command line help to confirm installation: |
||||
|
||||
```bash tab="Linux/macOS" |
||||
$ bin/pantheon --help |
||||
``` |
||||
|
||||
```bat tab="Windows" |
||||
bin\pantheon --help |
||||
``` |
@ -0,0 +1,22 @@ |
||||
description: Install Pantheon on Windows from Chocolatey package manager |
||||
<!--- END of page meta data --> |
||||
|
||||
# Install Chocolatey |
||||
|
||||
To install Chocolatey: |
||||
|
||||
1. Open **cmd.exe** as the administrative user by right-clicking on **cmd.exe** in the Start menu and selecting **Run as administrator**. |
||||
|
||||
2. Run: |
||||
|
||||
```bat |
||||
@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin" |
||||
``` |
||||
|
||||
3. Display the Chocolatey help to confirm installation: |
||||
|
||||
```bat |
||||
choco -? |
||||
``` |
||||
|
||||
For more information, refer to the [Chocolatey documentation](https://chocolatey.org/install). |
@ -0,0 +1,18 @@ |
||||
title: Installation overview |
||||
description: Overview and requirements to install Pantheon |
||||
<!--- END of page meta data --> |
||||
|
||||
# Installation Overview |
||||
|
||||
You can install Pantheon by: |
||||
|
||||
* [Installing the binary distribution](Install-Binaries.md) |
||||
* [Building from source](Build-From-Source.md) |
||||
|
||||
!!! note |
||||
To run a single node to connect the Ethereum mainnet or a public testnet, running from the [Pantheon docker image](../Getting-Started/Run-Docker-Image.md) is the fastest way to get started. |
||||
|
||||
## Disk Space and RAM Requirements |
||||
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. |
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,158 @@ |
||||
description: Pantheon JSON-RPC API objects reference |
||||
<!--- END of page meta data --> |
||||
|
||||
# JSON-RPC API Objects |
||||
|
||||
The following objects are parameters for or returned by JSON-RPC Methods. |
||||
|
||||
## Block Object |
||||
|
||||
Returned by [eth_getBlockByHash](JSON-RPC-API-Methods.md#eth_getblockbyhash) and [eth_getBlockByNumber](JSON-RPC-API-Methods.md#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](#transaction-object), or 32 byte transaction hashes depending on the specified boolean parameter. | |
||||
| **uncles** | Array | Array of uncle hashes. | |
||||
|
||||
|
||||
## Filter Options Object |
||||
|
||||
Parameter for [eth_newFilter](JSON-RPC-API-Methods.md#eth_newfilter) and [eth_getLogs](JSON-RPC-API-Methods.md#eth_getlogs). |
||||
|
||||
| Key | Type | Required/Optional | Value | |
||||
|---------------|:---------------------------------:|:-----------------:|---------------------------------------------------------------------------------------------------------------------------------------------| |
||||
| **fromBlock** | Quantity | Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [Block Parameter](Using-JSON-RPC-API.md#block-parameter). Default is `latest`. | |
||||
| **toBlock** | Quantity | Tag | Optional | Integer block number or `latest`, `pending`, `earliest`. See [Block Parameter](Using-JSON-RPC-API.md#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](JSON-RPC-API-Methods.md#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](JSON-RPC-API-Methods.md#eth_getfilterchanges) and [transaction receipt objects](#transaction-receipt-object) 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.) | |
||||
|
||||
## Trace Object |
||||
|
||||
Returned by [debug_traceTransaction](JSON-RPC-API-Methods.md#debug_traceTransaction). |
||||
|
||||
| Key | Type | Value | |
||||
|-----------------|:-------:|-------------------------------------------------------------------| |
||||
| **gas** | Integer | Gas used by the transaction | |
||||
| **failed** | Boolean | True if transaction failed; otherwise, false | |
||||
| **returnValue** | String | Bytes returned from transaction execution (without a `0x` prefix) | |
||||
| **structLogs** | Array | Array of structured log objects | |
||||
|
||||
|
||||
### Structured Log Object |
||||
|
||||
Part of the [Trace object](#trace-object). |
||||
|
||||
| Key | Type | Value | |
||||
|----------------------------|:----------------------------:|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
||||
| **pc** | Integer | Current program counter | |
||||
| **op** | String | Current OpCode | |
||||
| **gas** | Integer | Gas remaining | |
||||
| **gasCost** | Integer | Cost in wei of each gas unit | |
||||
| **depth** | Integer | Execution depth | |
||||
| **exceptionalHaltReasons** | Array | One or more strings representing an error condition that caused the EVM execution to terminate. These indicate that EVM execution terminated for reasons such as running out of gas or attempting to execute an unknown instruction. Generally a single exceptional halt reason is returned but it is possible for more than one to occur at once. | |
||||
| **stack** | Array of 32 byte arrays | EVM execution stack before executing current operation | |
||||
| **memory** | Array of 32 byte arrays | Memory space of the contract before executing current operation | |
||||
| **storage** | Object | Storage entries changed by the current transaction | |
||||
|
||||
|
||||
## Transaction Object |
||||
|
||||
Returned by [eth_getTransactionByHash](JSON-RPC-API-Methods.md#eth_gettransactionbyhash), [eth_getTransactionByBlockHashAndIndex](JSON-RPC-API-Methods.md#eth_gettransactionbyblockhashandindex), and [eth_getTransactionsByBlockNumberAndIndex](JSON-RPC-API-Methods.md#eth_gettransactionbyblocknumberandindex). |
||||
|
||||
| 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](JSON-RPC-API-Methods.md#eth_call) and [eth_estimateGas](JSON-RPC-API-Methods.md#eth_estimategas). |
||||
|
||||
!!!note |
||||
All parameters are optional for [eth_estimateGas](JSON-RPC-API-Methods.md#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](JSON-RPC-API-Methods.md#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](#log-object) 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| |
@ -0,0 +1,12 @@ |
||||
description: Pantheon JSON-RPC API reference |
||||
<!--- END of page meta data --> |
||||
|
||||
# JSON-RPC API overview |
||||
|
||||
The Pantheon JSON-RPC API uses the [JSON](http://json.org/) (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](Using-JSON-RPC-API.md) |
||||
* [JSON-RPC API Methods](JSON-RPC-API-Methods.md) |
||||
* [JSON-RPC API Objects](JSON-RPC-API-Objects.md) |
@ -0,0 +1,538 @@ |
||||
description: Pantheon commande line interface reference |
||||
<!--- END of page meta data --> |
||||
|
||||
# Pantheon Command Line |
||||
|
||||
This reference describes the syntax of the Pantheon Command Line Interface (CLI) options and subcommands. |
||||
|
||||
```bash |
||||
pantheon [OPTIONS] [COMMAND] |
||||
``` |
||||
|
||||
Runs the Pantheon Ethereum full node client. |
||||
|
||||
## Options |
||||
|
||||
### banned-nodeids |
||||
|
||||
```bash tab="Syntax" |
||||
--banned-nodeids=<bannedNodeId>[,<bannedNodeId>...]... |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--banned-nodeids=enode://c35c3...d615f@1.2.3.4:30303,enode://f42c13...fc456@1.2.3.5:30303 |
||||
``` |
||||
|
||||
List of node IDs with which this node will not peer. The node ID is the public key of the node. You can specify the banned node IDs with or without the `0x` prefix. |
||||
|
||||
!!!info |
||||
This option is only available from v0.8.2 or when [building from source](../Installation/Build-From-Source.md). |
||||
|
||||
### bootnodes |
||||
|
||||
```bash tab="Syntax" |
||||
--bootnodes=<enode://id@host:port>[,<enode://id@host:port>...]... |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--bootnodes=enode://c35c3...d615f@1.2.3.4:30303,enode://f42c13...fc456@1.2.3.5:30303 |
||||
``` |
||||
|
||||
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](../Getting-Started/Starting-Pantheon.md#run-a-node-on-ropsten-testnet) or |
||||
a [private network](../Configuring-Pantheon/Testing-Developing-Nodes.md#bootnodes). |
||||
|
||||
### config |
||||
|
||||
```bash tab="Syntax" |
||||
--config=<PATH> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--config=/home/me/me_node/config.toml |
||||
``` |
||||
|
||||
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 "Example TOML configuration file" |
||||
```toml |
||||
# 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 |
||||
|
||||
# Mining |
||||
miner-enabled=true |
||||
miner-coinbase="0x0000000000000000000000000000000000000002" |
||||
``` |
||||
|
||||
!!!note |
||||
This option is not used when running Pantheon from the [Docker image](../Getting-Started/Run-Docker-Image.md#custom-configuration-file). |
||||
|
||||
### datadir |
||||
|
||||
```bash tab="Syntax" |
||||
--datadir=<PATH> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--datadir=/home/me/me_node |
||||
``` |
||||
|
||||
The path to the Pantheon data directory. The default location is the `/build/distributions/pantheon-<version>` directory in the Pantheon installation directory. |
||||
|
||||
!!!note |
||||
This option is not used when running Pantheon from the [Docker image](../Getting-Started/Run-Docker-Image.md#persisting-data). |
||||
|
||||
|
||||
### dev-mode |
||||
|
||||
```bash tab="Syntax" |
||||
--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`](#network-id) option to the network you use for development. |
||||
Default is `false`. |
||||
|
||||
|
||||
!!!note |
||||
The [`--dev-mode`](#dev-mode) option overrides the [`--genesis`](#genesis) option. If both are specified, the development mode configuration is used. |
||||
|
||||
|
||||
### genesis |
||||
|
||||
```bash tab="Syntax" |
||||
--genesis=<PATH> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--genesis=/home/me/me_node/genesis_calling_all_stations.json |
||||
``` |
||||
|
||||
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`](#network-id) option. |
||||
|
||||
!!!note |
||||
This option is not used when running Pantheon from the [Docker image](../Getting-Started/Run-Docker-Image.md#custom-genesis-file). |
||||
|
||||
!!!note |
||||
The [`--genesis`](#genesis) option is overridden by the [`--dev-mode`](#dev-mode) option. |
||||
If both are specified, the specified genesis file is ignored and the development mode configuration used. |
||||
|
||||
|
||||
### host-whitelist |
||||
|
||||
```bash tab="Syntax" |
||||
--host-whitelist=<hostname>[,<hostname>...]... |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--host-whitelist=medomain.com,meotherdomain.com |
||||
``` |
||||
|
||||
Comma-separated list of hostnames to allow access to the HTTP JSON-RPC API. Default is `localhost`. |
||||
|
||||
!!!tip |
||||
To allow all hostnames, use `*` or `all`. We don't recommend this for production code. |
||||
|
||||
!!!note |
||||
This option is only available from v0.8.3 or when [building from source](../Installation/Build-From-Source.md). |
||||
Earlier versions allow access by all hostnames. |
||||
|
||||
### max-peers |
||||
|
||||
```bash tab="Syntax" |
||||
--max-peers=<INTEGER> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--max-peers=42 |
||||
``` |
||||
|
||||
Specifies the maximum P2P peer connections that can be established. |
||||
The default is 25. |
||||
|
||||
### max-trailing-peers |
||||
|
||||
```bash tab="Syntax" |
||||
--max-trailing-peers=<INTEGER> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--max-trailing-peers=2 |
||||
``` |
||||
|
||||
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`](#max-peers). |
||||
|
||||
### miner-coinbase |
||||
|
||||
```bash tab="Syntax" |
||||
--miner-coinbase=<Ethereum account address> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--miner-coinbase=fe3b557e8fb62b89f4916b721be55ceb828dbd73 |
||||
``` |
||||
|
||||
Account to which mining rewards are paid. |
||||
You must specify a valid coinbase when you enable mining using the [`--miner-enabled`](#miner-enabled) |
||||
option or the [`miner_start`](JSON-RPC-API-Methods.md#miner_start) JSON RPC-API method. |
||||
|
||||
!!!note |
||||
This option is ignored in networks using the [Clique Proof-of-Authority (PoA) consensus protocol](../Configuring-Pantheon/Proof-of-Authority.md). |
||||
|
||||
### miner-enabled |
||||
|
||||
```bash tab="Syntax" |
||||
--miner-enabled |
||||
``` |
||||
|
||||
Enables mining when the node is starts. |
||||
Default is `false`. |
||||
|
||||
### miner-extraData |
||||
|
||||
```bash tab="Syntax" |
||||
--miner-extraData=<Extra data> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--miner-extraData=0x444F4E27542050414E4943202120484F444C2C20484F444C2C20484F444C2021 |
||||
``` |
||||
|
||||
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 |
||||
|
||||
```bash tab="Syntax" |
||||
--miner-minTransactionGasPriceWei=<minTransactionGasPrice> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--miner-minTransactionGasPriceWei=1337 |
||||
``` |
||||
|
||||
The minimum price that a transaction offers for it to be included in a mined block. |
||||
The default is 1000. |
||||
|
||||
### network-id |
||||
|
||||
```bash tab="Syntax" |
||||
--network-id=<INTEGER> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--network-id=8675309 |
||||
``` |
||||
|
||||
P2P network identifier. |
||||
The default is set to mainnet with value `1`. |
||||
|
||||
### no-discovery |
||||
|
||||
```bash tab="Syntax" |
||||
--no-discovery |
||||
``` |
||||
|
||||
Disables P2P peer discovery. |
||||
The default is `false`. |
||||
|
||||
### node-private-key |
||||
|
||||
```bash tab="Syntax" |
||||
--node-private-key=<PATH> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--node-private-key=/home/me/me_node/my_precious |
||||
``` |
||||
|
||||
`<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. |
||||
|
||||
|
||||
!!!attention |
||||
The private key is not encrypted. |
||||
|
||||
!!!note |
||||
This option is only available from v0.8.2 or when [building from source](../Installation/Build-From-Source.md). |
||||
|
||||
### nodes-whitelist |
||||
|
||||
```bash tab="Syntax" |
||||
--nodes-whitelist=[=<enode://id@host:port>[,<enode://id@host:port>...]...] |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--nodes-whitelist=enode://c35c3...d615f@3.14.15.92:30303,enode://f42c13...fc456@65.35.89.79:30303 |
||||
``` |
||||
|
||||
Comma-separated enode URLs for permissioned networks. |
||||
If you specify an empty list or [`--nodes-whitelist`](#nodes-whitelist) without a list, your node will not connect to any other nodes. |
||||
|
||||
|
||||
!!!note |
||||
This option is only available from v0.8.3 or when [building from source](../Installation/Build-From-Source.md). |
||||
|
||||
!!!note |
||||
:construction: Permissioning is not currently supported. Support for permissioning is in active development. |
||||
|
||||
### ottoman |
||||
|
||||
```bash tab="Syntax" |
||||
--ottoman |
||||
``` |
||||
|
||||
Synchronize against the Ottoman test network. This is only useful if you are using an IBFT genesis file. The default is `false`. |
||||
|
||||
!!!note |
||||
:construction: IBFT is not currently supported. Support for IBFT is in active development. |
||||
|
||||
### p2p-listen |
||||
|
||||
```bash tab="Syntax" |
||||
--p2p-listen=<HOST:PORT> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
# to listen on all interfaces on port 1789 |
||||
--p2p-listen=0.0.0.0:1789 |
||||
``` |
||||
|
||||
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](../Getting-Started/Run-Docker-Image.md#exposing-ports). |
||||
|
||||
### rinkeby |
||||
|
||||
```bash tab="Syntax" |
||||
--rinkeby |
||||
``` |
||||
|
||||
Uses the Rinkeby test network. |
||||
Default is `false`. |
||||
|
||||
|
||||
### ropsten |
||||
|
||||
```bash tab="Syntax" |
||||
--ropsten |
||||
``` |
||||
|
||||
Uses the Ropsten test network. |
||||
Default is `false`. |
||||
|
||||
!!!note |
||||
This option is only available only from v0.8.2 or when [building from source](../Installation/Build-From-Source.md). |
||||
For v0.8.1, refer to [Ropsten section on Starting Pantheon page](../Getting-Started/Starting-Pantheon.md#run-a-node-on-ropsten-testnet). |
||||
|
||||
### rpc-enabled |
||||
|
||||
```bash tab="Syntax" |
||||
--rpc-enabled |
||||
``` |
||||
|
||||
Set to `true` to enable the JSON-RPC service (RPC over HTTP). |
||||
The default is `false`. |
||||
|
||||
### rpc-listen |
||||
|
||||
```bash tab="Syntax" |
||||
--rpc-listen=<HOST:PORT> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
# to listen on all interfaces on port 3435 |
||||
--rpc-listen=0.0.0.0:3435. |
||||
``` |
||||
|
||||
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](../Getting-Started/Run-Docker-Image.md#exposing-ports). |
||||
|
||||
### rpc-api |
||||
|
||||
```bash tab="Syntax" |
||||
--rpc-api=<api name>[,<api name>...]... |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--rpc-api=ETH,NET,WEB3 |
||||
``` |
||||
|
||||
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 |
||||
:construction: IBFT is not currently supported. Support for IBFT is in active development. |
||||
|
||||
### rpc-cors-origins |
||||
|
||||
```bash tab="Syntax" |
||||
--rpc-cors-origins=<rpcCorsAllowedOrigins> |
||||
``` |
||||
|
||||
```bash tab="Single domain xample" |
||||
# You can whitelist one single domains. |
||||
|
||||
--rpc-cors-origins="http://medomain.com" |
||||
``` |
||||
|
||||
```bash tab="Multiple domains example" |
||||
# You can whitelist one or more domains with a comma-separated list. |
||||
|
||||
--rpc-cors-origins="http://medomain.com","https://meotherdomain.com" |
||||
``` |
||||
|
||||
```bash tab="Remix IDE domain example" |
||||
# The following allows Remix to interact with your Pantheon node without using MetaMask. |
||||
|
||||
--rpc-cors-origins "http://remix.ethereum.org" |
||||
``` |
||||
|
||||
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. |
||||
|
||||
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. |
||||
|
||||
!!!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. |
||||
|
||||
!!!tip |
||||
For development purposes, you can use `"all"` to accept requests from any domain, but we don't recommend this for production code. |
||||
|
||||
### ws-enabled |
||||
|
||||
```bash tab="Syntax" |
||||
--ws-enabled |
||||
``` |
||||
|
||||
Set to `true` to enable the WS-RPC (WebSockets) service. |
||||
The default is `false`. |
||||
|
||||
### ws-api |
||||
|
||||
```bash tab="Syntax" |
||||
--ws-api=<api name>[,<api name>...]... |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--ws-api=ETH,NET,WEB3 |
||||
``` |
||||
|
||||
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 |
||||
:construction: IBFT is not currently supported. Support for IBFT is in active development. |
||||
|
||||
### ws-listen |
||||
|
||||
```bash tab="Syntax" |
||||
--ws-listen=<HOST:PORT> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
# to listen on all interfaces on port 6174 |
||||
--ws-listen=0.0.0.0:6174 |
||||
``` |
||||
|
||||
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](../Getting-Started/Run-Docker-Image.md#exposing-ports). |
||||
|
||||
### help |
||||
|
||||
```bash tab="Syntax" |
||||
-h, --help |
||||
``` |
||||
|
||||
Show the help message and exit. |
||||
|
||||
### logging |
||||
|
||||
```bash tab="Syntax" |
||||
-l, --logging=<LEVEL> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
--logging=DEBUG |
||||
``` |
||||
|
||||
Sets the logging verbosity. |
||||
Log levels are `OFF`, `FATAL`, `WARN`, `INFO`, `DEBUG`, `TRACE`, `ALL`. |
||||
Default is `INFO`. |
||||
|
||||
### version |
||||
|
||||
```bash tab="Syntax" |
||||
-V, --version |
||||
``` |
||||
|
||||
Print version information and exit. |
||||
|
||||
## Commands |
||||
|
||||
Pantheon subcommands are: |
||||
|
||||
### import |
||||
|
||||
```bash tab="Syntax" |
||||
$ pantheon import <block-file> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
$ pantheon import /home/me/me_project/mainnet.blocks |
||||
``` |
||||
|
||||
Imports blocks from the specified file into the blockchain database |
||||
|
||||
### export-pub-key |
||||
|
||||
```bash tab="Syntax" |
||||
$ pantheon export-pub-key <key-file> |
||||
``` |
||||
|
||||
```bash tab="Example" |
||||
$ pantheon export-pub-key /home/me/me_project/not_precious_pub_key |
||||
``` |
||||
|
||||
Exports node public key to the specified file. |
@ -0,0 +1,98 @@ |
||||
description: How to use Pantheon JSON-RPC API |
||||
<!--- END of page meta data --> |
||||
|
||||
# Using the JSON-RPC API |
||||
|
||||
!!!attention "Breaking Change in v0.8.3" |
||||
|
||||
From v0.8.3, incoming HTTP requests are only accepted from hostnames specified using the [`--host-whitelist`](Pantheon-CLI-Syntax.md#host-whitelist) option. |
||||
If not specified, the default value for [`--host-whitelist`](Pantheon-CLI-Syntax.md#host-whitelist) is `localhost`. |
||||
|
||||
If using the URL `http://127.0.0.1` to make JSON-RPC calls, use [`--host-whitelist`](Pantheon-CLI-Syntax.md#host-whitelist) to specify the hostname `127.0.0.1` or update the hostname to `localhost`. |
||||
|
||||
If your application publishes RPC ports, specify the hostnames when starting Pantheon. For example: |
||||
```bash |
||||
pantheon --host-whitelist=foo.com |
||||
``` |
||||
|
||||
Specify `*` or `all` for [`--host-whitelist`](Pantheon-CLI-Syntax.md#host-whitelist) to effectively disable host protection and replicate pre-v0.8.3 behavior. |
||||
|
||||
**This is not recommended for production code.** |
||||
|
||||
## Using the Pantheon JSON-RPC API |
||||
|
||||
### Postman |
||||
|
||||
Use the button to import our collection of examples to [Postman](https://www.getpostman.com/). |
||||
|
||||
[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/cffe1bc034b3ab139fa7) |
||||
|
||||
### 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`](../Reference/Pantheon-CLI-Syntax.md#rpc-listen) |
||||
and [`--ws-listen`](../Reference/Pantheon-CLI-Syntax.md#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](https://curl.haxx.se/download.html). |
||||
|
||||
```bash |
||||
$ 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](https://github.com/websockets/wscat), a Node.js based command-line tool. |
||||
|
||||
First connect to the WebSockets server using `wscat` (you only need to connect once per session): |
||||
|
||||
```bash |
||||
$ 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: |
||||
|
||||
```bash |
||||
> {"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":53} |
||||
``` |
||||
|
||||
The [RPC Pub/Sub methods](../Using-Pantheon/RPC-PubSub.md) can also be used over WebSockets. |
||||
|
||||
### 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](JSON-RPC-API-Methods.md#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](JSON-RPC-API-Methods.md#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`](JSON-RPC-API-Methods.md#eth_sendrawtransaction) to send signed transactions; `eth_sendTransaction` is not implemented. |
||||
|
||||
Use third-party wallets for [account management](../Using-Pantheon/Account-Management.md). |
||||
|
||||
### Protocols |
||||
|
||||
Pantheon does not implement the Whisper and Swarm protocols. |
@ -0,0 +1,11 @@ |
||||
description: Using third party wallets for account management |
||||
<!--- END of page meta data --> |
||||
|
||||
# Using Wallets for Account Management |
||||
|
||||
Pantheon does not implement private key management. Use third-party tools (for example, [MetaMask](https://consensys.zendesk.com/hc/en-us/articles/360004685212-Generating-MetaMask-Wallet-New-UI-) and [web3j](https://web3j.io/)) for creating accounts. |
||||
|
||||
In Pantheon, you can use the JSON-RPC methods: |
||||
|
||||
* [eth_getBalance](../Reference/JSON-RPC-API-Methods.md#eth_getbalance) to obtain the account balance |
||||
* [eth_sendRawTransaction](../Reference/JSON-RPC-API-Methods.md#eth_sendrawtransaction) to transfer ether or create and interact with contracts (for more information, refer to [Transactions](Transactions.md#transactions)). |
@ -0,0 +1,12 @@ |
||||
description: Frequently asked questions FAQ and answers for troubleshooting Pantheon use |
||||
<!--- END of page meta data --> |
||||
|
||||
# Debugging Pantheon |
||||
|
||||
## 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. |
||||
|
||||
## How can I monitor node performance and connectivity? |
||||
|
||||
Using the [`debug_metrics`](JSON-RPC-API-Methods#debug_metrics) JSON-RPC API method. |
@ -0,0 +1 @@ |
||||
#TODO |
@ -0,0 +1 @@ |
||||
#TODO |
@ -0,0 +1,17 @@ |
||||
description: Using Pantheon for PoW CPU mining |
||||
<!--- END of page meta data --> |
||||
|
||||
# Mining |
||||
|
||||
Start Pantheon with the following options to enable CPU mining: |
||||
```bash |
||||
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: |
||||
|
||||
* [`miner_start`](../Reference/JSON-RPC-API-Methods.md#miner_start) to start mining. |
||||
* [`miner_stop`](../Reference/JSON-RPC-API-Methods.md#miner_stop) to stop mining. |
||||
* [`eth_mining`](../Reference/JSON-RPC-API-Methods.md#eth_mining) to determine whether the client is actively mining new blocks. |
@ -0,0 +1,253 @@ |
||||
description: Using RPC Pub/Sub with Pantheon Web Socket API |
||||
<!--- END of page meta data --> |
||||
|
||||
# RPC Pub/Sub |
||||
|
||||
## Introduction |
||||
|
||||
Use the RPC Pub/Sub methods over [WebSockets](../Reference/Using-JSON-RPC-API.md#endpoint-address-and-port) |
||||
to wait for events instead of polling for them. For example, if a Dapp submits a transaction to the network, |
||||
you can use the RPC Pub/Sub interface to wait for the transaction confirmation followed by a specified |
||||
number of new blocks before confirming the transaction to the user. |
||||
|
||||
The RPC Pub/Sub methods are: |
||||
|
||||
* `eth_subscribe` - call to create a subscription for specific events. |
||||
* `eth_unsubscribe` - call to cancel a subscription. |
||||
* `eth_subscription` - invoked to publish event notifications to your client. |
||||
|
||||
!!!info |
||||
Notifications are published by `eth_subscription`; you do not need to call `eth_subscription`. |
||||
|
||||
!!!important |
||||
Unlike other [JSON RPC-API methods](../Reference/JSON-RPC-API-Methods.md), |
||||
the RPC Pub/Sub methods cannot be called over HTTP as well as WebSockets. |
||||
|
||||
### Subscription ID |
||||
|
||||
`eth_subscribe` returns a subscription ID for each subscription created. Notifications include the subscription ID. |
||||
|
||||
|
||||
!!!example |
||||
For example, to create a synchonizing subscription |
||||
|
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["syncing"]} |
||||
``` |
||||
The result includes the subscription ID of `"0x1"`: |
||||
```json |
||||
{"jsonrpc":"2.0","id":1,"result":"0x1"} |
||||
``` |
||||
The notifications also include the subscription ID of `"0x1"`: |
||||
```json |
||||
{"jsonrpc":"2.0","method":"eth_subscription","params":{"subscription":"0x1","result":{"startingBlock":"0x0","currentBlock":"0x50","highestBlock":"0x343c19"}}} |
||||
``` |
||||
|
||||
### Notifications when Synchronizing |
||||
|
||||
Subscribing to some events (for example, logs) can cause a flood of notifications while the node is synchronizing. |
||||
|
||||
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 the limit of ==10,000==, the connection is closed. |
||||
|
||||
## Subscribing |
||||
|
||||
Use `eth_subscribe` to create subscriptions for the following event types: |
||||
|
||||
* [New headers](#new-headers) |
||||
* [Logs](#logs) |
||||
* [Pending transactions](#pending-transactions) |
||||
* [Sychronizng](#synchronizing) |
||||
|
||||
If the WebSockets connection is closed, all subscriptions are removed. |
||||
|
||||
### New Headers |
||||
|
||||
Use the `newHeads` parameter with `eth_subscribe` to be notified each time a new header is added to the blockchain. |
||||
|
||||
If a chain reorganization occurs, the subscription publishes notifications for headers in the new chain. |
||||
This means the subscription can publish notifications for multiple headers at the same height on the blockchain. |
||||
|
||||
The new headers notification returns [Block Objects](Objects#block-object). Use the `logsBloom` parameter |
||||
to filter blocks to determine which blocks have logs of interest to you. |
||||
|
||||
!!!example |
||||
To subscribe to new header notifications: |
||||
|
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["newHeads"]} |
||||
``` |
||||
|
||||
Example result: |
||||
```json |
||||
{"jsonrpc":"2.0","id":2,"result":"0x1"} |
||||
``` |
||||
|
||||
Example notification: |
||||
```json |
||||
{ |
||||
"jsonrpc": "2.0", |
||||
"method": "eth_subscription", |
||||
"params":{ |
||||
"subscription":"0x1", |
||||
"result": { |
||||
"number":"0x40c22", |
||||
"hash":"0x16af2ee1672203c7ac13ff280822008be0f38e1e5bdc675760015ae3192c0e3a", |
||||
"parentHash":"0x1fcf5dadfaf2ab4d985eb05d40eaa23605b0db25d736610c4b87173bfe438f91", |
||||
"nonce":"0x0000000000000000", |
||||
"sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", |
||||
"logsBloom":"0x00008000000000080000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000040000000000000000000000000000000000000000001000000000000000000000040000000000000000000000000000000000000400000000010000000000000000100000000000020000000000000000000000000000000000010000000000000000000000000000000000000000000", |
||||
"transactionsRoot":"0x5b2e3c1a49352f1ca9fb5dfe74b7ffbbb6d70e23a12693444e26058d8a8e6296", |
||||
"stateRoot":"0xbe8d3bc58bd982421a3ea8b66753404502df0f464ae78a17661d157c406dd38b", |
||||
"receiptsRoot":"0x81b175ec1f4d44fbbd6ba08f1bd3950663b307b7cb35751c067b535cc0b58f12", |
||||
"miner":"0x0000000000000000000000000000000000000000", |
||||
"difficulty":"0x1", |
||||
"totalDifficulty":"0x7c16e", |
||||
"extraData":"0xd783010600846765746887676f312e372e33856c696e757800000000000000002160f780bb1f61eda045c67cdb1297ba37d8349df8035533cb0cf82a7e45f23f3d72bbec125a9f499b3eb110b7d1918d466cb2ede90b38296cfe2aaf452c513f00", |
||||
"size":"0x3a1", |
||||
"gasLimit":"0x47e7c4", |
||||
"gasUsed":"0x11ac3a", |
||||
"timestamp":"0x592afc24", |
||||
"uncles":[], |
||||
"transactions":["0x419c69d21b14e2e8f911def22bb6d0156c876c0e1c61067de836713043364d6c","0x70a5b2cb2cee6e0b199232a1757fc2a9d6053a4691a7afef8508fd88aeeec703","0x4b3035f1d32339fe1a4f88147dc197a0fe5bbd63d3b9dec2dad96a3b46e4fddd"] |
||||
} |
||||
} |
||||
} |
||||
``` |
||||
|
||||
#### Logs |
||||
|
||||
Use the `logs` parameter with `eth_subscribe` to be notified of logs included in new blocks. |
||||
|
||||
Logs subscriptions have an `object` parameter 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. |
||||
|
||||
If a chain reorganization occurs, the subscription publishes notifications for logs from the old chain |
||||
with the `removed` property in the [log object](../Reference/JSON-RPC-API-Objects.md#log-object) set to `true`. |
||||
This means the subscription can publish notifications for multiple logs for the same transaction. |
||||
|
||||
The logs subscription returns [Log objects](../Reference/JSON-RPC-API-Objects.md#log-object). |
||||
|
||||
!!!exemple |
||||
To subscribe to all logs notifications: |
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["logs",{}]} |
||||
``` |
||||
To subscribe to logs for a specific address and topic: |
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["logs", {"address": "0x8320fe7702b96808f7bbc0d4a888ed1468216cfd", "topics": ["0xd78a0cb8bb633d06981248b816e7bd33c2a35a6089241d099fa519e361cab902"]}]} |
||||
``` |
||||
|
||||
Example result: |
||||
```json |
||||
{"jsonrpc":"2.0","id":1,"result":"0x2"} |
||||
``` |
||||
Example notification: |
||||
```json |
||||
{ |
||||
"jsonrpc":"2.0", |
||||
"method":"eth_subscription", |
||||
"params":{ |
||||
"subscription":"0x2", |
||||
"result":{ |
||||
"logIndex":"0x0", |
||||
"removed":false, |
||||
"blockNumber":"0x2174", |
||||
"blockHash":"0x7bc83837534aa13df55ff7db77784b1d1ba666d4c4bdd223cae9fe09c7c37eba", |
||||
"transactionHash":"0x942179373e413824c6bc7045e92295aff91b679215446549b4aeb084da46495b", |
||||
"transactionIndex":"0x0", |
||||
"address":"0x9b8397f1b0fecd3a1a40cdd5e8221fa461898517", |
||||
"data":"0x", |
||||
"topics":["0x199cd93e851e4c78c437891155e2112093f8f15394aa89dab09e38d6ca072787","0x0000000000000000000000000000000000000000000000000000000000000005"] |
||||
} |
||||
} |
||||
} |
||||
``` |
||||
|
||||
#### Pending Transactions |
||||
|
||||
Use the `newPendingTransactions` parameter with `eth_subscribe` to be notified of new pending transactions of which your node is aware. |
||||
|
||||
The pending transactions subscription returns the transaction hashes of the pending transactions. |
||||
|
||||
If a chain reorganization occurs, transactions are resubmitted to be included in the new canonical chain. |
||||
This means the subscription can publish notifications for the same pending transaction more than once. |
||||
|
||||
!!!example |
||||
To subscribe to pending transaction notifications: |
||||
|
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["newPendingTransactions"]} |
||||
``` |
||||
|
||||
Example result: |
||||
```json |
||||
{"jsonrpc":"2.0","id":1,"result":"0x1"} |
||||
``` |
||||
|
||||
|
||||
Example notification: |
||||
```json |
||||
{ |
||||
"jsonrpc":"2.0", |
||||
"method":"eth_subscription", |
||||
"params":{ |
||||
"subscription":"0x1", |
||||
"result":"0x5705bc8bf875ff03e98adb98489428835892dc6ba6a6b139fee1becbc26db0b8" |
||||
} |
||||
} |
||||
``` |
||||
|
||||
#### Synchronizing |
||||
|
||||
Use the `syncing` parameter with `eth_subscribe` to be notified about synchronization progress. |
||||
|
||||
The sychronizing subscription either returns `false` indicating the synchronization has finished |
||||
or an `object` indicating the synchronization progress. |
||||
|
||||
!!!example |
||||
To subscribe to synchronizing notifications: |
||||
```json |
||||
{"id": 1, "method": "eth_subscribe", "params": ["syncing"]} |
||||
``` |
||||
|
||||
Example result: |
||||
```json |
||||
{"jsonrpc":"2.0","id":1,"result":"0x4"} |
||||
``` |
||||
|
||||
Example notification: |
||||
|
||||
```json |
||||
{ |
||||
"jsonrpc":"2.0", |
||||
"method":"eth_subscription", |
||||
"params":{ |
||||
"subscription":"0x4", |
||||
"result":{ |
||||
"startingBlock":"0x0", |
||||
"currentBlock":"0x3e80", |
||||
"highestBlock":"0x67b93c" |
||||
} |
||||
} |
||||
} |
||||
``` |
||||
|
||||
## Unsubscribing |
||||
|
||||
Use the [subscription ID](#subscription-id) with `eth_unsubscribe` to cancel a subscription. |
||||
|
||||
!!!example |
||||
To unsubscribe from a subsciption with subscription ID of `0x1`: |
||||
```json |
||||
{"id": 1, "method": "eth_unsubscribe", "params": ["0x1"]} |
||||
``` |
||||
|
||||
`eth_unsubscribe` returns `true` if subscription succuessfully unsubscribed; otherwise, an error is returned. |
||||
|
||||
Example result: |
||||
```json |
||||
{"jsonrpc":"2.0","id":1,"result":true} |
||||
``` |
@ -0,0 +1 @@ |
||||
#TODO |
@ -0,0 +1,158 @@ |
||||
description: Some use cases of creating transactions on a Pantheon network |
||||
<!--- END of page meta data --> |
||||
|
||||
# Creating and Sending Transactions |
||||
|
||||
You can send signed transactions using the [`eth_sendRawTransaction`](../Reference/JSON-RPC-API-Methods.md#eth_sendrawtransaction) JSON-RPC API method. |
||||
|
||||
These examples describe how to create a signed raw transaction that can be passed to [`eth_sendRawTransaction`](../Reference/JSON-RPC-API-Methods.md#eth_sendrawtransaction). |
||||
|
||||
!!!tip |
||||
To avoid exposing your private keys, create signed transactions offline. |
||||
|
||||
The examples use the following libraries to create signed transactions: |
||||
|
||||
* [web3.js](https://github.com/ethereum/web3.js/) |
||||
* [ethereumjs](https://github.com/ethereumjs/ethereumjs-tx) |
||||
|
||||
!!!info |
||||
Other libraries (such as [web3j](https://github.com/web3j/web3j) or [ethereumj](https://github.com/ethereum/ethereumj)) |
||||
and tools (such as [MyEtherWallet](https://kb.myetherwallet.com/offline/making-offline-transaction-on-myetherwallet.html) |
||||
or [MyCrypto](https://mycrypto.com/)) can also be used to create signed transactions. |
||||
|
||||
Example Javascript scripts are provided to create signed raw transaction strings to: |
||||
|
||||
* [Send ether](#sending-ether) |
||||
* [Deploy a contract](#deploying-a-contract) |
||||
|
||||
!!!attention |
||||
[Node.js](https://nodejs.org/en/download/) must be installed to run these Javascript scripts. |
||||
|
||||
The example Javascript scripts can be used to create raw transactions to send in the private network created |
||||
by the [Private Network Quickstart](../Getting-Started/Private-Network-Quickstart.md). |
||||
|
||||
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 Javascript script. |
||||
|
||||
```bash |
||||
$ node create_signed_raw_transaction.js |
||||
``` |
||||
|
||||
To send a signed transaction, run: |
||||
```bash |
||||
$ 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. |
||||
|
||||
!!!example |
||||
```bash |
||||
$ 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 |
||||
|
||||
!!!example |
||||
|
||||
The following is an example of JavaScript that displays a signed transaction string to send ether. |
||||
|
||||
```javascript linenums="1" |
||||
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 |
||||
|
||||
!!!example |
||||
The following is an example of JavaScript that displays a signed raw transaction string to deploy a contract. |
||||
|
||||
```javascript linenums="1" |
||||
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](../Reference/JSON-RPC-API-Methods.md#eth_call) or [eth_sendRawTransaction](../Reference/JSON-RPC-API-Methods.md#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) |
@ -0,0 +1,2 @@ |
||||
# -*- coding: utf-8 -*- |
||||
exclude_patterns = ['/ethereum/referencetests'] |
@ -0,0 +1,10 @@ |
||||
{% extends "base.html" %} |
||||
{% block content %} |
||||
|
||||
<p style="text-align: center;font-size: 3em"><i class="md-icon">account_balance</i></p> |
||||
<h1 id="404-page-not-found" style="text-align: center">404</h1> |
||||
<p style="text-align: center"><strong>Deity not found in the Pantheon</strong></p> |
||||
<p style="text-align: center">Try the <a href="/">homepage</a>, or use the search field on the top right of this documentation.</p> |
||||
<p style="text-align: center">If you think we made a mistake and deleted a page that should be here, then please tell us on <a href="https://gitter.im/PegaSysEng/pantheon">Gitter</a> or create an issue in <a href="{{ config.repo_url + '/issues' | url }}">Pantheon Github repository</a>.</p> |
||||
|
||||
{% endblock %} |
After Width: | Height: | Size: 32 KiB |
@ -0,0 +1,146 @@ |
||||
<!-- |
||||
Copyright (c) 2016-2018 Martin Donath <martin.donath@squidfunk.com> |
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy |
||||
of this software and associated documentation files (the "Software"), to |
||||
deal in the Software without restriction, including without limitation the |
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
||||
sell copies of the Software, and to permit persons to whom the Software is |
||||
furnished to do so, subject to the following conditions: |
||||
|
||||
The above copyright notice and this permission notice shall be included in |
||||
all copies or substantial portions of the Software. |
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
||||
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE |
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS |
||||
IN THE SOFTWARE. |
||||
--> |
||||
|
||||
{% import "partials/language.html" as lang with context %} |
||||
|
||||
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous"> |
||||
|
||||
<style> |
||||
.feedback{ |
||||
padding: 1em; |
||||
text-align: center; |
||||
background-color: {{config.extra.support.footer_layout.background_color}}; |
||||
} |
||||
.feedback a { |
||||
color: {{config.extra.support.footer_layout.links_color}} !important; |
||||
} |
||||
.md-nav--secondary .md-nav__item .md-nav__item a.md-nav__link { |
||||
font-weight: normal; |
||||
font-size: inherit; |
||||
} |
||||
.md-nav--secondary a.md-nav__link { |
||||
font-weight: bolder; |
||||
<!--font-size: larger;--> |
||||
} |
||||
.rst-versions { |
||||
border-color: lightseagreen !important; |
||||
border-style: solid !important; |
||||
font-size: large; |
||||
} |
||||
|
||||
.rst-versions .rst-current-version { |
||||
background-color: #475c64 !important; |
||||
} |
||||
|
||||
.headerlink { |
||||
font-family: "Font Awesome 5 Free"; |
||||
font-weight: 900; |
||||
font-size: small; |
||||
} |
||||
</style> |
||||
|
||||
<div class="feedback md-typeset"> |
||||
Questions or feedback? You can discuss issues and obtain free support on <a href="{{config.extra.support.gitter}}">Pegasys Pantheon Gitter room</a>. |
||||
<br/> |
||||
For paid professional support by <a href="https://pegasys.tech/">PegaSys</a>, contact us at <a href="mailto:{{config.extra.support.email}}">{{config.extra.support.email}}</a> |
||||
</div> |
||||
|
||||
<!-- Application footer --> |
||||
<footer class="md-footer"> |
||||
|
||||
<!-- Link to previous and/or next page --> |
||||
{% if page.previous_page or page.next_page %} |
||||
<div class="md-footer-nav"> |
||||
<nav class="md-footer-nav__inner md-grid"> |
||||
|
||||
<!-- Link to previous page --> |
||||
{% if page.previous_page %} |
||||
<a href="{{ page.previous_page.url | url }}" |
||||
title="{{ page.previous_page.title }}" |
||||
class="md-flex md-footer-nav__link md-footer-nav__link--prev" |
||||
rel="prev"> |
||||
<div class="md-flex__cell md-flex__cell--shrink"> |
||||
<i class="md-icon md-icon--arrow-back |
||||
md-footer-nav__button"></i> |
||||
</div> |
||||
<div class="md-flex__cell md-flex__cell--stretch |
||||
md-footer-nav__title"> |
||||
<span class="md-flex__ellipsis"> |
||||
<span class="md-footer-nav__direction"> |
||||
{{ lang.t("footer.previous") }} |
||||
</span> |
||||
{{ page.previous_page.title }} |
||||
</span> |
||||
</div> |
||||
</a> |
||||
{% endif %} |
||||
|
||||
<!-- Link to next page --> |
||||
{% if page.next_page %} |
||||
<a href="{{ page.next_page.url | url }}" |
||||
title="{{ page.next_page.title }}" |
||||
class="md-flex md-footer-nav__link md-footer-nav__link--next" |
||||
rel="next"> |
||||
<div class="md-flex__cell md-flex__cell--stretch |
||||
md-footer-nav__title"> |
||||
<span class="md-flex__ellipsis"> |
||||
<span class="md-footer-nav__direction"> |
||||
{{ lang.t("footer.next") }} |
||||
</span> |
||||
{{ page.next_page.title }} |
||||
</span> |
||||
</div> |
||||
<div class="md-flex__cell md-flex__cell--shrink"> |
||||
<i class="md-icon md-icon--arrow-forward |
||||
md-footer-nav__button"></i> |
||||
</div> |
||||
</a> |
||||
{% endif %} |
||||
</nav> |
||||
</div> |
||||
{% endif %} |
||||
|
||||
<!-- Further information --> |
||||
<div class="md-footer-meta md-typeset"> |
||||
<div class="md-footer-meta__inner md-grid"> |
||||
|
||||
<!-- Copyright and theme information --> |
||||
<div class="md-footer-copyright" style="padding-top: 0px; padding-bottom: 0px;"> |
||||
{% if config.copyright %} |
||||
<div class="md-footer-copyright__highlight"> |
||||
{{ config.copyright }} |
||||
</div> |
||||
{% endif %} |
||||
</div> |
||||
|
||||
<!-- Social links --> |
||||
{% block social %} |
||||
{% include "partials/social.html" %} |
||||
{% endblock %} |
||||
</div> |
||||
</div> |
||||
</footer> |
||||
|
||||
<script |
||||
src="https://code.jquery.com/jquery-1.12.4.min.js" |
||||
integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" |
||||
crossorigin="anonymous"></script> |
@ -0,0 +1,33 @@ |
||||
{% import "partials/language.html" as lang with context %} |
||||
<nav class="md-nav md-nav--secondary"> |
||||
{% set toc_ = page.toc %} |
||||
{% if toc_ | first is defined and "\x3ch1 id=" in page.content %} |
||||
{% set toc_ = (toc_ | first).children %} |
||||
{% endif %} |
||||
{% if toc_ | first is defined %} |
||||
<!--<label class="md-nav__title" for="__toc">{{ lang.t("toc.title") }}</label>--> |
||||
<ul class="md-nav__list" data-md-scrollfix> |
||||
{% for toc_item in toc_ %} |
||||
{% include "partials/toc-item.html" %} |
||||
{% endfor %} |
||||
{% if page.meta.source and page.meta.source | length > 0 %} |
||||
<li class="md-nav__item"> |
||||
<a href="#__source" title="{{ lang.t('meta.source') }}" class="md-nav__link md-nav__link--active"> |
||||
{{ lang.t("meta.source") }} |
||||
</a> |
||||
</li> |
||||
{% endif %} |
||||
{% set disqus = config.extra.disqus %} |
||||
{% if page and page.meta and page.meta.disqus is string %} |
||||
{% set disqus = page.meta.disqus %} |
||||
{% endif %} |
||||
{% if not page.is_homepage and disqus %} |
||||
<li class="md-nav__item"> |
||||
<a href="#__comments" title="{{ lang.t('meta.comments') }}" class="md-nav__link md-nav__link--active"> |
||||
{{ lang.t("meta.comments") }} |
||||
</a> |
||||
</li> |
||||
{% endif %} |
||||
</ul> |
||||
{% endif %} |
||||
</nav> |
@ -0,0 +1,19 @@ |
||||
!!! 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. |
||||
|
||||
!!! example "Account 1 (Miner Coinbase Account)" |
||||
* Address: `0xfe3b557e8fb62b89f4916b721be55ceb828dbd73` |
||||
* Private key : ==0x8f2a55949038a9610f50fb23b5883af3b4ecb3c3bb792cbcefbd1542c692be63== |
||||
* Initial balance : `0xad78ebc5ac6200000` (200000000000000000000 in decimal) |
||||
|
||||
!!! example "Account 2" |
||||
* Address: `0x627306090abaB3A6e1400e9345bC60c78a8BEf57` |
||||
* Private key : ==0xc87509a1c067bbde78beb793e6fa76530b6382a4c0241e5e4a9ec0a0f44dc0d3== |
||||
* Initial balance : `0x90000000000000000000000` (2785365088392105618523029504 in decimal) |
||||
|
||||
!!! example "Account 3" |
||||
* Address: `0xf17f52151EbEF6C7334FAD080c5704D77216b732` |
||||
* Private key : ==0xae6ae8e5ccbfb04590405997ee2d52d2b330726137b875053c36d94e974d162f== |
||||
* Initial balance : `0x90000000000000000000000` (2785365088392105618523029504 in decimal) |
@ -0,0 +1,26 @@ |
||||
title: Pantheon Enterprise Ethereum client |
||||
description: Pantheon is an open-source Enterprise 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. |
||||
<!--- END of page meta data --> |
||||
|
||||
## 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](Reference/Pantheon-CLI-Syntax.md) and [JSON-RPC API](Reference/JSON-RPC-API.md) 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 |
||||
|
||||
## What does Pantheon support? |
||||
|
||||
The Pantheon client supports common smart contract and Dapp development, deployment, and operational use cases, using tools such as [Truffle](http://truffleframework.com/), [Remix](https://github.com/ethereum/remix), and [web3j](https://web3j.io/). The client supports common JSON-RPC API methods such as eth, net, web3, debug, and miner. |
||||
|
||||
Pantheon doesn't support [Account management](Using-Pantheon/Account-Management.md). |
@ -0,0 +1,7 @@ |
||||
mkdocs>=1.0 |
||||
pymdown-extensions==6.0 |
||||
mkdocs-material>=3.1 |
||||
Markdown==3.0.1 |
||||
markdown-fenced-code-tabs==1.0.5 |
||||
markdown-include==0.5.1 |
||||
MarkupSafe==1.1.0 |
Loading…
Reference in new issue