Skip to main content

Motoko sample code and applications

Beginner
Motoko

Overview

Sample code, applications, and microservices that have been developed by DFINITY or contributed by the community are available from the DFINITY public repository.

By accessing the public repository, you can directly download, clone, fork, or share sample projects. You will also be able to contribute by suggesting updates or reporting issues for the published projects using the standard GitHub work flow.

Sample projects provide a way for you to experiment and collaborate with other developers. The projects and sample code are not, however, intended to be used as commercial applications and do not provide any explicit or implied support or warranty of any kind.

This section provides a preliminary look at some sample code for applications and microservices that you can copy and modify to jump-start your own projects.

Motoko

For projects that use the Motoko programming language, see Motoko sample projects.

Additional sample applications

This section includes sample code from projects that are not currently available in the public repository.

Hex encoding and decoding

The mo-hex project implements hexadecimal encoding and decoding routines for the Motoko programming language.

Source code

The project includes the hex.mo source code.

Polynomial long-division in GF(256)

This program performs polynomial long division for a Galois field GF(256) element.

Source code

In addition to standard libraries, this project uses two main Motoko source code files.

  • The Galois.mo file contains the core programming logic.

  • The Nat.mo file contains additional functions that are imported for use in the Galois.mo file.