Skip to content

Commit

Permalink
Fix formatting issues (#1589)
Browse files Browse the repository at this point in the history
* Fix formatting issues

Signed-off-by: Alexandra Tran <[email protected]>

* other minor fixes

Signed-off-by: Alexandra Tran <[email protected]>

* Apply suggestions from code review

Co-authored-by: Joan E <[email protected]>
Signed-off-by: Alexandra Tran Carrillo <[email protected]>

---------

Signed-off-by: Alexandra Tran <[email protected]>
Signed-off-by: Alexandra Tran Carrillo <[email protected]>
Co-authored-by: Alexandra Tran <[email protected]>
Co-authored-by: Joan E <[email protected]>
  • Loading branch information
3 people authored May 9, 2024
1 parent cf66ca2 commit bb35f58
Show file tree
Hide file tree
Showing 30 changed files with 219 additions and 258 deletions.
40 changes: 18 additions & 22 deletions docs/private-networks/concepts/permissioning/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,27 +27,23 @@ To enable permissioning in your plugin, implement the `PermissioningService` int
```java
@AutoService(BesuPlugin.class)
public class TestPermissioningPlugin implements BesuPlugin {
PermissioningService service;

@Override
public void register(final BesuContext context) {
service = context.getService(PermissioningService.class).get();
}

@Override
public void start() {
service.registerNodePermissioningProvider((sourceEnode, destinationEnode) -> {
// perform logic for node permissioning
return true;
});

service.registerNodeMessagePermissioningProvider((destinationEnode, code) -> {
// perform logic for message permissioning
return true;
});
}

@Override
public void stop() {}
PermissioningService service;
@Override
public void register(final BesuContext context) {
service = context.getService(PermissioningService.class).get();
}
@Override
public void start() {
service.registerNodePermissioningProvider((sourceEnode, destinationEnode) -> {
// perform logic for node permissioning
return true;
});
service.registerNodeMessagePermissioningProvider((destinationEnode, code) -> {
// perform logic for message permissioning
return true;
});
}
@Override
public void stop() {}
}
```
63 changes: 26 additions & 37 deletions docs/private-networks/concepts/privacy/plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,46 +66,35 @@ Your plugin needs to register the `PrivateMarkerTransactionFactory` interface wh

## Register your plugin

To enable Besu to use your privacy plugin, you must implement the `PrivacyPluginService` interface and you must call `setPayloadProvider`.
To enable Besu to use your privacy plugin, implement the `PrivacyPluginService` interface and call `setPayloadProvider`.

```java

@AutoService(BesuPlugin.class)
public class TestPrivacyPlugin implements BesuPlugin {

private PrivacyPluginService service;

@Override
public void register(BesuContext context) {
service = context.getService(PrivacyPluginService.class).get();
}

@Override
public void start() {
service.setPayloadProvider(new PrivacyPluginPayloadProvider() {
@Override
public Bytes generateMarkerPayload(PrivateTransaction privateTransaction, String privacyUserId) {
// perform logic to serialize the payload of the marker transaction
// in this example we are serialising the private transaction using rlp https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
return org.hyperledger.besu.ethereum.privacy.PrivateTransaction.serialize(privateTransaction).encoded();
}

@Override
public Optional<PrivateTransaction> getPrivateTransactionFromPayload(Transaction transaction) {
// perform logic to deserialize payload from the marker transaction

final BytesValueRLPInput bytesValueRLPInput =
new BytesValueRLPInput(transaction.getPayload(), false);

return Optional.of(org.hyperledger.besu.ethereum.privacy.PrivateTransaction.readFrom(bytesValueRLPInput));
}
});
}

@Override
public void stop() {

}
private PrivacyPluginService service;
@Override
public void register(BesuContext context) {
service = context.getService(PrivacyPluginService.class).get();
}
@Override
public void start() {
service.setPayloadProvider(new PrivacyPluginPayloadProvider() {
@Override
public Bytes generateMarkerPayload(PrivateTransaction privateTransaction, String privacyUserId) {
// perform logic to serialize the payload of the marker transaction
// in this example we are serialising the private transaction using rlp https://ethereum.org/en/developers/docs/data-structures-and-encoding/rlp/
return org.hyperledger.besu.ethereum.privacy.PrivateTransaction.serialize(privateTransaction).encoded();
}
@Override
public Optional<PrivateTransaction> getPrivateTransactionFromPayload(Transaction transaction) {
// perform logic to deserialize payload from the marker transaction
final BytesValueRLPInput bytesValueRLPInput =
new BytesValueRLPInput(transaction.getPayload(), false);
return Optional.of(org.hyperledger.besu.ethereum.privacy.PrivateTransaction.readFrom(bytesValueRLPInput));
}
});
}
@Override
public void stop() {}
}

```
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,17 @@ description: Private transaction overview
Private transactions have the same parameters as public Ethereum transactions, with the following additions:

- `privateFrom` - The Tessera public key of the transaction sender.

- One of the following:

- `privateFor` - The Tessera public keys of the transaction recipients.

- `privacyGroupId` - [The privacy group to receive the transaction](../privacy-groups.md).

- `restriction` - Whether the private transaction is `restricted` or `unrestricted`:

- `restricted` - Only the nodes participating in the transaction receive and store the payload of the private transaction.

- `unrestricted` - All nodes in the network receive the payload of the private transaction, but only the nodes participating in the transaction can read the transaction.

:::info
Expand Down
6 changes: 1 addition & 5 deletions docs/private-networks/how-to/configure/contracts.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ tags:

To pre-deploy contracts when starting Besu, specify the contract code in the [genesis file](../../../public-networks/concepts/genesis-file.md).

:::tip Contract code in the genesis file

```json
```json title="Contract code in the genesis file"
{
...
"alloc": {
Expand All @@ -29,8 +27,6 @@ To pre-deploy contracts when starting Besu, specify the contract code in the [ge
}
```

:::

The contract code in the genesis file defines the:

- Address.
Expand Down
6 changes: 2 additions & 4 deletions docs/private-networks/how-to/configure/free-gas.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,15 @@ When starting nodes, set the [minimum gas price](../../../public-networks/refere

<Tabs>

<TabItem value="Command Line" label="Command Line" default>
<TabItem value="Command line" default>

```bash
--min-gas-price=0
```

</TabItem>

<TabItem value="Configuration File" label="Configuration File">
<TabItem value="Configuration file">

```bash
min-gas-price=0
Expand All @@ -91,8 +91,6 @@ min-gas-price=0

</Tabs>

# Command Line

:::danger Important

In a free gas network, ensure the [minimum gas price](../../../public-networks/reference/cli/options.md#min-gas-price) is set to zero for every node. Any node with a minimum gas price set higher than zero will silently drop transactions with a zero gas price. You can query a node's gas configuration using [`eth_gasPrice`](../../../public-networks/reference/api/index.md#eth_gasprice).
Expand Down
48 changes: 22 additions & 26 deletions docs/private-networks/how-to/monitor/opentelemetry.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ You can also install exporters that send system metrics to OpenTelemetry to moni
It is easiest to run the OpenTelemetry collector with Docker with the following command:
<Tabs>
<TabItem value="Syntax" label="Syntax" default>
<Tabs>
<TabItem value="Syntax" label="Syntax" default>
```bash
docker run -d \
Expand All @@ -128,9 +128,9 @@ You can also install exporters that send system metrics to OpenTelemetry to moni
otel/opentelemetry-collector-contrib:latest
```

</TabItem>

<TabItem value="Example" label="Example">
</TabItem>
<TabItem value="Example" label="Example">

```bash
docker run -d \
Expand All @@ -141,47 +141,43 @@ You can also install exporters that send system metrics to OpenTelemetry to moni
otel/opentelemetry-collector-contrib:latest
```

</TabItem>

</Tabs>
</TabItem>
</Tabs>

You can also refer to this [Docker-compose example](https://github.com/splunk/splunk-connect-for-ethereum/blob/989dc2ccae7d8235bf3ce2a83a18cf0cd1713294/examples/besu-sync/full-sync/docker-compose.yaml).

2. Start Besu with the [`--metrics-enabled`](../../../public-networks/reference/cli/options.md#metrics-enabled) and [`--metrics-protocol=opentelemetry`](../../../public-networks/reference/cli/options.md#metrics-protocol) options. For example, run the following command to start a single node:

<Tabs>

<TabItem value="Syntax" label="Syntax" default>
<Tabs>
<TabItem value="Syntax" label="Syntax" default>

```bash
OTEL_EXPORTER_OTLP_ENDPOINT=https://<host>:<port> besu --network=dev --miner-enabled --miner-coinbase <COINBASE ADDRESS> --rpc-http-cors-origins="all" --rpc-http-enabled --metrics-enabled --metrics-protocol=opentelemetry
```

</TabItem>

<TabItem value="Example" label="Example">
</TabItem>
<TabItem value="Example" label="Example">

```bash
OTEL_EXPORTER_OTLP_ENDPOINT=https://localhost:4317 besu --network=dev --miner-enabled --miner-coinbase fe3b557e8fb62b89f4916b721be55ceb828dbd73 --rpc-http-cors-origins="all" --rpc-http-enabled --metrics-enabled --metrics-protocol=opentelemetry
```

</TabItem>

</Tabs>
</TabItem>
</Tabs>

The [OpenTelemetry SDK](https://github.com/open-telemetry/opentelemetry-specification/blob/8f7cdb73618a0b3afa9532b8f8103d719e352781/specification/sdk-environment-variables.md) mandates how to configure the OpenTelemetry gRPC client, so data flows to the collector from Besu.

You can use the following environment variables:

| Name | Description | Required |
| --- | --- | --- |
| OTEL_EXPORTER_OTLP_ENDPOINT | OpenTelemetry Collector endpoint, of the form `https://host:port`. The default value is `https://localhost:4317` | Yes |
| OTEL_EXPORTER_OTLP_INSECURE | Whether to allow insecure connections for OpenTelemetry data. False by default. | No |
| Name | Description | Required |
|-------------------------------|-------------------------------------------------------------------------------------------------------------|----------|
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry Collector endpoint, of the form `https://host:port`. The default is `https://localhost:4317`. | Yes |
| `OTEL_EXPORTER_OTLP_INSECURE` | Whether to allow insecure connections for OpenTelemetry data. The default is `false`. | No |

<!-- Links -->

[Monitoring Besu synchronization to chain with Splunk]: https://github.com/splunk/splunk-connect-for-ethereum/tree/master/examples/besu-sync

<!--- END of page meta data -->

\*[APM]: Application Performance Monitoring
39 changes: 16 additions & 23 deletions docs/private-networks/how-to/monitor/splunk.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: Use Splunk
sidebar_position: 5
toc_max_heading_level: 2
description: Send Hyperledger Besu logs to Splunk
tags:
- private networks
Expand All @@ -14,18 +15,10 @@ Splunk can aggregate multiple logs in one place and run complex queries without

Options for running Splunk and Besu are:

- [Use Splunk](#use-splunk)
- [Developer Quickstart with Splunk](#developer-quickstart-with-splunk)
- [Splunk Connect for Ethereum Docker Compose](#splunk-connect-for-ethereum-docker-compose)
- [Requirements](#requirements)
- [Steps](#steps)
- [Use Splunk Enterprise as a Docker container](#use-splunk-enterprise-as-a-docker-container)
- [Prerequisites](#prerequisites)
- [Steps](#steps-1)
- [Run a Splunk Enterprise instance](#run-a-splunk-enterprise-instance)
- [Prerequisites](#prerequisites-1)
- [Steps](#steps-2)
- [Splunk options reference](#splunk-options-reference)
- [Developer Quickstart with Splunk](#developer-quickstart-with-splunk)
- [Splunk Connect for Ethereum Docker Compose](#splunk-connect-for-ethereum-docker-compose)
- [Use Splunk Enterprise as a Docker container](#use-splunk-enterprise-as-a-docker-container)
- [Run a Splunk Enterprise instance](#run-a-splunk-enterprise-instance)

## Developer Quickstart with Splunk

Expand Down Expand Up @@ -177,16 +170,16 @@ If running [Besu as a Docker container](../../get-started/install/run-docker-ima

| Name | Description | Required |
| --- | --- | --- |
| LOGGER | Set to `Splunk` to activate sending logs to Splunk. | Yes |
| HOST | Current host. If in a Docker environment, the default value is the docker container ID. Otherwise, the default value is `localhost`. | No |
| SPLUNK_URL | URL of the Splunk HTTP Event Collector. For example, use `https://localhost:8088` | Yes |
| SPLUNK_TOKEN | Authentication token, usually of the form `11111111-1111-1111-1111-111111111111` | Yes |
| SPLUNK_INDEX | [Index](https://docs.splunk.com/Splexicon:Index) to store logs. Defaults to `besu` | No |
| SPLUNK_SOURCE | [Source of the logs](https://docs.splunk.com/Splexicon:Source). Defaults to `besu` | No |
| SPLUNK_SOURCETYPE | [Source type of the logs](https://docs.splunk.com/Splexicon:Sourcetype). Defaults to `besu` | No |
| SPLUNK_BATCH_SIZE_BYTES | Size of a log batch in bytes. Defaults to `65536` | No |
| SPLUNK_BATCH_SIZE_COUNT | Size of a log batch in number of events. Defaults to `1000` | No |
| SPLUNK_BATCH_INTERVAL | Interval at which to send log batches. Defaults to `500` | No |
| SPLUNK_SKIPTLSVERIFY | Whether to check the Splunk instance TLS certificate when sending data. Defaults to `false` | No |
| `LOGGER` | Set to `Splunk` to activate sending logs to Splunk. | Yes |
| `HOST` | Current host. If in a Docker environment, the default value is the docker container ID. Otherwise, the default value is `localhost`. | No |
| `SPLUNK_URL` | URL of the Splunk HTTP Event Collector. For example, use `https://localhost:8088` | Yes |
| `SPLUNK_TOKEN` | Authentication token, usually of the form `11111111-1111-1111-1111-111111111111` | Yes |
| `SPLUNK_INDEX` | [Index](https://docs.splunk.com/Splexicon:Index) to store logs. Defaults to `besu` | No |
| `SPLUNK_SOURCE` | [Source of the logs](https://docs.splunk.com/Splexicon:Source). Defaults to `besu` | No |
| `SPLUNK_SOURCETYPE` | [Source type of the logs](https://docs.splunk.com/Splexicon:Sourcetype). Defaults to `besu` | No |
| `SPLUNK_BATCH_SIZE_BYTES` | Size of a log batch in bytes. Defaults to `65536` | No |
| `SPLUNK_BATCH_SIZE_COUNT` | Size of a log batch in number of events. Defaults to `1000` | No |
| `SPLUNK_BATCH_INTERVAL` | Interval at which to send log batches. Defaults to `500` | No |
| `SPLUNK_SKIPTLSVERIFY` | Whether to check the Splunk instance TLS certificate when sending data. Defaults to `false` | No |

[Create an event index]: https://docs.splunk.com/Documentation/Splunk/8.0.4/Indexer/Setupmultipleindexes#Create_events_indexes
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Private transactions either deploy contracts or call contract functions. Ether t

:::

## eea_sendRawTransaction
## `eea_sendRawTransaction`

[`eea_sendRawTransaction`](../../reference/api/index.md#eea_sendrawtransaction) distributes the private transaction to the participating nodes, and signs and submits the PMT, as described in [Private transaction processing](../../concepts/privacy/private-transactions/processing.md).

Expand All @@ -34,7 +34,7 @@ If [sending concurrent transactions](concurrent-private-transactions.md), you mu

:::

## priv_distributeRawTransaction
## `priv_distributeRawTransaction`

Use [`priv_distributeRawTransaction`](../../reference/api/index.md#priv_distributerawtransaction) instead of [`eea_sendRawTransaction`](#eea_sendrawtransaction) when sending [concurrent private transactions](concurrent-private-transactions.md).

Expand Down
Loading

0 comments on commit bb35f58

Please sign in to comment.