diff --git a/docs/HowTo/Send-Transactions/Creating-Sending-Private-Transactions.md b/docs/HowTo/Send-Transactions/Creating-Sending-Private-Transactions.md index be9271fadff..629942a43eb 100644 --- a/docs/HowTo/Send-Transactions/Creating-Sending-Private-Transactions.md +++ b/docs/HowTo/Send-Transactions/Creating-Sending-Private-Transactions.md @@ -16,6 +16,10 @@ participants are offline when the private transaction is submitted, the transact !!! note Private transactions either deploy contracts or call contract functions. Ether transfer transactions cannot be private. + +!!! tip + For private contracts, [`priv_call`](../../Reference/API-Methods.md#priv_call) is the equivalent + of [`eth_call`](../../Reference/API-Methods.md#eth_call). ## eea_sendRawTransaction @@ -145,5 +149,4 @@ a contract are displayed below. -[privacy marker transaction]: ../../Concepts/Privacy/Private-Transaction-Processing.md - +[privacy marker transaction]: ../../Concepts/Privacy/Private-Transaction-Processing.md \ No newline at end of file diff --git a/docs/HowTo/Send-Transactions/Transactions.md b/docs/HowTo/Send-Transactions/Transactions.md index 5ca25c42cff..ccfb81ebe8a 100644 --- a/docs/HowTo/Send-Transactions/Transactions.md +++ b/docs/HowTo/Send-Transactions/Transactions.md @@ -27,12 +27,10 @@ and create a smart contract. Libraries such as [web3j](https://github.com/web3j/web3j) or [ethereumj](https://github.com/ethereum/ethereumj) and tools such as [MyCrypto](https://mycrypto.com/) can also be used to create signed transactions. - - ## eth_call vs eth_sendRawTransaction -You can interact with contracts using [eth_call](../../Reference/API-Methods.md#eth_call) -or [eth_sendRawTransaction](../../Reference/API-Methods.md#eth_sendrawtransaction). +You can interact with contracts using [`eth_call`](../../Reference/API-Methods.md#eth_call) +or [`eth_sendRawTransaction`](../../Reference/API-Methods.md#eth_sendrawtransaction). The table below compares the characteristics of both calls. | eth_call | eth_sendRawTransaction | diff --git a/docs/HowTo/Use-Privacy/Create-Manage-Privacy-Groups.md b/docs/HowTo/Use-Privacy/Create-Manage-Privacy-Groups.md index ea85c73ed0f..3970228b7f2 100644 --- a/docs/HowTo/Use-Privacy/Create-Manage-Privacy-Groups.md +++ b/docs/HowTo/Use-Privacy/Create-Manage-Privacy-Groups.md @@ -10,6 +10,4 @@ Hyperledger Besu-extended privacy provides JSON-RPC API methods for creating and !!! tip [EEA-compliant privacy groups](../../Concepts/Privacy/Privacy-Groups.md) can be found and deleted using [`priv_findPrivacyGroup`](../../Reference/API-Methods.md#priv_findprivacygroup) - and [`priv_deletePrivacyGroup`](../../Reference/API-Methods.md#priv_deleteprivacygroup) but - future functionality to update group membership will only be available for privacy groups - created using [`priv_createPrivacyGroup`](../../Reference/API-Methods.md#priv_createprivacygroup). \ No newline at end of file + and [`priv_deletePrivacyGroup`](../../Reference/API-Methods.md#priv_deleteprivacygroup). \ No newline at end of file diff --git a/docs/Reference/API-Methods.md b/docs/Reference/API-Methods.md index 63e47acd8e9..be56f24736d 100644 --- a/docs/Reference/API-Methods.md +++ b/docs/Reference/API-Methods.md @@ -1683,7 +1683,7 @@ To avoid exposing your private key, create signed transactions offline and send Invokes a contract function locally and does not change the state of the blockchain. -You can interact with contracts using [eth_sendRawTransaction or eth_call](../HowTo/Send-Transactions/Transactions.md#eth_call-or-eth_sendrawtransaction). +You can interact with contracts using [eth_sendRawTransaction or eth_call](../HowTo/Send-Transactions/Transactions.md#eth_call-vs-eth_sendrawtransaction). **Parameters** @@ -4208,6 +4208,72 @@ data using `eea_sendRawTransaction`. The `PRIV` API methods are not enabled by default for JSON-RPC. Use the [`--rpc-http-api`](CLI/CLI-Syntax.md#rpc-http-api) or [`--rpc-ws-api`](CLI/CLI-Syntax.md#rpc-ws-api) options to enable the `PRIV` API methods. +### priv_call + +Invokes a private contract function locally and does not change the privacy group state. + +For private contracts, `priv_call` is the equivalent to [`eth_call`](#eth_call). + +**Parameters** + +`data` - 32-byte [privacy Group ID](../Concepts/Privacy/Privacy-Groups.md). + +`object` - [Transaction call object](API-Objects.md#transaction-call-object). + +`quantity|tag` - Integer representing a block number or one of the string tags `latest`, `earliest`, +or `pending`, as described in [Block Parameter](../HowTo/Interact/APIs/Using-JSON-RPC-API.md#block-parameter). + +**Returns** + +`result` : `data` - Return value of the executed contract. + +!!! example + ```bash tab="curl HTTP" + curl -X POST --data '{"jsonrpc":"2.0","method":"priv_call","params":["tb8NVyQqZnHNegf/3mYsyB+HEud4SPWn90rz3GoskRw=", {"to":"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13","data": "0x3fa4f245"}, "latest"],"id":1}' http://127.0.0.1:8545 + ``` + + ```bash tab="wscat WS" + {"jsonrpc":"2.0","method":"priv_call","params":["tb8NVyQqZnHNegf/3mYsyB+HEud4SPWn90rz3GoskRw=", {"to":"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13","data": "0x3fa4f245"}, "latest"],"id":1} + ``` + + ```json tab="JSON result" + { + "jsonrpc": "2.0", + "id": 1, + "result": "0x0000000000000000000000000000000000000000000000000000000000000001" + } + ``` + + ```bash tab="curl GraphQL" + curl -X POST -H "Content-Type: application/json" --data '{ "query": "{block {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13\", data :\"0x12a7b914\"}){data status}}}"}' http://localhost:8547/graphql + ``` + + ```bash tab="GraphQL" + { + block { + number + call(data: {from: "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b", to: "0x69498dd54bd25aa0c886cf1f8b8ae0856d55ff13", data: "0x12a7b914"}) { + data + status + } + } + } + ``` + + ```json tab="GraphQL result" + { + "data" : { + "block" : { + "number" : 17449, + "call" : { + "data" : "0x", + "status" : 1 + } + } + } + } + ``` + ### priv_distributeRawTransaction Distributes a signed, RLP encoded [private transaction](../HowTo/Send-Transactions/Creating-Sending-Private-Transactions.md).