Initial web3js-eea client library docs (#1558)

Signed-off-by: Adrian Sutton <adrian.sutton@consensys.net>
pull/2/head
MadelineMurray 5 years ago committed by GitHub
parent 49e42d28f6
commit c95c74af1d
  1. 13
      docs/Privacy/Private-Transactions/Creating-Sending-Private-Transactions.md
  2. 15
      docs/Privacy/Private-Transactions/eeajs-Multinode-example.md
  3. 59
      docs/Privacy/Private-Transactions/eeajs.md
  4. 5
      mkdocs.yml

@ -0,0 +1,13 @@
description: Creating and sending private transactions
<!--- END of page meta data -->
# Creating and Sending Private Transactions
To create and send private transactions use one of:
* [web3.js-eea client library](eeajs.md)
* [`eea_sendTransaction` with EthSigner](https://docs.ethsigner.pegasys.tech/en/latest/Using-EthSigner/Using-EthSigner/)
!!! note
Private transactions either deploy contracts or call contract functions.
Ether transfer transactions cannot be private.

@ -1,18 +1,9 @@
description: Creating and sending private transactions
description: web3.js-eea client library multinode example
<!--- END of page meta data -->
# Creating and Sending Private Transactions
# Using Multinode Example in web3.js-eea Client Library
The [EEA JavaScript library](https://github.com/PegaSysEng/eeajs) is provided to create and send signed
RLP-encoded private transactions.
!!! note
Private transactions either deploy contracts or call contract functions.
Ether transfer transactions cannot be private.
## Using Multinode Example
To use the examples provided in EEA JS library with [your privacy network](Configuring-Privacy.md):
To use the examples provided in EEA JS library with [your privacy network](../Configuring-Privacy.md):
1. Clone the **PegaSysEng/eeajs** repository:
```bash

@ -0,0 +1,59 @@
description: web3.js-eea Client Library
<!--- END of page meta data -->
# web3.js-eea Client Library
The [web3.js-eea library](https://github.com/PegaSysEng/eeajs) adds an additional property to your web3
instance by extending [web3](https://github.com/ethereum/web3.js/). Use the library to create and send
RLP-encoded transactions using JSON-RPC.
!!! note
web3.js-eea supports JSON-RPC over HTTP only.
## Prerequisites
- [Node.js (version > 10)](https://nodejs.org/en/download/)
## Add web3.js-eea to Project
```bash
npm install web3-eea
```
## Initialize EEA Client
Initilize your EEA client where:
* `<JSON-RPC HTTP endpoint>` is the JSON-RPC HTTP endpoint of your Pantheon node. Specified by the
[`--rpc-http-host`](../../Reference/Pantheon-CLI-Syntax.md#rpc-http-host) and [`--rpc-http-port`](../../Reference/Pantheon-CLI-Syntax.md#rpc-http-port)
command line options.
* `<chain_id>` is the [chain ID](../../Configuring-Pantheon/NetworkID-And-ChainID.md) of your network.
!!! example
```js tab="Syntax"
const EEAClient = require("web3-eea");
const web3 = new EEAClient(new Web3("<JSON-RPC HTTP endpoint>", <chain_id>);
```
```js tab="Example"
const EEAClient = require("web3-eea");
const web3 = new EEAClient(new Web3("http://localhost:8545", 2018);
```
## Deploying a Contract with sendRawTransaction
To deploy a private contract, you need the contract binary. You can use [Solidity](https://solidity.readthedocs.io/en/develop/using-the-compiler.html)
to get the contract binary.
!!! example "Deploying a Contract with sendRawTransaction"
```js
const contractOptions = {
data: `0x123`, // contract binary
privateFrom: "orionNode1PublicKey",
privateFor: ["orionNode3PublicKey"],
privateKey: "pantheonNode1PrivateKey"
};
return web3.eea.sendRawTransaction(contractOptions);
```
The transaction hash is returned. To get the private transaction receipt, use `web3.eea.getTransactionReceipt(txHash)`.

@ -101,7 +101,10 @@ nav:
- Overview: Privacy/Privacy-Overview.md
- Processing Private Transactions: Privacy/Private-Transaction-Processing.md
- Configuring a Privacy-Enabled Network: Privacy/Configuring-Privacy.md
- Creating and Sending Private Transactions: Privacy/Creating-Sending-Private-Transactions.md
- Creating and Sending Private Transactions:
- Overview: Privacy/Private-Transactions/Creating-Sending-Private-Transactions.md
- web3.js-eea Client Library: Privacy/Private-Transactions/eeajs.md
- web3.js-eea Multinode Example: Privacy/Private-Transactions/eeajs-Multinode-example.md
- Quickstart for Private Transactions: Privacy/Privacy-Quickstart.md
- Permissions:
- Overview: Permissions/Permissioning-Overview.md

Loading…
Cancel
Save