OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Trufflepig

TrufflePig is a JavaScript command-line tool and local HTTP server that reads Truffle-generated contract JSON files and serves them by contract name. It can also expose configured account data from Ganache key files or JSON keystores.

Independent OpenViST project profile, based on linked sources.

Trufflepig — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

Practical overview

When it fits

Use TrufflePig during local development when a client needs to request Truffle-generated artifacts over HTTP, or when development account data should be exposed through its `/accounts` endpoint.

Who it is for

  • Developers building frontend clients for Truffle smart-contract projects.
  • Developers who want a local endpoint for contract artifacts or development-node account data.

Documented uses

  • Retrieve a generated contract artifact, including its ABI, by contract name.
  • Make updated Truffle artifact files available to clients during local development.
  • Serve configured Ganache or keystore account data through a local endpoint.
Before you choose

Requirements & limits

  • TrufflePig defaults to ./build/contracts and port 3030; both the contract directory and port can be configured.
  • Artifact requests are selected by the contractName property in Truffle’s JSON output.
  • Account serving requires a Ganache key file or a keystore directory; encrypted keystores can use the password option.
  • The repository specifies the MIT license.

Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.

Source-based practical guide

Install and serve Truffle contract artifacts locally

Start TrufflePig in a Truffle project and retrieve a generated contract artifact through its local HTTP API.

Before you start

  • A Truffle project containing built contract JSON files.
  • A way to make HTTP requests and parse JSON results.
  • Yarn to install TrufflePig globally or as a project devDependency.

Steps

  1. Install with yarn global add trufflepig or, in the Truffle project, yarn add trufflepig --dev.

  2. Run trufflepig from the project.

  3. Request http://localhost:3030/contracts?name=MyContractName to retrieve the artifact for that contract name.

Expected outcome

A JSON response for the named contract, including its contract name and ABI; changed contract files are picked up for subsequent requests.

Guide limitations

  • The documented default contract directory is ./build/contracts; use the --contractDir option when artifacts are elsewhere.
  • The service is documented for local development.
Source-based practical guide

Serve development account data from local files

Configure TrufflePig to expose account data at its local `/accounts` endpoint.

Before you start

  • TrufflePig installed and a local development setup using Ganache, Geth, or Parity.
  • For Ganache, a generated account-key JSON file; for Geth or Parity, a directory containing JSON keystore files.

Steps

  1. For Ganache, start it with ganache-cli --acctKeys ganache-accounts.json to create the account-key file.

  2. Run trufflepig --ganacheKeyFile ganache-accounts.json; alternatively, run trufflepig --keystoreDir YOUR_PREFERRED_KEYPATH for keystore files.

  3. For encrypted keystore files, supply the documented --keystorePassword option.

  4. Access the account data at http://localhost:3030/accounts.

Expected outcome

Account data is served as JSON through the local `/accounts` endpoint.

Guide limitations

  • The Ganache and keystore options use different input files or directories.
  • This guide covers local development account data, not a hosted account service.
Evidence and transparency

Sources & review

Source record details
Source availability
Active
Sources checked
16 October 2026
Original website title
JoinColony/trufflepig · Official homepage title · retained in its source language