Skip to main content

Coding projects

The Coding projects content area provides instructional material for working with the sample projects located in the pact-coding-projects repository. The topics that correspond with the sample projects illustrate concepts in action and complement explanation topics with hands-on exercises and coding challenges. The projects themselves highlight common use cases that can be adapted to many scenarios or extended to address new use cases.

The pact-coding-projects repository includes the following sample projects for you to use as learning tools and basic how-to guides:

  • "Hello, World!" revisited takes a closer look at your first contract and Pact syntax.
  • Simple payments illustrates how to create basic functions to work with accounts and balances.
  • Rotate authorized keys demonstrates how to rotate keys and use row guards.
  • Contract interactions provides an example of how to call functions that are defined in another module.
  • Gas station accounts explains how to set up an account to pay transaction fees on behalf of other users.
  • Loans in multiple tables highlights working with multiple tables and writing functions to manipulate data in tables.
  • Local testing describes how to configure and use the Pact built-in server to format, sign, and submit transaction requests for local testing.
  • Estimate gas shows how to use built-in function to enable gas modeling for indiviual functions and transactions.
  • Pact built-in server provides examples of how to write YAML request files and submit transactions using the Pact built-in server and REST API.
  • Conditions and control flow demonstrates how to write conditional statements and control program flow in Pact smart contracts.

Download sample projects​

All of the sample projects are located in the pact-coding-projects repository. You'll need a GitHub account to create a local copy of the repository and download the starter code for each sample project. If you don't already have an account, go to GitHub, then click Sign up. If you already have an account, click Sign in, then open the Coding projects repository.