All Projects → kadena-io → Pact

kadena-io / Pact

Licence: bsd-3-clause
The Pact Smart Contract Language

Programming Languages

haskell
3896 projects

Projects that are alternatives of or similar to Pact

Remix Project
Remix is a browser-based compiler and IDE that enables users to build Ethereum contracts with Solidity language and to debug transactions.
Stars: ✭ 225 (-35.16%)
Mutual labels:  blockchain, smart-contracts
Octopus
Security Analysis tool for WebAssembly module (wasm) and Blockchain Smart Contracts (BTC/ETH/NEO/EOS)
Stars: ✭ 261 (-24.78%)
Mutual labels:  blockchain, smart-contracts
Merkletreejs
🌱 Construct Merkle Trees and verify proofs in JavaScript.
Stars: ✭ 238 (-31.41%)
Mutual labels:  blockchain, smart-contracts
Insolar
Enterprise-ready blockchain platform
Stars: ✭ 192 (-44.67%)
Mutual labels:  blockchain, smart-contracts
0xdeca10b
Sharing Updatable Models (SUM) on Blockchain
Stars: ✭ 285 (-17.87%)
Mutual labels:  blockchain, smart-contracts
Blockchain Stuff
Blockchain and Crytocurrency Resources
Stars: ✭ 2,549 (+634.58%)
Mutual labels:  blockchain, smart-contracts
Go Vite
Official Go implementation of the Vite protocol
Stars: ✭ 257 (-25.94%)
Mutual labels:  blockchain, smart-contracts
Ebtc
eBitcoin (eBTC) is an ERC20 token. Its primary utility is to provide an easy & fast payment solution. Its edge over other tokens is that it is capable of sending up to 255 payments in a single transaction.
Stars: ✭ 149 (-57.06%)
Mutual labels:  blockchain, smart-contracts
Eventeum
A resilient Ethereum event listener that bridges your smart contract events and backend microservices
Stars: ✭ 272 (-21.61%)
Mutual labels:  blockchain, smart-contracts
Celo Monorepo
Official repository for core projects comprising the Celo platform
Stars: ✭ 269 (-22.48%)
Mutual labels:  blockchain, smart-contracts
Scilla
Scilla - A Smart Contract Intermediate Level Language
Stars: ✭ 186 (-46.4%)
Mutual labels:  blockchain, smart-contracts
Embark
Framework for serverless Decentralized Applications using Ethereum, IPFS and other platforms
Stars: ✭ 3,478 (+902.31%)
Mutual labels:  blockchain, smart-contracts
Go Matrix
First version of go-MATRIX, especially for TPS optimization and AI
Stars: ✭ 187 (-46.11%)
Mutual labels:  blockchain, smart-contracts
Wavelet
Write once, run forever. Deploy robust, scalable, decentralized WebAssembly applications on Wavelet.
Stars: ✭ 224 (-35.45%)
Mutual labels:  blockchain, smart-contracts
Ico Contracts
Ethereum smart contracts that have been used during successful ICOs
Stars: ✭ 160 (-53.89%)
Mutual labels:  blockchain, smart-contracts
Awesome Blockchain Kor
<블록체인의 정석>, <하이퍼레저 블록체인 개발> 소스코드 및 참고자료 저장소
Stars: ✭ 243 (-29.97%)
Mutual labels:  blockchain, smart-contracts
Cryptokernel
A SDK for implementing blockchain-based digital currencies
Stars: ✭ 146 (-57.93%)
Mutual labels:  blockchain, smart-contracts
Sablier
The protocol for real-time finance on the Ethereum blockchain
Stars: ✭ 147 (-57.64%)
Mutual labels:  blockchain, smart-contracts
Smart Contract Search Engine
Takes a link to a smart contract's raw ABI file and an RPC URL and then indexes all instances of that smart contract
Stars: ✭ 265 (-23.63%)
Mutual labels:  blockchain, smart-contracts
Web3j
Lightweight Java and Android library for integration with Ethereum clients
Stars: ✭ 3,537 (+919.31%)
Mutual labels:  blockchain, smart-contracts

Kadena

 

The Pact Programming Language

Build Status

Pact is an open-source, Turing-incomplete smart contract language that has been purpose-built with blockchains first in mind. Pact focuses on facilitating transactional logic with the optimal mix of functionality in authorization, data management, and workflow.

Read the whitepaper:

For additional information, press, and development inquires, please refer to the Kadena website

Table Of Contents

Tutorials

Extensive tutorials on every facet of the Pact language may be found here. Additionally, users may find example scripts in Kadena's pact-examples repository, in the examples directory, and in production as part of the Kadena Public Blockchain.

Documentation

The Pact language specification, API documentation, features, motivations, and in-depth tutorial content may be found here.

Documentation is always in flux, and corrections to out of date documentation are always appreciated. Feel free to do so if you find such an error by opening an issue.

Quickstart

The easiest and quickest way to try Pact is in the browser, or via the Chainweaver wallet. Both environments support error and warning highlighting, as well as an in-app REPL environment for you to test out your code immediately.

Installing Pact

Binary Distributions

Pact can be installed via binary distribution for Linux or Mac by following the instructions below:

  • Install z3.
  • Download the prebuilt binaries for either Linux or Mac, depending on your OS.
  • Once you've downloaded the binary, make sure that it is marked as executable by running chmod +x <executable-file>.
  • Put the binary somewhere in your PATH.

Once you have Pact in your path, proceed to validating your installation by trying out the repl.

Instructions for Mac Users

Using Brew

On Mac, the easiest way to install pact is with Homebrew. Make sure that Homebrew has been installed in your machine. Instructions for how to install it can be found here. Once Homebrew is installed, run the following command to install pact:

brew update
brew install kadena-io/pact/pact

If you want to install from source, see building from source

Instructions for Linux Users

Linux is supported in terms of both the binary distributions (see below) and building from source. For installing pact on Linux distributions in the Arch family, refer to building from source.

Building from Source

Dependencies

  • (Mac only) Homebrew: brew install git
  • (Linux/Mac) Installer

To get the code, you can go here. Once you have the code, we can pick a build tool.

Building with Cabal

Cabal is the preferred way to manage packages by the Haskell community. You will need a version of GHC installed on your machine to use it.

Dependencies
  • ghc >= 8.4 (Haskell compiler) and cabal >= 2.2 (Haskell build-tool)
    • The easiest way to get this is to install it using (Linux/Mac) ghcup and issue ghcup install 8.6.5, followed by ghcup install-cabal.
    • ghc may also be installed via brew, issuing brew install ghc and brew install cabal-install.

(You may also need to install zlib, z3, and sqlite)

To build a Pact binary:

# Only necessary if you haven't done this recently.
cabal v2-update

# Build the project.
cabal v2-build

This will install a runnable version of Pact, which you can run via:

cabal v2-exec pact

Alternatively, cabal v2-install will install the binary to ~/.cabal/bin/, which you may need to add to your path. Then, you can call pact as-is.

Building with Stack

Stack is a Haskell build tool that manages compiler and dependency versions for you. It's easy to install and use.

Dependencies
  • stack >= 1.9
    • (Mac only) Homebrew: brew install haskell-stack
    • (Linux/Mac) Installer

(You may also need to install zlib, z3, and sqlite)

To build a Pact binary:

stack build

This will compile a runnable version of Pact, which you can run via:

stack exec pact

Alternatively, stack install will install the binary to ~/.local/bin/, which you may need to add to your path. Then, you can call pact as-is.

Building with Nix

The fastest way to build and run Pact is to use the Nix package manager which has binary caching capabilities that allow you to download pre-built binaries for everything needed by Pact. For detailed instructions see our wiki.

When the build is finished, you can run Pact with the following command:

./result/ghc/pact/bin/pact

Verifying Installation

Test by issuing pact in a terminal or by executing your binary. Try out some commands:

$ pact
pact> (+ 1 2)
3
pact> (+ "hello, " "world")
"hello, world"

Supported Editors

Pact is supported by a variety of editors ranging from full-fledged IDE environments to syntax highlighting.

Chainweaver

The Chainweaver wallet is the Kadena's wallet, offering a seamless IDE experience and wallet in one. It supports a full in-app REPL, code preview, error/warning highlighting, code deployment, key generation, and integration with existing Kadena blockchains.

In-Browser

An implementation of Chainweaver exists in the browser, if you do not wish to download the wallet.

Atom

For a full-fledged IDE experience, install the Atom editor along with language-pact using the atom package manager.

Emacs

Emacs has pact-mode support via MELPA, along with flycheck-pact for on-the-fly error highlighting. Download pact-mode and (optionally) flycheck-pact by opening Emacs and issuing M-x package-list-packages, syncing MELPA, and installing by name. Then, in your init.el or .emacs, include

(use-package pact-mode
  :ensure t
  :config
  ;; optionally
  (require 'flycheck-pact))

If you've chosen to include flycheck-pact, you can start the interactive buffer and trace by calling flycheck-pact-toggle-trace and flycheck-pact-interactive-buffer.

Vim

If you are a vim user, the vim-pact plugin provides support for the pact syntax.

The Pact REST Api

Api Documentation

The REST API is documented at http://pact-language.readthedocs.io/en/latest/pact-reference.html#rest-api.

Pact REST API Server

Pact features a full REST API HTTP server and SQLite database implementation, making blockchain application development painless and easy. The Pact server simulates a single-node blockchain environment, with the same API supported by the Kadena ScalableBFT blockchain.

To start the server, issue

pact --serve CONFIG

or

pact -s CONFIG

where CONFIG is a valid config.yaml.

Hosting static files.

The HTTP server will host any static files it finds in its working directory.

Config file format

The pact dev server (pact-serve) requires a configuration Yaml file (e.g. server.conf) to operate. The documentation for it is:

console> pact --serve --help
Config file is YAML format with the following properties:
port       - HTTP server port
persistDir - Directory for database files.
             If ommitted, runs in-memory only.
logDir     - Directory for HTTP logs
pragmas    - SQLite pragmas to use with persistence DBs
verbose    - [True|False] Provide extra logging information

Replay from disk.

When running pact-serve with persistence enabled, the server automatically replays from the database commands.sqlite in the persist dir. To prevent replay, simply delete this file before starting the server.

Related Projects

  • The pact-lang-api npm package provides a JavaScript library to aid interaction with the API.

  • The pact-todomvc is a working demonstration.

License

This code is distributed under the terms of the BSD3 license. See LICENSE for details.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].