MCPcopy Index your code
hub / github.com/TruStory/truchain

github.com/TruStory/truchain @v0.3.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.3 ↗ · + Follow
1,176 symbols 4,153 edges 143 files 644 documented · 55%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

TruChain

CircleCI codecov

TruChain is an application-specific blockchain built with Cosmos SDK. It powers beta.trustory.io.

Installation

  1. Install Go by following the official docs.

Go version must be 1.13+.

  1. Install truchain binaries:
git clone https://github.com/TruStory/truchain.git
cd truchain && git checkout master
make install

This creates:

truchaind: TruStory blockchain daemon

truchaincli: TruStory blockchain client. Used for creating keys and lightweight interaction with the chain and underlying Tendermint node.

Getting Started

Run a single node

# Build the binaries
make build

# Create a wallet and save the mnemonic and passphrase
make create-wallet

# Initialize configuration files and genesis file
# Enter passphrase from above
make init

# Start the chain
make start

Run a local 4-node testnet

A 4-node local testnet can be created with Docker Compose.

NOTE: You will not be able to register accounts because each node won't have a registrar key setup. This restriction will go away after client-side signing.

# Build daemon for linux so it can run inside a Docker container
make build-linux

# Create 4-nodes with their own genesis files and configuration
make localnet-start

Go to each config file in build/nodeN/truchaind/config/config.toml and replace these:

laddr = "tcp://0.0.0.0:26657"
addr_book_strict = false
# stop and restart
make localnet-stop && make localnet-start

# Tail logs
docker-compose logs -f

Run a full node

TruChain can be run as a full node, syncing it's state with another node or validator. First follow the instructions above to install and setup a single node.

# Initialize another chain with a new moniker but same chain-id
truchaind init <moniker-2> --chain-id betanet-1 --home ~/.devnet

# Copy the genesis file from the first node
scp ubuntu@devnet:/home/ubuntu/.truchaind/config/genesis.json ~/.devnet/config/

# Get the node id of the first node
truchaincli status

# Add first node to `persistent_peers` in config.toml
sed -i -e 's/persistent_peers.*/persistent_peers = "[ip_address]:26656"/' ~/.devnet/config/config.toml

# Optional: Add verbose logging
sed -i -e 's/log_level.*/log_level = "main:info,state:info,*:error,app:info,account:info,trubank:info,claim:info,community:info,truslashing:info,trustaking:info"/' ~/.devnet/config/config.toml

# Start the node
truchaind start --home ~/.devnet

If the first node has many blocks, it could take several minutes for the first sync to complete. Now you will have two nodes running in lockstep!

Testing

# Run linter
make check

# Run tests
make test

API Documentation

# Generate a website with documentation
make doc

Extension points exported contracts — how you extend this code

AccountKeeper (Interface)
AccountKeeper is the expected account keeper interface for this module [2 implementers]
x/claim/expected_keepers.go
BankKeeper (Interface)
BankKeeper is the expected bank keeper interface for this module [1 implementers]
x/distribution/expected_keepers.go
BankKeeper (Interface)
BankKeeper is the expected bank keeper interface for this module [1 implementers]
x/staking/expected_keepers.go
BankKeeper (Interface)
BankKeeper is the expected bank keeper interface for this module [1 implementers]
x/account/expected_keepers.go
TransactionSetter (FuncType)
(no doc)
x/bank/exported/exported.go
AccountKeeper (Interface)
(no doc) [2 implementers]
x/staking/expected_keepers.go
Filter (FuncType)
(no doc)
x/bank/exported/exported.go
ClaimKeeper (Interface)
(no doc) [2 implementers]
x/staking/expected_keepers.go

Core symbols most depended-on inside this repo

SubmitArgument
called by 71
x/staking/keeper.go
String
called by 71
x/claim/types.go
String
called by 50
x/staking/types.go
Error
called by 46
x/staking/errors.go
GetParams
called by 36
x/slashing/params.go
store
called by 27
x/staking/keeper.go
GetParams
called by 27
x/community/params.go
GetParams
called by 26
x/staking/params.go

Shape

Function 532
Method 501
Struct 119
TypeAlias 14
Interface 6
FuncType 4

Languages

Go100%
Python1%

Modules by API surface

x/staking/msg.go48 symbols
x/staking/keeper.go42 symbols
x/claim/msg.go41 symbols
x/claim/keeper.go36 symbols
x/slashing/keeper.go32 symbols
x/slashing/msgs.go28 symbols
x/community/msgs.go28 symbols
x/staking/querier.go26 symbols
x/staking/common_test.go23 symbols
x/staking/keys.go21 symbols
x/bank/exported/exported.go20 symbols
x/staking/module.go19 symbols

For agents

$ claude mcp add truchain \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact