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

Added privacy group methods for web3.js-eea #1761

Merged
merged 32 commits into from
Jul 27, 2019
Merged
Changes from 1 commit
Commits
Show all changes
32 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
7c80061
Added priv group methods
MadelineMurray Jul 25, 2019
c7d3d2a
Merge branch 'master' into privGroupweb3jsEEA
MadelineMurray Jul 25, 2019
af90e99
Merge branch 'master' into privGroupweb3jsEEA
MadelineMurray Jul 26, 2019
2a90cd1
Merge branch 'master' into privGroupweb3jsEEA
MadelineMurray Jul 27, 2019
fd30c56
Merge branch 'master' into privGroupweb3jsEEA
MadelineMurray Jul 27, 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
WIP:
  • Loading branch information
MadelineMurray committed Jun 16, 2019
commit 0bb7329b29448b85440fd6ccabd1b2c2449110a9
138 changes: 72 additions & 66 deletions docs/Reference/web3js-eea-Methods.md
Original file line number Diff line number Diff line change
@@ -1,49 +1,28 @@
description: web3.js-eea methods reference
description: web3js-eea methods reference
<!--- END of page meta data -->

M
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)

## Options Parameter

The Options parameter is used by:

* [`generatePrivacyGroup`](#generateprivacygroup)
* [`sendRawParameter`](#sendrawtransaction)
* [`getTransactionCount`](#gettransactioncount)
* [`sendRawParameter`](#sendrawtransaction)

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`.
* `to` : Optional. Contract address to which to send the transaction. If not provided, the transaction
is a contract deployment transaction
* `to` : Optional. Contract address to which to send the transaction. Do not specify for contract deployment transactions
* `data` : Transaction data

## getMakerTransaction

Gets the [privacy marker transaction](../Privacy/Private-Transaction-Processing.md) transaction receipt.

**Parameters**

`txHash` - `string` : Transaction hash of the private transaction
`retries` - `int` : Number of attempts to make to get the private marker transaction receipts
`delay` - `int` : Delay between retries (in seconds?)

**Returns**

`result` : Privacy marker transaction receipt (promise?)

!!! example
```bash tab="JS request"
eea.getMakerTransaction("tx hash -add", 5, 2)
```

```bash tab="Result"
Add this
```

## generatePrivacyGroup

Generates the privacy group ID. The privacy group ID is the RLP-encoded `privateFor` and `privateFrom` keys.
Expand All @@ -54,79 +33,106 @@ Generates the privacy group ID. The privacy group ID is the RLP-encoded `private

**Returns**

`string` : Privacy marker transaction receipt

!!! example
```bash tab="JS request"
add
```

```bash tab="Result"
add
```

## sendRawTransaction
`string` : Privacy group ID

Signs and sends a RLP-encoded private transaction to Pantheon using `eea_sendRawTransaction`.
!!! example
```bash"
const privacyGroupId = web3.eea.generatePrivacyGroup({
privateFrom: "A1aVtMxLCUHmBVHXoZzzBgPbW/wj5axDpW9X8l91SGo=",
privateFor: ["Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="]
});
```

## getMarkerTransaction

Gets the [privacy marker transaction](../Privacy/Private-Transaction-Processing.md) transaction receipt.

**Parameters**

[Transaction options](#options-parameter)
`txHash` - `string` : Transaction hash of the private transaction
`retries` - `int` : Number of attempts to make to get the private marker transaction receipts
`delay` - `int` : Delay between retries in milliseconds

**Returns**

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

!!! example
```bash tab="JS request"
add
```

```bash tab="Result"
add
```
`result` : Privacy marker transaction receipt

!!! example
```bash
const privateMarkerTransacion = web3.eea.getMarkerTransaction("0x9c41b3d44ed73511c82a9e2b1ef581eb797475c82f318ca2802358d3ba4a8274", 5, 100);
```

## getTransactionCount

Returns the number of transactions sent from the specified address for the privacy group (add link to privacy group content).
Returns the number of transactions sent from the specified address for the privacy group.

**Parameters**

[Transaction options](#options-parameter)

**Returns**

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

!!! example
```bash tab="JS request"
add
```

```bash tab="Result"
add
```

## getTransactionReceipt

Gets the private transaction receipt.
Gets the private transaction receipt using `eea_getTransactionReceipt`.

**Parameters**

`txHash` - `string` : Transaction hash of the private transaction
`enclavePublicKey` - `string` : Orion public key (same as privateFrom? what about privateFor?)
`enclavePublicKey` - `string` : `privateFrom` key for the transaction
`retries` - `int` : Number of attempts to make to get the private marker transaction receipts
`delay` - `int` : Delay between retries (in seconds?)
`delay` - `int` : Delay between retries in milliseconds

**Returns**

Private transaction receipt

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


```bash tab="Result"
add
```
## sendRawTransaction

Signs and sends a RLP-encoded private transaction to Pantheon using `eea_sendRawTransaction`.

**Parameters**

[Transaction options](#options-parameter)

**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);
```