Skip to content

Commit

Permalink
GITBOOK-2425: update format and author cards #490
Browse files Browse the repository at this point in the history
  • Loading branch information
theekrystallee authored and gitbook-bot committed Nov 7, 2023
1 parent ce4a43c commit 8297b05
Show file tree
Hide file tree
Showing 22 changed files with 489 additions and 92 deletions.
2 changes: 1 addition & 1 deletion SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* [Send and Receive HBAR Using Solidity Smart Contracts](tutorials/smart-contracts/send-and-receive-hbar-using-solidity-smart-contracts.md)
* [Create an HBAR Faucet App Using React and MetaMask](tutorials/smart-contracts/create-an-hbar-faucet-app-using-react-and-metamask.md)
* [Deploy By Leveraging Ethereum Developer Tools On Hedera](tutorials/smart-contracts/deploy-by-leveraging-ethereum-developer-tools-on-hedera.md)
* [Deploy a Subgraph Using The Graph and JSON-RPC](tutorials/smart-contracts/deploy-a-subgraph-using-the-graph-and-json-rpc.md)
* [Deploy a Subgraph Using The Graph and Hedera JSON-RPC Relay](tutorials/smart-contracts/deploy-a-subgraph-using-the-graph-and-json-rpc.md)
* [How to Set Up Foundry to Test Smart Contracts on Hedera](tutorials/smart-contracts/how-to-set-up-foundry-to-test-smart-contracts-on-hedera.md)
* [Deploy Smart Contracts on Hedera Using Truffle](tutorials/smart-contracts/deploy-smart-contracts-on-hedera-using-truffle.md)
* [Hedera Smart Contracts Workshop](tutorials/smart-contracts/hscs-workshop/README.md)
Expand Down
35 changes: 30 additions & 5 deletions getting-started/try-examples/schedule-your-first-transaction.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,26 @@

In this tutorial, you'll learn how to create and sign a scheduled transaction. Scheduled Transactions enable multiple parties to easily, inexpensively, and natively schedule and execute any type of Hedera transaction together. Once a transaction is scheduled, additional signatures can be submitted via a ScheduleSign transaction. After the last signature is received within the allotted timeframe, the scheduled transaction will execute.

***

## Prerequisites

We recommend you complete the following introduction to get a basic understanding of Hedera transactions. This example does not build upon the previous examples.

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center">➡ <a href="../introduction.md"><mark style="color:purple;"><strong>INTRODUCTION</strong></mark></a><mark style="color:purple;"><strong></strong></mark></td><td><a href="../introduction.md">introduction.md</a></td></tr><tr><td align="center">➡ <a href="../environment-set-up.md"><mark style="color:purple;"><strong>ENVIRONMENT SETUP</strong></mark></a><mark style="color:purple;"><strong></strong></mark></td><td><a href="../environment-set-up.md">environment-set-up.md</a></td></tr></tbody></table>
* Get a [Hedera testnet account](../introduction.md).
* Set up your environment [here](../environment-set-up.md).

***

## Table of Contents

1. [Create Transaction](schedule-your-first-transaction.md#1.-create-a-transaction-to-schedule)
2. [Schedule Transaction](schedule-your-first-transaction.md#2.-schedule-the-transfer-transaction)
3. [Submit Signatures](schedule-your-first-transaction.md#3.-submit-signatures)
4. [Verify Schedule was Triggered](schedule-your-first-transaction.md#4.-verify-the-schedule-was-triggered)
5. [Verify Scheduled Transaction Executed](schedule-your-first-transaction.md#5.-verify-the-scheduled-transaction-executed)

***

## 1. Create a transaction to schedule

Expand Down Expand Up @@ -44,6 +59,8 @@ transaction := hedera.NewTransferTransaction().
{% endtab %}
{% endtabs %}

***

## 2. Schedule the transfer transaction

Next, you will schedule the transfer transaction by submitting a ScheduleCreate transaction to the network. Once the transfer transaction is scheduled, you can obtain the schedule ID from the receipt of the ScheduleCreate transaction. The schedule ID identifies the schedule that scheduled the transfer transaction. The schedule ID can be shared with the three signatories. The schedule is immutable unless the admin key is specified during creation.
Expand Down Expand Up @@ -129,7 +146,11 @@ fmt.Printf("The scheduled transaction ID is %v\n", scheduleTxId)
{% endtab %}
{% endtabs %}

## 3. Submit one of the required signatures for the transfer transaction
***

## 3. Submit Signatures

### Submit one of the required signatures for the transfer transaction

The signatures are submitted to the network via a [ScheduleSign](../../sdks-and-apis/sdks/schedule-transaction/sign-a-schedule-transaction.md) transaction. The [ScheduleSign ](../../sdks-and-apis/sdks/schedule-transaction/sign-a-schedule-transaction.md)transaction requires the schedule ID of the schedule and the signature of one or more of the required keys. The scheduled transaction has 30 minutes from the time it is scheduled to receive all of its signatures; if the signature requirements are not met, the scheduled transaction will expire.

Expand Down Expand Up @@ -215,7 +236,7 @@ fmt.Print(query1)
{% endtab %}
{% endtabs %}

## 4. Submit the second signature
### Submit the second signature

Next, you will submit the second signature and verify the transaction was successful by requesting the receipt. For example purposes, you have access to all three signing keys. But the idea here is that each signer can independently submit their signature to the network.

Expand Down Expand Up @@ -280,7 +301,9 @@ fmt.Printf("The transaction status is %v\n", status2)
{% endtab %}
{% endtabs %}

## 5. Verify the schedule was triggered
***

## 4. Verify the schedule was triggered

The schedule is triggered after it meets its minimum signing requirements. As soon as the last required signature is submitted, the schedule executes the scheduled transaction. To verify the schedule was triggered, query for the schedule info. When the schedule info is returned, you should notice both public keys that signed in the `signatories` field and the timestamp recorded for when the schedule transaction was executed in the `executedAt` field.

Expand Down Expand Up @@ -319,7 +342,9 @@ fmt.Print(query2)
{% endtab %}
{% endtabs %}

## 6. Verify the scheduled transaction executed
***

## 5. Verify the scheduled transaction executed

When the scheduled transaction (transfer transaction) executes a record is produced that contains the transaction details. The scheduled transaction record can be requested immediately after the transaction has executed and includes the corresponding schedule ID. If you do not know when the scheduled transaction will execute, you can always query a [mirror node](../../core-concepts/mirror-nodes/hedera-mirror-node.md) using the scheduled transaction ID without the `?scheduled` flag to get a copy of the transaction record.

Expand Down
23 changes: 23 additions & 0 deletions tutorials/consensus/query-messages-with-mirror-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,23 @@ In the first tutorial, "Submit Your First Message," you have learned how to subm

In this tutorial, you will learn how to query the Hedera Mirror Node API to retrieve and filter messages.&#x20;

***

## Prerequisites

We recommend that you complete the "Submit Your First Message" tutorial [here](submit-your-first-message.md) to get a basic understanding of the Hedera Consensus Service. **This example does not build upon the previous examples.**

***

## Table of Contents

1. [Create Topic and Submit Messages](query-messages-with-mirror-node.md#1.-create-a-topic-and-submit-three-messages)
2. [Query Hedera Mirror Node API](query-messages-with-mirror-node.md#2.-query-the-hedera-mirror-node-api)
3. [Retrieve Message](query-messages-with-mirror-node.md#3.-retrieve-a-specific-message-by-sequence-number)
4. [Advanced Filtering](query-messages-with-mirror-node.md#4.-advanced-filtering-methods-for-hcs-messages)

***

## 1. Create a topic and submit three messages

For this tutorial, create a new topic and submit three messages to this topic on testnet. You will use the retrieved topic ID to query for messages via the Hedera Mirror Node API.&#x20;
Expand Down Expand Up @@ -147,6 +160,8 @@ Your topic ID is: 0.0.<4603900>

Next, let's query the mirror node to retrieve data.

***

## 2. Query the Hedera Mirror Node API

Now all three messages have been submitted to your topic ID on testnet, let's query the mirror node. Let's use the testnet endpoint for the Hedera Mirror Node API to query for all messages for your topic ID. Make sure to replace the topic ID with the topic ID you've written down and execute the request in your browser or tool of choice.
Expand Down Expand Up @@ -201,6 +216,8 @@ The result should look similar to the API result below, with three messages bein

</details>

***

## 3. Retrieve a specific message by sequence number

In this section, you'll learn how to query messages by a sequence number. Each message you submit to a topic receives a sequence number starting from 1.&#x20;
Expand Down Expand Up @@ -244,6 +261,8 @@ Only message two is returned by the Hedera Mirror Node.

</details>

***

## 4. Advanced filtering methods for HCS messages

This section explores advanced filtering methods using query modifiers. The [OpenAPI specification](https://raw.githubusercontent.com/hashgraph/hedera-mirror-node/main/hedera-mirror-rest/api/v1/openapi.yml) for the Hedera Mirror Node REST API shows all details for query parameters (e.g. `timestampQueryParam`).
Expand Down Expand Up @@ -301,4 +320,8 @@ Only message two is returned by the Hedera Mirror Node.

</details>

{% hint style="info" %}
Have a question? [Ask it on StackOverflow](https://stackoverflow.com/questions/tagged/hedera-hashgraph)
{% endhint %}

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><p>Writer: Michiel, Developer Advocate</p><p><a href="https://github.com/michielmulders">GitHub</a> | <a href="https://www.linkedin.com/in/michielmulders/">LinkedIn</a></p></td><td><a href="https://www.linkedin.com/in/michielmulders/">https://www.linkedin.com/in/michielmulders/</a></td></tr><tr><td align="center"><p>Editor: Simi, Sr. Software Manager</p><p><a href="https://github.com/SimiHunjan">GitHub</a> | <a href="https://www.linkedin.com/in/shunjan">LinkedIn</a></p></td><td><a href="https://www.linkedin.com/in/shunjan">https://www.linkedin.com/in/shunjan </a></td></tr></tbody></table>
23 changes: 23 additions & 0 deletions tutorials/consensus/submit-message-to-private-topic.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,25 @@ In the previous tutorial, "Submit Your First Message," you have learned how to s

When setting a _Submit Key,_ your topic becomes a **private topic** because each message needs to be signed by the Submit Key. Therefore, you can control who can submit messages to your topic. Of course, the data is still public, as is all data on a public ledger, but we say the topic is private because the topic is restricted by who can submit messages to it.

***

## Prerequisites

We recommend you complete the "Submit Your First Message" tutorial [here](submit-your-first-message.md) to get a basic understanding of the Hedera Consensus Service. This example does not build upon the previous examples.

_You can find a full_ [_code check_](submit-message-to-private-topic.md#code-check) _for this tutorial at the bottom of this page._

***

## Table of Contents

1. [Create Private Topic](submit-message-to-private-topic.md#1.-create-a-private-topic)
2. [Subscribe to Topic](submit-message-to-private-topic.md#2.-subscribe-to-a-topic)
3. [Submit Message](submit-message-to-private-topic.md#3.-submit-a-message)
4. [Code Check](submit-message-to-private-topic.md#code-check)

***

## 1. Create a private topic

To create a private topic, you will use [_<mark style="color:purple;">**`setSubmitKey()`**</mark>_](https://docs.hedera.com/hedera/sdks-and-apis/sdks/consensus-service/create-a-topic#methods) to set a Submit Key. This key needs to sign all messages someone sends to the topic. A message will be rejected if you don't sign the message or sign with an incorrect key. The cost of creating a private topic is the same as a public topic: [**$0.01**](https://docs.hedera.com/hedera/networks/mainnet/fees#consensus-service).
Expand Down Expand Up @@ -83,6 +96,8 @@ fmt.Printf("topicID: %v\n", topicID)
{% endtab %}
{% endtabs %}

***

## 2. Subscribe to a topic

The code used to subscribe to a public or private topic doesn't change. Anyone can listen to the messages you send to your private topic. You need to provide the [_<mark style="color:purple;">**`TopicMessageQuery()`**</mark>_](../../sdks-and-apis/sdks/consensus-service/get-topic-message.md) with your topic ID to subscribe to it.&#x20;
Expand Down Expand Up @@ -126,6 +141,8 @@ _, err = hedera.NewTopicMessageQuery().
{% endtab %}
{% endtabs %}

***

## 3. Submit a message

Now you are ready to submit a message to your private topic. To do this, you will use [_<mark style="color:purple;">**`TopicMessageSubmitTransaction()`**</mark>_](../../sdks-and-apis/sdks/consensus-service/submit-a-message.md). However, you need to sign this transaction with your Submit Key. The cost for sending a message to a private topic is the same as a public topic: [**$0.0001**](https://docs.hedera.com/hedera/networks/mainnet/fees#consensus-service).&#x20;
Expand Down Expand Up @@ -208,6 +225,8 @@ time.Sleep(30000)

To conclude: The total cost to create a topic and send a message to it is **$0.0101.**

***

## Code Check ✅

<details>
Expand Down Expand Up @@ -451,4 +470,8 @@ func main() {

</details>

{% hint style="info" %}
Have a question? [Ask it on StackOverflow](https://stackoverflow.com/questions/tagged/hedera-hashgraph)
{% endhint %}

<table data-card-size="large" data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><p>Writer: Michiel, Developer Advocate</p><p><a href="https://github.com/michielmulders">GitHub</a> | <a href="https://www.linkedin.com/in/michielmulders/">LinkedIn</a></p></td><td><a href="https://www.linkedin.com/in/michielmulders/">https://www.linkedin.com/in/michielmulders/</a></td></tr><tr><td align="center"><p>Editor: Krystal, Technical Writer</p><p><a href="https://github.com/theekrystallee">GitHub</a> | <a href="https://twitter.com/theekrystallee">Twitter</a></p></td><td><a href="https://twitter.com/theekrystallee">https://twitter.com/theekrystallee</a></td></tr></tbody></table>
19 changes: 18 additions & 1 deletion tutorials/consensus/submit-your-first-message.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ With the Hedera Consensus Service (HCS), you can develop applications like stock

In short, HCS offers the validity of the order of events and transparency into the history of events without requiring a persistent history of transactions. To achieve this, [Mirror nodes](../../core-concepts/mirror-nodes/) store all transaction data so you can retrieve it to audit events.

<table data-view="cards"><thead><tr><th align="center"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td align="center"><strong>1.</strong> <a href="submit-your-first-message.md#prerequisites"><strong>PREREQUISITES</strong></a></td><td><a href="submit-your-first-message.md#1.-create-your-first-topic">#1.-create-your-first-topic</a></td></tr><tr><td align="center"><strong>2.</strong> <a href="submit-your-first-message.md#1.-create-your-first-topic"><strong>CREATE TOPIC</strong></a></td><td><a href="submit-your-first-message.md#1.-create-your-first-topic">#1.-create-your-first-topic</a></td></tr><tr><td align="center"><strong>3.</strong> <a href="submit-your-first-message.md#java"><strong>SUBSCRIBE</strong></a></td><td><a href="submit-your-first-message.md#2.-subscribe-to-a-topic">#2.-subscribe-to-a-topic</a></td></tr><tr><td align="center"><strong>4.</strong> <a href="submit-your-first-message.md#3.-submit-a-message"><strong>SUBMIT</strong></a></td><td><a href="submit-your-first-message.md#3.-submit-a-message">#3.-submit-a-message</a></td></tr><tr><td align="center"><strong>5.</strong> <a href="https://codesandbox.io/s/hedera-example-json-rpc-truffle-q6kibt?file=/create-account.js"><strong>CODESANDBOX</strong></a></td><td><a href="https://codesandbox.io/s/hedera-example-json-rpc-truffle-q6kibt?file=/create-account.js">https://codesandbox.io/s/hedera-example-json-rpc-truffle-q6kibt?file=/create-account.js</a></td></tr><tr><td align="center"><strong>6.</strong> <a href="https://github.com/ed-marquez/hedera-example-json-rpc-truffle"><strong>PROJECT REPO</strong></a></td><td><a href="https://github.com/ed-marquez/hedera-example-json-rpc-truffle">https://github.com/ed-marquez/hedera-example-json-rpc-truffle</a></td></tr></tbody></table>
***

## Prerequisites

Expand All @@ -17,6 +17,17 @@ We recommend you complete the following introduction to get a basic understandin

_You can find a full_ [_code check_](submit-your-first-message.md#code-check) _for this tutorial at the bottom of this page._

***

## Table of Contents

1. Create Topic
2. Subscribe to Topic
3. Submit Message
4. Code Check

***

## 1. Create your first topic

To create your first topic, you will use the _<mark style="color:blue;">**`TopicCreateTransaction()`**</mark>_, set its properties, and submit it to the Hedera network. In this tutorial, you will create a **public topic** by not setting any properties on the topic. This means that anyone can send messages to your topic.
Expand Down Expand Up @@ -89,6 +100,8 @@ fmt.Printf("topicID: %v\n", topicID)
{% endtab %}
{% endtabs %}

***

## 2. Subscribe to a topic

After you create the topic, you will want to subscribe to the topic via a Hedera mirror node. Subscribing to a topic via a Hedera mirror node allows you to receive the stream of messages that are being submitted to it.
Expand Down Expand Up @@ -137,6 +150,8 @@ _, err = hedera.NewTopicMessageQuery().
{% endtab %}
{% endtabs %}

***

## 3. Submit a message

Now you are ready to submit your first message to the topic. To do this, you will use [_<mark style="color:purple;">**`TopicMessageSubmitTransaction()`**</mark>_](../../sdks-and-apis/sdks/consensus-service/submit-a-message.md). For this transaction, you will provide the topic ID and the message to submit to it. Each message you send to a topic costs you [**$0.0001**](https://docs.hedera.com/hedera/networks/mainnet/fees#consensus-service). In other words, you can send 10,000 messages for $1 on the Hedera Network.
Expand Down Expand Up @@ -203,6 +218,8 @@ time.Sleep(30000)

To conclude: The total cost to create a topic and send a message to it is **$0.0101.**

***

## Code Check ✅

<details>
Expand Down
Loading

0 comments on commit 8297b05

Please sign in to comment.