Send private transactions
Use the SDK or REST API to submit private transactions.
Prerequisites:
- Orchestrate running
- Chain registered on the Chain Registry
- Smart contract registered on Contract Registry
- Sender account generated in Orchestrate
- Privacy configured using Besu or GoQuorum.
Use the SDK
Prerequisites:
- Install the PegaSys Orchestrate JS client library.
Example code is available in the Orchestrate Node SDK repository examples directory.
Private transaction parameters for Besu and Orion
Like public transactions, Besu private transactions are sent using sendTansaction
and sendRawTransaction
.
Additional parameters are specified for private transactions:
If using Besu private transactions, Orchestrate does not directly communicate with Orion so configuring the private transaction manager is not required.
Specify the following additional parameters for Besu private transactions:
-
protocol
:ProtocolType.BesuOrion
; use Besu private transactions. -
privateFor
orprivacyGroupId
:privateFor
is an array of Orion public keys for private transaction recipients. SpecifyprivateFor
when using EEA private transactions.- Specify
privacyGroupId
when using Besu-extended private transactions.
-
privateFrom
; Orion public key of the sender.
Private transaction parameters for GoQuorum and Tessera
Like public transactions, GoQuorum private transactions are sent using sendTransaction
and sendRawTransaction
.
To send private transactions using Quorum and Tessera, Tessera must be configured as a private transaction manager.
Additional parameters are specified for Quorum private transactions:
-
protocol
:ProtocolType.QuorumTessera
; Use Quorum private transactions -
privateFor
; Array of Tessera public keys for private transaction recipients. -
privateFrom
; Tessera public key of the sender.
Use the REST API
You can send transactions or deploy contracts privately using the REST API.
Send the private transaction
Orchestrate supports Orion and Tessera private transaction managers. Use the protocol
parameter to specify which manager to use.
The example sends a private transaction to the /transaction/send
endpoint on the Chain Registry service.
Example
{
"chain": "besu",
"params": {
"to": "0xf17f52151EbEF6C7334FAD080c5704D77216b732",
"from": "0x55DF86B4dB5C6a04b4441e27dB5243A5F4d759bB",
"methodSignature": "increment(int256)",
"args": [2],
"protocol": "Orion",
"privateFor": ["k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8="],
"privateFrom": "Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs="
}
}
{
"uuid": "94590feb-b69f-4831-84a8-45d0b819d9f7",
"idempotencyKey": "WweOFvUGLzvbwQyj",
"chain": "besu",
"params": {
"from": "0x55DF86B4dB5C6a04b4441e27dB5243A5F4d759bB",
"to": "0xf17f52151EbEF6C7334FAD080c5704D77216b732",
"methodSignature": "increment(int256)",
"args": [
2
],
"protocol": "Orion",
"privateFrom": "Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=",
"privateFor": [
"k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8="
]
},
"schedule": {
"uuid": "f61eb986-b6a5-4dda-b062-daf0ec562415",
"tenantID": "_",
"jobs": [
{
"uuid": "f3ffe1e3-541d-4303-a4e9-db17d4502613",
"chainUUID": "066c7842-d61c-49da-925e-493196289a2c",
"scheduleUUID": "f61eb986-b6a5-4dda-b062-daf0ec562415",
"transaction": {
"from": "0x55DF86B4dB5C6a04b4441e27dB5243A5F4d759bB",
"to": "0xf17f52151EbEF6C7334FAD080c5704D77216b732",
"data": "0xc03c30030000000000000000000000000000000000000000000000000000000000000002",
"privateFrom": "Ko2bVqD+nNlNYL5EE7y3IdOnviftjiizpjRt+HTuFBs=",
"privateFor": [
"k2zXEin4Ip/qBGlRkJejnGWdP9cjkK+DAvKNW31L2C8="
],
"createdAt": "2020-08-10T01:39:57.010549Z",
"updatedAt": "2020-08-10T01:39:57.010549Z"
},
"logs": [
{
"status": "CREATED",
"at": "2020-08-10T01:39:57.010549Z"
},
{
"status": "STARTED",
"at": "2020-08-10T01:39:57.033471Z"
}
],
"annotations": {
"chainID": "2020"
},
"status": "STARTED",
"type": "eth://orion/eeaTransaction",
"createdAt": "2020-08-10T01:39:57.010549Z"
}
],
"createdAt": "2020-08-10T01:39:57.010549Z"
},
"createdAt": "2020-08-10T01:39:57.010549Z"
}
In the JSON result, idempotencyKey
is a unique ID for the user transaction. Use the idempotencyKey
to retrieve the transaction details.