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.
Requirements & limits
- TrufflePig defaults to
./build/contractsand port 3030; both the contract directory and port can be configured. - Artifact requests are selected by the
contractNameproperty 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.
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
Install with
yarn global add trufflepigor, in the Truffle project,yarn add trufflepig --dev.Run
trufflepigfrom the project.Request
http://localhost:3030/contracts?name=MyContractNameto 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--contractDiroption when artifacts are elsewhere. - The service is documented for local development.
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
For Ganache, start it with
ganache-cli --acctKeys ganache-accounts.jsonto create the account-key file.Run
trufflepig --ganacheKeyFile ganache-accounts.json; alternatively, runtrufflepig --keystoreDir YOUR_PREFERRED_KEYPATHfor keystore files.For encrypted keystore files, supply the documented
--keystorePasswordoption.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.
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

