Skip to content
This repository has been archived by the owner on Sep 26, 2019. It is now read-only.

Added information on EEA-compliant and Pantheon-extended privacy #1765

Merged
merged 30 commits into from
Jul 29, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
0ed474b
WIP
MadelineMurray Jun 13, 2019
0cd240a
WIP
MadelineMurray Jun 15, 2019
0bb7329
WIP:
MadelineMurray Jun 16, 2019
8e1cc0e
WIP
MadelineMurray Jun 29, 2019
3329412
Merge branch 'master' of https://github.com/PegaSysEng/pantheon into …
MadelineMurray Jun 29, 2019
d9d7716
Ready for review
MadelineMurray Jun 29, 2019
4edbf16
WIP
MadelineMurray Jul 12, 2019
3bd6f8d
WIP
MadelineMurray Jul 13, 2019
236afe8
Merge branch 'master' of https://github.com/PegaSysEng/pantheon into …
MadelineMurray Jul 15, 2019
7f58702
Merge branch 'master' of https://github.com/PegaSysEng/pantheon into …
MadelineMurray Jul 21, 2019
0787fe8
Added overview of privacy methods
MadelineMurray Jul 21, 2019
e99111d
Added method overviews
MadelineMurray Jul 21, 2019
c46761a
Reorganised privacy section
MadelineMurray Jul 21, 2019
e261569
Moved files
MadelineMurray Jul 22, 2019
12c3568
Rework
MadelineMurray Jul 22, 2019
a5ffe15
Merge branch 'privacyReorg' of https://github.com/MadelineMurray/pant…
MadelineMurray Jul 22, 2019
9834dde
Merge branch 'MadelineMurray-privacyReorg'
MadelineMurray Jul 22, 2019
f55ff08
Merge branch 'master' of https://github.com/PegaSysEng/pantheon into …
MadelineMurray Jul 22, 2019
da054a5
Merge branch 'MadelineMurray-privacyReorg'
MadelineMurray Jul 22, 2019
1ca598f
Merge branch 'managingPrivateTransactions' of https://github.com/Made…
MadelineMurray Jul 22, 2019
7e1f705
rework
MadelineMurray Jul 22, 2019
4acf168
Merge branch 'MadelineMurray-managingPrivateTransactions'
MadelineMurray Jul 22, 2019
2058cbd
Merge branch 'master' of https://github.com/PegaSysEng/pantheon
MadelineMurray Jul 23, 2019
1a86c07
Merge branch 'eeajsMethods' of https://github.com/MadelineMurray/pant…
MadelineMurray Jul 24, 2019
9319b04
Merge branch 'MadelineMurray-eeajsMethods'
MadelineMurray Jul 24, 2019
fcd5f38
fix conflict
MadelineMurray Jul 24, 2019
6d4f152
Merge branch 'master' of https://github.com/PegaSysEng/pantheon
MadelineMurray Jul 25, 2019
ba57ea5
Merge branch 'master' of https://github.com/PegaSysEng/pantheon
MadelineMurray Jul 26, 2019
f6e61c1
Added privacy group content
MadelineMurray Jul 26, 2019
b567991
Merge branch 'master' into legPanPrivacyGroups
MadelineMurray Jul 29, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Ready for review
  • Loading branch information
MadelineMurray committed Jun 29, 2019
commit d9d7716954d444befc9e4dcdedf716f077d54d1a
4 changes: 4 additions & 0 deletions docs/Privacy/Private-Transactions/eeajs.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,7 @@ to get the contract binary.
```

The transaction hash is returned. To get the private transaction receipt, use `web3.eea.getTransactionReceipt(txHash)`.

## web3.js-eea Methods

Refer to the [web3.js-eea reference documentation](../../Reference/web3js-eea-Methods.md).
100 changes: 51 additions & 49 deletions docs/Reference/web3js-eea-Methods.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
description: web3js-eea methods reference
<!--- END of page meta data -->

For more examples, refer to the following in the [webjs-eea repository](https://github.com/PegaSysEng/web3js-eea):

* [`deployContract.js`](https://github.com/PegaSysEng/web3js-eea/blob/master/example/multiNodeExample/deployContract.js)
* [`storeValueFromNode1.js`](https://github.com/PegaSysEng/web3js-eea/blob/master/example/multiNodeExample/storeValueFromNode1.js)
Use the [web3.js-eea library](https://github.com/PegaSysEng/eeajs) to [create and send
private transactions](../Privacy/Private-Transactions/eeajs.md).

## Options Parameter

Expand All @@ -19,7 +17,7 @@ The Options parameter has the following properties:
* `privateKey`: Ethereum private key with which to sign the transaction
* `privateFrom` : Orion public key
* `privateFor` : Orion public keys of recipients
* `nonce` : Optional. If not provided, is calculated using `eea_getTransctionCount`.
* `nonce` : Optional. If not provided, calculated using [`eea_getTransctionCount`](../Reference/Pantheon-API-Methods.md).
* `to` : Optional. Contract address to which to send the transaction. Do not specify for contract deployment transactions
* `data` : Transaction data

Expand All @@ -36,7 +34,7 @@ Generates the privacy group ID. The privacy group ID is the RLP-encoded `private
`string` : Privacy group ID

!!! example
```bash"
```bash
const privacyGroupId = web3.eea.generatePrivacyGroup({
privateFrom: "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=",
privateFor: ["Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="]
Expand All @@ -50,12 +48,14 @@ Gets the [privacy marker transaction](../Privacy/Private-Transaction-Processing.
**Parameters**

`txHash` - `string` : Transaction hash of the private transaction
`retries` - `int` : Number of attempts to make to get the private marker transaction receipts

`retries` - `int` : Number of attempts to make to get the private marker transaction receipt

`delay` - `int` : Delay between retries in milliseconds

**Returns**

`result` : Privacy marker transaction receipt
Privacy marker transaction receipt

!!! example
```bash
Expand All @@ -74,39 +74,42 @@ Returns the number of transactions sent from the specified address for the priva

`int` : Transaction count for that account (`privateKey`) and privacy group

!!! example
```bash tab="JS request"
return web3.eea
.getTransactionCount({
privateKey: pantheon.node1.privateKey,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
})
```
!!! example
```bash
return web3.eea
.getTransactionCount({
privateKey: pantheon.node1.privateKey,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
})
```

## getTransactionReceipt

Gets the private transaction receipt using `eea_getTransactionReceipt`.
Gets the private transaction receipt using [`eea_getTransactionReceipt`](../Reference/Pantheon-API-Methods.md#eea_gettransactionreceipt).

**Parameters**

`txHash` - `string` : Transaction hash of the private transaction
`enclavePublicKey` - `string` : `privateFrom` key for the transaction
`retries` - `int` : Optional. Number of attempts to make to get the private marker transaction receipts. Default is `300`.

`enclavePublicKey` - `string` : [`privateFrom` key for the transaction](#options-parameter)

`retries` - `int` : Optional. Number of attempts to make to get the private marker transaction receipt. Default is `300`.

`delay` - `int` : Optional. Delay between retries in milliseconds. Optional. Default is `1000`.

**Returns**

Private transaction receipt

!!! example
```bash
const privateTxReceipt = web3.eea.getTransactionReceipt("0x9c41b3d44ed73511c82a9e2b1ef581eb797475c82f318ca2802358d3ba4a8274", "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=");
```
!!! example
```bash
const privateTxReceipt = web3.eea.getTransactionReceipt("0x9c41b3d44ed73511c82a9e2b1ef581eb797475c82f318ca2802358d3ba4a8274", "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=");
```

## sendRawTransaction

Signs and sends a RLP-encoded private transaction to Pantheon using `eea_sendRawTransaction`.
Signs and sends a RLP-encoded private transaction to Pantheon using [`eea_sendRawTransaction`](Pantheon-API-Methods.md#eea_sendrawtransaction).

**Parameters**

Expand All @@ -115,28 +118,27 @@ Signs and sends a RLP-encoded private transaction to Pantheon using `eea_sendRaw
**Returns**

`string` : Transaction hash of the [`privacy marker transaction`](../Privacy/Private-Transaction-Processing.md)

!!! example
```bash tab="Contract Deployment Transaction"
const createPrivateEmitterContract = () => {
const contractOptions = {
data: `0x${binary}`,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
privateKey: pantheon.node1.privateKey
};
return web3.eea.sendRawTransaction(contractOptions);
};
```

```bash tab="Contract Invocation Transaction"
const functionCall = {
to: address,
data: functionAbi.signature + functionArgs,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
privateKey: pantheon.node1.privateKey
};
return web3.eea.sendRawTransaction(functionCall);
```

!!! example
```bash tab="Contract Deployment"
const createPrivateEmitterContract = () => {
const contractOptions = {
data: `0x${binary}`,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
privateKey: pantheon.node1.privateKey
};
return web3.eea.sendRawTransaction(contractOptions);
};
```

```bash tab="Contract Invocation"
const functionCall = {
to: address,
data: functionAbi.signature + functionArgs,
privateFrom: orion.node1.publicKey,
privateFor: [orion.node2.publicKey],
privateKey: pantheon.node1.privateKey
};
return web3.eea.sendRawTransaction(functionCall);
```