docs: clarify grpc server (#9761)
## Description ref: [discord comment](https://discord.com/channels/669268347736686612/669274997264613376/867829184248152084) <!-- Add a description of the changes that this PR introduces and the files that are the most critical to review. --> This pull request provides clarification on the services that can be registered with the gRPC server and an example for broadcasting a transaction using `grpcurl`. --- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct `docs:` prefix in the PR title - [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] followed the [documentation writing guidelines](https://github.com/cosmos/cosmos-sdk/blob/master/docs/DOC_WRITING_GUIDELINES.md) - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct `docs:` prefix in the PR title - [ ] confirmed all author checklist items have been addressed - [ ] confirmed that this PR only changes documentation - [ ] reviewed content for consistency - [ ] reviewed content for thoroughness - [ ] reviewed content for spelling and grammar - [ ] tested instructions (if applicable)
This commit is contained in:
+17
-2
@@ -324,6 +324,21 @@ func simulateTx() error {
|
||||
}
|
||||
```
|
||||
|
||||
## Using gRPC
|
||||
|
||||
It is not possible to generate or sign a transaction using gRPC, only to broadcast one.
|
||||
|
||||
### Broadcasting a Transaction
|
||||
|
||||
Broadcasting a transaction using the gRPC endpoint can be done by sending a `BroadcastTx` request as follows, where the `txBytes` are the protobuf-encoded bytes of a signed transaction:
|
||||
|
||||
```bash
|
||||
grpcurl -plaintext \
|
||||
-d '{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}' \
|
||||
localhost:9090 \
|
||||
cosmos.tx.v1beta1.Service/BroadcastTx
|
||||
```
|
||||
|
||||
## Using REST
|
||||
|
||||
It is not possible to generate or sign a transaction using REST, only to broadcast one.
|
||||
@@ -334,8 +349,8 @@ Broadcasting a transaction using the REST endpoint (served by `gRPC-gateway`) ca
|
||||
|
||||
```bash
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json"
|
||||
-d'{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}'
|
||||
-H "Content-Type: application/json" \
|
||||
-d'{"tx_bytes":"{{txBytes}}","mode":"BROADCAST_MODE_SYNC"}' \
|
||||
localhost:1317/cosmos/tx/v1beta1/txs
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user